File indexing completed on 2026-04-07 08:08:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #define STRACKCUTSTUDY_CC
0013
0014
0015 #include "STrackCutStudy.h"
0016 #include "STrackCutStudy.io.h"
0017 #include "STrackCutStudy.ana.h"
0018 #include "STrackCutStudy.hist.h"
0019 #include "STrackCutStudy.plot.h"
0020
0021 using namespace std;
0022
0023
0024
0025
0026
0027 STrackCutStudy::STrackCutStudy() {
0028
0029
0030 sTxtEO.clear();
0031 sTxtPU.clear();
0032 nTxtEO = 0;
0033 nTxtPU = 0;
0034 inBatchMode = false;
0035 makePlots = false;
0036 doPileup = false;
0037 doIntNorm = false;
0038 doBeforeCuts = false;
0039 doAvgClustCalc = false;
0040 normalPtFracMin = 0.;
0041 normalPtFracMax = 9999.;
0042 doPrimaryCut = false;
0043 doMVtxCut = false;
0044 doVzCut = false;
0045 doDcaXyCut = false;
0046 doDcaZCut = false;
0047 doQualityCut = false;
0048
0049
0050 isTruth[TYPE::TRACK] = false;
0051 isTruth[TYPE::TRUTH] = true;
0052 isTruth[TYPE::WEIRD_ALL] = false;
0053 isTruth[TYPE::WEIRD_SI] = false;
0054 isTruth[TYPE::WEIRD_TPC] = false;
0055 isTruth[TYPE::NORMAL] = false;
0056 isTruth[TYPE::PILEUP] = false;
0057 isTruth[TYPE::PRIMARY] = false;
0058 isTruth[TYPE::NONPRIM] = false;
0059 isTruth[TYPE::TRK_CUT] = false;
0060 isTruth[TYPE::TRU_CUT] = true;
0061 isTruth[TYPE::WEIRD_CUT] = false;
0062 isTruth[TYPE::WEIRD_SI_CUT] = false;
0063 isTruth[TYPE::WEIRD_TPC_CUT] = false;
0064 isTruth[TYPE::NORM_CUT] = false;
0065 isTruth[TYPE::PILE_CUT] = false;
0066 isTruth[TYPE::PRIM_CUT] = false;
0067 isTruth[TYPE::NONPRIM_CUT] = false;
0068
0069
0070 isPileup[TYPE::TRACK] = false;
0071 isPileup[TYPE::TRUTH] = false;
0072 isPileup[TYPE::WEIRD_ALL] = false;
0073 isPileup[TYPE::WEIRD_SI] = false;
0074 isPileup[TYPE::WEIRD_TPC] = false;
0075 isPileup[TYPE::NORMAL] = false;
0076 isPileup[TYPE::PILEUP] = true;
0077 isPileup[TYPE::PRIMARY] = true;
0078 isPileup[TYPE::NONPRIM] = true;
0079 isPileup[TYPE::TRK_CUT] = false;
0080 isPileup[TYPE::TRU_CUT] = false;
0081 isPileup[TYPE::WEIRD_CUT] = false;
0082 isPileup[TYPE::WEIRD_SI_CUT] = false;
0083 isPileup[TYPE::WEIRD_TPC_CUT] = false;
0084 isPileup[TYPE::NORM_CUT] = false;
0085 isPileup[TYPE::PILE_CUT] = true;
0086 isPileup[TYPE::PRIM_CUT] = true;
0087 isPileup[TYPE::NONPRIM_CUT] = true;
0088
0089
0090 isBeforeCuts[TYPE::TRACK] = true;
0091 isBeforeCuts[TYPE::TRUTH] = true;
0092 isBeforeCuts[TYPE::WEIRD_ALL] = true;
0093 isBeforeCuts[TYPE::WEIRD_SI] = true;
0094 isBeforeCuts[TYPE::WEIRD_TPC] = true;
0095 isBeforeCuts[TYPE::NORMAL] = true;
0096 isBeforeCuts[TYPE::PILEUP] = true;
0097 isBeforeCuts[TYPE::PRIMARY] = true;
0098 isBeforeCuts[TYPE::NONPRIM] = true;
0099 isBeforeCuts[TYPE::TRK_CUT] = false;
0100 isBeforeCuts[TYPE::TRU_CUT] = false;
0101 isBeforeCuts[TYPE::WEIRD_CUT] = false;
0102 isBeforeCuts[TYPE::WEIRD_SI_CUT] = false;
0103 isBeforeCuts[TYPE::WEIRD_TPC_CUT] = false;
0104 isBeforeCuts[TYPE::NORM_CUT] = false;
0105 isBeforeCuts[TYPE::PILE_CUT] = false;
0106 isBeforeCuts[TYPE::PRIM_CUT] = false;
0107 isBeforeCuts[TYPE::NONPRIM_CUT] = false;
0108
0109
0110 trkVarHasTruVal[TRKVAR::VX] = true;
0111 trkVarHasTruVal[TRKVAR::VY] = true;
0112 trkVarHasTruVal[TRKVAR::VZ] = true;
0113 trkVarHasTruVal[TRKVAR::NMMS] = true;
0114 trkVarHasTruVal[TRKVAR::NMAP] = true;
0115 trkVarHasTruVal[TRKVAR::NINT] = true;
0116 trkVarHasTruVal[TRKVAR::NTPC] = true;
0117 trkVarHasTruVal[TRKVAR::QUAL] = false;
0118 trkVarHasTruVal[TRKVAR::DCAXY] = false;
0119 trkVarHasTruVal[TRKVAR::DCAZ] = false;
0120 trkVarHasTruVal[TRKVAR::DELDCAXY] = false;
0121 trkVarHasTruVal[TRKVAR::DELDCAZ] = false;
0122 trkVarHasTruVal[TRKVAR::NCLUST] = true;
0123 trkVarHasTruVal[TRKVAR::AVGCLUST] = true;
0124
0125
0126 physVarHasTruVal[PHYSVAR::PHI] = true;
0127 physVarHasTruVal[PHYSVAR::ETA] = true;
0128 physVarHasTruVal[PHYSVAR::PT] = true;
0129 physVarHasTruVal[PHYSVAR::DELPHI] = false;
0130 physVarHasTruVal[PHYSVAR::DELETA] = false;
0131 physVarHasTruVal[PHYSVAR::DELPT] = false;
0132
0133
0134 fTypeCol[TYPE::TRACK] = 923;
0135 fTypeCol[TYPE::TRUTH] = 899;
0136 fTypeCol[TYPE::WEIRD_ALL] = 879;
0137 fTypeCol[TYPE::WEIRD_SI] = 809;
0138 fTypeCol[TYPE::WEIRD_TPC] = 849;
0139 fTypeCol[TYPE::NORMAL] = 889;
0140 fTypeCol[TYPE::PILEUP] = 923;
0141 fTypeCol[TYPE::PRIMARY] = 859;
0142 fTypeCol[TYPE::NONPRIM] = 799;
0143 fTypeCol[TYPE::TRK_CUT] = 923;
0144 fTypeCol[TYPE::TRU_CUT] = 899;
0145 fTypeCol[TYPE::WEIRD_CUT] = 879;
0146 fTypeCol[TYPE::WEIRD_SI_CUT] = 809;
0147 fTypeCol[TYPE::WEIRD_TPC_CUT] = 849;
0148 fTypeCol[TYPE::NORM_CUT] = 889;
0149 fTypeCol[TYPE::PILE_CUT] = 923;
0150 fTypeCol[TYPE::PRIM_CUT] = 859;
0151 fTypeCol[TYPE::NONPRIM_CUT] = 799;
0152
0153
0154 fTypeMar[TYPE::TRACK] = 20;
0155 fTypeMar[TYPE::TRUTH] = 24;
0156 fTypeMar[TYPE::WEIRD_ALL] = 26;
0157 fTypeMar[TYPE::WEIRD_SI] = 5;
0158 fTypeMar[TYPE::WEIRD_TPC] = 2;
0159 fTypeMar[TYPE::NORMAL] = 32;
0160 fTypeMar[TYPE::PILEUP] = 20;
0161 fTypeMar[TYPE::PRIMARY] = 26;
0162 fTypeMar[TYPE::NONPRIM] = 32;
0163 fTypeMar[TYPE::TRK_CUT] = 20;
0164 fTypeMar[TYPE::TRU_CUT] = 24;
0165 fTypeMar[TYPE::WEIRD_CUT] = 26;
0166 fTypeMar[TYPE::WEIRD_SI_CUT] = 5;
0167 fTypeMar[TYPE::WEIRD_TPC_CUT] = 2;
0168 fTypeMar[TYPE::NORM_CUT] = 32;
0169 fTypeMar[TYPE::PILE_CUT] = 20;
0170 fTypeMar[TYPE::PRIM_CUT] = 26;
0171 fTypeMar[TYPE::NONPRIM_CUT] = 32;
0172
0173
0174 sTrkNames[TYPE::TRACK] = "AllTrack";
0175 sTrkNames[TYPE::TRUTH] = "AllTruth";
0176 sTrkNames[TYPE::WEIRD_ALL] = "AllWeird";
0177 sTrkNames[TYPE::WEIRD_SI] = "AllSiWeird";
0178 sTrkNames[TYPE::WEIRD_TPC] = "AllTpcWeird";
0179 sTrkNames[TYPE::NORMAL] = "AllNormal";
0180 sTrkNames[TYPE::PILEUP] = "AllPileup";
0181 sTrkNames[TYPE::PRIMARY] = "AllPrimePileup";
0182 sTrkNames[TYPE::NONPRIM] = "AllNonPrimePileup";
0183 sTrkNames[TYPE::TRK_CUT] = "CutTrack";
0184 sTrkNames[TYPE::TRU_CUT] = "CutTruth";
0185 sTrkNames[TYPE::WEIRD_CUT] = "CutWeird";
0186 sTrkNames[TYPE::WEIRD_SI_CUT] = "CutSiWeird";
0187 sTrkNames[TYPE::WEIRD_TPC_CUT] = "CutTpcWeird";
0188 sTrkNames[TYPE::NORM_CUT] = "CutNormal";
0189 sTrkNames[TYPE::PILE_CUT] = "CutPileup";
0190 sTrkNames[TYPE::PRIM_CUT] = "CutPrimePileup";
0191 sTrkNames[TYPE::NONPRIM_CUT] = "CutNonPrimePileup";
0192
0193
0194 sTrkLabels[TYPE::TRACK] = "Tracks (before cuts)";
0195 sTrkLabels[TYPE::TRUTH] = "Truth tracks (before cuts)";
0196 sTrkLabels[TYPE::WEIRD_ALL] = "Weird tracks (before cuts)";
0197 sTrkLabels[TYPE::WEIRD_SI] = "Weird tracks (Si seed, before cuts)";
0198 sTrkLabels[TYPE::WEIRD_TPC] = "Weird tracks (TPC seed, before cuts)";
0199 sTrkLabels[TYPE::NORMAL] = "Normal tracks (before cuts)";
0200 sTrkLabels[TYPE::PILEUP] = "Including pileup tracks (all, before cuts)";
0201 sTrkLabels[TYPE::PRIMARY] = "Including pileup tracks (only primary, before cuts)";
0202 sTrkLabels[TYPE::NONPRIM] = "Including pileup gracks (non-primary, before cuts)";
0203 sTrkLabels[TYPE::TRK_CUT] = "Tracks (after cuts)";
0204 sTrkLabels[TYPE::TRU_CUT] = "Truth tracks (after cuts)";
0205 sTrkLabels[TYPE::WEIRD_CUT] = "Weird tracks (after cuts)";
0206 sTrkLabels[TYPE::WEIRD_SI_CUT] = "Weird tracks (Si seed, after cuts)";
0207 sTrkLabels[TYPE::WEIRD_TPC_CUT] = "Weird tracks (TPC seed, after cuts)";
0208 sTrkLabels[TYPE::NORM_CUT] = "Normal tracks (after cuts)";
0209 sTrkLabels[TYPE::PILE_CUT] = "Including pileup tracks (all, after cuts)";
0210 sTrkLabels[TYPE::PRIM_CUT] = "Including pileup tracks (only primary, after cuts)";
0211 sTrkLabels[TYPE::NONPRIM_CUT] = "Including pileup gracks (non-primary, after cuts)";
0212
0213
0214 sTrkVars[TRKVAR::VX] = "Vx";
0215 sTrkVars[TRKVAR::VY] = "Vy";
0216 sTrkVars[TRKVAR::VZ] = "Vz";
0217 sTrkVars[TRKVAR::NMMS] = "NMms";
0218 sTrkVars[TRKVAR::NMAP] = "NMap";
0219 sTrkVars[TRKVAR::NINT] = "NInt";
0220 sTrkVars[TRKVAR::NTPC] = "NTpc";
0221 sTrkVars[TRKVAR::QUAL] = "Qual";
0222 sTrkVars[TRKVAR::DCAXY] = "DcaXY";
0223 sTrkVars[TRKVAR::DCAZ] = "DcaZ";
0224 sTrkVars[TRKVAR::DELDCAXY] = "DeltaDcaXY";
0225 sTrkVars[TRKVAR::DELDCAZ] = "DeltaDcaZ";
0226 sTrkVars[TRKVAR::NCLUST] = "NClust";
0227 sTrkVars[TRKVAR::AVGCLUST] = "AvgClustSize";
0228
0229
0230 sPhysVars[PHYSVAR::PHI] = "Phi";
0231 sPhysVars[PHYSVAR::ETA] = "Eta";
0232 sPhysVars[PHYSVAR::PT] = "Pt";
0233 sPhysVars[PHYSVAR::DELPHI] = "DeltaPhi";
0234 sPhysVars[PHYSVAR::DELETA] = "DeltaEta";
0235 sPhysVars[PHYSVAR::DELPT] = "DeltaPt";
0236 cout << "\n Beginning track cut study." << endl;
0237
0238 }
0239
0240
0241
0242
0243 STrackCutStudy::~STrackCutStudy() {
0244
0245 const bool doTuplesExist = (ntTrkEO || ntTrkPU);
0246 if (!doTuplesExist) {
0247 return;
0248 } else {
0249 delete ntTrkEO -> GetCurrentFile();
0250 delete ntTrkPU -> GetCurrentFile();
0251 }
0252
0253 }
0254
0255
0256
0257
0258
0259 void STrackCutStudy::Init() {
0260
0261
0262 cout << " Initializing:" << endl;
0263 InitFiles();
0264 InitTuples();
0265 InitHists();
0266 MakeCutText();
0267 return;
0268
0269 }
0270
0271
0272
0273 void STrackCutStudy::Analyze() {
0274
0275
0276 const bool isEmbedGood = ntTrkEO;
0277 const bool isPileGood = !(doPileup && ntTrkPU);
0278 const bool doTuplesExist = (isEmbedGood && isPileGood);
0279 if (!doTuplesExist) {
0280 cerr << "PANIC: no input tuples!\n"
0281 << " ntTrkEO = " << ntTrkEO << ", ntTrkPU = " << ntTrkPU
0282 << endl;
0283 assert(doTuplesExist);
0284 }
0285 cout << " Analyzing:" <<endl;
0286
0287
0288 Long64_t nEntriesEO = ntTrkEO -> GetEntries();
0289 cout << " Beginning embed-only entry loop: " << nEntriesEO << " entries to process..." << endl;
0290
0291
0292 Double_t recoTrkVars[NTrkVar];
0293 Double_t trueTrkVars[NTrkVar];
0294 Double_t recoPhysVars[NPhysVar];
0295 Double_t truePhysVars[NPhysVar];
0296
0297
0298 Long64_t nBytesEO(0);
0299 for (Long64_t iEntry = 0; iEntry < nEntriesEO; iEntry++) {
0300
0301
0302 const Long64_t bytesEO = ntTrkEO -> GetEntry(iEntry);
0303 if (bytesEO < 0.) {
0304 cerr << "WARNING: something wrong with embed-only entry #" << iEntry << "! Aborting loop!" << endl;
0305 break;
0306 }
0307 nBytesEO += bytesEO;
0308
0309
0310 const Long64_t iProg = iEntry + 1;
0311 if (inBatchMode) {
0312 cout << " Processing embed-only entry " << iProg << "/" << nEntriesEO << "..." << endl;
0313 } else {
0314 if (iProg == nEntriesEO) {
0315 cout << " Processing embed-only entry " << iProg << "/" << nEntriesEO << "..." << endl;
0316 } else {
0317 cout << " Processing embed-only entry " << iProg << "/" << nEntriesEO << "...\r" << flush;
0318 }
0319 }
0320
0321
0322 const Double_t umDcaXY = dca3dxy * 10000;
0323 const Double_t umDcaZ = dca3dz * 10000;
0324 const Double_t deltaDcaXY = abs(dca3dxy / dca3dxysigma);
0325 const Double_t deltaDcaZ = abs(dca3dz / dca3dzsigma);
0326 const Double_t deltaEta = abs(deltaeta / eta);
0327 const Double_t deltaPhi = abs(deltaphi / phi);
0328 const Double_t deltaPt = abs(deltapt / pt);
0329 const Double_t ptFrac = pt /gpt;
0330
0331
0332 recoTrkVars[TRKVAR::VX] = vx;
0333 recoTrkVars[TRKVAR::VY] = vy;
0334 recoTrkVars[TRKVAR::VZ] = vz;
0335 recoTrkVars[TRKVAR::NMMS] = (Double_t) nlmms;
0336 recoTrkVars[TRKVAR::NMAP] = (Double_t) nlmaps;
0337 recoTrkVars[TRKVAR::NINT] = (Double_t) nlintt;
0338 recoTrkVars[TRKVAR::NTPC] = (Double_t) ntpc;
0339 recoTrkVars[TRKVAR::QUAL] = quality;
0340 recoTrkVars[TRKVAR::DCAXY] = umDcaXY;
0341 recoTrkVars[TRKVAR::DCAZ] = umDcaZ;
0342 recoTrkVars[TRKVAR::DELDCAXY] = deltaDcaXY;
0343 recoTrkVars[TRKVAR::DELDCAZ] = deltaDcaZ;
0344 recoTrkVars[TRKVAR::NCLUST] = 0.;
0345 recoTrkVars[TRKVAR::AVGCLUST] = 0.;
0346
0347
0348 trueTrkVars[TRKVAR::VX] = gvx;
0349 trueTrkVars[TRKVAR::VY] = gvy;
0350 trueTrkVars[TRKVAR::VZ] = gvz;
0351 trueTrkVars[TRKVAR::NMMS] = (Double_t) gnlmms;
0352 trueTrkVars[TRKVAR::NMAP] = (Double_t) gnlmaps;
0353 trueTrkVars[TRKVAR::NINT] = (Double_t) gnlintt;
0354 trueTrkVars[TRKVAR::NTPC] = (Double_t) gntpc;
0355 trueTrkVars[TRKVAR::QUAL] = quality;
0356 trueTrkVars[TRKVAR::DCAXY] = umDcaXY;
0357 trueTrkVars[TRKVAR::DCAZ] = umDcaZ;
0358 trueTrkVars[TRKVAR::DELDCAXY] = deltaDcaXY;
0359 trueTrkVars[TRKVAR::DELDCAZ] = deltaDcaZ;
0360 trueTrkVars[TRKVAR::NCLUST] = 0.;
0361 trueTrkVars[TRKVAR::AVGCLUST] = 0.;
0362
0363
0364 recoPhysVars[PHYSVAR::PHI] = phi;
0365 recoPhysVars[PHYSVAR::ETA] = eta;
0366 recoPhysVars[PHYSVAR::PT] = pt;
0367 recoPhysVars[PHYSVAR::DELPHI] = deltaPhi;
0368 recoPhysVars[PHYSVAR::DELETA] = deltaEta;
0369 recoPhysVars[PHYSVAR::DELPT] = deltaPt;
0370
0371
0372 truePhysVars[PHYSVAR::PHI] = gphi;
0373 truePhysVars[PHYSVAR::ETA] = geta;
0374 truePhysVars[PHYSVAR::PT] = gpt;
0375 truePhysVars[PHYSVAR::DELPHI] = deltaPhi;
0376 truePhysVars[PHYSVAR::DELETA] = deltaEta;
0377 truePhysVars[PHYSVAR::DELPT] = deltaPt;
0378
0379
0380 const Bool_t hasSiSeed = (nmaps == 3);
0381 const Bool_t hasTpcSeed = (nmaps == 0);
0382 const Bool_t isPrimary = (gprimary == 1);
0383 const Bool_t isWeirdTrack = ((ptFrac < normalPtFracMin) || (ptFrac > normalPtFracMax));
0384
0385
0386 if (doBeforeCuts) {
0387 FillTrackHistograms(TYPE::TRACK, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0388 FillTruthHistograms(TYPE::TRUTH, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0389
0390
0391 if (isWeirdTrack) {
0392 FillTrackHistograms(TYPE::WEIRD_ALL, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0393 if (hasSiSeed) FillTrackHistograms(TYPE::WEIRD_SI, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0394 if (hasTpcSeed) FillTrackHistograms(TYPE::WEIRD_TPC, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0395 } else {
0396 FillTrackHistograms(TYPE::NORMAL, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0397 }
0398 }
0399
0400
0401 const Bool_t isGoodTrk = ApplyCuts(isPrimary, (UInt_t) nlmaps, (UInt_t) ntpc, vz, umDcaXY, umDcaZ, quality);
0402 if (!isGoodTrk) continue;
0403
0404
0405 FillTrackHistograms(TYPE::TRK_CUT, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0406 FillTruthHistograms(TYPE::TRU_CUT, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0407
0408
0409 if (isWeirdTrack) {
0410 FillTrackHistograms(TYPE::WEIRD_CUT, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0411 if (hasSiSeed) FillTrackHistograms(TYPE::WEIRD_SI_CUT, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0412 if (hasTpcSeed) FillTrackHistograms(TYPE::WEIRD_TPC_CUT, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0413 } else {
0414 FillTrackHistograms(TYPE::NORM_CUT, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0415 }
0416 }
0417 cout << " Finished embed-only entry loop." << endl;
0418
0419
0420 if (doPileup) {
0421 Long64_t nEntriesPU = ntTrkPU -> GetEntries();
0422 cout << " Beginning with-pileup entry loop: " << nEntriesPU << " entries to process..." << endl;
0423
0424
0425 Long64_t nBytesPU(0);
0426 for (Long64_t iEntry = 0; iEntry < nEntriesPU; iEntry++) {
0427
0428
0429 const Long64_t bytesPU = ntTrkPU -> GetEntry(iEntry);
0430 if (bytesPU < 0.) {
0431 cerr << "WARNING: something wrong with with-pileup entry #" << iEntry << "! Aborting loop!" << endl;
0432 break;
0433 }
0434 nBytesPU += bytesPU;
0435
0436
0437 const Long64_t iProg = iEntry + 1;
0438 if (inBatchMode) {
0439 cout << " Processing with-pileup entry " << iProg << "/" << nEntriesPU << "..." << endl;
0440 } else {
0441 if (iProg == nEntriesPU) {
0442 cout << " Processing with-pileup entry " << iProg << "/" << nEntriesPU << "..." << endl;
0443 } else {
0444 cout << " Processing with-pileup entry " << iProg << "/" << nEntriesPU << "...\r" << flush;
0445 }
0446 }
0447
0448
0449 const Double_t umDcaXY = pu_dca3dxy * 10000;
0450 const Double_t umDcaZ = pu_dca3dz * 10000;
0451 const Double_t deltaDcaXY = abs(pu_dca3dxy / pu_dca3dxysigma);
0452 const Double_t deltaDcaZ = abs(pu_dca3dz / pu_dca3dzsigma);
0453 const Double_t deltaEta = abs(pu_deltaeta / pu_eta);
0454 const Double_t deltaPhi = abs(pu_deltaphi / pu_phi);
0455 const Double_t deltaPt = abs(pu_deltapt / pu_pt);
0456
0457
0458 const Bool_t thereAreNans = (isnan(pu_dca3dxy) || isnan(pu_dca3dz) || isnan(pu_eta) || isnan(pu_phi) || isnan(pu_pt));
0459 if (thereAreNans) continue;
0460
0461
0462 recoTrkVars[TRKVAR::VX] = pu_vx;
0463 recoTrkVars[TRKVAR::VY] = pu_vy;
0464 recoTrkVars[TRKVAR::VZ] = pu_vz;
0465 recoTrkVars[TRKVAR::NMMS] = (Double_t) pu_nlmms;
0466 recoTrkVars[TRKVAR::NMAP] = (Double_t) pu_nlmaps;
0467 recoTrkVars[TRKVAR::NINT] = (Double_t) pu_nlintt;
0468 recoTrkVars[TRKVAR::NTPC] = (Double_t) pu_ntpc;
0469 recoTrkVars[TRKVAR::QUAL] = pu_quality;
0470 recoTrkVars[TRKVAR::DCAXY] = umDcaXY;
0471 recoTrkVars[TRKVAR::DCAZ] = umDcaZ;
0472 recoTrkVars[TRKVAR::DELDCAXY] = deltaDcaXY;
0473 recoTrkVars[TRKVAR::DELDCAZ] = deltaDcaZ;
0474 recoTrkVars[TRKVAR::NCLUST] = 0.;
0475 recoTrkVars[TRKVAR::AVGCLUST] = 0.;
0476
0477
0478 trueTrkVars[TRKVAR::VX] = pu_gvx;
0479 trueTrkVars[TRKVAR::VY] = pu_gvy;
0480 trueTrkVars[TRKVAR::VZ] = pu_gvz;
0481 trueTrkVars[TRKVAR::NMMS] = (Double_t) pu_gnlmms;
0482 trueTrkVars[TRKVAR::NMAP] = (Double_t) pu_gnlmaps;
0483 trueTrkVars[TRKVAR::NINT] = (Double_t) pu_gnlintt;
0484 trueTrkVars[TRKVAR::NTPC] = (Double_t) pu_gntpc;
0485 trueTrkVars[TRKVAR::QUAL] = pu_quality;
0486 trueTrkVars[TRKVAR::DCAXY] = umDcaXY;
0487 trueTrkVars[TRKVAR::DCAZ] = umDcaZ;
0488 trueTrkVars[TRKVAR::DELDCAXY] = deltaDcaXY;
0489 trueTrkVars[TRKVAR::DELDCAZ] = deltaDcaZ;
0490 trueTrkVars[TRKVAR::NCLUST] = 0.;
0491 trueTrkVars[TRKVAR::AVGCLUST] = 0.;
0492
0493
0494 recoPhysVars[PHYSVAR::PHI] = pu_phi;
0495 recoPhysVars[PHYSVAR::ETA] = pu_eta;
0496 recoPhysVars[PHYSVAR::PT] = pu_pt;
0497 recoPhysVars[PHYSVAR::DELPHI] = deltaPhi;
0498 recoPhysVars[PHYSVAR::DELETA] = deltaEta;
0499 recoPhysVars[PHYSVAR::DELPT] = deltaPt;
0500
0501
0502 truePhysVars[PHYSVAR::PHI] = gphi;
0503 truePhysVars[PHYSVAR::ETA] = geta;
0504 truePhysVars[PHYSVAR::PT] = gpt;
0505 truePhysVars[PHYSVAR::DELPHI] = deltaPhi;
0506 truePhysVars[PHYSVAR::DELETA] = deltaEta;
0507 truePhysVars[PHYSVAR::DELPT] = deltaPt;
0508
0509
0510 const Bool_t isPrimary = (pu_gprimary == 1);
0511
0512
0513 if (doBeforeCuts) {
0514 FillTrackHistograms(TYPE::PILEUP, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0515 if (isPrimary) {
0516 FillTrackHistograms(TYPE::PRIMARY, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0517 } else {
0518 FillTrackHistograms(TYPE::NONPRIM, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0519 }
0520 }
0521
0522
0523 const Bool_t isGoodTrk = ApplyCuts(isPrimary, (UInt_t) pu_nlmaps, (UInt_t) pu_ntpc, pu_vz, umDcaXY, umDcaZ, pu_quality);
0524 if (!isGoodTrk) continue;
0525
0526
0527 FillTrackHistograms(TYPE::PILE_CUT, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0528 if (isPrimary) {
0529 FillTrackHistograms(TYPE::PRIM_CUT, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0530 } else {
0531 FillTrackHistograms(TYPE::NONPRIM_CUT, recoTrkVars, trueTrkVars, recoPhysVars, truePhysVars);
0532 }
0533 }
0534 cout << " Finished with-pileup entry loop." << endl;
0535 }
0536
0537
0538 if (doIntNorm) NormalizeHists();
0539 return;
0540
0541 }
0542
0543
0544
0545 void STrackCutStudy::End() {
0546
0547
0548 cout << " Ending:" << endl;
0549
0550
0551 SetHistStyles();
0552
0553
0554 if (makePlots) {
0555 const TString sLabelAllEO("EmbedOnly_BeforeCuts");
0556 const TString sLabelCutEO("EmbedOnly_AfterCuts");
0557 const TString sLabelOddEO("EmbedOnly_WeirdVsNormal");
0558 const TString sLabelAllPU("WithPileup_BeforeCuts");
0559 const TString sLabelCutPU("WithPileup_AfterCuts");
0560 const TString sDirPlotAllEO("EmbedOnlyPlots_BeforeCuts");
0561 const TString sDirPlotCutEO("EmbedOnlyPlots_AfterCuts");
0562 const TString sDirPlotOddEO("EmbedOnlyPlots_WeirdVsNormal");
0563 const TString sDirPlotAllPU("AllWithPileupPlots");
0564 const TString sDirPlotCutPU("CutWithPileupPlots");
0565
0566
0567 const Ssiz_t nToDrawAllEO(3);
0568 const Ssiz_t nToDrawCutEO(3);
0569 const Ssiz_t nToDrawOddEO(3);
0570 const Ssiz_t nToDrawAllPU(3);
0571 const Ssiz_t nToDrawCutPU(3);
0572 const Int_t sToDrawAllEO[nToDrawAllEO] = {TYPE::TRACK, TYPE::TRUTH, TYPE::WEIRD_ALL};
0573 const Int_t sToDrawCutEO[nToDrawCutEO] = {TYPE::TRK_CUT, TYPE::TRU_CUT, TYPE::WEIRD_CUT};
0574 const Int_t sToDrawOddEO[nToDrawOddEO] = {TYPE::WEIRD_SI_CUT, TYPE::WEIRD_TPC_CUT, TYPE::NORM_CUT};
0575 const Int_t sToDrawAllPU[nToDrawAllPU] = {TYPE::PILEUP, TYPE::PRIMARY, TYPE::NONPRIM};
0576 const Int_t sToDrawCutPU[nToDrawCutPU] = {TYPE::PILE_CUT, TYPE::PRIM_CUT, TYPE::NONPRIM_CUT};
0577
0578
0579 ConstructPlots(nToDrawCutEO, sToDrawCutEO, sDirPlotCutEO, sLabelCutEO);
0580 ConstructPlots(nToDrawOddEO, sToDrawOddEO, sDirPlotOddEO, sLabelOddEO);
0581 if (doBeforeCuts) {
0582 ConstructPlots(nToDrawAllEO, sToDrawAllEO, sDirPlotAllEO, sLabelAllEO);
0583 }
0584 if (doPileup) {
0585 ConstructPlots(nToDrawCutPU, sToDrawCutPU, sDirPlotCutPU, sLabelCutPU);
0586 if (doBeforeCuts) ConstructPlots(nToDrawAllPU, sToDrawAllPU, sDirPlotAllPU, sLabelAllPU);
0587 }
0588 cout << " Created plots." << endl;
0589 }
0590
0591
0592 SaveHists();
0593
0594
0595 fOut -> cd();
0596 fOut -> Close();
0597 fInEO -> cd();
0598 fInEO -> Close();
0599 fInPU -> cd();
0600 fInPU -> Close();
0601 cout << " Closed files.\n"
0602 << " Finished track cut study!\n"
0603 << endl;
0604 return ;
0605
0606 }
0607
0608