Skip to content

Commit

Permalink
Merge pull request #109 from JeffersonLab/flatten_working
Browse files Browse the repository at this point in the history
Added an optional cut on shower quality.
  • Loading branch information
mashephe authored Jun 1, 2020
2 parents ad22b3b + f4a846f commit c5a398c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions FlattenForFSRoot/flatten.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ int FSMCExtras(int numThrown, int pids[]);
TFile* gInputFile;
TFile* gOutputFile;
double gChi2DOFCut;
double gShQualityCut;
int gNumUnusedTracksCut;
int gNumUnusedNeutralsCut;
int gNumNeutralHyposCut;
Expand Down Expand Up @@ -71,6 +72,7 @@ int main(int argc, char** argv){
cout << " (if none, just print info and quit)" << endl;
cout << " -mc [is this mc? 0 or 1] (default: 0)" << endl;
cout << " -chi2 [optional Chi2/DOF cut value] (default: 1000)" << endl;
cout << " -shQuality [optional shower quality cut value] (no default)" << endl;
cout << " -numUnusedTracks [optional cut (<= cut)] (no default)" << endl;
cout << " -numUnusedNeutrals [optional cut (<= cut)] (no default)" << endl;
cout << " -numNeutralHypos [optional cut (<= cut)] (no default)" << endl;
Expand All @@ -96,6 +98,7 @@ int main(int argc, char** argv){
TString outFileName("none");
gIsMC = false;
gChi2DOFCut = 1000.0;
gShQualityCut = -1;
gNumUnusedTracksCut = -1;
gNumUnusedNeutralsCut = -1;
gNumNeutralHyposCut = -1;
Expand All @@ -108,6 +111,7 @@ int main(int argc, char** argv){
if (argi == "-out") outFileName = argi1;
if (argi == "-mc"){ if (argi1 == "1") gIsMC = true; }
if (argi == "-chi2"){ gChi2DOFCut = atof(argi1); }
if (argi == "-shQuality"){ gShQualityCut = atof(argi1); }
if (argi == "-numUnusedTracks"){ gNumUnusedTracksCut = atoi(argi1); }
if (argi == "-numUnusedNeutrals"){ gNumUnusedNeutralsCut = atoi(argi1); }
if (argi == "-numNeutralHypos"){ gNumNeutralHyposCut = atoi(argi1); }
Expand All @@ -120,6 +124,7 @@ int main(int argc, char** argv){
cout << " output file: " << outFileName << endl;
cout << " MC? " << gIsMC << endl;
cout << " chi2/dof cut: " << gChi2DOFCut << endl;
cout << " shower quality cut: " << gShQualityCut << endl;
cout << " numUnusedTracks cut: " << gNumUnusedTracksCut << endl;
cout << " numUnusedNeutrals cut: " << gNumUnusedNeutralsCut << endl;
cout << " numNeutralHypos cut: " << gNumNeutralHyposCut << endl;
Expand Down Expand Up @@ -875,6 +880,7 @@ void ConvertTree(TString treeName){

// particle information

bool cutDueToParticleInfo = false;
for (unsigned int im = 0; im < orderedParticleNames.size(); im++){
for (unsigned int id = 0; id < orderedParticleNames[im].size(); id++){
TString name = orderedParticleNames[im][id];
Expand Down Expand Up @@ -924,6 +930,7 @@ void ConvertTree(TString treeName){
outMCPz[pIndex] = p4->Pz();
outMCEn[pIndex] = p4->E(); }
outShQuality[pIndex] = inNeutralHypo__ShowerQuality[(inNeutralIndex[pIndex][ic])];
if (outShQuality[pIndex] < gShQualityCut) cutDueToParticleInfo = true;
}

// decaying to charged tracks
Expand Down Expand Up @@ -1026,6 +1033,7 @@ void ConvertTree(TString treeName){

// make cuts

if (cutDueToParticleInfo) continue;
if (outChi2DOF > gChi2DOFCut) continue;
int numUnusedNeutrals = inNumNeutralHypos - numFSNeutrals;
if ((gNumUnusedTracksCut >= 0) && (outNumUnusedTracks > gNumUnusedTracksCut)) continue;
Expand Down

0 comments on commit c5a398c

Please sign in to comment.