LIDBuilder_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \brief Build and write out the ShowerLID objects and make nue PID
3 ///
4 /// \TODO Jianming's oscillation weighting: Need to find standard
5 // infrastructure to do this and replace his
6 /// code, which I stripped out of this class
7 ///
8 /// \author Alex Smith smith@physics.umn.edu
9 ////////////////////////////////////////////////////////////////////////
10 
11 // ROOT includes
12 #include "TFile.h"
13 #include "TH1D.h"
14 #include "TLorentzVector.h"
15 #include "TMath.h"
16 #include "TMultiLayerPerceptron.h"
17 #include "TRandom.h"
18 #include "TTree.h"
19 
20 // NOvA includes
21 #include "Geometry/Geometry.h"
22 #include "RecoBase/Cluster.h"
23 #include "RecoBase/PID.h"
24 #include "RecoBase/FilterList.h"
25 #include "RecoBase/Vertex.h"
26 #include "Utilities/AssociationUtil.h"
27 #include "Calibrator/Calibrator.h"
29 #include "ShowerLID/NuEEnergyAlg.h"
31 #include "ShowerLID/LIDAlg.h"
32 #include "ShowerLID/EventLID.h"
33 #include "ShowerLID/ShowerLID.h"
34 
35 // ART includes
47 #include "fhiclcpp/ParameterSet.h"
49 #include <cmath>
50 
51 namespace slid {
52 
53  class LIDBuilder : public art::EDProducer {
54  public:
55  explicit LIDBuilder(const fhicl::ParameterSet& pset);
56  ~LIDBuilder();
57  virtual void produce(art::Event& evt);
58  virtual void reconfigure(const fhicl::ParameterSet& pset);
59  virtual void beginRun(art::Run& run);
60 
61  protected:
65  std::vector<std::string> fFilterLabels; ///< Labels of filter lists to obey
66 
72 
74  int kIDNuE = 12; // TEMP, should find where stadard defs are.
75  /// Particle ID alorithm (loglikelihoods and dE/dx)
78  /// MVAAlgorithm (Neural Net, KNN, etc. May include any algorithm that is
79  /// a subclass of slid::LIDAlg)
84  /// FCL parameters for NuE Energy alorithm
86 
87  /// FCL parameters for particle ID alorithm (loglikelihoods and dE/dx)
89 
90  /// FCL parameters for LID alorithm
92 
93  /// determine if library load is necessary or not when moving to a new run
94  bool libLoad = false;
95 
96  };
97  bool CompareByE( const slid::ShowerLID& a, const slid::ShowerLID& b);
98 } // namespace
99 
100 namespace slid {
101  int Ncount0 = 0, Ncount1 = 0, Ncount2 = 0;
102  int Nfill = 0, Nput = 0;
103  //......................................................................
104 
106  : fParticleIDAlg(0), fNuEEnergyAlg(0),
107  fMVAAlg(0),
108  fMVAAlgWithE(0),
109  fMVAAlgEPi0(0),
110  fMVAAlgECos(0),
111  fNuEEnergyAlgPSet(pset.get< fhicl::ParameterSet >("NuEEnergyAlgPSet")),
112  fParticleIDAlgPSet(pset.get< fhicl::ParameterSet >("ParticleIDAlgPSet")),
113  fLIDAlgPSet(pset.get< fhicl::ParameterSet >("LIDAlgPSet"))
114  {
115  reconfigure(pset);
116  // Define output structures produced.
117  produces<std::vector<slid::ShowerLID> >();
118  produces<std::vector<slid::EventLID> >();
119  produces< art::Assns<slid::EventLID, rb::Cluster> >();
120  produces< art::Assns<slid::ShowerLID, rb::Shower> >();
121  produces< art::Assns<slid::ShowerLID, rb::Cluster> >();
122  }
123 
124  //......................................................................
125 
127  {
128  if (fParticleIDAlg) delete fParticleIDAlg;
129  if (fNuEEnergyAlg) delete fNuEEnergyAlg;
130  if (fMVAAlg) delete fMVAAlg;
131  if (fMVAAlgWithE) delete fMVAAlgWithE;
132  if (fMVAAlgEPi0) delete fMVAAlgEPi0;
133  if (fMVAAlgECos) delete fMVAAlgECos;
134  }
135 
136  //......................................................................
137 
139  {
140  //
141  // Read FCL parameters
142  //
143  fNuEEnergyAlgPSet = pset.get< fhicl::ParameterSet >("NuEEnergyAlgPSet");
144  fParticleIDAlgPSet = pset.get< fhicl::ParameterSet >("ParticleIDAlgPSet");
145  fLIDAlgPSet = pset.get< fhicl::ParameterSet >("LIDAlgPSet");
146  fObeyPreselection = pset.get<bool>("ObeyPreselection");
147  fSkipNoiseSlices = pset.get<bool>("SkipNoiseSlices");
148  fTrainingMode = pset.get<bool>("TrainingMode");
149  fParticleIDMode = pset.get<bool>("ParticleIDMode");
150  fFilterLabels = pset.get< std::vector<std::string> >("FilterLabels");
151  fSlicerLabel = pset.get< std::string >("SlicerLabel");
152  fShowerLabel = pset.get< std::string >("ShowerLabel");
153  fVertexLabel = pset.get< std::string >("VertexLabel");
154  fLibPath = util::EnvExpansion(pset.get< std::string >("LibraryPath"));
155  fPIDOnlyForHighestEShower = pset.get<bool>("PIDOnlyForHighestEShower");
156 
157  }
158 
160  {
161  }
162 
163 
164  //......................................................................
165 
167  {
168  // Currently libraries only depend on the detector. Safe to only initialize
169  // once.
170  if (!libLoad){
172  if (fParticleIDMode){
174  novadaq::cnv::DetId detId = geom->DetId();
176  }
177  if (!fTrainingMode){
186  }
187  libLoad = true;
188  }
189 
190 
192 
193  LOG_DEBUG("LIDBuilderDEBUG") << "In LIDBuilder::produce" << '\n';
194 
195  std::unique_ptr<std::vector<slid::ShowerLID>> showerlidcol(new std::vector<slid::ShowerLID>);
196  std::unique_ptr<std::vector<slid::EventLID>> elidcol(new std::vector<slid::EventLID>);
197  std::unique_ptr<art::Assns<slid::ShowerLID,rb::Shower>> assnSlidShower(new art::Assns<slid::ShowerLID, rb::Shower>);
198  std::unique_ptr<art::Assns<slid::ShowerLID,rb::Cluster>> assnSlidSlice(new art::Assns<slid::ShowerLID, rb::Cluster>);
199  std::unique_ptr<art::Assns<slid::EventLID,rb::Cluster>> assnElidSlice(new art::Assns<slid::EventLID, rb::Cluster>);
200 
202  evt.getByLabel(fSlicerLabel, slicecol);
203  art::PtrVector<rb::Cluster> slicelist;
204  for (unsigned int i = 0; i < slicecol->size(); ++i) {
205  art::Ptr<rb::Cluster> slice(slicecol, i);
206  slicelist.push_back(slice);
207  }
208  //
209  // Grab list of rb::Shower* for calculations and reading
210  // and list of art::Ptr<rb::Shower>
211  // for writing the output data products. Since these
212  // **should** be indexed the same, this
213  // should be OK.
214  //
215  art::FindManyP<rb::Shower> fmtP(slicecol, evt, fShowerLabel);
217  art::FindManyP<rb::Vertex> fmv(slicecol, evt, fVertexLabel);
218 
219  // loop over all of the slices
220  for (unsigned int iSlice = 0; iSlice < slicelist.size(); ++iSlice) {
221  const size_t nextShwIdx = showerlidcol->size();
222 
223  // Skip noise slices if this option is selected in FCL
224 
225  if (fSkipNoiseSlices && slicelist[iSlice]->IsNoise()) continue;
226 
227  // If there was nue preselection, skip slice if it
228  // failed if this option is selected in FCL
229 
230  if (fObeyPreselection &&
231  rb::IsFiltered(evt, slicecol, iSlice, fFilterLabels))
232  continue;
233 
234 
235  // get all of the showers in this slice
236  if ((!fmt.isValid())||(!fmtP.isValid())) continue;
237  const std::vector< const rb::Shower* > showercol = fmt.at(iSlice);
238  const std::vector < art::Ptr < rb::Shower >>
239  showercolPtr = fmtP.at(iSlice);
240  if ((showercol.empty())||(showercolPtr.empty())) continue;
241 
242  // hold slid objects temporarily before sorting
243  std::vector<slid::ShowerLID> tempslidcol;
244  // keep track of shower index associationed with the
245  // slid object after sorting
246  std::vector<std::pair<double,int> > associationlist;
247 
248 
249  //get the vertex for the slice
250  const std::vector<art::Ptr<rb::Vertex>> vertCol = fmv.at(iSlice);
251  //currently only one vertex per slice
252  TVector3 vert = vertCol[0]->GetXYZ();
253 
254  //
255  // Get indices of highest and second-highest energy showers
256  //
257  double eShHighest = 0;
258  double sliceShwE = 0;
259  unsigned int iHighestEnergySh = -1;
260  for (unsigned int jShower = 0;
261  jShower < showercol.size();
262  ++jShower) {
263  double thisESh = fNuEEnergyAlg->ShowerEnergy(showercol[jShower],
264  showercol, evt);
265  sliceShwE += thisESh;
266  if (thisESh > eShHighest) {
267  eShHighest = thisESh;
268  iHighestEnergySh = jShower;
269  }
270  }
271 
272  TLorentzVector evtP4(0.0,0.0,0.0,0.0);
273  //
274  // Loop over showers to fill PID info
275  //
276  std::map<int, int> showerLidToShower;
277  unsigned int nShowers = showercol.size();
278  for (unsigned int iShower = 0; iShower < nShowers; ++iShower) {
279 
280 
281  slid::ShowerLID showerlid;
282  if(fParticleIDMode){
283  // we only have to calculate the electron longitudinal
284  // and transverse likelihoods once, and can save the values
285  double ellmax = -9999;
286  double electronLongLL = -9999;
287  double electronTransLL = -9999;
288  for(int itype=0;
290  ++itype){
291  if(itype == int(slid::DedxParticleType::kELECTRON)||
296  double eLongLLTest =
298  showercol[iShower],
299  showercol, evt);
300  double eTransLLTest =
302  showercol[iShower],
303  showercol, evt);
304  if(ellmax< eLongLLTest+eTransLLTest){
305  ellmax = eLongLLTest+eTransLLTest;
306  electronLongLL = eLongLLTest;
307  electronTransLL = eTransLLTest;
308  }
309  }
310  }
311  showerlid.SetEGLLL(electronLongLL
313  showercol, evt));
314  showerlid.SetEGLLT(electronTransLL
316  showercol, evt));
317  showerlid.SetEMuLLL(electronLongLL
319  showercol, evt));
320  showerlid.SetEMuLLT(electronTransLL
322  showercol, evt));
323  showerlid.SetEPi0LLL(electronLongLL
325  showercol, evt));
326  showerlid.SetEPi0LLT(electronTransLL
328  showercol, evt));
329  showerlid.SetEPLLL(electronLongLL
331  showercol, evt));
332  showerlid.SetEPLLT(electronTransLL
334  showercol, evt));
335  showerlid.SetENLLL(electronLongLL
337  showercol, evt));
338  showerlid.SetENLLT(electronTransLL
340  showercol, evt));
341  showerlid.SetEPiLLL(electronLongLL
343  showercol, evt));
344  showerlid.SetEPiLLT(electronTransLL
346  showercol, evt));
348  showercol, evt));
349  showerlid.SetPi0PhotonID(fParticleIDAlg->Pi0SecondPhoton(showercol, iShower, evt) );
350 
351  showerlid.SetGap(fParticleIDAlg->GetGapVertexToShowerStart(showercol[iShower], vert, evt));
352 
353  showerlid.SetNMIPPlanes( fParticleIDAlg->GetMIPPlanes( showercol[iShower], showercol, evt));
354 
355  showerlid.SetPi0mass(std::max(fParticleIDAlg->Pi0Mass(showercol, iShower, evt), 0.0));
356  showerlid.SetRadius(fParticleIDAlg->Radius(showercol, iShower, evt));
357 
358 
359  showerlid.SetDedx0(0);
360  showerlid.SetDedx1(0);
361  showerlid.SetDedx2(0);
362  showerlid.SetDedx3(0);
363  showerlid.SetDedx4(0);
364  showerlid.SetDedx5(0);
365  fParticleIDAlg->SetShower(showercol[iShower],
366  showercol, evt);
367 
368  if(showercol[iShower]->ExtentPlane()>0)
369  showerlid.SetDedx0(fParticleIDAlg->PlaneLongDedx(0));
370  if(showercol[iShower]->ExtentPlane()>1)
371  showerlid.SetDedx1(fParticleIDAlg->PlaneLongDedx(1));
372  if(showercol[iShower]->ExtentPlane()>2)
373  showerlid.SetDedx2(fParticleIDAlg->PlaneLongDedx(2));
374  if(showercol[iShower]->ExtentPlane()>3)
375  showerlid.SetDedx3(fParticleIDAlg->PlaneLongDedx(3));
376  if(showercol[iShower]->ExtentPlane()>4)
377  showerlid.SetDedx4(fParticleIDAlg->PlaneLongDedx(4));
378  if(showercol[iShower]->ExtentPlane()>5)
379  showerlid.SetDedx5(fParticleIDAlg->PlaneLongDedx(5));
380 
381  for(int cell=-5;cell<=5;cell++){
382  for(int plane=0;plane<6;plane++){
383  double cpdedx = fParticleIDAlg->CellPlaneDedx(cell,plane);
384  showerlid.fVtxDedx[plane][cell] = cpdedx;
385  }
386  }
387 
388  showerlid.SetDedxp0c0(showerlid.fVtxDedx[0][0]);
389  showerlid.SetDedxp0c1(0.5*(showerlid.fVtxDedx[0][-1]+showerlid.fVtxDedx[0][1]));
390  showerlid.SetDedxp1c0(showerlid.fVtxDedx[1][0]);
391  showerlid.SetDedxp1c1(0.5*(showerlid.fVtxDedx[1][-1]+showerlid.fVtxDedx[1][1]));
392  showerlid.SetDedxp2c0(showerlid.fVtxDedx[2][0]);
393  showerlid.SetDedxp2c1(0.5*(showerlid.fVtxDedx[2][-1]+showerlid.fVtxDedx[2][1]));
394  showerlid.SetDedxp3c0(showerlid.fVtxDedx[3][0]);
395  showerlid.SetDedxp3c1(0.5*(showerlid.fVtxDedx[3][-1]+showerlid.fVtxDedx[3][1]));
396  showerlid.SetDedxp4c0(showerlid.fVtxDedx[4][0]);
397  showerlid.SetDedxp4c1(0.5*(showerlid.fVtxDedx[4][-1]+showerlid.fVtxDedx[4][1]));
398  showerlid.SetDedxp5c0(showerlid.fVtxDedx[5][0]);
399  showerlid.SetDedxp5c1(0.5*(showerlid.fVtxDedx[5][-1]+showerlid.fVtxDedx[5][1]));
400  }
401 
402  double shwE = fNuEEnergyAlg->ShowerEnergy(showercol.at(iShower),
403  showercol, evt);
404  if (sliceShwE > 1e-10) showerlid.SetShowerEFrac(shwE/sliceShwE);
405  else showerlid.SetShowerEFrac(0.0);
406 
407  if (shwE < 1e-10) shwE = 0.0;
408  showerlid.SetShowerEnergy(shwE);
409 
410  TLorentzVector showerptrk(showercol[iShower]->Dir()[0]*shwE,
411  showercol[iShower]->Dir()[1]*shwE,
412  showercol[iShower]->Dir()[2]*shwE,
413  shwE);
414 
415  TVector3 nuDir = fGeom->NuMIBeamDirection();
416  double theta = showerptrk.Angle(nuDir);
417 
418  showerlid.SetCosTheta(cos(theta));
419  showerlid.SetVertexEnergy(fNuEEnergyAlg->VertexEnergy(showercol.at(iShower), showercol, vertCol.at(0).get(), slicelist.at(iSlice).get(), evt));
420  evtP4 += showerptrk;
421 
422  if (std::isnan(sliceShwE) ||
423  std::isnan(shwE) ||
424  std::isinf(sliceShwE) ||
425  std::isinf(shwE)) {
426  mf::LogError("LIDBuilder")<< "sliceShwE/shwE is nan or inf";
427  continue;
428  }
429 
430  showerlid.SetIsMuon(!(showerlid.EMuLLL() > -0.2 &&
431  showerlid.EMuLLT() > -99999));
432  showerlid.SetPdg(kIDNuE);
433  showerlid.SetAlgDescription("dummy");
434  showerlid.SetShowerDepEnergy(fNuEEnergyAlg->ShowerDepEnergy(showercol.at(iShower),
435  showercol,
436  evt));
437 
438  showerlid.SetNueEnergy(fNuEEnergyAlg->NuEEnergy(showercol,
439  slicelist.at(iSlice).get(),
440  iShower, evt));
441 
442  showerlid.SetHadronicEnergy(fNuEEnergyAlg->HadronicEnergy(showercol,
443  slicelist.at(iSlice).get(),
444  iShower,
445  evt));
446 
448  || iShower == iHighestEnergySh){
449  // in training mode just write -5,
450  // since the ann weights have not been determined
451  if (fTrainingMode){
452  showerlid.SetAlgDescription(""); // not needed?
453  showerlid.SetVal(-5);
454  showerlid.SetValWithE(-5);
455  showerlid.SetValEPi0(-5);
456  showerlid.SetValECos(-5);
457  }
458  //standard running, calculate the ann
459  else{
460  showerlid.SetAlgDescription(fMVAAlg->Description()); // not needed?
461  showerlid.SetVal(fMVAAlg->CalcMVAResult(showerlid));
462  showerlid.SetValWithE(fMVAAlgWithE->CalcMVAResult(showerlid));
463 // std::cout<<"EPi0 PID = "<<fMVAAlgEPi0->CalcMVAResult(showerlid)<<std::endl;
464  showerlid.SetValEPi0(fMVAAlgEPi0->CalcMVAResult(showerlid));
465  showerlid.SetValECos(fMVAAlgECos->CalcMVAResult(showerlid));
466  }
467  }
468  if(fParticleIDMode){
469  showerlid.SetVtxDoca(fParticleIDAlg->PointDoca(vertCol.at(0)->GetXYZ(),
470  showercol[iShower]->Start(),
471  showercol[iShower]->Stop()));
472 
475  }
476 
477  tempslidcol.push_back(showerlid);
478  associationlist.push_back(std::make_pair(showerlid.ShowerEnergy(),
479  iShower));
480  }// end loop over showers
481 
482  std::sort( tempslidcol.begin(), tempslidcol.end(), CompareByE);
483  std::sort(associationlist.rbegin(), associationlist.rend());
484 
485  for (unsigned int islid=0; islid<tempslidcol.size(); ++islid){
486  showerlidcol->push_back(tempslidcol[islid]);
487  util::CreateAssn(*this, evt, *(showerlidcol.get()),
488  showercolPtr[associationlist[islid].second],
489  *(assnSlidShower.get()));
490  }
491 
492  //if we have added new showers, make event pid and associations to slice
493  if (showerlidcol->size() > nextShwIdx){
494  // for the event lid nextShwIdx points to the most
495  // energetic shower, which is what we want
496  slid::EventLID elid;
497  elid.SetPdg( showerlidcol->at(nextShwIdx).Pdg());
498  elid.SetVal( showerlidcol->at(nextShwIdx).Value());
499  elid.SetValWithE( showerlidcol->at(nextShwIdx).ValueWithE() );
500  elid.SetValEPi0( showerlidcol->at(nextShwIdx).ValueEPi0() );
501  elid.SetValECos( showerlidcol->at(nextShwIdx).ValueECos() );
502  elidcol->push_back(elid);
503  util::CreateAssn(*this, evt, *(elidcol.get()), slicelist[iSlice],
504  *(assnElidSlice.get()));
505  //create new associations for the most recent set of showers
506  util::CreateAssn(*this, evt, *showerlidcol, slicelist[iSlice],
507  *(assnSlidSlice.get()), nextShwIdx,
508  showerlidcol->size());
509  }
510 
511  } //end loop over slices
512  evt.put(std::move(showerlidcol));
513  evt.put(std::move(elidcol));
514  evt.put(std::move(assnSlidShower));
515  evt.put(std::move(assnElidSlice));
516  evt.put(std::move(assnSlidSlice));
517 
518  }// end of producer
519 
520  ////////////////////////////////////////////////////////////////////////
521 
523 
524  {
525  return a.ShowerEnergy() > b.ShowerEnergy();
526  }
527 
529 }
void SetValEPi0(float in)
Definition: ShowerLID.h:51
T max(const caf::Proxy< T > &a, T b)
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
std::string fVertexLabel
void SetEPiLLL(float in)
Definition: ShowerLID.h:41
void SetEMuLLT(float in)
Definition: ShowerLID.h:34
int isinf(const stan::math::var &a)
Definition: std_isinf.hpp:16
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
double VertexEnergy(const rb::Shower *shower, const std::vector< const rb::Shower * > showercol, const rb::Vertex *vertex, const rb::Cluster *slice, const art::Event &evt)
Returns energy within 8 planes of the start of the shower.
void SetDedx3(float in)
Definition: ShowerLID.h:57
void SetVtxDoca(float in)
Definition: ShowerLID.h:84
std::string fSlicerLabel
void SetDedxp2c0(float in)
Definition: ShowerLID.h:65
void SetNueEnergy(float in)
Definition: ShowerLID.h:95
double NuEEnergy(const std::vector< const rb::Shower * > shower, const rb::Cluster *slice, const int &elecShowerIndex, const art::Event &evt)
Returns the neutrino energy, assuming &#39;shower&#39; is electron shower.
slid::LIDAlg * fMVAAlgEPi0
pdg code and pid value
fhicl::ParameterSet fParticleIDAlgPSet
FCL parameters for particle ID alorithm (loglikelihoods and dE/dx)
double DedxTransLL(const slid::DedxParticleType partHyp, const rb::Shower *vShower, const std::vector< const rb::Shower * > showercol, const art::Event &evt)
Calculate transverse dE/dx log-likelihood for specific particle hypothesis.
double GetGapVertexToShowerStart(const rb::Shower *vShower, TVector3 evtVtx, const art::Event &evt)
Calculate the gap between the vertex and the start of the shower.
void SetValWithE(float in)
Definition: EventLID.h:24
std::map< int, float > fPartLongLL
Map of the longitudinal ll by paricle type.
Definition: ShowerLID.h:238
std::string EnvExpansion(const std::string &inString)
Function to expand environment variables.
Definition: EnvExpand.cxx:8
void SetShowerEnergy(float in)
Definition: ShowerLID.h:94
std::string fShowerLabel
void SetEMuLLL(float in)
Definition: ShowerLID.h:33
void SetDedxp0c0(float in)
Definition: ShowerLID.h:61
void SetDedx4(float in)
Definition: ShowerLID.h:58
void SetDedxp3c1(float in)
Definition: ShowerLID.h:68
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
bool CompareByE(const slid::ShowerLID &a, const slid::ShowerLID &b)
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
virtual void beginRun(art::Run &run)
NuEEnergyAlg * fNuEEnergyAlg
DEFINE_ART_MODULE(TestTMapFile)
void SetDedx2(float in)
Definition: ShowerLID.h:56
double PlaneLongDedx(unsigned int pIdx)
return longitudinal dedx for a specified plane index
std::string Description()
Definition: LIDAlg.h:72
void SetEPi0LLL(float in)
Definition: ShowerLID.h:35
void SetShowerEFrac(float in)
Definition: ShowerLID.h:46
void SetPi0mass(float in)
Definition: ShowerLID.h:44
Definition: Run.h:31
int isnan(const stan::math::var &a)
Definition: std_isnan.hpp:18
void SetAlgDescription(const std::string &algDescription)
set algorithm description
Definition: ShowerLID.h:90
double CalcMVAResult(slid::ShowerLID &showerlid)
Calculate value of predictors for MVA Algorithm using candidate rb::Shower. A pointer to the object o...
Definition: LIDAlg.cxx:284
int GetMIPPlanes(const rb::Shower *shower, const std::vector< const rb::Shower * > showercol, const art::Event &evt)
Number of MIP planes within the first 20 planes of the start of the shower.
void SetValEPi0(float in)
Definition: EventLID.h:25
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void SetEPiLLT(float in)
Definition: ShowerLID.h:42
DedxParticleType
An enum used to give allowed particle types a visible name in the code. Note that for electron...
double HadronicEnergy(const std::vector< const rb::Shower * > showercol, const rb::Cluster *slice, const int &elecShowerIndex, const art::Event &evt)
Returns the hadronic energy in the slice, assuming &#39;shower&#39; is the electron shower.
void SetDedx0(float in)
Definition: ShowerLID.h:54
slid::LIDAlg * fMVAAlgWithE
void SetDedxp0c1(float in)
Definition: ShowerLID.h:62
void SetShowerDepEnergy(float in)
Definition: ShowerLID.h:92
void SetEPi0LLT(float in)
Definition: ShowerLID.h:36
TensorflowHandler for ShowerLID.
void SetRadius(float in)
Definition: ShowerLID.h:79
double CellPlaneDedx(int tpIdx, unsigned int pIdx)
return transverse dedx for specified transverse plane
int Pi0SecondPhoton(const std::vector< const rb::Shower * > showerCollection, unsigned int iShower, const art::Event &evt)
Index in showerCollection of the shower for which the reconstructed invariant mass was closest to pi0...
void SetInverseGLLL(float in)
Definition: ShowerLID.h:81
void SetENLLT(float in)
Definition: ShowerLID.h:40
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:441
void SetDedxp4c1(float in)
Definition: ShowerLID.h:70
LIDBuilder(const fhicl::ParameterSet &pset)
void SetDedxp2c1(float in)
Definition: ShowerLID.h:66
virtual void reconfigure(const fhicl::ParameterSet &pset)
const double a
double ShowerDepEnergy(const rb::Shower *shower, const std::vector< const rb::Shower * > showercol, const art::Event &evt)
Returns the deposited energy of a shower. Does not contain corrections due to dead material or thresh...
T get(std::string const &key) const
Definition: ParameterSet.h:231
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
int evt
void SetENLLL(float in)
Definition: ShowerLID.h:39
void SetDedxp1c0(float in)
Definition: ShowerLID.h:63
bool libLoad
determine if library load is necessary or not when moving to a new run
void SetDedx5(float in)
Definition: ShowerLID.h:59
float EMuLLL() const
Definition: ShowerLID.h:107
void SetIsMuon(bool in)
Definition: ShowerLID.h:48
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
std::map< int, float > fPartTransLL
Map of the transverse ll by particle type.
Definition: ShowerLID.h:241
void SetCosTheta(float in)
Definition: ShowerLID.h:47
virtual void produce(art::Event &evt)
void SetDedxp5c0(float in)
Definition: ShowerLID.h:71
reference at(size_type n)
Definition: PtrVector.h:365
void SetVertexEnergy(float in)
Definition: ShowerLID.h:93
std::map< int, float > fPartTransLL
Map of the transverse ll by particle type.
void SetHadronicEnergy(float in)
Definition: ShowerLID.h:96
Vertex location in position and time.
double PointDoca(TVector3 vtx, TVector3 start, TVector3 stop)
Get distance of closest approach between shower and vertex.
void SetEPLLL(float in)
Definition: ShowerLID.h:37
void SetValWithE(float in)
Setters.
Definition: ShowerLID.h:30
Definition: run.py:1
size_type size() const
Definition: PtrVector.h:308
void SetPi0PhotonID(float in)
Definition: ShowerLID.h:45
ParticleIDAlg * fParticleIDAlg
Particle ID alorithm (loglikelihoods and dE/dx)
double ShowerEnergy(const rb::Shower *shower, const std::vector< const rb::Shower * > showercol, const art::Event &evt)
Returns the total energy of a shower. along with corrections due to dead material and threshold effec...
std::vector< std::string > fFilterLabels
Labels of filter lists to obey.
void SetPdg(int pdg)
Definition: PID.h:23
void SetValECos(float in)
Definition: ShowerLID.h:77
slid::LIDAlg * fMVAAlg
TVector3 NuMIBeamDirection() const
Direction of neutrinos from the NuMI beam (unit vector)
void SetDedxp5c1(float in)
Definition: ShowerLID.h:72
fhicl::ParameterSet fNuEEnergyAlgPSet
FCL parameters for NuE Energy alorithm.
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
void SetDedxp1c1(float in)
Definition: ShowerLID.h:64
Calculate dE/dx and log likelihoods for different particle hypotheses. This information will be of us...
float ShowerEnergy() const
Definition: ShowerLID.h:157
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
Calculates deposited and corrected energy of the electron shower and of electron flavoured neutrino...
slid::LIDAlg * fMVAAlgECos
void SetGap(float in)
Definition: ShowerLID.h:43
void geom(int which=0)
Definition: geom.C:163
const hit & b
Definition: hits.cxx:21
float EMuLLT() const
Definition: ShowerLID.h:108
T cos(T number)
Definition: d0nt_math.hpp:78
void SetDedxp3c0(float in)
Definition: ShowerLID.h:67
double Radius(const std::vector< const rb::Shower * > showerCollection, unsigned int iShower, const art::Event &evt)
Calculate the shower radius.
void SetEGLLT(float in)
Definition: ShowerLID.h:32
void SetValECos(float in)
Definition: EventLID.h:26
Build slid::LID objects to store electron ID, if asked for, otherwise, calculate LID info and make av...
Definition: FillPIDs.h:13
void SetNMIPPlanes(float in)
Definition: ShowerLID.h:82
void SetVal(double val)
Definition: PID.h:24
void SetDedx1(float in)
Definition: ShowerLID.h:55
Float_t e
Definition: plot.C:35
std::map< int, float > fPartLongLL
Map of the longitudinal ll by paricle type.
void SetEGLLL(float in)
Definition: ShowerLID.h:31
double DedxInverseLongLL(const slid::DedxParticleType partHyp, const rb::Shower *vShower, const std::vector< const rb::Shower * > showercol, const art::Event &evt)
Calculate longitudinal dE/dx log-likelihood for specific particle hypothesis assuming that the partic...
double Pi0Mass(const std::vector< const rb::Shower * > showerCollection, unsigned int iShower, const art::Event &evt)
Calculate the mass of candidate and any other shower in the slice that is closest to the pi0 mass...
void SetDedxp4c0(float in)
Definition: ShowerLID.h:69
Encapsulate the geometry of one entire detector (near, far, ndos)
void SetEPLLT(float in)
Definition: ShowerLID.h:38
std::map< int, std::map< int, float > > fVtxDedx
Definition: ShowerLID.h:242
double DedxLongLL(const slid::DedxParticleType partHyp, const rb::Shower *vShower, const std::vector< const rb::Shower * > showercol, const art::Event &evt)
Calculate longitudinal dE/dx log-likelihood for specific particle hypothesis.
fhicl::ParameterSet fLIDAlgPSet
FCL parameters for LID alorithm.
void SetShower(const rb::Shower *vShower, const std::vector< const rb::Shower * > showercol, const art::Event &evt)
Set rb::Prong to be analyzed. This must be set before any calculations can be done.