From a8a27468c13ae984ab4979822842d5237429129a Mon Sep 17 00:00:00 2001 From: Sean Dobbs Date: Mon, 25 Jun 2018 13:52:23 -0400 Subject: [PATCH] Revert to outputting one event per event (not combo!), some bug fixes, add Delta T(RF) cut --- .../DReaction_factory_pi0calib.cc | 21 +++++------ .../JEventProcessor_pi0calib.cc | 36 +++++++++++-------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/plugins/Utilities/exclusivepi0skim/DReaction_factory_pi0calib.cc b/src/plugins/Utilities/exclusivepi0skim/DReaction_factory_pi0calib.cc index cbfe8e322..5cb0afeed 100644 --- a/src/plugins/Utilities/exclusivepi0skim/DReaction_factory_pi0calib.cc +++ b/src/plugins/Utilities/exclusivepi0skim/DReaction_factory_pi0calib.cc @@ -43,7 +43,7 @@ jerror_t DReaction_factory_pi0calib::init(void) locReactionStep->Set_InitialParticleID(Pi0); locReactionStep->Add_FinalParticleID(Gamma); locReactionStep->Add_FinalParticleID(Gamma); - locReactionStep->Set_KinFitConstrainInitMassFlag(false); + locReactionStep->Set_KinFitConstrainInitMassFlag(false); locReaction->Add_ReactionStep(locReactionStep); dReactionStepPool.push_back(locReactionStep); //register so will be deleted later: prevent memory leak @@ -60,19 +60,20 @@ jerror_t DReaction_factory_pi0calib::init(void) /**************************************************** pi0calib Analysis Actions ****************************************************/ // Recommended: Analysis actions automatically performed by the DAnalysisResults factories to histogram useful quantities. - //These actions are executed sequentially, and are executed on each surviving (non-cut) particle combination - //Pre-defined actions can be found in ANALYSIS/DHistogramActions.h and ANALYSIS/DCutActions.h - - locReaction->Set_MaxExtraGoodTracks(1); - //locReaction->Set_InvariantMassCut(Pi0, 0.05, 0.22); // Use default AnLib cut of M(gg) = 80 - 190 MeV + //These actions are executed sequentially, and are executed on each surviving (non-cut) particle combination + //Pre-defined actions can be found in ANALYSIS/DHistogramActions.h and ANALYSIS/DCutActions.h + locReaction->Set_NumPlusMinusRFBunches(0); // no accidentals! + locReaction->Set_MaxExtraGoodTracks(1); + //locReaction->Set_InvariantMassCut(Pi0, 0.05, 0.22); // Use default AnLib cut of M(gg) = 80 - 190 MeV + // Require BCAL photons locReaction->Add_AnalysisAction(new DCustomAction_CutPhotonKin(locReaction)); - + // Make some back-to-backness and other exclusivity cuts - locReaction->Add_AnalysisAction(new DCustomAction_p2gamma_cuts(locReaction, false)); - - // Require kin fit CL > 1% + locReaction->Add_AnalysisAction(new DCustomAction_p2gamma_cuts(locReaction, false)); + + // Require kin fit CL > 1% locReaction->Add_AnalysisAction(new DCutAction_KinFitFOM(locReaction, 0.01)); _data.push_back(locReaction); //Register the DReaction with the factory diff --git a/src/plugins/Utilities/exclusivepi0skim/JEventProcessor_pi0calib.cc b/src/plugins/Utilities/exclusivepi0skim/JEventProcessor_pi0calib.cc index b1af0ebc4..0b839053b 100644 --- a/src/plugins/Utilities/exclusivepi0skim/JEventProcessor_pi0calib.cc +++ b/src/plugins/Utilities/exclusivepi0skim/JEventProcessor_pi0calib.cc @@ -101,34 +101,37 @@ jerror_t JEventProcessor_pi0calib::evnt(JEventLoop *loop, uint64_t eventnumber) break; } - if(locSuccessFlag) { // there are combos that satisfy our reaction - if( (locAnalysisResultsVector.size() > 0) && (locAnalysisResultsVector[0]->Get_NumPassedParticleCombos() != 0) ) { + if( (locAnalysisResultsVector.size() > 0) && locSuccessFlag) { // there are combos that satisfy our reaction + //if( (locAnalysisResultsVector.size() > 0) && (locAnalysisResultsVector[0]->Get_NumPassedParticleCombos() != 0) ) { // SIMPLE - write out the full event //eventWriterEVIO->Write_EVIOEvent(loop, "exclusivepi0"); // Instead: Write out each combo as an "event", only saving the combo vertex, RF bunch, and showers associated with the combo // This should be a lot smaller + + vector< const JObject* > locObjectsToSave; vector locEventRFBunches; loop->Get(locEventRFBunches); - + //locObjectsToSave.push_back(static_cast(locEventRFBunches)); + locObjectsToSave.push_back(locEventRFBunches[0]); + vector kinfitVertex; loop->Get(kinfitVertex); + locObjectsToSave.push_back(kinfitVertex[0]); + if(kinfitVertex.size() > 0) { // pretty sure this should always be true if we have a combo.... for( auto result : locAnalysisResultsVector ) { deque combos; result->Get_PassedParticleCombos(combos); for( auto combo : combos ) { - // one event per combo - vector< const JObject* > locObjectsToSave; - // need to save the RF bunch info - locObjectsToSave.push_back(static_cast(combo->Get_EventRFBunch())); - + //locObjectsToSave.push_back(static_cast(combo->Get_EventRFBunch())); + // need to make a new vertex object - base it on the old one // we probably don'e need most of this information, but keep it reasonable I guess - DVertex *comboVertex = new DVertex(*(kinfitVertex[0])); - comboVertex->dSpacetimeVertex = combo->Get_EventVertex(); + //DVertex *comboVertex = new DVertex(*(kinfitVertex[0])); + //comboVertex->dSpacetimeVertex = combo->Get_EventVertex(); // Save the actual showers - the EVIO writer will only write out the associated hits //set< const JObject *> bcalShowers; @@ -137,17 +140,22 @@ jerror_t JEventProcessor_pi0calib::evnt(JEventLoop *loop, uint64_t eventnumber) if(ParticleCharge(particle->PID()) == 0) { auto locNeutralParticleHypothesis = static_cast(particle); auto locNeutralShower = locNeutralParticleHypothesis->Get_NeutralShower(); - locObjectsToSave.push_back(locNeutralShower->dBCALFCALShower); + if(find(locObjectsToSave.begin(),locObjectsToSave.end(),locNeutralShower->dBCALFCALShower) == locObjectsToSave.end()) + locObjectsToSave.push_back(locNeutralShower->dBCALFCALShower); //bcalShowers.insert(locNeutralShower->dBCALFCALShower); } } // actually write the event out - eventWriterEVIO->Write_EVIOEvent( loop, "exclusivepi0", locObjectsToSave ); + //eventWriterEVIO->Write_EVIOEvent( loop, "exclusivepi0", locObjectsToSave ); } } } - } + + // actually write the event out + eventWriterEVIO->Write_EVIOEvent( loop, "exclusivepi0", locObjectsToSave ); + + //} //for( auto *shower_ptr : bcalShowers ) { // locObjectsToSave.push_back(static_cast(shower_ptr)); @@ -155,7 +163,7 @@ jerror_t JEventProcessor_pi0calib::evnt(JEventLoop *loop, uint64_t eventnumber) } } - + if( WRITE_ROOT_TREE ){ //Recommended: Write surviving particle combinations (if any) to output ROOT TTree