Public Member Functions | Private Attributes | List of all members
protoana::ProtoDUNEBeamlineFilter Class Reference
Inheritance diagram for protoana::ProtoDUNEBeamlineFilter:
art::EDFilter art::detail::Filter art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 ProtoDUNEBeamlineFilter (fhicl::ParameterSet const &pset)
 
virtual ~ProtoDUNEBeamlineFilter ()
 
void beginJob ()
 
bool filter (art::Event &evt)
 
void reconfigure (fhicl::ParameterSet const &pset)
 
void endJob ()
 
- Public Member Functions inherited from art::EDFilter
 EDFilter (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDFilter (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Filter
virtual ~Filter () noexcept
 
 Filter (fhicl::ParameterSet const &)
 
 Filter (Filter const &)=delete
 
 Filter (Filter &&)=delete
 
Filteroperator= (Filter const &)=delete
 
Filteroperator= (Filter &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

protoana::ProtoDUNEBeamlineUtils fBeamlineUtils
 
float fNominalBeamMomentum
 
bool fIsElectron
 
bool fIsMuon
 
bool fIsPion
 
bool fIsKaon
 
bool fIsProton
 
bool fAndParticles
 
TH1F * fIsBeamTrigger
 
TH1F * fBITriggerAll
 
TH1F * fBITriggerPass
 
TH1F * fBIAndTimingMatchAll
 
TH1F * fBIAndTimingMatchPass
 
TH1F * fPossiblePartsTOF
 
TH1F * fPossiblePartsCherenkov
 
TH1F * fPossiblePartsAll
 
TH1F * fPossiblePartsPass
 
TH1F * fMomentumAll
 
TH1F * fMomentumPass
 
TH1F * fTOFAll
 
TH1F * fTOFPass
 
TH1F * fTOFChannelAll
 
TH1F * fTOFChannelPass
 
TH1F * fCKov0All
 
TH1F * fCKov0Pass
 
TH1F * fCKov1All
 
TH1F * fCKov1Pass
 
TH1F * fCKov0PressureAll
 
TH1F * fCKov0PressurePass
 
TH1F * fCKov1PressureAll
 
TH1F * fCKov1PressurePass
 
TH1F * fCKovAll
 
TH1F * fCKovPass
 
TH1F * fMassAll
 
TH1F * fMassPass
 

Additional Inherited Members

- Public Types inherited from art::EDFilter
using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
- Public Types inherited from art::detail::Filter
template<typename UserConfig >
using Table = Modifier::Table< UserConfig >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Attributes inherited from art::detail::Filter
static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 33 of file ProtoDUNEBeamlineFilter_module.cc.

Constructor & Destructor Documentation

protoana::ProtoDUNEBeamlineFilter::ProtoDUNEBeamlineFilter ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 86 of file ProtoDUNEBeamlineFilter_module.cc.

86  :
87  EDFilter(pset), fBeamlineUtils(pset.get<fhicl::ParameterSet>("BeamlineUtils"))
88 {
89 
90  this->reconfigure(pset);
91 
92 }
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:21
protoana::ProtoDUNEBeamlineUtils fBeamlineUtils
void reconfigure(fhicl::ParameterSet const &pset)
protoana::ProtoDUNEBeamlineFilter::~ProtoDUNEBeamlineFilter ( )
virtual

Definition at line 95 of file ProtoDUNEBeamlineFilter_module.cc.

95 {}

Member Function Documentation

void protoana::ProtoDUNEBeamlineFilter::beginJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 98 of file ProtoDUNEBeamlineFilter_module.cc.

98  {
99 
101  fIsBeamTrigger = tfs->make<TH1F>("IsBeamTrigger", "Is the CTB trigger from the beamline?", 2,0,1);
102  fBITriggerAll = tfs->make<TH1F>("BITriggerAll", "Beam Instrumentation Trigger for All Events", 3,-1,1);
103  fBITriggerPass = tfs->make<TH1F>("BITriggerPass", "Beam Instrumentation Trigger for Passing Events", 3,-1,1);
104  fBIAndTimingMatchAll = tfs->make<TH1F>("BIAndTimingMatchAll", "Beam Instrumentation & Timing Triggers Match for All Events", 2,0,1);
105  fBIAndTimingMatchPass = tfs->make<TH1F>("BIAndTimingMatchPass", "Beam Instrumentation & Timing Triggers Match for Passing Events", 2,0,1);
106  fPossiblePartsTOF = tfs->make<TH1F>("PossiblePartsTOF", "Possible TOF Particles for All Events", 5,0,5);
107  fPossiblePartsCherenkov = tfs->make<TH1F>("PossiblePartsCherenkov", "Possible Cherenkov Particles for All Events", 5,0,5);
108  fPossiblePartsAll = tfs->make<TH1F>("PossiblePartsAll", "Possible Particles for All Events", 5,0,5);
109  fPossiblePartsPass = tfs->make<TH1F>("PossiblePartsPass", "Possible Particles for Passing Events", 5,0,5);
110  fMomentumAll = tfs->make<TH1F>("MomentumAll", "Momentum for All Events", 100,0,10);
111  fMomentumPass = tfs->make<TH1F>("MomentumPass", "Momentum for Passing Events", 100,0,10);
112  fTOFAll = tfs->make<TH1F>("TOFAll", "TOF for All Events", 350,-100,250);
113  fTOFPass = tfs->make<TH1F>("TOFPass", "TOF for Passing Events", 350,-100,250);
114  fTOFChannelAll = tfs->make<TH1F>("TOFChannelAll", "TOF Channel for All Events", 6,-1,5);
115  fTOFChannelPass = tfs->make<TH1F>("TOFChannelPass", "TOF Channel for Passing Events", 6,-1,5);
116  fCKov0All = tfs->make<TH1F>("CKov0All", "Cherenkov 0 for All Events", 3,-1,2);
117  fCKov0Pass = tfs->make<TH1F>("CKov0Pass", "Cherenkov 0 for Passing Events", 3,-1,2);
118  fCKov1All = tfs->make<TH1F>("CKov1All", "Cherenkov 1 for All Events", 3,-1,2);
119  fCKov1Pass = tfs->make<TH1F>("CKov1Pass", "Cherenkov 1 for Passing Events", 3,-1,2);
120  fCKov0PressureAll = tfs->make<TH1F>("CKov0PressureAll", "Cherenkov 0 Pressure for All Events", 100,0,10);
121  fCKov0PressurePass = tfs->make<TH1F>("CKov0PressurePass", "Cherenkov 0 Pressure for Passing Events", 100,0,10);
122  fCKov1PressureAll = tfs->make<TH1F>("CKov1PressureAll", "Cherenkov 1 Pressure for All Events", 100,0,10);
123  fCKov1PressurePass = tfs->make<TH1F>("CKov1PressurePass", "Cherenkov 1 Pressure for Passing Events", 100,0,10);
124  fCKovAll = tfs->make<TH1F>("CKovAll", "Both Cherenkovs for All Events", 5,-1,4);
125  fCKovPass = tfs->make<TH1F>("CKovPass", "Both Cherenkovs for Passing Events", 5,-1,4);
126  fMassAll = tfs->make<TH1F>("MassAll", "Beamline Particle Mass for All Events", 200,0,5);
127  fMassPass = tfs->make<TH1F>("MassPass", "Beamline Particle Mass for Passing Events", 200,0,5);
128 
129 }
void protoana::ProtoDUNEBeamlineFilter::endJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 238 of file ProtoDUNEBeamlineFilter_module.cc.

238 {}
bool protoana::ProtoDUNEBeamlineFilter::filter ( art::Event evt)
virtual

Implements art::EDFilter.

Definition at line 143 of file ProtoDUNEBeamlineFilter_module.cc.

143  {
144 
146  {
147  fIsBeamTrigger->Fill(1);
148  }
149  else
150  {
151  fIsBeamTrigger->Fill(0);
152  return false;
153  }
154  const auto possibleParts = fBeamlineUtils.GetPIDCandidates(evt,fNominalBeamMomentum);
155  mf::LogInfo("protoana::ProtoDUNEBeamlineFilter::filter") << (std::string) possibleParts;
156  bool result = false;
157  if(fAndParticles)
158  {
159  if(fIsElectron && !possibleParts.electron) result = false;
160  else if(fIsMuon && !possibleParts.muon) result = false;
161  else if(fIsPion && !possibleParts.pion) result = false;
162  else if(fIsKaon && !possibleParts.kaon) result = false;
163  else if(fIsProton && !possibleParts.proton) result = false;
164  else result = true;
165  }
166  else // or
167  {
168  if(fIsElectron && possibleParts.electron) result = true;
169  else if(fIsMuon && possibleParts.muon) result = true;
170  else if(fIsPion && possibleParts.pion) result = true;
171  else if(fIsKaon && possibleParts.kaon) result = true;
172  else if(fIsProton && possibleParts.proton) result = true;
173  else result = false;
174  }
175 
176  if (possibleParts.electron) fPossiblePartsAll->Fill(0);
177  if (possibleParts.muon) fPossiblePartsAll->Fill(1);
178  if (possibleParts.pion) fPossiblePartsAll->Fill(2);
179  if (possibleParts.kaon) fPossiblePartsAll->Fill(3);
180  if (possibleParts.proton) fPossiblePartsAll->Fill(4);
181  if(result)
182  {
183  if (possibleParts.electron) fPossiblePartsPass->Fill(0);
184  if (possibleParts.muon) fPossiblePartsPass->Fill(1);
185  if (possibleParts.pion) fPossiblePartsPass->Fill(2);
186  if (possibleParts.kaon) fPossiblePartsPass->Fill(3);
187  if (possibleParts.proton) fPossiblePartsPass->Fill(4);
188  }
189 
190  const auto [momentum,tof,tofChannel,ckov0,ckov1,ckov0Pressure,ckov1Pressure,timingTrigger,BITrigger,areBIAndTimingMatched] = fBeamlineUtils.GetBeamlineVarsAndStatus(evt);
191  fMomentumAll->Fill(momentum);
192  if(result) fMomentumPass->Fill(momentum);
193  fTOFAll->Fill(momentum);
194  if(result) fTOFPass->Fill(tof);
195  fTOFChannelAll->Fill(tofChannel);
196  if(result) fTOFChannelPass->Fill(tofChannel);
197 
198  fCKov0All->Fill(ckov0);
199  if(result) fCKov0Pass->Fill(ckov0);
200  fCKov1All->Fill(ckov1);
201  if(result) fCKov1Pass->Fill(ckov1);
202  fCKov0PressureAll->Fill(ckov0Pressure);
203  if(result) fCKov0PressurePass->Fill(ckov0Pressure);
204  fCKov1PressureAll->Fill(ckov1);
205  if(result) fCKov1PressurePass->Fill(ckov1Pressure);
206 
207  int ckov = -1;
208  if (ckov0 >=0 && ckov1 >=0)
209  {
210  ckov = ckov0;
211  ckov += (ckov1 << 1);
212  }
213  fCKovAll->Fill(ckov);
214  if(result) fCKovPass->Fill(ckov);
215 
216  mf::LogInfo("protoana::ProtoDUNEBeamlineFilter::filter") << "pass: " << result << "momentum: " << momentum << " GeV/c, TOF: "<<tof
217  << " ns, tofChannel: " << tofChannel << " cherenkov 0: " << ckov0 << " cherenkov 1: " << ckov1
218  << " ckov0Pressure: " << ckov0Pressure
219  << " ckov1Pressure: " << ckov1Pressure
220  << " timingTrigger: "<<timingTrigger<<" BITrigger: "<<BITrigger
221  << " BIAndTimingMatched: "<<areBIAndTimingMatched;
222  std::vector<double> massSquareds = fBeamlineUtils.GetBeamlineMassSquared(evt);
223  for (const auto& massSquared: massSquareds)
224  {
225  const auto& mass = std::sqrt(massSquared);
226  mf::LogInfo("protoana::ProtoDUNEBeamlineFilter::filter") << "mass^2: " << massSquared << " (GeV/c^2)^2 " << "mass: " << mass << " GeV/c^2";
227  fMassAll->Fill(mass);
228  if(result) fMassPass->Fill(mass);
229  }
230  fBITriggerAll->Fill(BITrigger);
231  if(result) fBITriggerPass->Fill(BITrigger);
232  fBIAndTimingMatchAll->Fill(areBIAndTimingMatched);
233  if(result) fBIAndTimingMatchPass->Fill(areBIAndTimingMatched);
234 
235  return result;
236 }
PossibleParticleCands GetPIDCandidates(beam::ProtoDUNEBeamEvent const &beamevt, double nominal_momentum)
static QCString result
std::string string
Definition: nybbler.cc:12
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
const std::tuple< double, double, int, int, int, double, double, int, int, bool > GetBeamlineVarsAndStatus(art::Event const &evt) const
std::vector< double > GetBeamlineMassSquared(art::Event const &evt) const
bool IsGoodBeamlineTrigger(art::Event const &evt) const
def momentum(x1, x2, x3, scale=1.)
protoana::ProtoDUNEBeamlineUtils fBeamlineUtils
void protoana::ProtoDUNEBeamlineFilter::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 132 of file ProtoDUNEBeamlineFilter_module.cc.

132  {
133  fNominalBeamMomentum = pset.get<float>("NominalBeamMomentum"); // GeV/c
134  fIsElectron = pset.get<bool>("IsElectron");
135  fIsMuon = pset.get<bool>("IsMuon");
136  fIsPion = pset.get<bool>("IsPion");
137  fIsKaon = pset.get<bool>("IsKaon");
138  fIsProton = pset.get<bool>("IsProton");
139  fAndParticles = pset.get<bool>("AndParticles");
140 }

Member Data Documentation

bool protoana::ProtoDUNEBeamlineFilter::fAndParticles
private

Definition at line 53 of file ProtoDUNEBeamlineFilter_module.cc.

protoana::ProtoDUNEBeamlineUtils protoana::ProtoDUNEBeamlineFilter::fBeamlineUtils
private

Definition at line 46 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fBIAndTimingMatchAll
private

Definition at line 59 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fBIAndTimingMatchPass
private

Definition at line 60 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fBITriggerAll
private

Definition at line 57 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fBITriggerPass
private

Definition at line 58 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fCKov0All
private

Definition at line 71 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fCKov0Pass
private

Definition at line 72 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fCKov0PressureAll
private

Definition at line 75 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fCKov0PressurePass
private

Definition at line 76 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fCKov1All
private

Definition at line 73 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fCKov1Pass
private

Definition at line 74 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fCKov1PressureAll
private

Definition at line 77 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fCKov1PressurePass
private

Definition at line 78 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fCKovAll
private

Definition at line 79 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fCKovPass
private

Definition at line 80 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fIsBeamTrigger
private

Definition at line 56 of file ProtoDUNEBeamlineFilter_module.cc.

bool protoana::ProtoDUNEBeamlineFilter::fIsElectron
private

Definition at line 48 of file ProtoDUNEBeamlineFilter_module.cc.

bool protoana::ProtoDUNEBeamlineFilter::fIsKaon
private

Definition at line 51 of file ProtoDUNEBeamlineFilter_module.cc.

bool protoana::ProtoDUNEBeamlineFilter::fIsMuon
private

Definition at line 49 of file ProtoDUNEBeamlineFilter_module.cc.

bool protoana::ProtoDUNEBeamlineFilter::fIsPion
private

Definition at line 50 of file ProtoDUNEBeamlineFilter_module.cc.

bool protoana::ProtoDUNEBeamlineFilter::fIsProton
private

Definition at line 52 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fMassAll
private

Definition at line 81 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fMassPass
private

Definition at line 82 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fMomentumAll
private

Definition at line 65 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fMomentumPass
private

Definition at line 66 of file ProtoDUNEBeamlineFilter_module.cc.

float protoana::ProtoDUNEBeamlineFilter::fNominalBeamMomentum
private

Definition at line 47 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fPossiblePartsAll
private

Definition at line 63 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fPossiblePartsCherenkov
private

Definition at line 62 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fPossiblePartsPass
private

Definition at line 64 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fPossiblePartsTOF
private

Definition at line 61 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fTOFAll
private

Definition at line 67 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fTOFChannelAll
private

Definition at line 69 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fTOFChannelPass
private

Definition at line 70 of file ProtoDUNEBeamlineFilter_module.cc.

TH1F* protoana::ProtoDUNEBeamlineFilter::fTOFPass
private

Definition at line 68 of file ProtoDUNEBeamlineFilter_module.cc.


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