Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DCustomAction_ee_ShowerEoverP_cut.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DCustomAction_ee_ShowerEoverP_cut.cc
4 // Created: Mon Mar 9 18:27:49 EDT 2015
5 // Creator: sdobbs (on Linux ifarm1401 2.6.32-431.el6.x86_64 x86_64)
6 //
7 
9 
10 void DCustomAction_ee_ShowerEoverP_cut::Initialize(JEventLoop* locEventLoop)
11 {
12  //Optional: Create histograms and/or modify member variables.
13  //Create any histograms/trees/etc. within a ROOT lock.
14  //This is so that when running multithreaded, only one thread is writing to the ROOT file at a time.
15 }
16 
17 bool DCustomAction_ee_ShowerEoverP_cut::Perform_Action(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo)
18 {
19  // require tracks to have E/p in a certain range
20  // reject events with tracks not matched to tracks
21 
22  auto locParticles = Get_UseKinFitResultsFlag() ? locParticleCombo->Get_FinalParticles(Get_Reaction(), false, false, d_Charged) : locParticleCombo->Get_FinalParticles_Measured(Get_Reaction(), d_Charged);
23  for(size_t loc_i = 0; loc_i < locParticles.size(); ++loc_i)
24  {
25  const DChargedTrackHypothesis* locChargedTrackHypothesis = static_cast<const DChargedTrackHypothesis*>(locParticles[loc_i]);
26  auto locBCALShowerMatchParams = locChargedTrackHypothesis->Get_BCALShowerMatchParams();
27  auto locFCALShowerMatchParams = locChargedTrackHypothesis->Get_FCALShowerMatchParams();
28  // require all tracks to have a matched shower
29  if( (locBCALShowerMatchParams == NULL) && (locFCALShowerMatchParams == NULL) )
30  continue;
31 
32  //Particle_t locPID = locChargedTrackHypothesis->PID();
33  if(locBCALShowerMatchParams) {
34  const DBCALShower* locBCALShower = locBCALShowerMatchParams->dBCALShower;
35  double locShowerEOverP = locBCALShower->E/locChargedTrackHypothesis->momentum().Mag();
36 
37  if( (locShowerEOverP < dBCAL_EP_min) || (locShowerEOverP > dBCAL_EP_max) )
38  return false;
39  }
40  if(locFCALShowerMatchParams) {
41  const DFCALShower* locFCALShower = locFCALShowerMatchParams->dFCALShower;
42  double locShowerEOverP = locFCALShower->getEnergy()/locChargedTrackHypothesis->momentum().Mag();
43 
44  if( (locShowerEOverP < dFCAL_EP_min) || (locShowerEOverP > dFCAL_EP_max) )
45  return false;
46  }
47 
48  }
49 
50  return true;
51 
52 }
double getEnergy() const
Definition: DFCALShower.h:156
const DReaction * Get_Reaction(void) const
bool Get_UseKinFitResultsFlag(void) const
bool Perform_Action(JEventLoop *locEventLoop, const DParticleCombo *locParticleCombo)
vector< const DKinematicData * > Get_FinalParticles(const DReaction *locReaction, bool locIncludeMissingFlag=true, bool locIncludeDecayingFlag=true, Charge_t locCharge=d_AllCharges) const
vector< const DKinematicData * > Get_FinalParticles_Measured(const DReaction *locReaction, Charge_t locCharge=d_AllCharges) const
shared_ptr< const DFCALShowerMatchParams > Get_FCALShowerMatchParams(void) const
const DVector3 & momentum(void) const
shared_ptr< const DBCALShowerMatchParams > Get_BCALShowerMatchParams(void) const