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

Public Member Functions

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

Private Attributes

bool fVtxInTPC
 
std::vector< int > fLepPDGs
 
bool fCC
 
bool fNC
 

Detailed Description

Definition at line 15 of file GenNuFilter_module.cc.

Constructor & Destructor Documentation

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

Definition at line 32 of file GenNuFilter_module.cc.

33  : EDFilter(pset)
34  {
35  this->reconfigure(pset);
36 
37  }
void reconfigure(fhicl::ParameterSet const &pset)

Member Function Documentation

void filt::GenNuFilter::beginJob ( )
overridevirtual

Definition at line 85 of file GenNuFilter_module.cc.

85  {
86  }
bool filt::GenNuFilter::filter ( art::Event &  e)
overridevirtual

Definition at line 48 of file GenNuFilter_module.cc.

48  {
49  //std::vector< art::Handle< std::vector<simb::MCTruth> > > mclists;
50  //e.getManyByType(mclists);
51  auto mclists = e.getMany< std::vector<simb::MCTruth> >();
52  for (unsigned int i = 0; i < mclists.size() ; i++){
53  for (unsigned int j = 0; j < mclists[i]->size(); j++){
54  //Should have the truth record for the event now
55  const art::Ptr<simb::MCTruth> mc_truth(mclists[i],j);
56  if(mc_truth->Origin() == simb::kBeamNeutrino){
57  simb::MCNeutrino nu = mc_truth->GetNeutrino();
58  // Check vertex in TPC
59  double vtxX = nu.Nu().Vx();
60  double vtxY = nu.Nu().Vy();
61  double vtxZ = nu.Nu().Vz();
62  TVector3 vtx(vtxX, vtxY, vtxZ);
63  if(fVtxInTPC && !RecoUtils::IsInsideTPC(vtx, 0)) continue;
64  // Check if CC or NC specified
65  if(!(fCC && fNC)){
66  if(fCC && nu.CCNC() == simb::kNC) continue;
67  if(fNC && nu.CCNC() == simb::kCC) continue;
68  }
69  // Check which flavour of interaction
70  int lepPdg = nu.Lepton().PdgCode();
71  if(fLepPDGs.size() > 0){
72  if(fLepPDGs[0] != 0){
73  if(std::find(fLepPDGs.begin(), fLepPDGs.end(), lepPdg) == fLepPDGs.end()) continue;
74  }
75  }
76  return true;
77  }
78  }
79  }
80 
81  return false;
82  }
std::vector< int > fLepPDGs
Charged-current interactions.
Definition: IPrediction.h:38
do i e
Neutral-current interactions.
Definition: IPrediction.h:39
BEGIN_PROLOG SN nu
bool IsInsideTPC(TVector3 position, double distance_buffer)
void filt::GenNuFilter::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 40 of file GenNuFilter_module.cc.

40  {
41  fVtxInTPC = pset.get<bool>("VtxInTPC");
42  fLepPDGs = pset.get<std::vector<int>>("LepPDGs");
43  fCC = pset.get<bool>("CC");
44  fNC = pset.get<bool>("NC");
45  }
std::vector< int > fLepPDGs

Member Data Documentation

bool filt::GenNuFilter::fCC
private

Definition at line 26 of file GenNuFilter_module.cc.

std::vector<int> filt::GenNuFilter::fLepPDGs
private

Definition at line 25 of file GenNuFilter_module.cc.

bool filt::GenNuFilter::fNC
private

Definition at line 27 of file GenNuFilter_module.cc.

bool filt::GenNuFilter::fVtxInTPC
private

Definition at line 24 of file GenNuFilter_module.cc.


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