22 inBatchMode = doBatch;
24 cout <<
" Will run in batch mode." << endl;
26 cout <<
" Will not run in batch mode." << endl;
36 sInFileEO = sEmbedOnlyInput;
37 sInFilePU = sPileupInput;
39 cout <<
" Set i/o files:\n"
40 <<
" Embed Only = " << sInFileEO.Data() <<
"\n"
41 <<
" With Pileup = " << sInFilePU.Data() <<
"\n"
42 <<
" Output = " << sOutput.Data()
52 sInTupleEO = sEmbedOnlyTuple;
53 sInTuplePU = sPileupTuple;
54 sInClustEO = sEmbedOnlyClusterTuple;
55 cout <<
" Set input track tuples:\n"
56 <<
" Embed Only = " << sInTupleEO.Data() <<
"\n"
57 <<
" With Pileup = " << sInTuplePU.Data()
60 if (sEmbedOnlyClusterTuple !=
"") {
61 cout <<
" Set input cluster tuples:\n"
62 <<
" Embed-only cluster tuple = " << sInClustEO.Data()
71 void STrackCutStudy::SetStudyParameters(
const Bool_t plots,
const Bool_t pileup,
const Bool_t intNorm,
const Bool_t beforeCuts,
const Bool_t avgClustCalc,
const Double_t normalFracMin,
const Double_t normalFracMax) {
76 doBeforeCuts = beforeCuts;
77 doAvgClustCalc = avgClustCalc;
78 normalPtFracMin = normalFracMin;
79 normalPtFracMax = normalFracMax;
80 cout <<
" Set normal pT fraction:\n"
81 <<
" Normal Pt Fraction = (" << normalPtFracMin <<
", " << normalPtFracMax <<
")"
85 cout <<
" Making plots." << endl;
87 cout <<
" Not making plots." << endl;
91 cout <<
" Looking at pileup tuple." << endl;
93 cout <<
" Not looking at pileup tuple." << endl;
97 cout <<
" Normalizing by integral." << endl;
99 cout <<
" No normalization." << endl;
103 cout <<
" Including quantities before cuts." << endl;
105 cout <<
" Not including quantities before cuts." << endl;
108 if (doAvgClustCalc) {
109 cout <<
" Will calculate average cluster size." << endl;
111 cout <<
" Will not calculate average cluster size." << endl;
119 void STrackCutStudy::SetCutFlags(
const Bool_t doPrimary,
const Bool_t doMVtx,
const Bool_t doTpc,
const Bool_t doVz,
const Bool_t doDcaXY,
const Bool_t doDcaZ,
const Bool_t doQuality) {
121 doPrimaryCut = doPrimary;
125 doDcaXyCut = doDcaXY;
127 doQualityCut = doQuality;
128 cout <<
" Set cut flags:\n"
129 <<
" doPrimaryCut = " << doPrimaryCut <<
"\n"
130 <<
" doMVtxCut = " << doMVtxCut <<
"\n"
131 <<
" doTpcCut = " << doTpcCut <<
"\n"
132 <<
" doVzCut = " << doVzCut <<
"\n"
133 <<
" doDcaXyCut = " << doDcaXyCut <<
"\n"
134 <<
" doDCaZCut = " << doDcaZCut <<
"\n"
135 <<
" doQualityCut = " << doQualityCut
144 void STrackCutStudy::SetTrackCuts(
const pair<UInt_t, UInt_t> nMVtxRange,
const pair<UInt_t, UInt_t> nTpcRange,
const pair<Double_t, Double_t> vzRange,
const pair<Double_t, Double_t> dcaXyRange,
const pair <Double_t, Double_t> dcaZRange,
const pair<Double_t, Double_t> qualityRange) {
146 nMVtxCut = nMVtxRange;
149 dcaXyCut = dcaXyRange;
151 qualityCut = qualityRange;
152 cout <<
" Set track cuts:\n"
153 <<
" mvtx hits = (" << nMVtxCut.first <<
", " << nMVtxCut.second <<
")\n"
154 <<
" tpc hits = (" << nTpcCut.first <<
", " << nTpcCut.second <<
")\n"
155 <<
" z-vertex = (" << vzCut.first <<
", " << vzCut.second <<
")\n"
156 <<
" dca (xy) = (" << dcaXyCut.first <<
", " << dcaXyCut.second <<
")\n"
157 <<
" dca (z) = (" << dcaZCut.first <<
", " << dcaZCut.second <<
")\n"
158 <<
" quality = (" << qualityCut.first <<
", " << qualityCut.second <<
")"
170 for (Ssiz_t iTxtEO = 0; iTxtEO < nTxtEO; iTxtEO++) {
171 sTxtEO.push_back(sTxtE[iTxtEO]);
173 for (Ssiz_t iTxtPU = 0; iTxtPU < nTxtPU; iTxtPU++) {
174 sTxtPU.push_back(sTxtP[iTxtPU]);
176 cout <<
" Set plot text." << endl;
186 fOut =
new TFile(sOutfile.Data(),
"recreate");
187 fInEO =
new TFile(sInFileEO.Data(),
"read");
188 fInPU =
new TFile(sInFilePU.Data(),
"read");
189 if (!fOut || !fInEO || !fInPU) {
190 cerr <<
"PANIC: couldn't open a file!\n"
191 <<
" fOut = " << fOut <<
", fInEO = " << fInEO <<
", fInPU = " << fInPU <<
"\n"
193 assert(fOut && fInEO && fInPU);
195 cout <<
" Initialized files." << endl;
205 ntTrkEO = (TNtuple*) fInEO ->
Get(sInTupleEO.Data());
207 cerr <<
"PANIC: couldn't grab an input Ntuple!\n"
208 <<
" ntTrkEO = " << ntTrkEO <<
"\n"
214 ntTrkPU = (TNtuple*) fInPU ->
Get(sInTuplePU.Data());
216 cerr <<
"PANIC: couldn't grab an input Ntuple!\n"
217 <<
" ntTrkPU = " << ntTrkPU <<
"\n"
223 if (doAvgClustCalc) {
224 ntClustEO = (TNtuple*) fInEO ->
Get(sInClustEO.Data());
226 cerr <<
"PANIC: couldn't grab an input cluster NTuple!\n"
227 <<
" ntClustEO = " << ntClustEO <<
"\n"
232 cout <<
" Initialized input ntuples." << endl;
433 cout <<
" Set branch addresses." << endl;
443 TDirectory *dOut[
NType];
444 for (UInt_t iDir = 0; iDir <
NType; iDir++) {
447 if (isBeforeCuts[iDir] || isPileup[iDir]) {
448 if (isBeforeCuts[iDir] && !doBeforeCuts)
continue;
449 if (isPileup[iDir] && !doPileup)
continue;
454 dOut[iDir] = (TDirectory*) fOut -> mkdir(sTrkNames[iDir].
Data());
456 cout <<
" Made directories." << endl;
459 for (
int iType = 0; iType <
NType; iType++) {
462 if (isBeforeCuts[iType] || isPileup[iType]) {
463 if (isBeforeCuts[iType] && !doBeforeCuts)
continue;
464 if (isPileup[iType] && !doPileup)
continue;
468 for (
size_t iTrkVar = 0; iTrkVar <
NTrkVar; iTrkVar++) {
469 hTrkVar[iType][iTrkVar] ->
Write();
470 hTrkVarDiff[iType][iTrkVar] ->
Write();
471 hTrkVarFrac[iType][iTrkVar] ->
Write();
472 hTrkVarVsNTpc[iType][iTrkVar] ->
Write();
473 hTrkVarVsPtReco[iType][iTrkVar] ->
Write();
474 hTrkVarVsPtTrue[iType][iTrkVar] ->
Write();
475 hTrkVarVsPtFrac[iType][iTrkVar] ->
Write();
477 for (
size_t iPhysVar = 0; iPhysVar <
NPhysVar; iPhysVar++) {
478 hPhysVar[iType][iPhysVar] ->
Write();
479 hPhysVarDiff[iType][iPhysVar] ->
Write();
480 hPhysVarFrac[iType][iPhysVar] ->
Write();
481 hPhysVarVsNTpc[iType][iPhysVar] ->
Write();
482 hPhysVarVsPtReco[iType][iPhysVar] ->
Write();
483 hPhysVarVsPtTrue[iType][iPhysVar] ->
Write();
484 hPhysVarVsPtFrac[iType][iPhysVar] ->
Write();
488 cout <<
" Saved histograms." << endl;