Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
skim::EvaluatorNumuCCpi Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-09-17/AnalysisSkimmer/evaluators/EvaluatorNumuCCpi.h"

Inheritance diagram for skim::EvaluatorNumuCCpi:
skim::Evaluator

Public Member Functions

 EvaluatorNumuCCpi (fhicl::ParameterSet const &p)
 
 EvaluatorNumuCCpi (EvaluatorNumuCCpi const &)=delete
 
 EvaluatorNumuCCpi (EvaluatorNumuCCpi &&)=delete
 
EvaluatorNumuCCpioperator= (EvaluatorNumuCCpi const &)=delete
 
EvaluatorNumuCCpioperator= (EvaluatorNumuCCpi &&)=delete
 
void reconfigure (fhicl::ParameterSet const &p)
 
bool Initialize (novadaq::cnv::DetId const &detId, art::Event const &e)
 
size_t CheckSlices ()
 
std::vector< KeptSliceInfo > const & SlicesToKeep ()
 

Protected Member Functions

bool CheckTiming (rb::Cluster const &slice)
 
bool CheckSliceQuality (rb::Cluster const &slice)
 

Protected Attributes

art::ServiceHandle< geo::LiveGeometryfLiveGeom
 the LiveGeometry service More...
 
novadaq::cnv::DetId fDetId
 the id of the detector we are looking at More...
 
std::string fRecordLabel
 label of module creating records More...
 
bool fIsData
 is this data or MC? More...
 
int fCurrentRun
 the current run number More...
 
int fCurrentSubRun
 the current run number More...
 
int fCurrentEvent
 the current run number More...
 
std::vector< KeptSliceInfofKeptSlices
 slices we keep More...
 
std::vector< art::Ptr< rb::Cluster > > fSlicePtrs
 all slices in the spill More...
 

Private Member Functions

bool InitializeNumuCCpi (art::Event const &e)
 
bool KeepSlice (size_t s)
 
bool KeepEventSlices (size_t s)
 

Private Attributes

std::map< size_t, std::vector< rb::Track const * > > fTrack
 slice index to track ptrs More...
 
std::map< size_t, std::vector< numue::NumuE const * > > fNumuE
 slice index to numue ptrs More...
 
std::map< size_t, std::vector< rb::Energy const * > > fEnergy
 slice index to energy ptrs More...
 
std::map< size_t, std::vector< remid::ReMId const * > > fReMId
 slice index to remid ptrs More...
 
std::map< size_t, std::vector< cosrej::CosRejObj const * > > fCosRej
 slice index to remid ptrs More...
 
std::map< size_t, std::vector< qeef::QePId const * > > fQePId
 slice index to remid ptrs More...
 
std::map< size_t, size_t > fSliceBestTrkPID
 slice index to index of track with best remid More...
 
std::string fSliceLabel
 label of module creating slices More...
 
std::string fTrackLabel
 label of module creating tracks More...
 
std::string fEnergyLabel
 label of module creating energies More...
 
std::string fNumuELabel
 label of module creating numues More...
 
std::string fReMIdLabel
 label of module creating remids More...
 
std::string fQePIdLabel
 label of module creating qepids More...
 
std::string fCosRejLabel
 label of module creating cosrejs More...
 
std::string fCosmicsLabel
 label of module creating cosmic tracks More...
 
float fMaxNumuE
 maximum energy for neutrinos More...
 
double fMinReMId
 minimum ReMId PID value to keep a slice More...
 
float fMinSliceHits
 minimum number of hits in a slice to keep it More...
 
float fMinSliceContigPlanes
 minimum number of contiguous hit planes in a slice More...
 
unsigned int fMinCellsFromEdge
 minimum number of cells between the edge of the detector and activity in the slice More...
 
float fMinQePID1Track
 minimum qepid value to accept a 1 track event, set to -1.e6 to keep everything More...
 
float fMinQePID2Track
 minimum qepid value to accept a 2 track event, set to -1.e6 to keep everything More...
 
int fFDMinKalmanFwdCell
 see CosRejObj.h More...
 
int fFDMinKalmanBakCell
 see CosRejObj.h More...
 
int fFDMinCosFwdCell
 see CosRejObj.h More...
 
int fFDMinCosBakCell
 see CosRejObj.h More...
 
unsigned int fFDMinPlanesToFront
 see NumuCuts.h More...
 
unsigned int fFDMinPlanesToBack
 see NumuCuts.h More...
 
float fFDMinKalmanAngle
 
float fFDMinContPID
 
unsigned int fFDMaxSliceHits
 
unsigned int fNDMinPlane
 
unsigned int fNDMaxPlane
 
float fNDMaxTrackStartZPos
 
float fNDMaxTrackStopZPos
 
float fNDMaxKalmanYPosAtTrans
 
int fNDMinKalmanFwdCell
 
int fNDMinKalmanBakCell
 
float fNDMaxHadCalEnergySum
 
art::ServiceHandle< geo::GeometryfGeom
 
art::ServiceHandle< nova::dbi::RunHistoryServicefRunHistory
 
TH1F * fNeutrinoE
 
TH1F * fReMIdVal
 
TH1F * fSliceHits
 
TH1F * fSliceContigPlanes
 
TH1F * fCellsFromEdge
 
TH1F * fQePId1Track
 
TH1F * fQePId2Track
 
TH1F * fFDKalmanFwdCell
 
TH1F * fFDKalmanBakCell
 
TH1F * fFDCosFwdCell
 
TH1F * fFDCosBakCell
 
TH1F * fFDPlanesToFront
 
TH1F * fFDPlanesToBack
 
TH1F * fFDKalmanAngle
 
TH1F * fFDContPID
 
TH1F * fFDSliceHits
 
TH1F * fNDMaxPlaneHit
 
TH1F * fNDMinPlaneHit
 
TH1F * fNDTrackStartZ
 
TH1F * fNDTrackStopZ
 
TH1F * fNDKalmanFwdCell
 
TH1F * fNDKalmanBakCell
 
TH1F * fNDHadCalEnergySum
 
