File indexing completed on 2024-04-06 12:29:00
0001 {
0002 gSystem->Load("libFWCoreFWLite.so");
0003 FWLiteEnabler::enable();
0004
0005 TFile file("TracksParTest2.root");
0006 TTree * tree = (TTree *) gROOT->FindObject("Events");
0007 TFile outFile("graphsParTest2.root","recreate");
0008 float intervals[] = {0,0.5,1.0,1.5,2.0,2.5};
0009 int bins = 5;
0010 const char * ptinterval = "4.99<P_{T}<5.01";
0011 const char * etainterval = "|#eta|<2.5";
0012 const char * rs = "recoTracks_rsWithMaterialTracks__RsWithMaterial";
0013 const char * ctf = "recoTracks_ctfWithMaterialTracks__FinalFits";
0014 const char * sim = "SimTracks_SimG4Object__Test";
0015
0016 vector<float> tot;
0017 vector<float> ptrmsRS;
0018 vector<float> efficRS;
0019 vector<float> ptrmsCTF;
0020 vector<float> efficCTF;
0021 ostringstream title, name, expr, cut;
0022 float binfix=0.0001;
0023 int i;
0024
0025 cout << "Processing SIMULATION" << endl;
0026
0027 for (i=1;i<(bins+1);i++){
0028 name.str("");
0029 title.str("");
0030 expr.str("");
0031 cut.str("");
0032 cut << "fabs("<<sim<<".obj.momentum().pseudoRapidity())>"<< intervals[i-1] <<"&&fabs("<<sim<<".obj.momentum().pseudoRapidity())<"<<intervals[i];
0033 name << "producedtracks_vs_eta" << intervals[i];
0034 expr << ""<<sim<<".@obj.size() >> " << name.str();
0035 title << name.str();
0036 TH1F prod(name.str().c_str(),title.str().c_str(),10,0,10);
0037 tree->Draw(expr.str().c_str(),cut.str().c_str(),"goff");
0038 tot.push_back(prod.GetEntries());
0039
0040 }
0041
0042 name.str("etagen_distrib");
0043 title.str("");
0044 expr.str("");
0045 title <<"Eta generated "<< ptinterval;
0046 expr <<sim<<".obj.momentum().pseudoRapidity() >> etagen_distrib";
0047 TH1F etagen(name.str().c_str(),title.str().c_str(),100,-3,3);
0048 tree->Draw(expr.str().c_str(),"","goff");
0049 etagen.Write();
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177 cout << "Processing COMBINATORIAL TRACK FINDER" << endl;
0178 for (i=1;i<(bins+1);i++){
0179
0180 name.str("");
0181 expr.str("");
0182 title.str("");
0183 cut.str("");
0184 name <<"ptresCTF"<<intervals[i];
0185 title <<"Pt residue "<< ptinterval << " "<< intervals[i-1] << "<#eta<"<<intervals[i];
0186 TH1F ptres2CTF(name.str().c_str(),title.str().c_str(),100,-1,1);
0187 expr << ""<<sim<<".obj.momentum().perp()-"<<ctf<<".obj.pt() >> " << name.str();
0188 cut << "fabs("<<sim<<".obj.momentum().pseudoRapidity())>"<< intervals[i-1] <<"&&fabs("<<sim<<".obj.momentum().pseudoRapidity())<"<<intervals[i];
0189 tree->Draw(expr.str().c_str(),cut.str().c_str(),"goff");
0190 ptrmsCTF.push_back(ptres2CTF.GetRMS());
0191 ptres2CTF.Write();
0192
0193
0194
0195 name.str("");
0196 expr.str("");
0197 name <<"missingtracks_vs_eta_CTF"<<intervals[i];
0198 expr << "(-"<<sim<<".@obj.size()+"<<ctf<<".@obj.size()) >> " << name.str();
0199 TH1F effCTF(name.str().c_str(),title.str().c_str(),3,-1.5,1.5);
0200 tree->Draw(expr.str().c_str(),cut.str().c_str(),"goff");
0201 if (tot[i-1]!=0) effCTF.Scale(1/tot[i-1]);
0202 efficCTF.push_back( effCTF.GetBinContent( effCTF.FindBin(0) ) );
0203 effCTF.Write();
0204 }
0205
0206
0207 name.str("ptres_distrib_CTF");
0208 title.str("");
0209 expr.str("");
0210 title << "Pt residue " << ptinterval << " " << etainterval;
0211 expr <<sim<<".obj.momentum().perp()-"<<ctf<<".obj.pt() >> ptres_distrib_CTF";
0212 TH1F ptresCTF(name.str().c_str(),title.str().c_str(),100,-1,1);
0213 tree->Draw(expr.str().c_str(),"","goff");
0214 ptresCTF.Write();
0215
0216
0217
0218 name.str("chi2_distrib_CTF");
0219 title.str("");
0220 expr.str("");
0221 title <<"NChi2 distribution " << ptinterval << " " << etainterval;
0222 expr <<ctf<<".obj.chi2()/"<<ctf<<".obj.ndof() >> chi2_distrib_CTF";
0223 TH1F chi2histoCTF(name.str().c_str(),title.str().c_str(),100,0,10);
0224 tree->Draw(expr.str().c_str(),"","goff");
0225 chi2histoCTF.Write();
0226
0227
0228 name.str("etaresidue_distrib_CTF");
0229 title.str("");
0230 expr.str("");
0231 title <<"Eta residue "<< ptinterval << " " << etainterval;
0232 expr <<sim<<".obj.momentum().pseudoRapidity()-"<<ctf<<".obj.eta() >> etaresidue_distrib_CTF";
0233 TH1F etaresCTF(name.str().c_str(),title.str().c_str(),100,-3,3);
0234 tree->Draw(expr.str().c_str(),"","goff");
0235 etaresCTF.Write();
0236
0237
0238
0239 name.str("etafound_distrib_CTF");
0240 title.str("");
0241 expr.str("");
0242 title <<"Eta found "<< ptinterval << " " << etainterval;
0243 expr <<ctf<<".obj.eta() >> etafound_distrib_CTF";
0244 TH1F etafoundCTF(name.str().c_str(),title.str().c_str(),100,-3,3);
0245 tree->Draw(expr.str().c_str(),"","goff");
0246 etafoundCTF.Write();
0247
0248
0249 name.str("hits_distrib_CTF");
0250 title.str("");
0251 expr.str("");
0252 title <<"Hits found "<< ptinterval << " " << etainterval;
0253 expr <<ctf<<".obj.numberOfValidHits() >> hits_distrib_CTF";
0254 TH1F hitsCTF(name.str().c_str(),title.str().c_str(),100,0,25);
0255 tree->Draw(expr.str().c_str(),"","goff");
0256 hitsCTF.Write();
0257
0258
0259
0260 name.str("hits2_distrib_CTF");
0261 title.str("");
0262 expr.str("");
0263 cut.str("");
0264 title <<"Hits found (>1tracks) "<< ptinterval << " " << etainterval;
0265 expr <<ctf<<".obj.numberOfValidHits() >> hits2_distrib_CTF";
0266 cut <<ctf<<".@obj.size()>1";
0267 TH1F hits2CTF(name.str().c_str(),title.str().c_str(),100,0,25);
0268 tree->Draw(expr.str().c_str(),cut.str().c_str(),"goff");
0269 hits2CTF.Write();
0270
0271
0272
0273 name.str("PtRMS_vs_eta_CTF");
0274 title.str("");
0275 title <<"PtRMS vs #eta "<< ptinterval;
0276 TH1F ptrmshCTF(name.str().c_str(),title.str().c_str(),bins,intervals);
0277 name.str("eff_vs_eta_CTF");
0278 title.str("");
0279 title <<"efficiency vs #eta "<< ptinterval;
0280 TH1F effhCTF(name.str().c_str(),title.str().c_str(),bins,intervals);
0281 for (int i=1;i<(bins+1);i++){
0282 ptrmshCTF.Fill(intervals[i]-binfix,ptrmsCTF[i-1]);
0283 effhCTF.Fill(intervals[i]-binfix,efficCTF[i-1]);
0284 }
0285 ptrmshCTF.Write();
0286 effhCTF.Write();
0287
0288
0289
0290
0291
0292
0293 file.Close();
0294 outFile.Close();
0295 }