All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
filt::LArG4FakeTriggerFilter Class Reference
Inheritance diagram for filt::LArG4FakeTriggerFilter:

Public Member Functions

 LArG4FakeTriggerFilter (fhicl::ParameterSet const &pset)
 
virtual bool filter (art::Event &e) override
 
void reconfigure (fhicl::ParameterSet const &pset)
 
virtual void beginJob () override
 

Private Member Functions

bool IsInterestingParticle (const art::Ptr< simb::MCParticle > particle)
 
double EnergyInTPC (const art::Ptr< simb::MCParticle > particle)
 

Private Attributes

double fBeamTimeMin
 
double fBeamTimeMax
 
double fEnergyDeposit
 
std::string fLArG4ModuleName
 
geo::GeometryCore const * fGeometryService
 

Detailed Description

Definition at line 14 of file LArG4FakeTriggerFilter_module.cc.

Constructor & Destructor Documentation

filt::LArG4FakeTriggerFilter::LArG4FakeTriggerFilter ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 37 of file LArG4FakeTriggerFilter_module.cc.

38  : EDFilter(pset)
39  {
40  this->reconfigure(pset);
41 
42  fGeometryService = lar::providerFrom<geo::Geometry>();
43  }
void reconfigure(fhicl::ParameterSet const &pset)
geo::GeometryCore const * fGeometryService

Member Function Documentation

void filt::LArG4FakeTriggerFilter::beginJob ( )
overridevirtual

Definition at line 86 of file LArG4FakeTriggerFilter_module.cc.

86  {
87  }
double filt::LArG4FakeTriggerFilter::EnergyInTPC ( const art::Ptr< simb::MCParticle >  particle)
private

Definition at line 105 of file LArG4FakeTriggerFilter_module.cc.

105  {
106 
107  double xmin = -2.0 * fGeometryService->DetHalfWidth();
108  double xmax = 2.0 * fGeometryService->DetHalfWidth();
109  double ymin = -fGeometryService->DetHalfHeight();
110  double ymax = fGeometryService->DetHalfHeight();
111  double zmin = 0.;
112  double zmax = fGeometryService->DetLength();
113 
114  double e_dep = 0;
115 
116  int npts = particle->NumberTrajectoryPoints();
117  for (int i = 1; i < npts; i++){
118  TVector3 pos(particle->Vx(i), particle->Vy(i), particle->Vz(i));
119  // Check if point is within the TPC
120  if (pos[0] >= xmin && pos[0] <= xmax && pos[1] >= ymin && pos[1] <= ymax && pos[2] >= zmin && pos[2] <= zmax){
121  e_dep += particle->E(i-1) - particle->E(i);
122  }
123  }
124 
125  return e_dep;
126  }
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
process_name pandoraGausCryo1 vertexChargeCryo1 vertexStubCryo1 xmin
geo::Length_t DetHalfHeight(geo::TPCID const &tpcid) const
Returns the half height of the active volume of the specified TPC.
geo::Length_t DetLength(geo::TPCID const &tpcid) const
Returns the length of the active volume of the specified TPC.
geo::GeometryCore const * fGeometryService
bool filt::LArG4FakeTriggerFilter::filter ( art::Event &  e)
overridevirtual

Definition at line 57 of file LArG4FakeTriggerFilter_module.cc.

57  {
58 
59  art::Handle<std::vector<simb::MCParticle> > particles;
60  e.getByLabel(fLArG4ModuleName, particles);
61 
62  double e_dep = 0;
63 
64  for (unsigned int part_i = 0; part_i < particles->size(); part_i++){
65 
66  const art::Ptr<simb::MCParticle> particle(particles, part_i);
67 
68  // Check particle time is within the beam time
69  double time = particle->T() * 1e-3; // [us]
70  if(time < fBeamTimeMin || time > fBeamTimeMax) continue;
71 
72  // Check particle is stable and charged
73  if (!IsInterestingParticle(particle)) continue;
74 
75  // Add up the energy deposit inside the TPC
76  e_dep += EnergyInTPC(particle); // [GeV]
77  }
78 
79  // If the energy deposit within the beam time is greater than some limit then trigger the event
80  if(e_dep > fEnergyDeposit/1000.) return true;
81  return false;
82 
83  }
bool IsInterestingParticle(const art::Ptr< simb::MCParticle > particle)
do i e
double EnergyInTPC(const art::Ptr< simb::MCParticle > particle)
bool filt::LArG4FakeTriggerFilter::IsInterestingParticle ( const art::Ptr< simb::MCParticle >  particle)
private

Definition at line 91 of file LArG4FakeTriggerFilter_module.cc.

91  {
92 
93  // Stable final state
94  if(particle->StatusCode() != 1) return false;
95 
96  // Charged: e, mu, pi, K, p
97  int pdg = particle->PdgCode();
98  if(!(pdg==11 || pdg==13 || pdg==211 || pdg==321 || pdg==2212)) return false;
99 
100  return true;
101 
102  }
var pdg
Definition: selectors.fcl:14
void filt::LArG4FakeTriggerFilter::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 46 of file LArG4FakeTriggerFilter_module.cc.

46  {
47 
48  fBeamTimeMin = pset.get<double>("BeamTimeMin");
49  fBeamTimeMax = pset.get<double>("BeamTimeMax");
50  fEnergyDeposit = pset.get<double>("EnergyDeposit");
51 
52  fLArG4ModuleName = pset.get<std::string>("LArG4ModuleName");
53 
54  }

Member Data Documentation

double filt::LArG4FakeTriggerFilter::fBeamTimeMax
private

Definition at line 25 of file LArG4FakeTriggerFilter_module.cc.

double filt::LArG4FakeTriggerFilter::fBeamTimeMin
private

Definition at line 24 of file LArG4FakeTriggerFilter_module.cc.

double filt::LArG4FakeTriggerFilter::fEnergyDeposit
private

Definition at line 26 of file LArG4FakeTriggerFilter_module.cc.

geo::GeometryCore const* filt::LArG4FakeTriggerFilter::fGeometryService
private

Definition at line 30 of file LArG4FakeTriggerFilter_module.cc.

std::string filt::LArG4FakeTriggerFilter::fLArG4ModuleName
private

Definition at line 28 of file LArG4FakeTriggerFilter_module.cc.


The documentation for this class was generated from the following file: