Public Types | Public Member Functions | Static 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::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
template<typename UserConfig >
using Table = ProducerBase::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 ()
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Static Public Attributes

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

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

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

using art::EDFilter::ModuleType = EDFilter
inherited

Definition at line 37 of file EDFilter.h.

template<typename UserConfig >
using art::EDFilter::Table = ProducerBase::Table<UserConfig>
inherited

Definition at line 46 of file EDFilter.h.

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

Definition at line 38 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  {
128  produces< rb::FilterList<rb::Cluster> >();
129  reconfigure(pset);
130  }
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 447 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, InteractionTrueE, and art::TFileDirectory::make().

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

Definition at line 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

147 {
148  if (!moduleContext_)
149  return ProductToken<T>::invalid();
150 
151  consumables_[BT].emplace_back(ConsumableType::Product,
152  TypeID{typeid(T)},
153  it.label(),
154  it.instance(),
155  it.process());
156  return ProductToken<T>{it};
157 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
CurrentProcessingContext const* art::EDFilter::currentContext ( ) const
protectedinherited
void showere::ShowerEnergyFilterMC::endJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 477 of file ShowerEnergyFilterMC_module.cc.

References DEFINE_ART_MODULE().

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

Implements art::EDFilter.

Definition at line 158 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::Event::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.

159  {
160  bool passedfilter = false;
161 
163 
165  const sim::ParticleNavigator& pnav = bt->ParticleNavigator();
166 
167  std::unique_ptr< rb::FilterList<rb::Cluster> > filtcol(new rb::FilterList<rb::Cluster>);
168 
169  // Get event slices
171  evt.getByLabel(fSlicerLabel, sliceHandle);
172  const unsigned int sliceMax = sliceHandle->size();
173 
174  // Loop over slices
175  for(unsigned int sliceIdx = 0; sliceIdx < sliceMax; ++sliceIdx){
176  if(rb::IsFiltered(evt, sliceHandle, sliceIdx)) continue;
177  art::Ptr<rb::Cluster> slice(sliceHandle, sliceIdx);
178 
179  // Skip already filtered
180  if ( slice->IsNoise() ){
181  filtcol->Add(sliceHandle, sliceIdx);
182  continue;
183  }
184 
185  // Get nu info
186  std::vector<cheat::NeutrinoEffPur> SlicePurr = bt->SliceToMCTruth(slice->AllCells(),slice->AllCells());
187  if(SlicePurr.size()==0){
188  filtcol->Add(sliceHandle, sliceIdx);
189  continue;
190  }
191 
192  const art::Ptr<simb::MCTruth> &SliceTruth = SlicePurr[0].neutrinoInt;
193  if(!SliceTruth->NeutrinoSet()){
194  filtcol->Add(sliceHandle, sliceIdx);
195  continue;
196  }
197 
198  // get nu energy
199  const simb::MCNeutrino& nu = SliceTruth->GetNeutrino();
200  double E = nu.Nu().E();
201  int nuPDG = nu.Nu().PdgCode();
202  int lepPDG = nu.Lepton().PdgCode();
203  // int intType = nu.InteractionType();
204  int intCurrent = nu.CCNC();
205 
206  // Skip muons if option is provided
207  if ( fSkipNuMu && nuPDG != 12 && nuPDG != -12 ) return passedfilter;
208 
209  // E should be measurable. Substract outgoing nu energy (or outgoing muon energy)
210  if ( lepPDG == 12 || lepPDG == 14 || lepPDG == 16 || lepPDG == 13 || lepPDG == -13 )
211  E -= nu.Lepton().E();
212 
213  std::vector<int> hitsNfls;
214  std::vector<double> hitsIsEve;
215  std::vector<double> hitsIsEve_e;
216  std::vector<double> hitsIsEve_mu;
217  std::vector<double> hitsIsEve_tau;
218  std::vector<double> hitsIsEM;
219  std::vector<double> hitsEveIsEM;
220  std::vector<double> hitsIsMu;
221  std::vector<double> hitsEveIsMu;
222  std::vector<double> hitsADC;
223  std::vector<double> hitsPECorr;
224  std::vector<double> hitsTrueE;
225  std::vector<double> hitsRecoE;
226 
227  // Further slice selection
228  float xmin[2] = { 9999, 9999};
229  float ymin[2] = { 9999, 9999};
230  float zmin[2] = { 9999, 9999};
231  float xmax[2] = {-9999,-9999};
232  float ymax[2] = {-9999,-9999};
233  float zmax[2] = {-9999,-9999};
234 
235 
236  const int interactionNhits = slice->NCell();
237  //Loop over CellHits
238  for(int view = geo::kX; view <= geo::kY; ++view) {
239  const geo::View_t geoview = geo::View_t(view);
240  for(unsigned int j = 0; j < slice->NCell(geoview); ++j) {
241  const rb::CellHit* ch = slice->Cell(geoview,j).get();
242  art::Ptr< rb::CellHit > chptr = slice->Cell(geoview,j);
243 
244  rb::RecoHit rh = slice->RecoHit (chptr);
245  if ( ! rh.IsCalibrated() ) continue;
246 
247  float hitRecoE = rh.GeV();
248  float hitPECorr = rh.PECorr();
249  double hitADC = ch->ADC();
250 
251  const std::vector< sim::FLSHit > CellFLSs = bt->HitToFLSHit(chptr);
252  int nFLSs = CellFLSs.size();
253 
254  // Calculate total TrueE for this CellHit
255  // Calculate total TrueE for this CellHit
256  float hitTrueE = 0;
257  if ( nFLSs == 0 ) continue;
258  if ( nFLSs == 1 ) hitTrueE = CellFLSs[0].GetEdep();
259  if ( nFLSs > 1 ){
260  for ( int FlsIdx = 0; FlsIdx < nFLSs; ++FlsIdx)
261  hitTrueE += CellFLSs[FlsIdx].GetEdep();
262  }// fls
263 
264  // Now calculate %E from diferent components on this CellHit
265  double hitIsEve = 0; // fraction coming from Eve particles
266  double hitIsEve_e = 0; // fraction coming from Eve electron
267  double hitIsEve_mu = 0; // fraction coming from Eve muon
268  double hitIsEve_tau = 0; // fraction coming from Eve tau
269  double hitIsEM = 0; // fraction from EM 0 (Had) to 1 (EM)
270  double hitEveIsEM = 0; // fraction from EM shower
271  double hitIsMu = 0; // fraction from muon 0 (other) to 1 (Muon)
272  double hitEveIsMu = 0; // fraction from primary muon
273 
274  for ( int flsIdx = 0; flsIdx < nFLSs; ++flsIdx){
275  sim::FLSHit fls = CellFLSs[flsIdx];
276  int trkID = fls.GetTrackID();
277  const sim::Particle * fls_p = bt->TrackIDToParticle(trkID);
278  int EveID = pnav.EveId(trkID);
279  const sim::Particle * Eve_p = bt->TrackIDToParticle(EveID);
280 
281  double thisIsEve;
282  double thisIsEve_e;
283  double thisIsEve_mu;
284  double thisIsEve_tau;
285  double thisIsEM, thisEveIsEM;
286  double thisIsMu, thisEveIsMu;
287 
288  // Determine the source of this cell hit for the categories we care about
289  if ( trkID == EveID ) thisIsEve = 1;
290  else thisIsEve = 0;
291  if ( trkID == EveID && (Eve_p->PdgCode() == 11 || Eve_p->PdgCode() == -11) ) thisIsEve_e = 1;
292  else thisIsEve_e = 0;
293  if ( trkID == EveID && (Eve_p->PdgCode() == 13 || Eve_p->PdgCode() == -13) ) thisIsEve_mu = 1;
294  else thisIsEve_mu = 0;
295  if ( trkID == EveID && (Eve_p->PdgCode() == 15 || Eve_p->PdgCode() == -15) ) thisIsEve_tau = 1;
296  else thisIsEve_tau = 0;
297 
298  if ( Eve_p->PdgCode() == 11 || Eve_p->PdgCode() == -11 ||
299  Eve_p->PdgCode() == 22 || Eve_p->PdgCode() == 111 ) thisEveIsEM = 1;
300  else thisEveIsEM = 0;
301  if ( fls_p->PdgCode() == 11 || fls_p->PdgCode() == -11 ||
302  fls_p->PdgCode() == 22 || fls_p->PdgCode() == 111 ) thisIsEM = 1;
303  else thisIsEM = 0;
304 
305  if ( Eve_p->PdgCode() == 13 || Eve_p->PdgCode() == -13 ) thisEveIsMu = 1;
306  else thisEveIsMu = 0;
307  if ( fls_p->PdgCode() == 13 || fls_p->PdgCode() == -13 ) thisIsMu = 1;
308  else thisIsMu = 0;
309 
310 
311  float thisflsE = fls.GetEdep();
312  // Add % of FLSHits Edep in CellHit coming from each source
313  hitIsEve += (thisflsE/hitTrueE)*thisIsEve;
314  hitIsEve_e += (thisflsE/hitTrueE)*thisIsEve_e;
315  hitIsEve_mu += (thisflsE/hitTrueE)*thisIsEve_mu;
316  hitIsEve_tau += (thisflsE/hitTrueE)*thisIsEve_tau;
317  hitIsEM += (thisflsE/hitTrueE)*thisIsEM;
318  hitEveIsEM += (thisflsE/hitTrueE)*thisEveIsEM;
319  hitIsMu += (thisflsE/hitTrueE)*thisIsMu;
320  hitEveIsMu += (thisflsE/hitTrueE)*thisEveIsMu;
321 
322  }// fls
323 
324  hitsADC.push_back(hitADC);
325  hitsPECorr.push_back((double)hitPECorr);
326  hitsNfls.push_back(nFLSs);
327  hitsTrueE.push_back(hitTrueE);
328  hitsRecoE.push_back((double)hitRecoE);
329  hitsIsEve.push_back(hitIsEve);
330  hitsIsEve_e.push_back(hitIsEve_e);
331  hitsIsEve_mu.push_back(hitIsEve_mu);
332  hitsIsEve_tau.push_back(hitIsEve_tau);
333  hitsIsEM.push_back(hitIsEM);
334  hitsEveIsEM.push_back(hitEveIsEM);
335  hitsIsMu.push_back(hitIsMu);
336  hitsEveIsMu.push_back(hitEveIsMu);
337 
338  // Get Hit position
339  double xyz[3];
340  geom->Plane(ch->Plane())->Cell(ch->Cell())->GetCenter(xyz);
341  const double x = xyz[0];
342  const double y = xyz[1];
343  const double z = xyz[2];
344 
345  if ( ch->View()==geo::kX ){
346  if ( x < xmin[0] ) { xmin[1] = xmin[0]; xmin[0] = x;}
347  else if ( x < xmin[1] ) xmin[1] = x;
348  if ( z < zmin[0] ) { zmin[1] = zmin[0]; zmin[0] = z;}
349  else if ( z < zmin[1] ) zmin[1] = z;
350  if ( x > xmax[0] ) { xmax[1] = xmax[0]; xmax[0] = x;}
351  else if ( x > xmax[1] ) xmax[1] = x;
352  if ( z > zmax[0] ) { zmax[1] = zmax[0]; zmax[0] = z;}
353  else if ( z > zmax[1] ) zmax[1] = zmax[0];
354  }
355  if ( ch->View()==geo::kY ){
356  if ( y < ymin[0] ) { ymin[1] = ymin[0]; ymin[0] = y;}
357  else if ( y < ymin[1] ) ymin[1] = y;
358  if ( z < zmin[0] ) { zmin[1] = zmin[0]; zmin[0] = z;}
359  else if ( z < zmin[1] ) zmin[1] = z;
360  if ( y > ymax[0] ) { ymax[1] = ymax[0]; ymax[0] = y;}
361  else if ( y > ymax[1] ) ymax[1] = y;
362  if ( z > zmax[0] ) { zmax[1] = zmax[0]; zmax[0] = z;}
363  else if ( z > zmax[1] ) zmax[1] = zmax[0];
364  }
365 
366  }// cellhit
367  }//views
368  InteractionNCalHits = hitsADC.size();
369 
370  // ------------- Get Interaction info -------------
371  InteractionNhits = (int)interactionNhits;
373  InteractionCurrent = intCurrent;
374  InteractionNuPDG = nuPDG;
375  InteractionLepPDG = lepPDG;
376 
377  double TotalRecoE =0;
378  double TotalRecoE_EM =0;
379 
380  for(int h = 0; h < InteractionNCalHits; ++h){
381  HitsNfls[h] = hitsNfls[h];
382  HitsIsEve[h] = hitsIsEve[h];
383  HitsIsEve_e[h] = hitsIsEve_e[h];
384  HitsIsEve_mu[h] = hitsIsEve_mu[h];
385  HitsIsEve_tau[h] = hitsIsEve_tau[h];
386  HitsIsEM[h] = hitsIsEM[h];
387  HitsEveIsEM[h] = hitsEveIsEM[h];
388  HitsIsMu[h] = hitsIsMu[h];
389  HitsEveIsMu[h] = hitsEveIsMu[h];
390  HitsADC[h] = hitsADC[h];
391  HitsPECorr[h] = hitsPECorr[h];
392  HitsTrueE[h] = hitsTrueE[h];
393  HitsRecoE[h] = hitsRecoE[h];
394 
395  double EveMuness = HitsIsEve_mu[h];
396  // double Muness = HitsIsMu[h];
397  double EMness = HitsIsEM[h];
398  // double HADness = 1.0 - (EMness + EveMuness);
399 
400  TotalRecoE += (1.0 -EveMuness)*(HitsRecoE[h]);
401  TotalRecoE_EM += EMness *(HitsRecoE[h]);
402  }
403  double InteractionHitRecoE = TotalRecoE;
404  // Ratio of EM fraction/Total hits Reco E
405  double R_emRE_HitsRE = TotalRecoE_EM/InteractionHitRecoE;
406 
407 
408  // -------------------- Do All Cuts -----------------------
409 
410  bool selected = true;
411 
412  if ( fDoEMfracCut ){
413  if ( R_emRE_HitsRE < fMinEfrac || R_emRE_HitsRE > fMaxEfrac ) selected = false;
414  }
415  if ( fDoCurrentCut ){
416  if ( InteractionCurrent != fValCCNC ) selected = false;
417  }
418  if ( fDoEnergyCut ){
419  if ( InteractionTrueE > fMaxE || InteractionTrueE < fMinE ) selected = false;
420  }
421  if ( fDoBBCcut ){
422  // Allow 0 hits outside containment
423  if (xmin[0] < fMinXFid || ymin[0] < fMinYFid || zmin[0] < fMinZ ||
424  xmax[0] > fMaxXFid || ymax[0] > fMaxYFid || zmax[0] > fMaxZ )
425  selected = false;
426  }
427 
428  // ------------------ Filter if not selected --------------
429  if(selected == true){
430  std::cout << "Event: " << evt.id().event() << ", slice: "<<sliceIdx<<"\n";
431  fInteractionTree->Fill();
432  passedfilter = selected;
433  }
434 
435  if(selected == false){
436  filtcol->Add(sliceHandle, sliceIdx);
437  }
438 
439  }//slices
440 
441  evt.put(std::move(filtcol));
442 
443  return passedfilter;
444  } // 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:76
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:744
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
void Add(simb::MCParticle &part)
Definition: MCTruth.h:79
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
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
unsigned short Cell() const
Definition: CellHit.h:40
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
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
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
void geom(int which=0)
Definition: geom.C:163
Double_t ymin
Definition: plot.C:24
bool NeutrinoSet() const
Definition: MCTruth.h:77
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
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
Definition: Event.h:56
int EveId(const int trackID) const
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
template<typename PROD , BranchType B>
ProductID art::EDFilter::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 131 of file EDFilter.h.

References art::EDFilter::moduleDescription_.

Referenced by novaddt::HoughTrackMaker::create_associations().

132  {
133  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
134  instanceName);
135  }
ModuleDescription moduleDescription_
Definition: EDFilter.h:124
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
bool art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID(), and string.

41  {
42  return true;
43  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void showere::ShowerEnergyFilterMC::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 133 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().

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

Referenced by art::RootOutput::endJob().

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Member Data Documentation

constexpr bool art::EDFilter::Fail {false}
staticinherited

Definition at line 33 of file EDFilter.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::EDFilter::Pass {true}
staticinherited

Definition at line 32 of file EDFilter.h.

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


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