Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DCustomAction_CutPhotonKin.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DCustomAction_CutPhotonKin.cc
4 // Created: Fri Jul 18 12:51:03 EDT 2014
5 // Creator: jrsteven (on Linux ifarm1102 2.6.32-220.7.1.el6.x86_64 x86_64)
6 //
7 
9 
10 void DCustomAction_CutPhotonKin::Initialize(JEventLoop* locEventLoop)
11 {
12 
13 }
14 
15 bool DCustomAction_CutPhotonKin::Perform_Action(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo)
16 {
17  auto locParticles = locParticleCombo->Get_FinalParticles_Measured(Get_Reaction());
18 
19  for(size_t loc_i = 0; loc_i < locParticles.size(); ++loc_i)
20  {
21  if(ParticleCharge(locParticles[loc_i]->PID()) == 0)
22  {
23  const DNeutralParticleHypothesis* locNeutralParticleHypothesis = static_cast<const DNeutralParticleHypothesis*>(locParticles[loc_i]);
24  const DNeutralShower* locNeutralShower = locNeutralParticleHypothesis->Get_NeutralShower();
25 
26  // make BCAL cut on photon here
27  if(locNeutralShower->dDetectorSystem != SYS_BCAL) return false;
28  // Require each photon to have at least 500 MeV of energy
29  if(locNeutralShower->dEnergy < 0.5) return false;
30  }
31  }
32 
33  return true; //return false if you want to use this action to apply a cut (and it fails the cut!)
34 }
const DReaction * Get_Reaction(void) const
void Initialize(JEventLoop *locEventLoop)
static int ParticleCharge(Particle_t p)
const DNeutralShower * Get_NeutralShower(void) const
Definition: GlueX.h:19
DetectorSystem_t dDetectorSystem
vector< const DKinematicData * > Get_FinalParticles_Measured(const DReaction *locReaction, Charge_t locCharge=d_AllCharges) const
bool Perform_Action(JEventLoop *locEventLoop, const DParticleCombo *locParticleCombo)