int fTrackMuPDG
 pdg value of muon More...
 
int fTrackChargedPiPDG
 pdg value of charged pion More...
 
bool hasMuon
 confirm of slice includes a true muon More...
 
bool hasPion
 confirm if slice includes a true pion More...
 
int numMuons
 
int numChargedPions
 
TH1F * fParticlePDG
 
TH1F * fNumMuons
 
TH1F * fNumPions
 

Detailed Description

Definition at line 39 of file EvaluatorNumuCCpi.h.

Constructor & Destructor Documentation

skim::EvaluatorNumuCCpi::EvaluatorNumuCCpi ( fhicl::ParameterSet const &  p)

Definition at line 19 of file EvaluatorNumuCCpi.cxx.

References fNumMuons, fNumPions, fParticlePDG, art::TFileDirectory::make(), and reconfigure().

20 {
21  this->reconfigure(p);
22 
23  // make histograms for each selection criteria
25  /*
26  fNeutrinoE = tfs->make<TH1F>("neutrinoE", ";E_{#nu} (GeV);Events", 100, 0., 10. );
27  fReMIdVal = tfs->make<TH1F>("remid", ";ReMId;Events", 200, -1., 1. );
28  fSliceHits = tfs->make<TH1F>("sliceHits", ";Hits In Slice;Events", 100, 0., 400. );
29  fSliceContigPlanes = tfs->make<TH1F>("sliceContigPlanes", ";Contiguous Planes in Slice;Events", 50, 0., 50. );
30  fCellsFromEdge = tfs->make<TH1F>("cellsFromEdge", ";Cells From Edge;Events", 50, 0., 50. );
31  fQePId1Track = tfs->make<TH1F>("qepid1Track", ";QePId_{1 track};Events", 200, -1., 1. );
32  fQePId2Track = tfs->make<TH1F>("qepid2Track", ";QePId_{2 tracks};Events", 200, -1., 1. );
33  fFDKalmanFwdCell = tfs->make<TH1F>("fdKalmanFwdCell", ";Kalman Foward Cell;Events", 100, 0., 100. );
34  fFDKalmanBakCell = tfs->make<TH1F>("fdKalmanBakCell", ";Kalman Backward Cell;Events", 100, 0., 100. );
35  fFDCosFwdCell = tfs->make<TH1F>("fdCosFwdCell", ";cos Foward Cell;Events", 100, 0., 100. );
36  fFDCosBakCell = tfs->make<TH1F>("fdCosBakCell", ";cos Backward Cell;Events", 100, 0., 100. );
37  fFDPlanesToFront = tfs->make<TH1F>("fdPlanesToFront", ";Planes to Front;Events", 100, 0., 100. );
38  fFDPlanesToBack = tfs->make<TH1F>("fdPlanesToBack", ";Planes to Back;Events", 100, 0., 100. );
39  fFDKalmanAngle = tfs->make<TH1F>("fdKalmanAngle", ";Kalman Angle;Events", 200, -4., 4. );
40  fFDContPID = tfs->make<TH1F>("fdContPID", ";ContPID;Events", 200, -1., 1. );
41  fFDSliceHits = tfs->make<TH1F>("fdSliceHits", ";Slice Hits;Events", 500, 0., 500. );
42 
43  fNDMaxPlaneHit = tfs->make<TH1F>("ndMaxPlaneHit", ";Max Hit Plane;Events", 220, 0., 220. );
44  fNDMinPlaneHit = tfs->make<TH1F>("ndMinPlaneHit", ";Min Hit Plane;Events", 220, 0., 220. );
45  fNDTrackStartZ = tfs->make<TH1F>("ndTrackStartZ", ";Track Starting Z Pos (cm);Events", 200, 0., 2000.);
46  fNDTrackStopZ = tfs->make<TH1F>("ndTrackStopZ", ";Track Ending Z Pos (cm);Events", 200, 0., 2000.);
47  fNDKalmanFwdCell = tfs->make<TH1F>("ndKalmanFwdCell", ";Kalman Foward Cell;Events", 100, 0., 100. );
48  fNDKalmanBakCell = tfs->make<TH1F>("ndKalmanBakCell", ";Kalman Backward Cell;Events", 100, 0., 100. );
49  fNDHadCalEnergySum = tfs->make<TH1F>("ndHadCalEnergySum", ";Hadronic Energy (GeV);Events", 100, 0., 10. );
50  */
51  fParticlePDG = tfs->make<TH1F>("fParticlePDG", ";PDG Val;Events", 500, -250., 250. );
52  fNumMuons = tfs->make<TH1F>("fNumMuons", ";PDG Num;Events", 100, 209., 213. );
53  fNumPions = tfs->make<TH1F>("fNumPions", ";PDG Num;Events", 100, 11., 15. );
54 
55  return;
56 }
const char * p
Definition: xmltok.h:285
void reconfigure(fhicl::ParameterSet const &p)
T * make(ARGS...args) const
skim::EvaluatorNumuCCpi::EvaluatorNumuCCpi ( EvaluatorNumuCCpi const &  )
delete
skim::EvaluatorNumuCCpi::EvaluatorNumuCCpi ( EvaluatorNumuCCpi &&  )
delete

Member Function Documentation

bool skim::Evaluator::CheckSliceQuality ( rb::Cluster const &  slice)
protectedinherited

Definition at line 73 of file Evaluator.cxx.

References calcFirstLastLivePlane(), skim::Evaluator::fDetId, nova::dbi::RunHistory::GetConfiguration(), nova::dbi::RunHistory::GoodDiBlockMask(), novadaq::cnv::kFARDET, LOG_DEBUG, rb::Cluster::MaxPlane(), rb::Cluster::MinPlane(), and rh.

Referenced by CheckSlices(), skim::EvaluatorNumu::CheckSlices(), and skim::EvaluatorNue::CheckSlices().

