All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimEnergyDepFakeTriggerFilter_module.cc
Go to the documentation of this file.
1 #include "art/Framework/Core/EDFilter.h"
2 #include "art/Framework/Core/ModuleMacros.h"
3 #include "art/Framework/Principal/Event.h"
4 
6 
7 namespace filt {
8 
9 class SimEnergyDepFakeTriggerFilter : public art::EDFilter {
10  public:
11  explicit SimEnergyDepFakeTriggerFilter(fhicl::ParameterSet const& pset);
12  virtual bool filter(art::Event& e) override;
13 
14  private:
15  const double fBeamTimeMin; // Minimum time of beam window [us]
16  const double fBeamTimeMax; // Maximum time of beam window [us]
17  const double fEnergyDeposit; // Minimum energy deposit in TPC for trigger [MeV]
18 
19  const std::string fSimEnergyDepModuleName;
20 };
21 
23  : EDFilter(pset)
24  , fBeamTimeMin(pset.get<double>("BeamTimeMin"))
25  , fBeamTimeMax(pset.get<double>("BeamTimeMax"))
26  , fEnergyDeposit(pset.get<double>("EnergyDeposit"))
27  , fSimEnergyDepModuleName(pset.get<std::string>("SimEnergyDepModuleName"))
28 {
29 }
30 
32 {
33  const art::ValidHandle<std::vector<sim::SimEnergyDeposit>>&
34  energyDeps(e.getValidHandle<std::vector<sim::SimEnergyDeposit>>(fSimEnergyDepModuleName));
35 
36  double energy(0);
37 
38  for (const sim::SimEnergyDeposit& energyDep : *energyDeps) {
39  // Check particle time is within the beam time
40  const double time(energyDep.Time() * 1e-3); // [ns] -> [us]
41  if (time < fBeamTimeMin || time > fBeamTimeMax)
42  continue;
43 
44  // Add up the energy deposit inside the TPC
45  energy += energyDep.Energy(); // [MeV]
46  }
47 
48  // If the energy deposit within the beam time is greater than some limit then trigger the event
49  return energy > fEnergyDeposit;
50 }
51 
52 DEFINE_ART_MODULE(SimEnergyDepFakeTriggerFilter)
53 
54 }
SimEnergyDepFakeTriggerFilter(fhicl::ParameterSet const &pset)
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Definition: UtilFunc.cxx:42
contains information for a single step in the detector simulation
then filt
Energy deposition in the active material.
do i e