Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
showere::ShowerEnergyFilterMC Class Reference
Inheritance diagram for showere::ShowerEnergyFilterMC:
art::EDFilter art::detail::Filter art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
template<typename UserConfig >
using Table = Modifier::Table< UserConfig >
 

Public Member Functions

 ShowerEnergyFilterMC (const fhicl::ParameterSet &pset)
 
 ~ShowerEnergyFilterMC ()
 
bool filter (art::Event &evt)
 
void reconfigure (const fhicl::ParameterSet &pset)
 
void beginJob ()
 
void endJob ()
 
std::string workerType () const
 
void doBeginJob ()
 
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)
 
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< TconsumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< TmayConsumeView (InputTag const &tag)
 

Static Public Attributes

static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (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< TmayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Protected Attributes

std::string fSlicerLabel
 
std::string fTrackLabel
 
bool fSkipNuMu
 
bool fDoEMfracCut
 
bool fDoCurrentCut
 
bool fDoEnergyCut
 
bool fDoBBCcut
 
double fMinEfrac
 
double fMaxEfrac
 
double fMinE
 
double fMaxE
 
int fValCCNC
 
double fMinXFid
 
double fMinYFid
 
double fMinZ
 
double fMaxZ
 
double fMaxXFid
 
double fMaxYFid
 

Private Attributes

TTree * fInteractionTree
 
double InteractionTrueE
 
double InteractionRecoE
 
int InteractionCurrent
 
int InteractionNuPDG
 
int InteractionLepPDG
 
int InteractionNhits
 
int InteractionNCalHits
 
int HitsNfls [1000]
 
double HitsIsEve [1000]
 
double HitsIsEve_e [1000]
 
double HitsIsEve_mu [1000]
 
double HitsIsEve_tau [1000]
 
double HitsIsEM [1000]
 
double HitsEveIsEM [1000]
 
double HitsIsMu [1000]
 
double HitsEveIsMu [1000]
 
double HitsADC [1000]
 
double HitsPECorr [1000]
 
double HitsTrueE [1000]
 
double HitsRecoE [1000]
 

Detailed Description

Definition at line 52 of file ShowerEnergyFilterMC_module.cc.

Member Typedef Documentation

Definition at line 19 of file EDFilter.h.

template<typename UserConfig >
using art::detail::Filter::Table = Modifier::Table<UserConfig>
inherited

Definition at line 29 of file Filter.h.

using art::EDFilter::WorkerType = WorkerT<EDFilter>
inherited

Definition at line 20 of file EDFilter.h.

Constructor & Destructor Documentation

showere::ShowerEnergyFilterMC::ShowerEnergyFilterMC ( const fhicl::ParameterSet pset)
explicit

Definition at line 126 of file ShowerEnergyFilterMC_module.cc.

References reconfigure().

127  : EDFilter(pset)
128  {
129  produces< rb::FilterList<rb::Cluster> >();
130  reconfigure(pset);
131  }
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:22
void reconfigure(const fhicl::ParameterSet &pset)
showere::ShowerEnergyFilterMC::~ShowerEnergyFilterMC ( )

Definition at line 121 of file ShowerEnergyFilterMC_module.cc.

122  {
123  }

Member Function Documentation

void showere::ShowerEnergyFilterMC::beginJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 448 of file ShowerEnergyFilterMC_module.cc.

References fInteractionTree, HitsADC, HitsEveIsEM, HitsEveIsMu, HitsIsEM, HitsIsEve, HitsIsEve_e, HitsIsEve_mu, HitsIsEve_tau, HitsIsMu, HitsNfls, HitsPECorr, HitsRecoE, HitsTrueE, InteractionCurrent, InteractionLepPDG, InteractionNCalHits, InteractionNhits, InteractionNuPDG, InteractionRecoE, and InteractionTrueE.

449  {
451 
452  fInteractionTree = tfs->make<TTree>("InteractionTree","InteractionTree");
453  fInteractionTree->Branch("InteractionNuPDG",&InteractionNuPDG,"InteractionNuPDG/I");
454  fInteractionTree->Branch("InteractionLepPDG",&InteractionLepPDG,"InteractionLepPDG/I");
455  fInteractionTree->Branch("InteractionCurrent",&InteractionCurrent,"InteractionCurrent/I");
456  fInteractionTree->Branch("InteractionNhits",&InteractionNhits,"InteractionNhits/I");
457  fInteractionTree->Branch("InteractionNCalHits",&InteractionNCalHits,"InteractionNCalHits/I");
458  fInteractionTree->Branch("InteractionTrueE",&InteractionTrueE,"InteractionTrueE/D");
459  fInteractionTree->Branch("InteractionRecoE",&InteractionRecoE,"InteractionRecoE/D");
460  // Vector Branches
461  fInteractionTree->Branch("HitsNfls",&HitsNfls,"HitsNfls[InteractionNCalHits]/I");
462  fInteractionTree->Branch("HitsIsEM",&HitsIsEM,"HitsIsEM[InteractionNCalHits]/D");
463  fInteractionTree->Branch("HitsEveIsEM",&HitsEveIsEM,"HitsEveIsEM[InteractionNCalHits]/D");
464  fInteractionTree->Branch("HitsIsMu",&HitsIsMu,"HitsIsMu[InteractionNCalHits]/D");
465  fInteractionTree->Branch("HitsEveIsMu",&HitsEveIsMu,"HitsEveIsMu[InteractionNCalHits]/D");
466  fInteractionTree->Branch("HitsADC",&HitsADC,"HitsADC[InteractionNCalHits]/D");
467  fInteractionTree->Branch("HitsPECorr",&HitsPECorr,"HitsPECorr[InteractionNCalHits]/D");
468  fInteractionTree->Branch("HitsTrueE",&HitsTrueE,"HitsTrueE[InteractionNCalHits]/D");
469  fInteractionTree->Branch("HitsRecoE",&HitsRecoE,"HitsRecoE[InteractionNCalHits]/D");
470  fInteractionTree->Branch("HitsIsEve",&HitsIsEve,"HitsIsEve[InteractionNCalHits]/D");
471  fInteractionTree->Branch("HitsIsEve_e",&HitsIsEve_e,"HitsIsEve_e[InteractionNCalHits]/D");
472  fInteractionTree->Branch("HitsIsEve_mu",&HitsIsEve_mu,"HitsIsEve_mu[InteractionNCalHits]/D");
473  fInteractionTree->Branch("HitsIsEve_tau",&HitsIsEve_tau,"HitsIsEve_tau[InteractionNCalHits]/D");
474 
475  } // end beginJob
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 55 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumes(), T, and getGoodRuns4SAM::tag.

56  {
57  return collector_.consumes<T, BT>(tag);
58  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ProductToken< T > consumes(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ConsumesCollector& art::ModuleBase::consumesCollector ( )
protectedinherited
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 69 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumesMany(), and T.

70  {
71  collector_.consumesMany<T, BT>();
72  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 62 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumesView(), T, and getGoodRuns4SAM::tag.

63  {
64  return collector_.consumesView<T, BT>(tag);
65  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > consumesView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
void art::detail::Filter::doBeginJob ( )
inherited
bool art::detail::Filter::doBeginRun ( RunPrincipal rp,
ModuleContext const &   
)
inherited
bool art::detail::Filter::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
void art::detail::Filter::doEndJob ( )
inherited
bool art::detail::Filter::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Filter::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Filter::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 
)
inherited
void art::detail::Filter::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited
void art::detail::Filter::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited
void art::detail::Filter::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited
void art::detail::Filter::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited
void showere::ShowerEnergyFilterMC::endJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 478 of file ShowerEnergyFilterMC_module.cc.

References DEFINE_ART_MODULE().

479  {
480  // Implementation of optional member function here.
481  } //end endJob
bool showere::ShowerEnergyFilterMC::filter ( art::Event evt)
virtual

Implements art::EDFilter.

Definition at line 159 of file ShowerEnergyFilterMC_module.cc.

References rawdata::RawDigit::ADC(), simb::MCTruth::Add(), rb::Cluster::AllCells(), simb::MCNeutrino::CCNC(), rb::CellHit::Cell(), rb::Cluster::Cell(), om::cout, E, simb::MCParticle::E(), sim::ParticleNavigator::EveId(), art::EventID::event(), fDoBBCcut, fDoCurrentCut, fDoEMfracCut, fDoEnergyCut, fInteractionTree, fMaxE, fMaxEfrac, fMaxXFid, fMaxYFid, fMaxZ, fMinE, fMinXFid, fMinYFid, fMinZ, fSkipNuMu, fSlicerLabel, fValCCNC, geom(), art::Ptr< T >::get(), art::DataViewImpl::getByLabel(), sim::FLSHit::GetEdep(), simb::MCTruth::GetNeutrino(), sim::FLSHit::GetTrackID(), rb::RecoHit::GeV(), make_syst_table_plots::h, HitsADC, HitsEveIsEM, HitsEveIsMu, HitsIsEM, HitsIsEve, HitsIsEve_e, HitsIsEve_mu, HitsIsEve_tau, HitsIsMu, HitsNfls, HitsPECorr, HitsRecoE, HitsTrueE, cheat::BackTracker::HitToFLSHit(), art::Event::id(), makeTrainCVSamples::int, InteractionCurrent, InteractionLepPDG, InteractionNCalHits, InteractionNhits, InteractionNuPDG, InteractionTrueE, rb::RecoHit::IsCalibrated(), rb::IsFiltered(), rb::Cluster::IsNoise(), calib::j, geo::kX, geo::kY, simb::MCNeutrino::Lepton(), rb::Cluster::NCell(), simb::MCTruth::NeutrinoSet(), simb::MCNeutrino::Nu(), cheat::BackTracker::ParticleNavigator(), simb::MCParticle::PdgCode(), rb::RecoHit::PECorr(), rb::CellHit::Plane(), geo::GeometryBase::Plane(), art::DataViewImpl::put(), rb::Cluster::RecoHit(), rh, cheat::BackTracker::SliceToMCTruth(), cheat::BackTracker::TrackIDToParticle(), POTSpillRate::view, rb::CellHit::View(), submit_syst::x, xmax, make_mec_shifts_plots::xmin, submit_syst::y, ymax, ymin, test::z, and make_true_q0q3_plots::zmax.

160  {
161  bool passedfilter = false;
162 
164 
166  const sim::ParticleNavigator& pnav = bt->ParticleNavigator();
167 
168  std::unique_ptr< rb::FilterList<rb::Cluster> > filtcol(new rb::FilterList<rb::Cluster>);
169 
170  // Get event slices
172  evt.getByLabel(fSlicerLabel, sliceHandle);
173  const unsigned int sliceMax = sliceHandle->size();
174 
175  // Loop over slices
176  for(unsigned int sliceIdx = 0; sliceIdx < sliceMax; ++sliceIdx){
177  if(rb::IsFiltered(evt, sliceHandle, sliceIdx)) continue;
178  art::Ptr<rb::Cluster> slice(sliceHandle, sliceIdx);
179 
180  // Skip already filtered
181  if ( slice->IsNoise() ){
182  filtcol->Add(sliceHandle, sliceIdx);
183  continue;
184  }
185 
186  // Get nu info
187  std::vector<cheat::NeutrinoEffPur> SlicePurr = bt->SliceToMCTruth(slice->AllCells(),slice->AllCells());
188  if(SlicePurr.size()==0){
189  filtcol->Add(sliceHandle, sliceIdx);
190  continue;
191  }
192 
193  const art::Ptr<simb::MCTruth> &SliceTruth = SlicePurr[0].neutrinoInt;
194  if(!SliceTruth->NeutrinoSet()){
195  filtcol->Add(sliceHandle, sliceIdx);
196  continue;
197  }
198 
199  // get nu energy
200  const simb::MCNeutrino& nu = SliceTruth->GetNeutrino();
201  double E = nu.Nu().E();
202  int nuPDG = nu.Nu().PdgCode();
203  int lepPDG = nu.Lepton().PdgCode();
204  // int intType = nu.InteractionType();
205  int intCurrent = nu.CCNC();
206 
207  // Skip muons if option is provided
208  if ( fSkipNuMu && nuPDG != 12 && nuPDG != -12 ) return passedfilter;
209 
210  // E should be measurable. Substract outgoing nu energy (or outgoing muon energy)
211  if ( lepPDG == 12 || lepPDG == 14 || lepPDG == 16 || lepPDG == 13 || lepPDG == -13 )
212  E -= nu.Lepton().E();
213 
214  std::vector<int> hitsNfls;
215  std::vector<double> hitsIsEve;
216  std::vector<double> hitsIsEve_e;
217  std::vector<double> hitsIsEve_mu;
218  std::vector<double> hitsIsEve_tau;
219  std::vector<double> hitsIsEM;
220  std::vector<double> hitsEveIsEM;
221  std::vector<double> hitsIsMu;
222  std::vector<double> hitsEveIsMu;
223  std::vector<double> hitsADC;
224  std::vector<double> hitsPECorr;
225  std::vector<double> hitsTrueE;
226  std::vector<double> hitsRecoE;
227 
228  // Further slice selection
229  float xmin[2] = { 9999, 9999};
230  float ymin[2] = { 9999, 9999};
231  float zmin[2] = { 9999, 9999};
232  float xmax[2] = {-9999,-9999};
233  float ymax[2] = {-9999,-9999};
234  float zmax[2] = {-9999,-9999};
235 
236 
237  const int interactionNhits = slice->NCell();
238  //Loop over CellHits
239  for(int view = geo::kX; view <= geo::kY; ++view) {
240  const geo::View_t geoview = geo::View_t(view);
241  for(unsigned int j = 0; j < slice->NCell(geoview); ++j) {
242  const rb::CellHit* ch = slice->Cell(geoview,j).get();
243  art::Ptr< rb::CellHit > chptr = slice->Cell(geoview,j);
244 
245  rb::RecoHit rh = slice->RecoHit (chptr);
246  if ( ! rh.IsCalibrated() ) continue;
247 
248  float hitRecoE = rh.GeV();
249  float hitPECorr = rh.PECorr();
250  double hitADC = ch->ADC();
251 
252  const std::vector< sim::FLSHit > CellFLSs = bt->HitToFLSHit(chptr);
253  int nFLSs = CellFLSs.size();
254 
255  // Calculate total TrueE for this CellHit
256  // Calculate total TrueE for this CellHit
257  float hitTrueE = 0;
258  if ( nFLSs == 0 ) continue;
259  if ( nFLSs == 1 ) hitTrueE = CellFLSs[0].GetEdep();
260  if ( nFLSs > 1 ){
261  for ( int FlsIdx = 0; FlsIdx < nFLSs; ++FlsIdx)
262  hitTrueE += CellFLSs[FlsIdx].GetEdep();
263  }// fls
264 
265  // Now calculate %E from diferent components on this CellHit
266  double hitIsEve = 0; // fraction coming from Eve particles
267  double hitIsEve_e = 0; // fraction coming from Eve electron
268  double hitIsEve_mu = 0; // fraction coming from Eve muon
269  double hitIsEve_tau = 0; // fraction coming from Eve tau
270  double hitIsEM = 0; // fraction from EM 0 (Had) to 1 (EM)
271  double hitEveIsEM = 0; // fraction from EM shower
272  double hitIsMu = 0; // fraction from muon 0 (other) to 1 (Muon)
273  double hitEveIsMu = 0; // fraction from primary muon
274 
275  for ( int flsIdx = 0; flsIdx < nFLSs; ++flsIdx){
276  sim::FLSHit fls = CellFLSs[flsIdx];
277  int trkID = fls.GetTrackID();
278  const sim::Particle * fls_p = bt->TrackIDToParticle(trkID);
279  int EveID = pnav.EveId(trkID);
280  const sim::Particle * Eve_p = bt->TrackIDToParticle(EveID);
281 
282  double thisIsEve;
283  double thisIsEve_e;
284  double thisIsEve_mu;
285  double thisIsEve_tau;
286  double thisIsEM, thisEveIsEM;
287  double thisIsMu, thisEveIsMu;
288 
289  // Determine the source of this cell hit for the categories we care about
290  if ( trkID == EveID ) thisIsEve = 1;
291  else thisIsEve = 0;
292  if ( trkID == EveID && (Eve_p->PdgCode() == 11 || Eve_p->PdgCode() == -11) ) thisIsEve_e = 1;
293  else thisIsEve_e = 0;
294  if ( trkID == EveID && (Eve_p->PdgCode() == 13 || Eve_p->PdgCode() == -13) ) thisIsEve_mu = 1;
295  else thisIsEve_mu = 0;
296  if ( trkID == EveID && (Eve_p->PdgCode() == 15 || Eve_p->PdgCode() == -15) ) thisIsEve_tau = 1;
297  else thisIsEve_tau = 0;
298 
299  if ( Eve_p->PdgCode() == 11 || Eve_p->PdgCode() == -11 ||
300  Eve_p->PdgCode() == 22 || Eve_p->PdgCode() == 111 ) thisEveIsEM = 1;
301  else thisEveIsEM = 0;
302  if ( fls_p->PdgCode() == 11 || fls_p->PdgCode() == -11 ||
303  fls_p->PdgCode() == 22 || fls_p->PdgCode() == 111 ) thisIsEM = 1;
304  else thisIsEM = 0;
305 
306  if ( Eve_p->PdgCode() == 13 || Eve_p->PdgCode() == -13 ) thisEveIsMu = 1;
307  else thisEveIsMu = 0;
308  if ( fls_p->PdgCode() == 13 || fls_p->PdgCode() == -13 ) thisIsMu = 1;
309  else thisIsMu = 0;
310 
311 
312  float thisflsE = fls.GetEdep();
313  // Add % of FLSHits Edep in CellHit coming from each source
314  hitIsEve += (thisflsE/hitTrueE)*thisIsEve;
315  hitIsEve_e += (thisflsE/hitTrueE)*thisIsEve_e;
316  hitIsEve_mu += (thisflsE/hitTrueE)*thisIsEve_mu;
317  hitIsEve_tau += (thisflsE/hitTrueE)*thisIsEve_tau;
318  hitIsEM += (thisflsE/hitTrueE)*thisIsEM;
319  hitEveIsEM += (thisflsE/hitTrueE)*thisEveIsEM;
320  hitIsMu += (thisflsE/hitTrueE)*thisIsMu;
321  hitEveIsMu += (thisflsE/hitTrueE)*thisEveIsMu;
322 
323  }// fls
324 
325  hitsADC.push_back(hitADC);
326  hitsPECorr.push_back((double)hitPECorr);
327  hitsNfls.push_back(nFLSs);
328  hitsTrueE.push_back(hitTrueE);
329  hitsRecoE.push_back((double)hitRecoE);
330  hitsIsEve.push_back(hitIsEve);
331  hitsIsEve_e.push_back(hitIsEve_e);
332  hitsIsEve_mu.push_back(hitIsEve_mu);
333  hitsIsEve_tau.push_back(hitIsEve_tau);
334  hitsIsEM.push_back(hitIsEM);
335  hitsEveIsEM.push_back(hitEveIsEM);
336  hitsIsMu.push_back(hitIsMu);
337  hitsEveIsMu.push_back(hitEveIsMu);
338 
339  // Get Hit position
340  double xyz[3];
341  geom->Plane(ch->Plane())->Cell(ch->Cell())->GetCenter(xyz);
342  const double x = xyz[0];
343  const double y = xyz[1];
344  const double z = xyz[2];
345 
346  if ( ch->View()==geo::kX ){
347  if ( x < xmin[0] ) { xmin[1] = xmin[0]; xmin[0] = x;}
348  else if ( x < xmin[1] ) xmin[1] = x;
349  if ( z < zmin[0] ) { zmin[1] = zmin[0]; zmin[0] = z;}
350  else if ( z < zmin[1] ) zmin[1] = z;
351  if ( x > xmax[0] ) { xmax[1] = xmax[0]; xmax[0] = x;}
352  else if ( x > xmax[1] ) xmax[1] = x;
353  if ( z > zmax[0] ) { zmax[1] = zmax[0]; zmax[0] = z;}
354  else if ( z > zmax[1] ) zmax[1] = zmax[0];
355  }
356  if ( ch->View()==geo::kY ){
357  if ( y < ymin[0] ) { ymin[1] = ymin[0]; ymin[0] = y;}
358  else if ( y < ymin[1] ) ymin[1] = y;
359  if ( z < zmin[0] ) { zmin[1] = zmin[0]; zmin[0] = z;}
360  else if ( z < zmin[1] ) zmin[1] = z;
361  if ( y > ymax[0] ) { ymax[1] = ymax[0]; ymax[0] = y;}
362  else if ( y > ymax[1] ) ymax[1] = y;
363  if ( z > zmax[0] ) { zmax[1] = zmax[0]; zmax[0] = z;}
364  else if ( z > zmax[1] ) zmax[1] = zmax[0];
365  }
366 
367  }// cellhit
368  }//views
369  InteractionNCalHits = hitsADC.size();
370 
371  // ------------- Get Interaction info -------------
372  InteractionNhits = (int)interactionNhits;
374  InteractionCurrent = intCurrent;
375  InteractionNuPDG = nuPDG;
376  InteractionLepPDG = lepPDG;
377 
378  double TotalRecoE =0;
379  double TotalRecoE_EM =0;
380 
381  for(int h = 0; h < InteractionNCalHits; ++h){
382  HitsNfls[h] = hitsNfls[h];
383  HitsIsEve[h] = hitsIsEve[h];
384  HitsIsEve_e[h] = hitsIsEve_e[h];
385  HitsIsEve_mu[h] = hitsIsEve_mu[h];
386  HitsIsEve_tau[h] = hitsIsEve_tau[h];
387  HitsIsEM[h] = hitsIsEM[h];
388  HitsEveIsEM[h] = hitsEveIsEM[h];
389  HitsIsMu[h] = hitsIsMu[h];
390  HitsEveIsMu[h] = hitsEveIsMu[h];
391  HitsADC[h] = hitsADC[h];
392  HitsPECorr[h] = hitsPECorr[h];
393  HitsTrueE[h] = hitsTrueE[h];
394  HitsRecoE[h] = hitsRecoE[h];
395 
396  double EveMuness = HitsIsEve_mu[h];
397  // double Muness = HitsIsMu[h];
398  double EMness = HitsIsEM[h];
399  // double HADness = 1.0 - (EMness + EveMuness);
400 
401  TotalRecoE += (1.0 -EveMuness)*(HitsRecoE[h]);
402  TotalRecoE_EM += EMness *(HitsRecoE[h]);
403  }
404  double InteractionHitRecoE = TotalRecoE;
405  // Ratio of EM fraction/Total hits Reco E
406  double R_emRE_HitsRE = TotalRecoE_EM/InteractionHitRecoE;
407 
408 
409  // -------------------- Do All Cuts -----------------------
410 
411  bool selected = true;
412 
413  if ( fDoEMfracCut ){
414  if ( R_emRE_HitsRE < fMinEfrac || R_emRE_HitsRE > fMaxEfrac ) selected = false;
415  }
416  if ( fDoCurrentCut ){
417  if ( InteractionCurrent != fValCCNC ) selected = false;
418  }
419  if ( fDoEnergyCut ){
420  if ( InteractionTrueE > fMaxE || InteractionTrueE < fMinE ) selected = false;
421  }
422  if ( fDoBBCcut ){
423  // Allow 0 hits outside containment
424  if (xmin[0] < fMinXFid || ymin[0] < fMinYFid || zmin[0] < fMinZ ||
425  xmax[0] > fMaxXFid || ymax[0] > fMaxYFid || zmax[0] > fMaxZ )
426  selected = false;
427  }
428 
429  // ------------------ Filter if not selected --------------
430  if(selected == true){
431  std::cout << "Event: " << evt.id().event() << ", slice: "<<sliceIdx<<"\n";
432  fInteractionTree->Fill();
433  passedfilter = selected;
434  }
435 
436  if(selected == false){
437  filtcol->Add(sliceHandle, sliceIdx);
438  }
439 
440  }//slices
441 
442  evt.put(std::move(filtcol));
443 
444  return passedfilter;
445  } // end filter
double E(const int i=0) const
Definition: MCParticle.h:232
A simple list of products that have been marked "filtered out".
Definition: FilterList.h:74
int PdgCode() const
Definition: MCParticle.h:211
int CCNC() const
Definition: MCNeutrino.h:148
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:77
std::map< std::string, double > xmax
TH2 * rh
Definition: drawXsec.C:5
const sim::ParticleNavigator & ParticleNavigator() const
Get a reference to the ParticleNavigator.
Definition: BackTracker.h:748
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
unsigned short Plane() const
Definition: CellHit.h:39
geo::View_t View() const
Definition: CellHit.h:41
const simb::MCParticle & Nu() const
Definition: MCNeutrino.h:146
Vertical planes which measure X.
Definition: PlaneGeo.h:28
A single unit of energy deposition in the liquid scintillator.
Definition: FLSHit.h:19
const PlaneGeo * Plane(unsigned int i) const
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
Calibrated quantities relying on position in the orthogonal view. To generate a rb::CellHit from a rb...
Definition: RecoHit.h:19
Double_t ymax
Definition: plot.C:25
unsigned short Cell() const
Definition: CellHit.h:40
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
const simb::MCParticle & Lepton() const
Definition: MCNeutrino.h:147
Float_t E
Definition: plot.C:20
std::vector< sim::FLSHit > HitToFLSHit(const rb::CellHit &hit) const
All the FLSHits that contributed to this hit, sorted from most to least light.
bool IsCalibrated() const
You MUST check here before accessing PECorr, MIP or GeV.
Definition: RecoHit.cxx:35
bool IsFiltered(const art::Event &evt, art::Ptr< T > x, const std::vector< std::string > &labels)
Is this Ptr marked "filtered out"?
Definition: FilterList.h:96
const double j
Definition: BetheBloch.cxx:29
z
Definition: test.py:28
const sim::Particle * TrackIDToParticle(int const &id) const
Returns a pointer to the sim::Particle object corresponding to the given TrackID. ...
OStream cout
Definition: OStream.cxx:6
EventNumber_t event() const
Definition: EventID.h:116
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
void Add(simb::MCParticle const &part)
Definition: MCTruth.h:80
float GeV() const
Definition: RecoHit.cxx:69
int GetTrackID() const
Track ID.
Definition: FLSHit.h:45
int16_t ADC(uint32_t i) const
Definition: RawDigit.cxx:58
void geom(int which=0)
Definition: geom.C:163
Double_t ymin
Definition: plot.C:24
bool NeutrinoSet() const
Definition: MCTruth.h:78
float GetEdep() const
Get total Energy deposited into the cell for the whole FLSHit.
Definition: FLSHit.h:31
float PECorr() const
Definition: RecoHit.cxx:47
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:730
Event generator information.
Definition: MCNeutrino.h:18
std::vector< NeutrinoEffPur > SliceToMCTruth(const std::vector< const rb::CellHit * > &sliceHits, const std::vector< const rb::CellHit * > &allHits, bool sortPur=false) const
Given a collection of hits (often a slice), returns vector of structures of MCTruth, efficiency, and purity of that neutrino interaction relative to the slice. Efficiency is defined as FLS energy from neutrino interaction in slice / total FLS energy from neutrino interaction in event. This vector is sorted from the highest efficiency interaction to lowest. This function returns all MCTruth, including those without neutrino interactions, i.e. cosmics.
EventID id() const
int EveId(const int trackID) const
std::array<std::vector<ProductInfo>, NumBranchTypes> const& art::ModuleBase::getConsumables ( ) const
inherited
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 76 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsume(), T, and getGoodRuns4SAM::tag.

77  {
78  return collector_.mayConsume<T, BT>(tag);
79  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 90 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsumeMany(), and T.

91  {
93  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 83 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsumeView(), T, and getGoodRuns4SAM::tag.

84  {
85  return collector_.mayConsumeView<T, BT>(tag);
86  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > mayConsumeView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ModuleDescription const& art::ModuleBase::moduleDescription ( ) const
inherited
void showere::ShowerEnergyFilterMC::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 134 of file ShowerEnergyFilterMC_module.cc.

References fDoBBCcut, fDoCurrentCut, fDoEMfracCut, fDoEnergyCut, fMaxE, fMaxEfrac, fMaxXFid, fMaxYFid, fMaxZ, fMinE, fMinEfrac, fMinXFid, fMinYFid, fMinZ, fSkipNuMu, fSlicerLabel, fTrackLabel, fValCCNC, fhicl::ParameterSet::get(), and string.

Referenced by ShowerEnergyFilterMC().

135  {
136  fSlicerLabel = pset.get<std::string >("SlicerLabel");
137  fTrackLabel = pset.get<std::string >("TrackLabel");
138  fSkipNuMu = pset.get<bool >("SkipNuMu");
139  fDoEMfracCut = pset.get<bool >("DoEMfracCut");
140  fDoCurrentCut = pset.get<bool >("DoCurrentCut");
141  fDoEnergyCut = pset.get<bool >("DoEnergyCut");
142  fDoBBCcut = pset.get<bool >("DoBBCcut");
143 
144  // Further selection
145  fMinEfrac = pset.get<double >("MinEfrac");
146  fMaxEfrac = pset.get<double >("MaxEfrac");
147  fMinE = pset.get<double >("MinE");
148  fMaxE = pset.get<double >("MaxE");
149  fValCCNC = pset.get<int >("ValCCNC");
150  fMinXFid = pset.get< float >("MinXFid");
151  fMaxXFid = pset.get< float >("MaxXFid");
152  fMinYFid = pset.get< float >("MinYFid");
153  fMaxYFid = pset.get< float >("MaxYFid");
154  fMinZ = pset.get< float >("MinZ");
155  fMaxZ = pset.get< float >("MaxZ");
156  }
T get(std::string const &key) const
Definition: ParameterSet.h:231
enum BeamMode string
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  )
inherited
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited
std::string art::EDFilter::workerType ( ) const
inherited

Referenced by art::EDFilter::EDFilter().

Member Data Documentation

constexpr bool art::detail::Filter::Fail {false}
staticinherited

Definition at line 26 of file Filter.h.

Referenced by evgen::GENIEFilter::filter().

bool showere::ShowerEnergyFilterMC::fDoBBCcut
protected

Definition at line 76 of file ShowerEnergyFilterMC_module.cc.

Referenced by filter(), and reconfigure().

bool showere::ShowerEnergyFilterMC::fDoCurrentCut
protected

Definition at line 74 of file ShowerEnergyFilterMC_module.cc.

Referenced by filter(), and reconfigure().

bool showere::ShowerEnergyFilterMC::fDoEMfracCut
protected

Definition at line 73 of file ShowerEnergyFilterMC_module.cc.

Referenced by filter(), and reconfigure().

bool showere::ShowerEnergyFilterMC::fDoEnergyCut
protected

Definition at line 75 of file ShowerEnergyFilterMC_module.cc.

Referenced by filter(), and reconfigure().

TTree* showere::ShowerEnergyFilterMC::fInteractionTree
private

Definition at line 92 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

double showere::ShowerEnergyFilterMC::fMaxE
protected

Definition at line 81 of file ShowerEnergyFilterMC_module.cc.

Referenced by filter(), and reconfigure().

double showere::ShowerEnergyFilterMC::fMaxEfrac
protected

Definition at line 79 of file ShowerEnergyFilterMC_module.cc.

Referenced by filter(), and reconfigure().

double showere::ShowerEnergyFilterMC::fMaxXFid
protected

Definition at line 87 of file ShowerEnergyFilterMC_module.cc.

Referenced by filter(), and reconfigure().

double showere::ShowerEnergyFilterMC::fMaxYFid
protected

Definition at line 88 of file ShowerEnergyFilterMC_module.cc.

Referenced by filter(), and reconfigure().

double showere::ShowerEnergyFilterMC::fMaxZ
protected

Definition at line 86 of file ShowerEnergyFilterMC_module.cc.

Referenced by filter(), and reconfigure().

double showere::ShowerEnergyFilterMC::fMinE
protected

Definition at line 80 of file ShowerEnergyFilterMC_module.cc.

Referenced by filter(), and reconfigure().

double showere::ShowerEnergyFilterMC::fMinEfrac
protected

Definition at line 78 of file ShowerEnergyFilterMC_module.cc.

Referenced by reconfigure().

double showere::ShowerEnergyFilterMC::fMinXFid
protected

Definition at line 83 of file ShowerEnergyFilterMC_module.cc.

Referenced by filter(), and reconfigure().

double showere::ShowerEnergyFilterMC::fMinYFid
protected

Definition at line 84 of file ShowerEnergyFilterMC_module.cc.

Referenced by filter(), and reconfigure().

double showere::ShowerEnergyFilterMC::fMinZ
protected

Definition at line 85 of file ShowerEnergyFilterMC_module.cc.

Referenced by filter(), and reconfigure().

bool showere::ShowerEnergyFilterMC::fSkipNuMu
protected

Definition at line 72 of file ShowerEnergyFilterMC_module.cc.

Referenced by filter(), and reconfigure().

std::string showere::ShowerEnergyFilterMC::fSlicerLabel
protected

Definition at line 70 of file ShowerEnergyFilterMC_module.cc.

Referenced by filter(), and reconfigure().

std::string showere::ShowerEnergyFilterMC::fTrackLabel
protected

Definition at line 71 of file ShowerEnergyFilterMC_module.cc.

Referenced by reconfigure().

int showere::ShowerEnergyFilterMC::fValCCNC
protected

Definition at line 82 of file ShowerEnergyFilterMC_module.cc.

Referenced by filter(), and reconfigure().

double showere::ShowerEnergyFilterMC::HitsADC[1000]
private

Definition at line 114 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

double showere::ShowerEnergyFilterMC::HitsEveIsEM[1000]
private

Definition at line 109 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

double showere::ShowerEnergyFilterMC::HitsEveIsMu[1000]
private

Definition at line 112 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

double showere::ShowerEnergyFilterMC::HitsIsEM[1000]
private

Definition at line 108 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

double showere::ShowerEnergyFilterMC::HitsIsEve[1000]
private

Definition at line 104 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

double showere::ShowerEnergyFilterMC::HitsIsEve_e[1000]
private

Definition at line 105 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

double showere::ShowerEnergyFilterMC::HitsIsEve_mu[1000]
private

Definition at line 106 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

double showere::ShowerEnergyFilterMC::HitsIsEve_tau[1000]
private

Definition at line 107 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

double showere::ShowerEnergyFilterMC::HitsIsMu[1000]
private

Definition at line 111 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

int showere::ShowerEnergyFilterMC::HitsNfls[1000]
private

Definition at line 103 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

double showere::ShowerEnergyFilterMC::HitsPECorr[1000]
private

Definition at line 115 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

double showere::ShowerEnergyFilterMC::HitsRecoE[1000]
private

Definition at line 117 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

double showere::ShowerEnergyFilterMC::HitsTrueE[1000]
private

Definition at line 116 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

int showere::ShowerEnergyFilterMC::InteractionCurrent
private

Definition at line 95 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

int showere::ShowerEnergyFilterMC::InteractionLepPDG
private

Definition at line 97 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

int showere::ShowerEnergyFilterMC::InteractionNCalHits
private

Definition at line 99 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

int showere::ShowerEnergyFilterMC::InteractionNhits
private

Definition at line 98 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

int showere::ShowerEnergyFilterMC::InteractionNuPDG
private

Definition at line 96 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

double showere::ShowerEnergyFilterMC::InteractionRecoE
private

Definition at line 94 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob().

double showere::ShowerEnergyFilterMC::InteractionTrueE
private

Definition at line 93 of file ShowerEnergyFilterMC_module.cc.

Referenced by beginJob(), and filter().

constexpr bool art::detail::Filter::Pass {true}
staticinherited

Definition at line 25 of file Filter.h.

Referenced by evgen::GENIEFilter::filter().


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