74 {
75  if(fDetId != novadaq::cnv::kFARDET) return true;
76 
78  unsigned int dibmask = (rh->GoodDiBlockMask()&rh->GetConfiguration());
79  std::bitset<14> binary(dibmask);
80 
81  std::pair<int,int> planesA = calcFirstLastLivePlane(slice.MinPlane(), binary, fDetId);
82  std::pair<int,int> planesB = calcFirstLastLivePlane(slice.MaxPlane(), binary, fDetId);
83 
84  LOG_DEBUG("Evaluator")
85  << "min plane: " << slice.MinPlane() << " max plane: " << slice.MaxPlane()
86  << " " << planesA.first << " " << planesA.second
87  << " " << planesB.first << " " << planesB.second
88  << " " << (planesA.second - planesA.first + 1)/64 << " > 3";
89 
90  if ((planesA.first != planesB.first) || (planesA.second != planesB.second))
91  return false;
92 
93  // 1/64 = 0.015625
94  return ((planesA.second - planesA.first + 1) * 0.015625 > 3);
95 }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
novadaq::cnv::DetId fDetId
the id of the detector we are looking at
Definition: Evaluator.h:84
TH2 * rh
Definition: drawXsec.C:5
std::pair< int, int > calcFirstLastLivePlane(int plane, std::bitset< 14 > binary, novadaq::cnv::DetId det)
Definition: Evaluator.cxx:51
Far Detector at Ash River, MN.
int GoodDiBlockMask(int subrun=-1, bool reload=false)
size_t skim::EvaluatorNumuCCpi::CheckSlices ( )
virtual

Implements skim::Evaluator.

Definition at line 190 of file EvaluatorNumuCCpi.cxx.

References skim::Evaluator::CheckSliceQuality(), skim::Evaluator::CheckTiming(), skim::Evaluator::fKeptSlices, skim::Evaluator::fSlicePtrs, KeepSlice(), and LOG_DEBUG.

191 {
192  // fKeptSlicePtrs was cleared in the initialize call
193  // only non-noise slices were put into fSlicePtrs in the initialize call
194  for(size_t s = 0; s < fSlicePtrs.size(); ++s){
195  LOG_DEBUG("EvaluatorNumuCCpi")
196  << "on slice " << s;
197  if(this->KeepSlice(s) &&
198  this->CheckTiming( *(fSlicePtrs[s]) ) &&
199  this->CheckSliceQuality( *(fSlicePtrs[s]) )
200  ){
201  LOG_DEBUG("EvaluatorNumuCCpi")
202  << "keeping slice " << s;
203  fKeptSlices.emplace_back(fSlicePtrs[s], s);
204  }
205  }
206 
207  return fKeptSlices.size();
208 }
std::vector< art::Ptr< rb::Cluster > > fSlicePtrs
all slices in the spill
Definition: Evaluator.h:92
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
bool CheckTiming(rb::Cluster const &slice)
Definition: Evaluator.cxx:20
std::vector< KeptSliceInfo > fKeptSlices
slices we keep
Definition: Evaluator.h:91
const XML_Char * s
Definition: expat.h:262
bool CheckSliceQuality(rb::Cluster const &slice)
Definition: Evaluator.cxx:73
bool skim::Evaluator::CheckTiming ( rb::Cluster const &  slice)
protectedinherited

Definition at line 20 of file Evaluator.cxx.

References skim::Evaluator::fCurrentRun, LOG_DEBUG, and rb::Cluster::MeanTNS().

Referenced by CheckSlices(), skim::EvaluatorNumu::CheckSlices(), and skim::EvaluatorNue::CheckSlices().

21 {
22  // look in CAFAna/TimingCuts.h for definitions of the timing constants
23 
24  const double BeamWindowMinMicroSec = 217;
25  const double BeamWindowMaxMicroSec = 229;
26  const double PeakShiftMicroSec = 64;
27  const int LastBadTimingRun = 17945;
28 
29  auto time = slice.MeanTNS();
30 
31  LOG_DEBUG("Evaluator")
32  << "the mean time is " << time
33  << "\ncurrent Run " << fCurrentRun << "/" << LastBadTimingRun
34  << "\nbeam window min " << 1000 * BeamWindowMinMicroSec
35  << "\nbeam window max " << 1000 * BeamWindowMaxMicroSec
36  << "\nbeam offset " << 1000 * PeakShiftMicroSec;
37 
38  if(fCurrentRun <= LastBadTimingRun &&
39  time > 1000 * (BeamWindowMinMicroSec + PeakShiftMicroSec) &&
40  time < 1000 * (BeamWindowMaxMicroSec + PeakShiftMicroSec)) return true;
41 
42  if(time > 1000 * BeamWindowMinMicroSec &&
43  time < 1000 * BeamWindowMaxMicroSec) return true;
44 
45  return false;
46 }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
int fCurrentRun
the current run number
Definition: Evaluator.h:88
bool skim::EvaluatorNumuCCpi::Initialize ( novadaq::cnv::DetId const &  detId,
art::Event const &  e 
)
virtual

Implements skim::Evaluator.

Definition at line 105 of file EvaluatorNumuCCpi.cxx.

References make_associated_cosmic_defs::cosmics, runNovaSAM::detId, fCosmicsLabel, fCosRej, fCosRejLabel, skim::Evaluator::fCurrentRun, skim::Evaluator::fDetId, fEnergy, fEnergyLabel, skim::SkimmingUtils::FillSliceMap(), skim::Evaluator::fIsData, skim::Evaluator::fKeptSlices, PandAna.Demos.pi0_spectra::fmt, fNumuE, fNumuELabel, fQePId, fQePIdLabel, fReMId, fReMIdLabel, fSliceBestTrkPID, fSliceLabel, skim::Evaluator::fSlicePtrs, fTrack, fTrackLabel, art::FindManyP< ProdB, Data >::get(), art::DataViewImpl::getValidHandle(), remid::HighestPIDTrack(), art::Event::isRealData(), LOG_WARNING, art::Event::run(), gen_flatrecord::size, and confusionMatrixTree::t.

