Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
p3pi_hists/DCustomAction_CutExtraTrackPID.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DCustomAction_CutExtraTrackPID.cc
4 // Created: Thu Oct 1 21:41:32 EDT 2015
5 // Creator: pmatt (on Darwin Pauls-MacBook-Pro-2.local 13.4.0 i386)
6 //
7 
9 
10 void DCustomAction_CutExtraTrackPID::Initialize(JEventLoop* locEventLoop)
11 {
12  locEventLoop->GetSingle(dAnalysisUtilities);
13 
14  dPIDCuts[SYS_TOF] = 1.0;
15  dPIDCuts[SYS_BCAL] = 1.0;
16  dPIDCuts[SYS_FCAL] = 2.0;
17 
19  ddEdxCutAction->Initialize(locEventLoop);
20 }
21 
22 bool DCustomAction_CutExtraTrackPID::Perform_Action(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo)
23 {
24  //Write custom code to perform an action on the INPUT DParticleCombo (DParticleCombo)
25  //NEVER: Grab DParticleCombo or DAnalysisResults objects (of any tag!) from the JEventLoop within this function
26  //NEVER: Grab objects that are created post-kinfit (e.g. DKinFitResults, etc.) from the JEventLoop if Get_UseKinFitResultsFlag() == false: CAN CAUSE INFINITE DEPENDENCY LOOP
27 
28  vector<const DChargedTrack*> locUnusedChargedTracks;
29  dAnalysisUtilities->Get_UnusedChargedTracks(locEventLoop, locParticleCombo, locUnusedChargedTracks);
30 
31  for(size_t loc_i = 0; loc_i < locUnusedChargedTracks.size(); ++loc_i)
32  {
33  const DChargedTrackHypothesis* locChargedTrackHypothesis = locUnusedChargedTracks[loc_i]->Get_Hypothesis(dExtraTrackTargetPID);
34  if(locChargedTrackHypothesis == NULL)
35  return false;
36 
37  if(!ddEdxCutAction->Cut_dEdx(locChargedTrackHypothesis))
38  return false;
39 
40  DetectorSystem_t locSystem = locChargedTrackHypothesis->t1_detector();
41  if(dPIDCuts.find(locSystem) == dPIDCuts.end())
42  continue;
43 
44  double locDeltaT = locChargedTrackHypothesis->time() - locChargedTrackHypothesis->t0();
45  double dDeltaTCut = dPIDCuts.find(locSystem)->second;
46  if(fabs(locDeltaT) > dDeltaTCut)
47  return false;
48  }
49 
50  return true; //return false if you want to use this action to apply a cut (and it fails the cut!)
51 }
52 
void Initialize(JEventLoop *locEventLoop)
Definition: DCutActions.cc:884
const DReaction * Get_Reaction(void) const
DetectorSystem_t
Definition: GlueX.h:15
Definition: GlueX.h:19
double time(void) const
void Get_UnusedChargedTracks(JEventLoop *locEventLoop, const DParticleCombo *locParticleCombo, vector< const DChargedTrack * > &locUnusedChargedTracks) const
Definition: GlueX.h:20
Definition: GlueX.h:22
bool Perform_Action(JEventLoop *locEventLoop, const DParticleCombo *locParticleCombo)
DetectorSystem_t t1_detector(void) const
bool Cut_dEdx(const DChargedTrackHypothesis *locChargedTrackHypothesis)
Definition: DCutActions.cc:920