12 std::cout<<
"Cleaning ClusterHistos"<<std::endl;
26 for (std::map<std::string, TGraphErrors*>::iterator it =
baselineGraphs.begin();
40 std::string h_name =
"";
60 std::string h_name =
"";
66 "Global Y [mm]",nbins,startY,(nbins+1)*pitch,
71 "Global X [mm] ",80,-20,20,
76 "Global Y [mm]",nbins,startY,(nbins+1)*pitch,
81 "Global X [mm] ",80,-20,20,
88 "Global X [mm] ",400,-20,20,
89 "Global Y [mm]",200,0,5);
94 "Global X [mm] ",400,-20,20,
95 "Global Y [mm]",200,0,5);
107 "Strip Position",640,0,640,
108 "charge",100,0,10000);
113 "#sqrt{x^{2} + y^{2}}",600,0,150,
114 "charge",100,0,10000);
119 "Strip Position",640,0,640,
120 "corrected charge",100,0,10000);
125 "Strip Position",640,0,640,
126 "sample0",200,-2000,2000);
130 "Strip Position",640,0,640,
131 "sample1",200,-2000,2000);
138 "Sample0",200,-2000,2000);
145 "Sample1",200,-2000,2000);
150 "Global Y [mm]", nbins, startY, (nbins+1)* pitch,
151 "strip Pos", 640,0,640);
158 TFile *inFile =
new TFile((baselineFits).c_str(),
"READ");
163 TIter next(inFile->GetListOfKeys());
165 while ((key = (TKey*)next())) {
166 std::string classname = key->GetClassName();
167 if (classname.find(
"TDirectoryFile") != -1){
168 TDirectoryFile* tdir = (TDirectoryFile*) inFile->Get(key->GetName());
169 TGraphErrors* gr = (TGraphErrors*) tdir->Get(((std::string)(key->GetName())+
"_baseline_0").c_str());
170 std::string grname = gr->GetName();
171 std::cout <<
"Loading baselines from graph " << grname << std::endl;
172 grname = grname.substr(0,grname.find(
"_baseline_0"));
174 std::cout << grname << std::endl;
188 TFile *baselinesFile =
new TFile((baselinesIn).c_str());
194 TDirectory* dir = baselinesFile->GetDirectory(
"baseline");
196 TList* keyList = dir->GetListOfKeys();
203 while ( (key = (TKey*)next())) {
211 std::string graph_key = key->GetName();
212 graph_key = graph_key.substr(graph_key.find(
"F"),4);
213 baselineGraphs[graph_key] = (TGraphErrors*) (dir->Get(key->GetName()));
226 baselinesFile->Close();
227 delete baselinesFile;
228 baselinesFile =
nullptr;
248 std::string swTag =
"";
250 for (
unsigned int irh = 0; irh < rawhits_.GetEntries(); ++irh) {
255 swTag =
"ly"+std::to_string(rawhit->
getLayer())+
"_m"+std::to_string(rawhit->
getModule());
265 double baseline = -999;
274 float sample0 = baseline - rawhit->
getADCs()[0];
275 float sample1 = baseline - rawhit->
getADCs()[1];
296 for (std::map<std::string, int>::iterator it =
cluSizeMap.begin(); it!=
cluSizeMap.end(); ++it ) {
297 if (it->second != 0) {
299 histos1d[it->first]->Fill(it->second,weight);
305 for (std::map<std::string, double>::iterator it =
chargeMap.begin(); it!=
chargeMap.end(); ++it ) {
308 if (it->second > 1e-6) {
311 std::string plotID = (it->first).substr(0,(it->first).find(
"_charge"));
315 double charge = it->second;
316 histos1d[it->first]->Fill(charge,weight);
320 histos2d[it->first+
"_vs_stripPos"]->Fill(weighted_pos,charge,weight);
323 histos2d[it->first+
"_corrected_vs_stripPos"]->Fill(weighted_pos,chargeCorrected,weight);
327 histos2d[plotID+
"_stripPos_vs_gy"]->Fill(fabs(hit->
getGlobalY()),weighted_pos,weight);
330 histos2d[it->first+
"_vs_globRad"]->Fill(globRad,charge,weight);
std::map< std::string, double > cluPositionMap
bool LoadBaselineHistos(const std::string &baselineRun)
Load baseline histograms.
ClusterHistos(const std::string &inputName)
Constructor.
std::vector< std::string > half_module_names
std::map< std::string, double > chargeCorrectedMap
virtual void Define1DHistos()
description
void FillHistograms(TrackerHit *hit, float weight=1.)
description
std::map< std::string, int > cluSizeMap
virtual void Define2DHistos()
description
bool LoadOfflineBaselines(const std::string &baselineFits)
Load offline baseline.
std::map< std::string, double > chargeMap
std::map< std::string, TGraphErrors * > baselineGraphs
std::map< std::string, TH2F * > histos2d
description
TH2F * plot2D(std::string name, std::string xtitle, int nbinsX, float xmin, float xmax, std::string ytitle, int nbinsY, float ymin, float ymax)
description
std::map< std::string, TH1F * > histos1d
description
TH1F * plot1D(const std::string &name, const std::string &xtitle, int nbinsX, float xmin, float xmax)
description
std::string m_name
description
std::string getStringFromSw(const std::string &key)
Get the String From Sw.
void getStrings(std::vector< std::string > &strings)
Get list of string modules.
double getGlobalY() const
double getGlobalZ() const
TRefArray getRawHits() const
double getGlobalX() const