107 {
108  fSlicePtrs .clear();
109  fKeptSlices .clear();
110  fTrack .clear();
111  fNumuE .clear();
112  fEnergy .clear();
113  fReMId .clear();
114  fCosRej .clear();
115  fQePId .clear();
116  fSliceBestTrkPID.clear();
117 
118  fIsData = e.isRealData();
119  fDetId = detId;
120  fCurrentRun = e.run();
121 
122  // fill the vectors of vector<art::Ptr<>> for the reco objects related
123  // to each slice in the spill
124  // get the slices out of the event
125  auto slices = e.getValidHandle<std::vector<rb::Cluster> >(fSliceLabel);
126  if( slices.failedToGet() ){
127  LOG_WARNING("EvaluatorNumuCCpi") << "No slices in this event";
128  return false;
129  }
130 
131  auto cosmics = e.getValidHandle<std::vector<rb::Track> >(fCosmicsLabel);
132  if( cosmics.failedToGet() ){
133  LOG_WARNING("EvaluatorNumuCCpi") << "No cosmics in this event";
134  return false;
135  }
136 
137  // get the FindMany for the slices to shower association.
139  art::FindManyP<rb::Track> fmtp(slices, e, fTrackLabel );
141  art::FindMany<qeef::QePId> fmqe(slices, e, fQePIdLabel );
142  art::FindMany<numue::NumuE> fme (slices, e, fNumuELabel );
143 
145 
146  for(size_t s = 0; s < slices->size(); ++s){
147 
148  fSlicePtrs.emplace_back(slices, s);
149 
150  su.FillSliceMap(s, fmt, fTrack);
151  su.FillSliceMap(s, fmcr, fCosRej);
152  su.FillSliceMap(s, fmqe, fQePId);
153  su.FillSliceMap(s, fme, fNumuE);
154 
155  // get the vector of art::Ptrs of tracks for this slice to be able to find
156  // the highest pid track. I am assuming that FindMany and FindManyP
157  std::vector< art::Ptr<rb::Track> > tracks;
158  fmtp.get(s, tracks);
159 
160  // map the tracks to the rb::Energy for the slice - just fill the fEnergyPtrs
161  // value (ie vector< art::Ptr<rb::Energy> > ) in the same order as the fTrackPtrs
162  // value for this slice
163  if(fTrack[s].size() > 0){
164 
165  // save the index of the highest PID track for this slice
167 
168  // this is not terribly efficient, as we are making the FindOneP
169  // for every slice in the event, but I don't see a good way around
170  // that while still getting the bookkeeping right
173 
174  if( !foe.isValid() || !foid.isValid() ) continue;
175 
176  for(size_t t = 0; t < fTrack[s].size(); ++t){
177  fEnergy[s].push_back( &(foe.at(t).ref()) );
178  fReMId[s] .push_back( &(foid.at(t).ref()) );
179  }
180 
181  }// end if we found tracks in the spill
182 
183  } // end the loop over the slices
184 
185 
186  return true;
187 }
std::vector< art::Ptr< rb::Cluster > > fSlicePtrs
all slices in the spill
Definition: Evaluator.h:92
std::string fTrackLabel
label of module creating tracks
novadaq::cnv::DetId fDetId
the id of the detector we are looking at
Definition: Evaluator.h:84
std::string fCosRejLabel
label of module creating cosrejs
void FillSliceMap(size_t const &s, art::FindMany< T > &fmp, std::map< size_t, std::vector< T const * > > &ptrMap)
std::string fReMIdLabel
label of module creating remids
std::map< size_t, std::vector< numue::NumuE const * > > fNumuE
slice index to numue ptrs
bool fIsData
is this data or MC?
Definition: Evaluator.h:87
std::string fCosmicsLabel
label of module creating cosmic tracks
std::string fEnergyLabel
label of module creating energies
std::map< size_t, std::vector< cosrej::CosRejObj const * > > fCosRej
slice index to remid ptrs
std::vector< KeptSliceInfo > fKeptSlices
slices we keep
Definition: Evaluator.h:91
std::map< size_t, std::vector< rb::Track const * > > fTrack
slice index to track ptrs
const XML_Char * s
Definition: expat.h:262
std::string fQePIdLabel
label of module creating qepids
#define LOG_WARNING(category)
std::map< size_t, std::vector< rb::Energy const * > > fEnergy
slice index to energy ptrs
std::string fNumuELabel
label of module creating numues
std::map< size_t, size_t > fSliceBestTrkPID
slice index to index of track with best remid
std::map< size_t, std::vector< remid::ReMId const * > > fReMId
slice index to remid ptrs
std::map< size_t, std::vector< qeef::QePId const * > > fQePId
slice index to remid ptrs
int fCurrentRun
the current run number
Definition: Evaluator.h:88
std::string fSliceLabel
label of module creating slices
Float_t e
Definition: plot.C:35
unsigned int HighestPIDTrack(const std::vector< art::Ptr< rb::Track > > &sliceTracks, const std::string &remidModuleLabel, const art::Event &e)
Definition: ReMId.cxx:249
bool skim::EvaluatorNumuCCpi::InitializeNumuCCpi ( art::Event const &  e)
private

Referenced by SlicesToKeep().

bool skim::EvaluatorNumuCCpi::KeepEventSlices ( size_t  s)
private

Definition at line 211 of file EvaluatorNumuCCpi.cxx.

References abs(), fParticlePDG, skim::Evaluator::fSlicePtrs, fTrackChargedPiPDG, fTrackMuPDG, MECModelEnuComparisons::i, numChargedPions, numMuons, sim::ParticleNavigator::Particle(), cheat::BackTracker::ParticleNavigator(), simb::MCParticle::PdgCode(), and sim::ParticleNavigator::size().

Referenced by SlicesToKeep().

212 {
213  // we don't check for the existance of cosmic rays reconstructed in
214  // this slice because that is for the full event and is tested in
215  // the Initialize method
216  // Initialise bools for slice
217  //hasMuon = false;
218  //hasPion = false;
219  // Initialise counters;
220  numMuons = 0;
221  numChargedPions = 0;
222  // if there are no tracks in the slice, or it is a noise slice
223  // we don't want it
224  if(fSlicePtrs[s]->IsNoise() ) return false;
225 
226  // --- Set up back tracker to get track pdg values from each slice in spill.
228  // use particle navigator to see all true events in slice.
229  sim::ParticleNavigator const& pn = back_tracker->ParticleNavigator();
230  //bool isMC = back_tracker->HaveTruthInfo();
231 
232  // We don't need this as the cuts are so simple
233  //skim::ParametersNumuCCpi params(*fSlicePtrs[s], isMC);
234 
235  // LOG_DEBUG("EvaluatorNumuCCpi") << params;
236  //LOG_VERBATIM("EvaluatorNumuCCpi") << "#######################";
237  //LOG_VERBATIM("EvaluatorNumuCCpi") << "test out";
238  //LOG_VERBATIM("EvaluatorNumuCCpi") << "#######################";
239  int numberOfParticles = pn.size();
240  for (int i=0; i<numberOfParticles; ++i){
241  sim::Particle* particle = pn.Particle(i);
242  int partPDG = particle->PdgCode();
243  if ( abs(partPDG) == fTrackMuPDG) {
244  fParticlePDG->Fill(partPDG);
245  numMuons++;
246  //hasMuon = true;
247  }
248  if ( abs(partPDG) == fTrackChargedPiPDG){
249  fParticlePDG->Fill(partPDG);
250  numChargedPions++;
251  //hasPion = true;
252  }
253 
254  }
255 
256  if ( (numMuons>=1) && (numChargedPions>=1) ){
257  return true;
258  }
259  else{
260  return false;
261  }
262 
263 }
std::vector< art::Ptr< rb::Cluster > > fSlicePtrs
all slices in the spill
Definition: Evaluator.h:92
int PdgCode() const
Definition: MCParticle.h:211
const sim::ParticleNavigator & ParticleNavigator() const
Get a reference to the ParticleNavigator.
Definition: BackTracker.h:744
size_type size() const
void abs(TH1 *hist)
const XML_Char * s
Definition: expat.h:262
int fTrackChargedPiPDG
pdg value of charged pion
int fTrackMuPDG
pdg value of muon
mapped_type Particle(const size_type) const
bool skim::EvaluatorNumuCCpi::KeepSlice ( size_t  s)
private

Definition at line 266 of file EvaluatorNumuCCpi.cxx.

References abs(), fParticlePDG, skim::Evaluator::fSlicePtrs, fTrackChargedPiPDG, fTrackMuPDG, hasMuon, hasPion, cheat::BackTracker::HitsToParticle(), numChargedPions, and numMuons.

Referenced by CheckSlices(), and SlicesToKeep().

267 {
268 
269  // we don't check for the existance of cosmic rays reconstructed in
270  // this slice because that is for the full event and is tested in
271  // the Initialize method
272 
273  // Initialise bools for slice
274  hasMuon = false;
275  hasPion = false;
276  // Initialise counters;
277  numMuons = 0;
278  numChargedPions = 0;
279  // if there are no tracks in the slice, or it is a noise slice
280  // we don't want it
281  if(fSlicePtrs[s]->IsNoise() ) return false;
282 
283  // --- Get vector of CellHits that corresponds to slice to be checked
284  art::PtrVector<rb::CellHit> sliceHits = fSlicePtrs[s]->AllCells();
285  // --- Set up back tracker to get track pdg values from each slice in spill.
287  // --- Get list of truth particles that corresponds to all hits in slice
288  std::vector<const sim::Particle*> truth_parts = back_tracker->HitsToParticle(sliceHits);
289  // -- Determine if true muons and pions contribute to hits found in slice
290  for(unsigned int i_part = 0; i_part<truth_parts.size(); i_part++){
291 
292  //int partPDG = truth_parts[i_part]->PdgCode();
293  int partPDG = truth_parts[i_part]->PdgCode();
294  if ( abs(partPDG) == fTrackMuPDG ) {
295  //std::cout << "abs(partPDG) : " << abs(partPDG) << std::endl;
296  fParticlePDG->Fill(partPDG);
297  numMuons++;
298  }
299  if ( abs(partPDG) == fTrackChargedPiPDG ){
300  //std::cout << "abs(partPDG) : " << abs(partPDG) << std::endl;
301  fParticlePDG->Fill(partPDG);
302  numChargedPions++;
303  }
304 
305  }
306 
307  if (numMuons>=1) {
308  hasMuon = true;
309  //for(int i = 0; i < numMuons; i++) fNumMuons->Fill(fTrackMuPDG);
310  }
311  if (numChargedPions>=1) {
312  hasPion = true;
313  //for(int i = 0; i < numChargedPions; i++) fNumPions->Fill(fTrackChargedPiPDG);
314  }
315 
316  if(hasMuon && hasPion) return true;
317  else return false;
318 
319 }
std::vector< art::Ptr< rb::Cluster > > fSlicePtrs
all slices in the spill
Definition: Evaluator.h:92
void abs(TH1 *hist)
const XML_Char * s
Definition: expat.h:262
int fTrackChargedPiPDG
pdg value of charged pion
bool hasPion
confirm if slice includes a true pion
int fTrackMuPDG
pdg value of muon
bool hasMuon
confirm of slice includes a true muon
std::vector< const sim::Particle * > HitsToParticle(const std::vector< const rb::CellHit * > &hits) const
Returns vector of sim::Particle objects contributing to the given collection of hits.
EvaluatorNumuCCpi& skim::EvaluatorNumuCCpi::operator= ( EvaluatorNumuCCpi const &  )
delete
EvaluatorNumuCCpi& skim::EvaluatorNumuCCpi::operator= ( EvaluatorNumuCCpi &&  )
delete
void skim::EvaluatorNumuCCpi::reconfigure ( fhicl::ParameterSet const &  p)
virtual

Implements skim::Evaluator.

Definition at line 59 of file EvaluatorNumuCCpi.cxx.

References fCosmicsLabel, fCosRejLabel, fEnergyLabel, fNumuELabel, fQePIdLabel, skim::Evaluator::fRecordLabel, fReMIdLabel, fSliceLabel, fTrackChargedPiPDG, fTrackLabel, fTrackMuPDG, and fhicl::ParameterSet::get().

Referenced by EvaluatorNumuCCpi().

60 {
61  fSliceLabel = p.get<std::string>("SliceLabel", "slicer" );
62  fTrackLabel = p.get<std::string>("TrackLabel", "kalmantrackmerge");
63  fCosRejLabel = p.get<std::string>("CosRejLabel", "cosrej" );
64  fQePIdLabel = p.get<std::string>("QePIdLabel", "qepid" );
65  fReMIdLabel = p.get<std::string>("ReMIdLabel", "remid" );
66  fNumuELabel = p.get<std::string>("NumuELabel", "numue" );
67  fEnergyLabel = p.get<std::string>("EnergyLabel", "numue" );
68  fCosmicsLabel = p.get<std::string>("CosmicsLabel", "cosmictrack" );
69  fRecordLabel = p.get<std::string>("RecordLabel", "cafmaker" );
70  /*
71  // values for the cuts
72  fMaxNumuE = p.get<float >("MaxNumuE", 100. );
73  fMinReMId = p.get<float >("MinReMId", 0.75 ); // set to 0 to allow NC like events in
74  fMinSliceHits = p.get<float >("MinSliceHits", 21. ); // ok
75  fMinSliceContigPlanes = p.get<float >("MinSliceContigPlanes", 5. ); // ok
76  fMinCellsFromEdge = p.get<unsigned int>("MinCellsFromEdge", 2 ); // ok
77  fMinQePID1Track = p.get<float >("MinQePID1Track", -1.e6 ); // default selection is 0.45
78  fMinQePID2Track = p.get<float >("MinQePID2Track", -1.e6 ); // default selection is 0.4
79  fFDMinKalmanFwdCell = p.get<int >("FDMinKalmanFwdCell", 11 ); // ok
80  fFDMinKalmanBakCell = p.get<int >("FDMinKalmanBakCell", 11 ); // ok
81  fFDMinCosFwdCell = p.get<int >("FDMinCosFwdCell", 1 ); // ok
82  fFDMinCosBakCell = p.get<int >("FDMinCosBakCell", 1 ); // ok
83  fFDMinPlanesToFront = p.get<unsigned int>("FDMinPlanesToFront", 2 ); // ok
84  fFDMinPlanesToBack = p.get<unsigned int>("FDMinPlanesToBack", 2 ); // ok
85  fFDMinKalmanAngle = p.get<float >("FDMinKalmanAngle", 0.5 ); // ok
86  fFDMinContPID = p.get<float >("FDMinContPID", 0.535); // ok
87  fFDMaxSliceHits = p.get<unsigned int>("FDMaxSliceHits", 399 ); // ok
88 
89  fNDMinPlane = p.get<unsigned int>("NDMinPlane", 2 ); // ok
90  fNDMaxPlane = p.get<unsigned int>("NDMaxPlane", 211 ); // ok
91  fNDMaxTrackStartZPos = p.get<float >("NDMaxTrackStartZPos", 1150.); // ok
92  fNDMaxTrackStopZPos = p.get<float >("NDMaxTrackStopZPos", 1275.); // ok
93  fNDMinKalmanFwdCell = p.get<int >("NDMinKalmanFwdCell", 5 ); // ok
94  fNDMinKalmanBakCell = p.get<int >("NDMinKalmanBakCell", 9 ); // ok
95  fNDMaxHadCalEnergySum = p.get<float >("NDMaxHadCalEnergySum", 0.03 ); // ok
96  fNDMaxKalmanYPosAtTrans = p.get<float >("NDMaxKalmanYPosAtTrans", 55 ); // ok
97  */
98 
99  fTrackMuPDG = p.get<int >("TrackMuPDG", 13 ); // ok
100  fTrackChargedPiPDG = p.get<int >("TrackChargedPiPDG", 211); // ok
101  return;
102 }
std::string fTrackLabel
label of module creating tracks
std::string fCosRejLabel
label of module creating cosrejs
const char * p
Definition: xmltok.h:285
std::string fReMIdLabel
label of module creating remids
std::string fCosmicsLabel
label of module creating cosmic tracks
std::string fEnergyLabel
label of module creating energies
std::string fQePIdLabel
label of module creating qepids
std::string fRecordLabel
label of module creating records
Definition: Evaluator.h:86
int fTrackChargedPiPDG
pdg value of charged pion
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
std::string fNumuELabel
label of module creating numues
std::string fSliceLabel
label of module creating slices
int fTrackMuPDG
pdg value of muon
std::vector<KeptSliceInfo> const& skim::EvaluatorNumuCCpi::SlicesToKeep ( )
inline

Definition at line 64 of file EvaluatorNumuCCpi.h.

References skim::Evaluator::fKeptSlices, InitializeNumuCCpi(), KeepEventSlices(), and KeepSlice().

64 { return fKeptSlices; }
std::vector< KeptSliceInfo > fKeptSlices
slices we keep
Definition: Evaluator.h:91

Member Data Documentation

TH1F* skim::EvaluatorNumuCCpi::fCellsFromEdge
private

Definition at line 134 of file EvaluatorNumuCCpi.h.

std::string skim::EvaluatorNumuCCpi::fCosmicsLabel
private

label of module creating cosmic tracks

Definition at line 99 of file EvaluatorNumuCCpi.h.

Referenced by Initialize(), and reconfigure().

std::map< size_t, std::vector<cosrej::CosRejObj const*> > skim::EvaluatorNumuCCpi::fCosRej
private

slice index to remid ptrs

Definition at line 88 of file EvaluatorNumuCCpi.h.

Referenced by Initialize().

std::string skim::EvaluatorNumuCCpi::fCosRejLabel
private

label of module creating cosrejs

Definition at line 98 of file EvaluatorNumuCCpi.h.

Referenced by Initialize(), and reconfigure().

int skim::Evaluator::fCurrentEvent
protectedinherited

the current run number

Definition at line 90 of file Evaluator.h.

Referenced by skim::EvaluatorNue::Initialize().

int skim::Evaluator::fCurrentRun
protectedinherited

the current run number

Definition at line 88 of file Evaluator.h.

Referenced by skim::Evaluator::CheckTiming(), Initialize(), skim::EvaluatorNumu::Initialize(), and skim::EvaluatorNue::Initialize().

int skim::Evaluator::fCurrentSubRun
protectedinherited

the current run number

Definition at line 89 of file Evaluator.h.

Referenced by skim::EvaluatorNue::Initialize().

novadaq::cnv::DetId skim::Evaluator::fDetId
protectedinherited
std::map< size_t, std::vector<rb::Energy const*> > skim::EvaluatorNumuCCpi::fEnergy
private

slice index to energy ptrs

Definition at line 86 of file EvaluatorNumuCCpi.h.

Referenced by Initialize().

std::string skim::EvaluatorNumuCCpi::fEnergyLabel
private

label of module creating energies

Definition at line 94 of file EvaluatorNumuCCpi.h.

Referenced by Initialize(), and reconfigure().

TH1F* skim::EvaluatorNumuCCpi::fFDContPID
private

Definition at line 144 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fFDCosBakCell
private

Definition at line 140 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fFDCosFwdCell
private

Definition at line 139 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fFDKalmanAngle
private

Definition at line 143 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fFDKalmanBakCell
private

Definition at line 138 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fFDKalmanFwdCell
private

Definition at line 137 of file EvaluatorNumuCCpi.h.

unsigned int skim::EvaluatorNumuCCpi::fFDMaxSliceHits
private

Definition at line 116 of file EvaluatorNumuCCpi.h.

float skim::EvaluatorNumuCCpi::fFDMinContPID
private

Definition at line 115 of file EvaluatorNumuCCpi.h.

int skim::EvaluatorNumuCCpi::fFDMinCosBakCell
private

see CosRejObj.h

Definition at line 111 of file EvaluatorNumuCCpi.h.

int skim::EvaluatorNumuCCpi::fFDMinCosFwdCell
private

see CosRejObj.h

Definition at line 110 of file EvaluatorNumuCCpi.h.

float skim::EvaluatorNumuCCpi::fFDMinKalmanAngle
private

Definition at line 114 of file EvaluatorNumuCCpi.h.

int skim::EvaluatorNumuCCpi::fFDMinKalmanBakCell
private

see CosRejObj.h

Definition at line 109 of file EvaluatorNumuCCpi.h.

int skim::EvaluatorNumuCCpi::fFDMinKalmanFwdCell
private

see CosRejObj.h

Definition at line 108 of file EvaluatorNumuCCpi.h.

unsigned int skim::EvaluatorNumuCCpi::fFDMinPlanesToBack
private

see NumuCuts.h

Definition at line 113 of file EvaluatorNumuCCpi.h.

unsigned int skim::EvaluatorNumuCCpi::fFDMinPlanesToFront
private

see NumuCuts.h

Definition at line 112 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fFDPlanesToBack
private

Definition at line 142 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fFDPlanesToFront
private

Definition at line 141 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fFDSliceHits
private

Definition at line 145 of file EvaluatorNumuCCpi.h.

art::ServiceHandle<geo::Geometry> skim::EvaluatorNumuCCpi::fGeom
private

Definition at line 126 of file EvaluatorNumuCCpi.h.

bool skim::Evaluator::fIsData
protectedinherited
std::vector< KeptSliceInfo > skim::Evaluator::fKeptSlices
protectedinherited
art::ServiceHandle<geo::LiveGeometry> skim::Evaluator::fLiveGeom
protectedinherited

the LiveGeometry service

Definition at line 83 of file Evaluator.h.

float skim::EvaluatorNumuCCpi::fMaxNumuE
private

maximum energy for neutrinos

Definition at line 101 of file EvaluatorNumuCCpi.h.

unsigned int skim::EvaluatorNumuCCpi::fMinCellsFromEdge
private

minimum number of cells between the edge of the detector and activity in the slice

Definition at line 105 of file EvaluatorNumuCCpi.h.

float skim::EvaluatorNumuCCpi::fMinQePID1Track
private

minimum qepid value to accept a 1 track event, set to -1.e6 to keep everything

Definition at line 106 of file EvaluatorNumuCCpi.h.

float skim::EvaluatorNumuCCpi::fMinQePID2Track
private

minimum qepid value to accept a 2 track event, set to -1.e6 to keep everything

Definition at line 107 of file EvaluatorNumuCCpi.h.

double skim::EvaluatorNumuCCpi::fMinReMId
private

minimum ReMId PID value to keep a slice

Definition at line 102 of file EvaluatorNumuCCpi.h.

float skim::EvaluatorNumuCCpi::fMinSliceContigPlanes
private

minimum number of contiguous hit planes in a slice

Definition at line 104 of file EvaluatorNumuCCpi.h.

float skim::EvaluatorNumuCCpi::fMinSliceHits
private

minimum number of hits in a slice to keep it

Definition at line 103 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fNDHadCalEnergySum
private

Definition at line 153 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fNDKalmanBakCell
private

Definition at line 152 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fNDKalmanFwdCell
private

Definition at line 151 of file EvaluatorNumuCCpi.h.

float skim::EvaluatorNumuCCpi::fNDMaxHadCalEnergySum
private

Definition at line 124 of file EvaluatorNumuCCpi.h.

float skim::EvaluatorNumuCCpi::fNDMaxKalmanYPosAtTrans
private

Definition at line 121 of file EvaluatorNumuCCpi.h.

unsigned int skim::EvaluatorNumuCCpi::fNDMaxPlane
private

Definition at line 118 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fNDMaxPlaneHit
private

Definition at line 147 of file EvaluatorNumuCCpi.h.

float skim::EvaluatorNumuCCpi::fNDMaxTrackStartZPos
private

Definition at line 119 of file EvaluatorNumuCCpi.h.

float skim::EvaluatorNumuCCpi::fNDMaxTrackStopZPos
private

Definition at line 120 of file EvaluatorNumuCCpi.h.

int skim::EvaluatorNumuCCpi::fNDMinKalmanBakCell
private

Definition at line 123 of file EvaluatorNumuCCpi.h.

int skim::EvaluatorNumuCCpi::fNDMinKalmanFwdCell
private

Definition at line 122 of file EvaluatorNumuCCpi.h.

unsigned int skim::EvaluatorNumuCCpi::fNDMinPlane
private

Definition at line 117 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fNDMinPlaneHit
private

Definition at line 148 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fNDTrackStartZ
private

Definition at line 149 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fNDTrackStopZ
private

Definition at line 150 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fNeutrinoE
private

Definition at line 130 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fNumMuons
private

Definition at line 167 of file EvaluatorNumuCCpi.h.

Referenced by EvaluatorNumuCCpi().

TH1F* skim::EvaluatorNumuCCpi::fNumPions
private

Definition at line 168 of file EvaluatorNumuCCpi.h.

Referenced by EvaluatorNumuCCpi().

std::map< size_t, std::vector<numue::NumuE const*> > skim::EvaluatorNumuCCpi::fNumuE
private

slice index to numue ptrs

Definition at line 85 of file EvaluatorNumuCCpi.h.

Referenced by Initialize().

std::string skim::EvaluatorNumuCCpi::fNumuELabel
private

label of module creating numues

Definition at line 95 of file EvaluatorNumuCCpi.h.

Referenced by Initialize(), and reconfigure().

TH1F* skim::EvaluatorNumuCCpi::fParticlePDG
private

Definition at line 166 of file EvaluatorNumuCCpi.h.

Referenced by EvaluatorNumuCCpi(), KeepEventSlices(), and KeepSlice().

std::map< size_t, std::vector<qeef::QePId const*> > skim::EvaluatorNumuCCpi::fQePId
private

slice index to remid ptrs

Definition at line 89 of file EvaluatorNumuCCpi.h.

Referenced by Initialize().

TH1F* skim::EvaluatorNumuCCpi::fQePId1Track
private

Definition at line 135 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fQePId2Track
private

Definition at line 136 of file EvaluatorNumuCCpi.h.

std::string skim::EvaluatorNumuCCpi::fQePIdLabel
private

label of module creating qepids

Definition at line 97 of file EvaluatorNumuCCpi.h.

Referenced by Initialize(), and reconfigure().

std::string skim::Evaluator::fRecordLabel
protectedinherited

label of module creating records

Definition at line 86 of file Evaluator.h.

Referenced by reconfigure(), and skim::EvaluatorNumu::reconfigure().

std::map< size_t, std::vector<remid::ReMId const*> > skim::EvaluatorNumuCCpi::fReMId
private

slice index to remid ptrs

Definition at line 87 of file EvaluatorNumuCCpi.h.

Referenced by Initialize().

std::string skim::EvaluatorNumuCCpi::fReMIdLabel
private

label of module creating remids

Definition at line 96 of file EvaluatorNumuCCpi.h.

Referenced by Initialize(), and reconfigure().

TH1F* skim::EvaluatorNumuCCpi::fReMIdVal
private

Definition at line 131 of file EvaluatorNumuCCpi.h.

art::ServiceHandle<nova::dbi::RunHistoryService> skim::EvaluatorNumuCCpi::fRunHistory
private

Definition at line 127 of file EvaluatorNumuCCpi.h.

std::map< size_t, size_t > skim::EvaluatorNumuCCpi::fSliceBestTrkPID
private

slice index to index of track with best remid

Definition at line 90 of file EvaluatorNumuCCpi.h.

Referenced by Initialize().

TH1F* skim::EvaluatorNumuCCpi::fSliceContigPlanes
private

Definition at line 133 of file EvaluatorNumuCCpi.h.

TH1F* skim::EvaluatorNumuCCpi::fSliceHits
private

Definition at line 132 of file EvaluatorNumuCCpi.h.

std::string skim::EvaluatorNumuCCpi::fSliceLabel
private

label of module creating slices

Definition at line 92 of file EvaluatorNumuCCpi.h.

Referenced by Initialize(), and reconfigure().

std::vector< art::Ptr<rb::Cluster> > skim::Evaluator::fSlicePtrs
protectedinherited
std::map< size_t, std::vector<rb::Track const*> > skim::EvaluatorNumuCCpi::fTrack
private

slice index to track ptrs

Definition at line 84 of file EvaluatorNumuCCpi.h.

Referenced by Initialize().

int skim::EvaluatorNumuCCpi::fTrackChargedPiPDG
private

pdg value of charged pion

Definition at line 157 of file EvaluatorNumuCCpi.h.

Referenced by KeepEventSlices(), KeepSlice(), and reconfigure().

std::string skim::EvaluatorNumuCCpi::fTrackLabel
private

label of module creating tracks

Definition at line 93 of file EvaluatorNumuCCpi.h.

Referenced by Initialize(), and reconfigure().

int skim::EvaluatorNumuCCpi::fTrackMuPDG
private

pdg value of muon

Definition at line 156 of file EvaluatorNumuCCpi.h.

Referenced by KeepEventSlices(), KeepSlice(), and reconfigure().

bool skim::EvaluatorNumuCCpi::hasMuon
private

confirm of slice includes a true muon

Definition at line 159 of file EvaluatorNumuCCpi.h.

Referenced by KeepSlice().

bool skim::EvaluatorNumuCCpi::hasPion
private

confirm if slice includes a true pion

Definition at line 160 of file EvaluatorNumuCCpi.h.

Referenced by KeepSlice().

int skim::EvaluatorNumuCCpi::numChargedPions
private

Definition at line 163 of file EvaluatorNumuCCpi.h.

Referenced by KeepEventSlices(), and KeepSlice().

int skim::EvaluatorNumuCCpi::numMuons
private

Definition at line 162 of file EvaluatorNumuCCpi.h.

Referenced by KeepEventSlices(), and KeepSlice().


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