Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
calib::EnergyStandardCandles Class Reference
Inheritance diagram for calib::EnergyStandardCandles:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Classes

struct  Pi0
 
struct  StoppingMu
 Utility type to hold info about stopping muons. More...
 

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 EnergyStandardCandles (const fhicl::ParameterSet &pset)
 
virtual ~EnergyStandardCandles ()
 
void analyze (const art::Event &evt)
 
void reconfigure (const fhicl::ParameterSet &pset)
 
void beginJob ()
 
void endJob ()
 
std::string workerType () const
 
bool modifiesEvent () const
 
void registerProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
art::Handle< art::TriggerResultsgetTriggerResults (Event const &e) 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 ()
 

Protected Member Functions

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

Private Member Functions

void FindStoppingMuons (const art::Event &evt)
 
bool IsContained (const rb::Track &trk) const
 
bool IsMuon (const rb::Track &trk) const
 
void FindPi0s (const art::Event &evt)
 
void PrepareMichelENtuple ()
 
void PrepareMuondEdXNtuple ()
 
void PreparePi0Ntuple ()
 
void FillMichelENtuple ()
 
void FillMichelRecoInfo (const std::shared_ptr< StoppingMu > stoppingMu, MichelCandidate &michelCand)
 
void FillTruthInfo (const std::shared_ptr< StoppingMu > stoppingMu, MichelCandidate &michelCand)
 
void FillTrueMichelInfo (const sim::Particle *trueParticle, TrueMichel *eContrib)
 
void FixPhotonAncestry (const sim::Particle *&trueParticle, const sim::Particle *parentParticle, TrueEContrib *eContrib)
 Sometimes photon ancestries are more complicated than we need them to be. More...
 
void FillMuondEdXNtuple ()
 
void FillPi0Ntuple ()
 

Private Attributes

std::vector< std::shared_ptr< StoppingMu > > fStoppingMus
 
std::vector< std::shared_ptr< Pi0 > > fPi0s
 
double fFrontSize
 maximum distance to front of detector to qualify as "front-entering" More...
 
std::string fGeneratorLabel
 name of generator information label in event record More...
 
std::string fHitLabel
 name of hits container in event record More...
 
std::string fMichelLabel
 name of Michel electron container in event record More...
 
std::string fNumiBeamLabel
 name of NuMI spill information container in event record More...
 
double fMinDistToEdge
 minimum distance in cm to edge of detector to qualify as "contained" More...
 
std::string fScintillatorName
 name of geometry TGeoMaterial corresponding to scintillator More...
 
std::string fTrackLabel
 name of tracks container in event record More...
 
std::map< std::string, intfHeaderInfo
 run/subrun/gate for output ntuple More...
 
TParameter< double > * fPOTStorage
 container for POT that will go to output ntuple More...
 
double fPOT
 
MichelCandidatefMichelCandidate
 used for filling output ntuple More...
 
std::map< std::string, TTree * > fOutTrees
 
art::ServiceHandle< art::TFileServicefFileService
 
art::ServiceHandle< geo::GeometryfGeom
 
art::ServiceHandle< geo::LiveGeometryfLiveGeom
 
art::ServiceHandle< cheat::BackTrackerfBackTracker
 

Detailed Description

Definition at line 45 of file EnergyStandardCandles_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

calib::EnergyStandardCandles::EnergyStandardCandles ( const fhicl::ParameterSet pset)
explicit

Definition at line 125 of file EnergyStandardCandles_module.cc.

References reconfigure().

126  : EDAnalyzer(pset)
127  {
128  reconfigure(pset);
129  }
void reconfigure(const fhicl::ParameterSet &pset)
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
virtual calib::EnergyStandardCandles::~EnergyStandardCandles ( )
inlinevirtual

Definition at line 49 of file EnergyStandardCandles_module.cc.

References analyze(), beginJob(), endJob(), evt, and reconfigure().

49 {};

Member Function Documentation

void calib::EnergyStandardCandles::analyze ( const art::Event evt)

Definition at line 163 of file EnergyStandardCandles_module.cc.

References art::EventID::event(), fBackTracker, fGeneratorLabel, fHeaderInfo, FillMichelENtuple(), FillMuondEdXNtuple(), FillPi0Ntuple(), FindPi0s(), FindStoppingMuons(), fNumiBeamLabel, fPi0s, fPOT, fStoppingMus, art::DataViewImpl::getByLabel(), cheat::BackTracker::HaveTruthInfo(), art::Event::id(), art::Handle< T >::isValid(), art::Event::run(), sumdata::SpillData::spillpot, and art::Event::subRun().

Referenced by ~EnergyStandardCandles().

164  {
165 
166  fHeaderInfo["run"] = evt.run();
167  fHeaderInfo["subRun"] = evt.subRun();
168  fHeaderInfo["spillNum"] = evt.id().event();
169 
172  evt.getByLabel(fGeneratorLabel, spillPot);
173  else
174  evt.getByLabel(fNumiBeamLabel, spillPot);
175 
176  if (spillPot.isValid()) // won't be for PC
177  this->fPOT += spillPot->spillpot;
178 
179  fStoppingMus.clear();
180 
181  this->FindStoppingMuons(evt);
182  this->FindPi0s(evt);
183 
184  if (fStoppingMus.size() > 0)
185  {
186  this->FillMichelENtuple();
187  this->FillMuondEdXNtuple();
188  }
189 
190  if (fPi0s.size() > 0)
191  {
192  this->FillPi0Ntuple();
193  }
194  }
SubRunNumber_t subRun() const
Definition: Event.h:72
std::vector< std::shared_ptr< StoppingMu > > fStoppingMus
bool isValid() const
Definition: Handle.h:189
std::string fNumiBeamLabel
name of NuMI spill information container in event record
std::map< std::string, int > fHeaderInfo
run/subrun/gate for output ntuple
EventNumber_t event() const
Definition: EventID.h:116
std::vector< std::shared_ptr< Pi0 > > fPi0s
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
bool HaveTruthInfo() const
Is this a file with truth info in? (Is BackTracker going to be any use to you?)
Definition: BackTracker.h:133
void FindStoppingMuons(const art::Event &evt)
art::ServiceHandle< cheat::BackTracker > fBackTracker
RunNumber_t run() const
Definition: Event.h:77
double spillpot
POT for spill normalized by 10^12.
Definition: SpillData.h:26
std::string fGeneratorLabel
name of generator information label in event record
EventID id() const
Definition: Event.h:56
void calib::EnergyStandardCandles::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 131 of file EnergyStandardCandles_module.cc.

References fFileService, fHeaderInfo, fPOT, fPOTStorage, art::TFileDirectory::make(), PrepareMichelENtuple(), PrepareMuondEdXNtuple(), and PreparePi0Ntuple().

Referenced by ~EnergyStandardCandles().

132  {
133  this->fHeaderInfo = { {"run", 0}, {"subRun", 0}, {"spillNum", 0} };
134  this->fPOTStorage = this->fFileService->make<TParameter<double> >("POT", this->fPOT);
135  gDirectory->Append(this->fPOTStorage); // doesn't make it to the file without this. probably due to ROOT's crazy 'directory' system
136  this->fPOT = 0;
137 
138  this->PrepareMichelENtuple();
139  this->PrepareMuondEdXNtuple();
140  this->PreparePi0Ntuple();
141  }
TParameter< double > * fPOTStorage
container for POT that will go to output ntuple
std::map< std::string, int > fHeaderInfo
run/subrun/gate for output ntuple
art::ServiceHandle< art::TFileService > fFileService
T * make(ARGS...args) const
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

80  {
81  return selectors_;
82  }
detail::CachedProducts selectors_
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::EDAnalyzer::currentContext ( ) const
protectedinherited
void calib::EnergyStandardCandles::endJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 143 of file EnergyStandardCandles_module.cc.

References fMichelCandidate, fPOT, and fPOTStorage.

Referenced by ~EnergyStandardCandles().

144  {
145  // store the POT in the file
146  this->fPOTStorage->SetVal(this->fPOT);
147 
148  if (fMichelCandidate)
149  delete fMichelCandidate;
150  } // EnergyStandardCandles::endJob()
MichelCandidate * fMichelCandidate
used for filling output ntuple
TParameter< double > * fPOTStorage
container for POT that will go to output ntuple
void calib::EnergyStandardCandles::FillMichelENtuple ( )
private

Definition at line 640 of file EnergyStandardCandles_module.cc.

References FillMichelRecoInfo(), FillTruthInfo(), fMichelCandidate, fOutTrees, and fStoppingMus.

Referenced by analyze().

641  {
642 
643  for (const auto & stoppingMu : this->fStoppingMus)
644  {
645  MichelCandidate & michelCand = *(this->fMichelCandidate); // save on some typing
646 
647  this->FillMichelRecoInfo(stoppingMu, michelCand);
648  this->FillTruthInfo(stoppingMu, michelCand);
649 
650  this->fOutTrees["Michel"]->Fill();
651  } // for (stoppingMu)
652 
653  } // EnergyStandardCandles::FillMichelENtuple()
std::map< std::string, TTree * > fOutTrees
std::vector< std::shared_ptr< StoppingMu > > fStoppingMus
void FillTruthInfo(const std::shared_ptr< StoppingMu > stoppingMu, MichelCandidate &michelCand)
MichelCandidate * fMichelCandidate
used for filling output ntuple
void FillMichelRecoInfo(const std::shared_ptr< StoppingMu > stoppingMu, MichelCandidate &michelCand)
void calib::EnergyStandardCandles::FillMichelRecoInfo ( const std::shared_ptr< StoppingMu stoppingMu,
MichelCandidate michelCand 
)
private

Definition at line 332 of file EnergyStandardCandles_module.cc.

References calib::MichelCandidate::alreadyUsedEnergy, delta, calib::MichelCandidate::deltaR, calib::MichelCandidate::deltaT, allTimeWatchdog::endl, energy, calib::MichelCandidate::energy, calib::GeV2MeV, calib::MichelCandidate::hitEnergies, location, calib::MichelCandidate::location, calib::MichelCandidate::MID, calib::MichelCandidate::nAlreadyUsedHits, calib::MichelCandidate::parentFrontZ, std::sqrt(), calib::MichelCandidate::t_RMS, and wgt.

Referenced by FillMichelENtuple().

333  {
334  double deltaT_Ewgtd = 0;
335  double deltaR_Ewgtd = 0;
336  double MID_Ewgtd = 0;
337  double wgt = 0; // going to do a pulse-height-weighted sum
338  double hit_wgt = 0;
339  TVector3 location;
340  michelCand.hitEnergies.clear(); // this buffer is re-used. gotta empty it
341 
342  double t_mean_running(0), t_M_2_running(0);
343  for (const auto & michelClus : stoppingMu->michelEClusters)
344  {
345  for (unsigned int idx_cell = 0; idx_cell < michelClus->NCell(); idx_cell++)
346  {
347  const auto & recoHit = michelClus->RecoHit(idx_cell);
348  if (!recoHit.IsCalibrated())
349  continue;
350  michelCand.hitEnergies.push_back( recoHit.GeV() * michelClus->Weight(idx_cell) * GeV2MeV );
351  }
352  double energy = michelClus->TotalGeV() * GeV2MeV;
353  deltaT_Ewgtd += energy * michelClus->DeltaT();
354  deltaR_Ewgtd += energy * michelClus->DistToTrk();
355  MID_Ewgtd += energy * michelClus->MID();
356  location += energy * michelClus->MeanXYZ();
357  wgt += energy;
358 
359  // single-pass calculation for variance from https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance
360  for (const auto & hit : michelClus->WeightedHits())
361  {
362  double hit_pe = hit.hit->PE() * hit.weight;
363  double old_wgt = hit_wgt;
364  hit_wgt += hit_pe;
365  double delta = hit.hit->TNS() - t_mean_running;
366  double wgtd_delta = delta * hit_pe / hit_wgt;
367  t_mean_running += wgtd_delta;
368  t_M_2_running += old_wgt * delta * wgtd_delta;
369  mf::LogDebug("EnergyStandardCandles") << " calculating hit time variance: hit time, hit PE, hit_wgt, delta, t_mean_running, t_M_2_running = "
370  << hit.hit->TNS() << ", "
371  << hit_pe << ", "
372  << delta << ", "
373  << t_mean_running << ", "
374  << t_M_2_running;
375  }
376  }
377  if (wgt > 0)
378  {
379  michelCand.energy = wgt;
380  michelCand.deltaT = deltaT_Ewgtd / wgt;
381  michelCand.location = location * (1./wgt); // no operator/() in TVector3, strangely
382 // std::cout << " weighted location:" << std::endl;
383 // michelCand.location.Print();
384  michelCand.deltaR = deltaR_Ewgtd / wgt;
385  michelCand.MID = MID_Ewgtd / wgt;
386  }
387  else
388  {
389  michelCand.location = TVector3();
390  michelCand.deltaT = 0;
391  michelCand.deltaR = 0;
392  michelCand.MID = -999;
393  }
394 
395  if (hit_wgt > 0)
396  michelCand.t_RMS = sqrt(t_M_2_running/hit_wgt);
397  else
398  michelCand.t_RMS = 0;
399  mf::LogDebug("EnergyStandardCandles") << " hit time std. dev.: " << michelCand.t_RMS << std::endl;
400 
401  michelCand.nAlreadyUsedHits = stoppingMu->doubleCountedHits.size();
402  michelCand.alreadyUsedEnergy = std::accumulate(stoppingMu->doubleCountedHits.begin(),
403  stoppingMu->doubleCountedHits.end(),
404  0,
405  [] (double runningSum, const art::Ptr<rb::CellHit> & hit)
406  { return runningSum + hit->PE(); }
407  );
408 
409  michelCand.parentFrontZ = stoppingMu->track.Start().Z();
410 
411  } // EnergyStandardCandles::FillMichelRecoInfo
#define location
static const double GeV2MeV
double delta
Definition: runWimpSim.h:98
T sqrt(T number)
Definition: d0nt_math.hpp:156
double energy
Definition: plottest35.C:25
const ana::Var wgt
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
Definition: structs.h:12
void calib::EnergyStandardCandles::FillMuondEdXNtuple ( )
private

Definition at line 660 of file EnergyStandardCandles_module.cc.

Referenced by analyze().

661  {
662  }
void calib::EnergyStandardCandles::FillPi0Ntuple ( )
private

Definition at line 671 of file EnergyStandardCandles_module.cc.

References DEFINE_ART_MODULE().

Referenced by analyze().

672  {
673  }
void calib::EnergyStandardCandles::FillTrueMichelInfo ( const sim::Particle trueParticle,
TrueMichel eContrib 
)
private

Definition at line 460 of file EnergyStandardCandles_module.cc.

References CLHEP::cm, simb::MCParticle::Daughter(), dE, calib::TrueMichel::deadFraction, simb::MCParticle::E(), calib::TrueMichel::ElostToBrem, calib::TrueMichel::ElostToDeadMaterials, simb::MCParticle::EndE(), allTimeWatchdog::endl, fBackTracker, fGeom, fScintillatorName, GetName(), calib::GeV2MeV, MECModelEnuComparisons::i, eplot::material, geo::GeometryBase::Material(), geo::GeometryBase::MaterialsBetweenPoints(), CLHEP::mm, simb::MCParticle::NumberDaughters(), cheat::BackTracker::ParticleToFLSHit(), calib::TrueMichel::totalRange, simb::MCParticle::TrackId(), cheat::BackTracker::TrackIDToParticle(), simb::MCParticle::Trajectory(), and calib::TrueEContrib::trueFourP.

Referenced by FillTruthInfo().

461  {
462  if (!eContrib)
463  return;
464 
465  auto allHits = fBackTracker->ParticleToFLSHit(trueParticle->TrackId());
466  // auto onlyEhits = fBackTracker->ParticleToFLSHit(trueParticle->TrackId(), trueParticle->PdgCode()); // not trustworthy since there might be more particles in the daughter chain with the same PDG as the original e+/e-
467 
468 
469  mf::LogDebug("EnergyStandardCandles") << " True Michel electron:";
470 
471  double deadEnergy = 0; // that is, energy deposited in inactive material
472  double deadRange = 0;
473  double totalRange = 0;
474  const auto & traj = trueParticle->Trajectory();
475  {
476  // these braces to make the LogDebug object go out of scope
477  // after we're done with it and thus write to the stream
478  mf::LogDebug trajLog("EnergyStandardCandles");
479  trajLog << " Trajectory points:\n";
480  double lastE = -1;
481  TVector3 lastPos;
482  for (const auto & trajP : traj)
483  {
484  trajLog << " pos = (" << trajP.first.X() << "," << trajP.first.Y() << "," << trajP.first.Z() << ") mm;"
485  << " fourP = (" << trajP.second.E() << "," << trajP.second.Px() << "," << trajP.second.Py() << "," << trajP.second.Pz() << ") GeV\n";
486 
487  bool haveLast = lastE > 0;
488 
489  // compute how much of the energy in this trajectory step
490  // was lost in inactive ("dead") materials.
491  // can't do this exactly, because not enough information was
492  // retained here from GEANT. to first approximation, though,
493  // ionization energy (which is most of what we're worried about
494  // here, since the rad length is reasonably long) is proportional
495  // to density. so we weight the dE of this step
496  // by the fraction of the range (= density * step size)
497  // that was in "dead" materials. that's our "dead" energy.
498  if (haveLast)
499  {
500  double dE = lastE - trajP.second.E();
501  // now count how much of the energy was deposited in inactive material
502  std::vector<double> pathLengths;
503  std::vector<const TGeoMaterial*> materials;
504  fGeom->MaterialsBetweenPoints(lastPos, trajP.first.Vect(), pathLengths, materials);
505 
506  trajLog << " in this step:\n";
507  double stepTotalRange = 0;
508  double stepDeadRange = 0;
509  for (unsigned int idx_mat = 0; idx_mat < pathLengths.size(); idx_mat++)
510  {
511  const TGeoMaterial * material = materials[idx_mat];
512  double pathLength = pathLengths[idx_mat];
513  trajLog << " material: " << material->GetName()
514  << "; path length = " << pathLength << "mm;\n";
515  double stepRange = material->GetDensity() * (pathLength * CLHEP::mm / CLHEP::cm);
516  stepTotalRange += stepRange;
517  if (material->GetName() != fScintillatorName)
518  stepDeadRange += stepRange;
519  }
520 
521  if (stepTotalRange > 0)
522  deadEnergy += stepDeadRange / stepTotalRange * dE;
523 
524  deadRange += stepDeadRange;
525  totalRange += stepTotalRange;
526  } // if (haveLast)
527 
528  lastE = trajP.second.E();
529  lastPos = trajP.first.Vect();
530  } // for (traj)
531  } // scope for trajLog
532 
533  mf::LogDebug("EnergyStandardCandles") << " Children: " << trueParticle->NumberDaughters() << std::endl;
534 // double childEnergy = 0; // not sure what this quantity really tells us.
535  double bremEnergy = 0;
536  for (int i = 0; i < trueParticle->NumberDaughters(); i++)
537  {
538  auto daughterParticle = this->fBackTracker->TrackIDToParticle(trueParticle->Daughter(i));
539  double daughterE = daughterParticle->E();
540  TLorentzVector daughterPos = daughterParticle->Position();
541  mf::LogDebug("EnergyStandardCandles") << " PID: " << daughterParticle->PdgCode() << ";"
542  << " process name: " << daughterParticle->Process() << ";"
543  << " energy: " << daughterE * GeV2MeV << " MeV;"
544  << " creation point: (" << daughterPos.X() << "," << daughterPos.Y() << "," << daughterPos.Z() << ")";
545 // childEnergy += daughterE;
546  if (daughterParticle->Process() == "eBrem")
547  {
548  bremEnergy += daughterE;
549  // if the Brem. was created in 'dead' material,
550  // don't count the Brem's energy in the "dead energy" -- that double-counts
551  if (fGeom->Material(daughterPos.X(), daughterPos.Y(), daughterPos.Z())->GetName() != fScintillatorName )
552  deadEnergy -= daughterE;
553  }
554  // since the parent is an electron or positron,
555  // this is Moller/Bhaba scattering,
556  // which is delta ray ("knock-on electron") production by electrons.
557  // this will produce prompt, nearby energy that should be
558  // lumped together with the regular ionization from the Michel.
559  else if (daughterParticle->Process() == "eIoni")
560  {
561  auto daughterHits = fBackTracker->ParticleToFLSHit(daughterParticle->TrackId());
562  allHits.insert(allHits.end(), daughterHits.begin(), daughterHits.end());
563  }
564  }
565  eContrib->ElostToBrem = bremEnergy * GeV2MeV;
566  eContrib->ElostToDeadMaterials = deadEnergy * GeV2MeV;
567  eContrib->totalRange = totalRange;
568  if (totalRange > 0)
569  eContrib->deadFraction = deadRange / totalRange;
570 
571 
572  double allHitEnergy = std::accumulate(allHits.begin(), allHits.end(), 0.0, [&](double runningSum, const auto & hit) {return runningSum + hit.GetEdep(); });
573 
574  mf::LogDebug("EnergyStandardCandles") << "Michel E = " << eContrib->trueFourP.E() << " MeV).";
575  mf::LogDebug("EnergyStandardCandles") << " Total energy in " << allHits.size() << " hits: " << GeV2MeV * allHitEnergy;
576 // mf::LogDebug("EnergyStandardCandles") << " Total energy in " << onlyEhits.size() << " hits directly from Michel E: " << GeV2MeV * EhitEnergy << std::endl;
577  mf::LogDebug("EnergyStandardCandles") << " End energy of Michel e: " << trueParticle->EndE() * GeV2MeV << " MeV";
578 // mf::LogDebug("EnergyStandardCandles") << " Total energy of children: " << childEnergy * GeV2MeV << " MeV" << std::endl;
579  mf::LogDebug("EnergyStandardCandles") << " Invisible energy: " << (trueParticle->E() - allHitEnergy) * GeV2MeV << " MeV";
580  mf::LogDebug("EnergyStandardCandles") << " (estimated energy lost in inactive material: " << deadEnergy * GeV2MeV << " MeV)";
581  mf::LogDebug("EnergyStandardCandles") << " (energy lost in Bremsstrahlung: " << bremEnergy * GeV2MeV << " MeV)";
582 
583  } // EnergyStandardCandles::FillTrueMichelInfo
double E(const int i=0) const
Definition: MCParticle.h:232
double EndE() const
Definition: MCParticle.h:243
TGeoMaterial * Material(double x, double y, double z) const
static const double GeV2MeV
const simb::MCTrajectory & Trajectory() const
Definition: MCParticle.h:252
std::vector< sim::FLSHit > ParticleToFLSHit(const int &trackID) const
All the FLSHits that were created by the track id trackID, sorted from most to least light...
void MaterialsBetweenPoints(const double *p1, const double *p2, std::vector< double > &ds, std::vector< const TGeoMaterial * > &mat) const
double dE
int NumberDaughters() const
Definition: MCParticle.h:216
int TrackId() const
Definition: MCParticle.h:209
int Daughter(const int i) const
Definition: MCParticle.cxx:112
string material
Definition: eplot.py:19
static constexpr double cm
Definition: SystemOfUnits.h:99
std::string GetName(int i)
std::string fScintillatorName
name of geometry TGeoMaterial corresponding to scintillator
const sim::Particle * TrackIDToParticle(int const &id) const
Returns a pointer to the sim::Particle object corresponding to the given TrackID. ...
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
Definition: structs.h:12
static constexpr double mm
Definition: SystemOfUnits.h:95
art::ServiceHandle< cheat::BackTracker > fBackTracker
art::ServiceHandle< geo::Geometry > fGeom
void calib::EnergyStandardCandles::FillTruthInfo ( const std::shared_ptr< StoppingMu stoppingMu,
MichelCandidate michelCand 
)
private

Definition at line 585 of file EnergyStandardCandles_module.cc.

References abs(), calib::TrueEContrib::contribEFrac, simb::MCParticle::E(), calib::MichelCandidate::eContribs, fBackTracker, FillTrueMichelInfo(), FixPhotonAncestry(), calib::TrueEContrib::fracCaptured, calib::TrueEContrib::geantCreationProcName, calib::GeV2MeV, simb::MCParticle::Mother(), calib::TrueEContrib::pdg, simb::MCParticle::PdgCode(), simb::MCParticle::Process(), simb::MCParticle::Px(), simb::MCParticle::Py(), simb::MCParticle::Pz(), cheat::BackTracker::TrackIDToParticle(), and calib::TrueEContrib::trueFourP.

Referenced by FillMichelENtuple().

586  {
587  michelCand.eContribs.clear();
588  for (const auto & geantTrackInfo : stoppingMu->michelTruth)
589  {
590  TrueEContrib * eContrib;
591  const sim::Particle * trueParticle = this->fBackTracker->TrackIDToParticle(geantTrackInfo.trackID);
592  const sim::Particle * parentParticle = NULL;
593  if (trueParticle->Process() != "Primary")
594  parentParticle = this->fBackTracker->TrackIDToParticle(trueParticle->Mother());
595 
596  if ((trueParticle->PdgCode() == 11 && trueParticle->Process() == "muMinusCaptureAtRest")
597  || (abs(trueParticle->PdgCode()) == 11 && trueParticle->Process() == "Decay" && abs(parentParticle->PdgCode()) == 13))
598  eContrib = new TrueMichel;
599  else if (parentParticle && trueParticle->Process() == "nCapture")
600  eContrib = new TrueNeutronCapture;
601  else
602  eContrib = new TrueEContrib;
603 
604  // photons from pi0 decay, neutron capture need special treatment
605  if (trueParticle->PdgCode() == 22)
606  this->FixPhotonAncestry(trueParticle, parentParticle, eContrib);
607 // else if (abs(trueParticle->PdgCode()) == 13)
608 // {
609 // std::cout << " muon. Process: " << trueParticle->Process();
610 // if (parentParticle)
611 // std::cout << "; parent PDG: " << parentParticle->PdgCode();
612 // std::cout << std::endl;
613 // }
614  eContrib->pdg = trueParticle->PdgCode();
615  eContrib->geantCreationProcName = trueParticle->Process();
616  eContrib->trueFourP = TLorentzVector(
617  trueParticle->Px() * GeV2MeV,
618  trueParticle->Py() * GeV2MeV,
619  trueParticle->Pz() * GeV2MeV,
620  trueParticle->E() * GeV2MeV
621  );
622  eContrib->contribEFrac = geantTrackInfo.energyFrac;
623  eContrib->fracCaptured = geantTrackInfo.energy/trueParticle->E();
624 
625  // if it really was a Michel electron, how much of it did we get?
626  // (aside: looks like GEANT4 combines muon capture and decay-in-orbit
627  // into a single process, 'muMinusCaptureAtRest'. in that process
628  // we wind up with the usual electron and two neutrinos, possibly along
629  // with some de-excitation photons, the decay time away from the muon's
630  // final time. this is in contrast to normal muon decay, in which
631  // the muon's lifetime is kept by the muon particle and the delta T
632  // between the electron and the muon is 0.)
633  this->FillTrueMichelInfo(trueParticle, dynamic_cast<TrueMichel*>(eContrib));
634 
635  michelCand.eContribs.push_back(eContrib);
636  } // for (geant particle contributor)
637 
638  } //EnergyStandardCandles::FillTruthInfo()
double E(const int i=0) const
Definition: MCParticle.h:232
int PdgCode() const
Definition: MCParticle.h:211
double Py(const int i=0) const
Definition: MCParticle.h:230
void FixPhotonAncestry(const sim::Particle *&trueParticle, const sim::Particle *parentParticle, TrueEContrib *eContrib)
Sometimes photon ancestries are more complicated than we need them to be.
static const double GeV2MeV
int Mother() const
Definition: MCParticle.h:212
double Px(const int i=0) const
Definition: MCParticle.h:229
void abs(TH1 *hist)
std::string Process() const
Definition: MCParticle.h:214
const sim::Particle * TrackIDToParticle(int const &id) const
Returns a pointer to the sim::Particle object corresponding to the given TrackID. ...
double Pz(const int i=0) const
Definition: MCParticle.h:231
art::ServiceHandle< cheat::BackTracker > fBackTracker
void FillTrueMichelInfo(const sim::Particle *trueParticle, TrueMichel *eContrib)
void calib::EnergyStandardCandles::FindPi0s ( const art::Event evt)
private

Definition at line 311 of file EnergyStandardCandles_module.cc.

Referenced by analyze().

312  {
313 
314  // look at the event.
315  // is there anything that meets the pi0 criteria?:
316  }
void calib::EnergyStandardCandles::FindStoppingMuons ( const art::Event evt)
private

Definition at line 196 of file EnergyStandardCandles_module.cc.

References art::PtrVector< T >::begin(), simb::MCParticle::E(), art::PtrVector< T >::end(), fBackTracker, fMichelLabel, fStoppingMus, fTrackLabel, art::DataViewImpl::getByLabel(), cheat::BackTracker::HaveTruthInfo(), hits(), cheat::BackTracker::HitsToTrackIDE(), art::PtrVector< T >::insert(), IsContained(), IsMuon(), simb::MCParticle::PdgCode(), and cheat::BackTracker::TrackIDToParticle().

Referenced by analyze().

197  {
198 
199  // look at all the tracks.
200  // do any of them meet the stopping muon criteria?:
201  // - pass muon PID
202  // - stops inside fiducial volume
203  // - matched Michel electron candidate
204  // if so, store the relevant info for plotting later on.
205 
207  evt.getByLabel(fTrackLabel, tracks);
208  art::FindManyP<me::TrkME> michelEs(tracks, evt, fMichelLabel);
209 
210  // will need these for checking whether Michel finding is vacuuming up
211  // already tracked hits
212  std::set<art::Ptr<rb::CellHit> > hitsOnTracks;
213  for(const auto & track : *tracks)
214  {
215  const auto & hits = track.AllCells();
216  hitsOnTracks.insert(hits.begin(), hits.end());
217  }
218 
219  mf::LogDebug("EnergyStandardCandles") << "There are " << tracks->size() << " tracks in this event.";
220 
221  auto it_track = tracks->begin();
222  for (unsigned long int trk_idx = 0; it_track != tracks->end(); trk_idx++, it_track++)
223  {
224  mf::LogDebug("EnergyStandardCandles") << "Considering track #" << trk_idx << ":";
225  const rb::Track & track = *it_track;
226  if ( !IsContained(track) )
227  {
228  mf::LogDebug("EnergyStandardCandles") << " track not contained. skip.";
229  continue;
230  }
231 
232  if ( !IsMuon(track) )
233  {
234  mf::LogDebug("EnergyStandardCandles") << " track not a muon. skip.";
235  continue;
236  }
237 
238  // because of the association it's kind of messy to package the Michel matching
239  // into a function (requires lots of arguments). it's short so just do it here
240  std::vector<art::Ptr<me::TrkME> > matchedMichelClusters = michelEs.at(trk_idx);
241  if ( matchedMichelClusters.size() == 0 )
242  {
243  mf::LogDebug("EnergyStandardCandles") << " track has no matched Michel clusters. skip.";
244  continue;
245  }
246 
247  // grab all the hits from all the Michel-matched clusters.
248  // we need to pass hits (not clusters) to the BackTracker?
249  art::PtrVector<rb::CellHit> michelHits;
250  for (auto michelClus : matchedMichelClusters)
251  {
252  auto clusHits = michelClus->AllCells();
253  michelHits.insert(michelHits.end(), clusHits.begin(), clusHits.end());
254 
255  }
256  // were any of these hits already owned by some other track?
257  // (need the set because set_intersection() assumes they're unique & sorted;
258  // shoving them into a std::set does that automatically)
259  std::set<art::Ptr<rb::CellHit> > michelHits_set(michelHits.begin(), michelHits.end());
261  std::set_intersection(michelHits_set.begin(),
262  michelHits_set.end(),
263  hitsOnTracks.begin(),
264  hitsOnTracks.end(),
265  ixn.begin());
266 
267  std::vector<cheat::TrackIDE> michelTruthInfo;
269  {
270  michelTruthInfo = fBackTracker->HitsToTrackIDE(michelHits);
271  for (const auto & geantTrackInfo : michelTruthInfo)
272  {
273  const sim::Particle * trueParticle = this->fBackTracker->TrackIDToParticle(geantTrackInfo.trackID);
274  mf::LogDebug("EnergyStandardCandles") << " frac from PID " << trueParticle->PdgCode() << " = " << geantTrackInfo.energyFrac;
275  mf::LogDebug("EnergyStandardCandles") << " (particle energy = " << trueParticle->E() << " MeV)";
276  }
277  }
278 
279  // this is (probably) a stopping muon! store info for histogramming later.
280  fStoppingMus.push_back( std::make_shared<StoppingMu>(track, std::move(matchedMichelClusters), std::move(ixn), michelTruthInfo) );
281  mf::LogDebug("EnergyStandardCandles") << " accepted.";
282  } // for (it_trk, trk_idx)
283  } // StandardCandleSelection::FindStoppingMuons()
double E(const int i=0) const
Definition: MCParticle.h:232
int PdgCode() const
Definition: MCParticle.h:211
std::vector< std::shared_ptr< StoppingMu > > fStoppingMus
iterator begin()
Definition: PtrVector.h:223
Definition: event.h:19
A rb::Prong with full reconstructed trajectory.
Definition: Track.h:20
bool IsContained(const rb::Track &trk) const
void hits()
Definition: readHits.C:15
iterator end()
Definition: PtrVector.h:237
const sim::Particle * TrackIDToParticle(int const &id) const
Returns a pointer to the sim::Particle object corresponding to the given TrackID. ...
bool IsMuon(const rb::Track &trk) const
std::vector< TrackIDE > HitsToTrackIDE(const std::vector< const rb::CellHit * > &hits, bool useBirksE=false) const
Returns vector of TrackIDE structs contributing to the given collection of hits.
iterator insert(iterator position, Ptr< U > const &p)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
std::string fTrackLabel
name of tracks container in event record
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
bool HaveTruthInfo() const
Is this a file with truth info in? (Is BackTracker going to be any use to you?)
Definition: BackTracker.h:133
art::ServiceHandle< cheat::BackTracker > fBackTracker
std::string fMichelLabel
name of Michel electron container in event record
void calib::EnergyStandardCandles::FixPhotonAncestry ( const sim::Particle *&  trueParticle,
const sim::Particle parentParticle,
TrueEContrib eContrib 
)
private

Sometimes photon ancestries are more complicated than we need them to be.

Definition at line 414 of file EnergyStandardCandles_module.cc.

References simb::MCParticle::Daughter(), fBackTracker, MECModelEnuComparisons::i, calib::TrueNeutronCapture::nCaptureNucleus, simb::MCParticle::NumberDaughters(), simb::MCParticle::PdgCode(), simb::MCParticle::Process(), and cheat::BackTracker::TrackIDToParticle().

Referenced by FillTruthInfo().

415  {
416  if (parentParticle && parentParticle->PdgCode() == 111)
417  trueParticle = parentParticle;
418  else if (parentParticle && trueParticle->Process() == "nCapture")
419  {
420  TrueNeutronCapture * nCapContrib = dynamic_cast<TrueNeutronCapture*>(eContrib);
421 
422  trueParticle = parentParticle;
423 // std::cout << " neutron capture. neutron daughter particles:" << std::endl;
424  for (int i = 0; i < parentParticle->NumberDaughters(); i++)
425  {
426  auto daughterParticle = this->fBackTracker->TrackIDToParticle(parentParticle->Daughter(i));
427  // in GEANT4 evidently the neutron capture byproduct nucleus
428  // is the only daughter of the captured neutron that has a nucleus
429  // PDG code (1000000000 to 10999999999) AND has the 'nCapture' process set.
430  // (the neutron might bump into other nuclei and knock them out via
431  // elastic or inelastic scattering, so we've got to look at the process too.)
432  // note that this tells you the RESULTING nucleus, not the STRUCK one.
433  // Hopefully just subtracting 1 from the atomic mass of the resulting nucleus
434  // yields the correct struck nucleus?
435  auto daughterPdg = daughterParticle->PdgCode();
436  if (daughterPdg > 1000000000 && daughterPdg < 1099999999 && daughterParticle->Process() == "nCapture")
437  {
438  // PDG code for nuclei is: 10LZZZAAAI
439  // (L = strangeness, ZZZ = 3-digit atomic number, AAA = 3-digit mass number, I = isomer number (resonant state))
440  nCapContrib->nCaptureNucleus = daughterPdg - 10;
441 // std::cout << " neutron captured on nucleus: " << nCapContrib->nCaptureNucleus << std::endl;
442  break;
443  }
444 // std::cout << " " << daughterParticle->PdgCode() << " (process: " << daughterParticle->Process() << ")" << std::endl;
445  } // for (i)
446  } // else if (is N capture)
447 
448  /*
449  else
450  {
451  std::cout << " photon with unclassified parent. Process: " << trueParticle->Process();
452  if (parentParticle)
453  std::cout << "; parent PDG: " << parentParticle->PdgCode();
454  std::cout << std::endl;
455  }
456 */
457 
458  } // EnergyStandardCandles::FixPhotonAncestry()
int PdgCode() const
Definition: MCParticle.h:211
std::string Process() const
Definition: MCParticle.h:214
int NumberDaughters() const
Definition: MCParticle.h:216
int Daughter(const int i) const
Definition: MCParticle.cxx:112
const sim::Particle * TrackIDToParticle(int const &id) const
Returns a pointer to the sim::Particle object corresponding to the given TrackID. ...
art::ServiceHandle< cheat::BackTracker > fBackTracker
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
art::Handle<art::TriggerResults> art::EventObserverBase::getTriggerResults ( Event const &  e) const
inlineinherited

Definition at line 61 of file EventObserverBase.h.

References art::detail::CachedProducts::getOneTriggerResults(), and art::EventObserverBase::selectors_.

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
Float_t e
Definition: plot.C:35
bool calib::EnergyStandardCandles::IsContained ( const rb::Track trk) const
private

Definition at line 285 of file EnergyStandardCandles_module.cc.

References geo::LiveGeometry::DistToEdgeXY(), geo::LiveGeometry::DistToEdgeZ(), fLiveGeom, fMinDistToEdge, rb::Prong::Start(), and rb::Track::Stop().

Referenced by FindStoppingMuons().

286  {
287  // cribbed from StopperSelection in this package
288 
289  const TVector3 v1 = trk.Start();
290  const TVector3 v2 = trk.Stop();
291  const TVector3 stop = (v1.Y() < v2.Y()) ? v1 : v2; // Start and end don't mean much, pick whichever is lowest in y.
292 
293  mf::LogDebug("EnergyStandardCandles") << "Track "
294  << "start pos: (" << v1.x() << "," << v1.y() << "," << v1.z() << "); "
295  << "stop pos: (" << v2.x() << "," << v2.y() << "," << v2.z() << ")";
296  if(fLiveGeom->DistToEdgeXY(stop) < fMinDistToEdge ||
298  return false;
299  if(v1.X() == v2.X() || v1.Y() == v2.Y())
300  return false; // dx or dy = 0 means bad fit or 2d track only
301 
302  return true;
303  }
double DistToEdgeXY(TVector3 vertex)
virtual TVector3 Start() const
Definition: Prong.h:73
double DistToEdgeZ(TVector3 vertex)
art::ServiceHandle< geo::LiveGeometry > fLiveGeom
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
double fMinDistToEdge
minimum distance in cm to edge of detector to qualify as "contained"
TVector3 Stop() const
Position of the final trajectory point.
Definition: Track.cxx:186
bool calib::EnergyStandardCandles::IsMuon ( const rb::Track trk) const
private

Definition at line 305 of file EnergyStandardCandles_module.cc.

Referenced by FindStoppingMuons().

306  {
307  // just a stub for the moment
308  return true;
309  }
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::EventObserverBase::modifiesEvent ( ) const
inlineinherited

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void calib::EnergyStandardCandles::PrepareMichelENtuple ( )
private

Definition at line 318 of file EnergyStandardCandles_module.cc.

References fFileService, fHeaderInfo, fMichelCandidate, fOutTrees, art::TFileDirectory::make(), and string.

Referenced by beginJob().

319  {
320  this->fOutTrees["Michel"] = fFileService->make<TTree>("MichelE", "Michel electron candidates");
321 
322  for (auto & branchPair : this->fHeaderInfo)
323  {
324  std::string typeCode = branchPair.first + "/I";
325  this->fOutTrees["Michel"]->Branch(branchPair.first.c_str(), &branchPair.second, typeCode.c_str());
326  }
327 
328  this->fMichelCandidate = new MichelCandidate;
329  this->fOutTrees["Michel"]->Branch("michel_candidate", this->fMichelCandidate);
330  }
std::map< std::string, TTree * > fOutTrees
MichelCandidate * fMichelCandidate
used for filling output ntuple
std::map< std::string, int > fHeaderInfo
run/subrun/gate for output ntuple
art::ServiceHandle< art::TFileService > fFileService
T * make(ARGS...args) const
enum BeamMode string
void calib::EnergyStandardCandles::PrepareMuondEdXNtuple ( )
private

Definition at line 656 of file EnergyStandardCandles_module.cc.

Referenced by beginJob().

657  {
658  }
void calib::EnergyStandardCandles::PreparePi0Ntuple ( )
private

Definition at line 665 of file EnergyStandardCandles_module.cc.

Referenced by beginJob().

666  {
667 
668 
669  }
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void calib::EnergyStandardCandles::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 152 of file EnergyStandardCandles_module.cc.

References fGeneratorLabel, fHitLabel, fMichelLabel, fMinDistToEdge, fNumiBeamLabel, fScintillatorName, fTrackLabel, fhicl::ParameterSet::get(), and string.

Referenced by EnergyStandardCandles(), and ~EnergyStandardCandles().

153  {
154  fGeneratorLabel = pset.get<std::string> ( "GeneratorInput" );
155  fHitLabel = pset.get<std::string> ( "HitLabel" );
156  fMichelLabel = pset.get<std::string> ( "MichelLabel" );
157  fMinDistToEdge = pset.get<double> ( "MinDistToEdge", 50. ); // TODO: what are the units here?
158  fNumiBeamLabel = pset.get<std::string> ( "NuMIBeamInput" );
159  fScintillatorName = pset.get<std::string> ( "ScintillatorName" );
160  fTrackLabel = pset.get<std::string> ( "TrackLabel" );
161  }
std::string fNumiBeamLabel
name of NuMI spill information container in event record
T get(std::string const &key) const
Definition: ParameterSet.h:231
std::string fScintillatorName
name of geometry TGeoMaterial corresponding to scintillator
std::string fTrackLabel
name of tracks container in event record
std::string fHitLabel
name of hits container in event record
double fMinDistToEdge
minimum distance in cm to edge of detector to qualify as "contained"
std::string fMichelLabel
name of Michel electron container in event record
std::string fGeneratorLabel
name of generator information label in event record
enum BeamMode string
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

References string.

36  {}
fhicl::ParameterSetID art::EventObserverBase::selectorConfig ( ) const
inlineinherited

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

57  {
58  return selector_config_id_;
59  }
fhicl::ParameterSetID selector_config_id_
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

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

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited

Definition at line 46 of file EventObserverBase.h.

References art::EventObserverBase::wantAllEvents_.

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

47  {
48  return wantAllEvents_;
49  }
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited

Definition at line 51 of file EventObserverBase.h.

References art::EventObserverBase::selectors_, and art::detail::CachedProducts::wantEvent().

52  {
53  return selectors_.wantEvent(e);
54  }
detail::CachedProducts selectors_
Float_t e
Definition: plot.C:35
bool wantEvent(Event const &)
std::string art::EDAnalyzer::workerType ( ) const
inlineinherited

Definition at line 109 of file EDAnalyzer.h.

References art::EDAnalyzer::currentContext().

110  {
111  return "WorkerT<EDAnalyzer>";
112  }

Member Data Documentation

art::ServiceHandle<cheat::BackTracker> calib::EnergyStandardCandles::fBackTracker
private
art::ServiceHandle<art::TFileService> calib::EnergyStandardCandles::fFileService
private

Definition at line 119 of file EnergyStandardCandles_module.cc.

Referenced by beginJob(), and PrepareMichelENtuple().

double calib::EnergyStandardCandles::fFrontSize
private

maximum distance to front of detector to qualify as "front-entering"

Definition at line 103 of file EnergyStandardCandles_module.cc.

std::string calib::EnergyStandardCandles::fGeneratorLabel
private

name of generator information label in event record

Definition at line 104 of file EnergyStandardCandles_module.cc.

Referenced by analyze(), and reconfigure().

art::ServiceHandle<geo::Geometry> calib::EnergyStandardCandles::fGeom
private

Definition at line 120 of file EnergyStandardCandles_module.cc.

Referenced by FillTrueMichelInfo().

std::map<std::string, int> calib::EnergyStandardCandles::fHeaderInfo
private

run/subrun/gate for output ntuple

Definition at line 112 of file EnergyStandardCandles_module.cc.

Referenced by analyze(), beginJob(), and PrepareMichelENtuple().

std::string calib::EnergyStandardCandles::fHitLabel
private

name of hits container in event record

Definition at line 105 of file EnergyStandardCandles_module.cc.

Referenced by reconfigure().

art::ServiceHandle<geo::LiveGeometry> calib::EnergyStandardCandles::fLiveGeom
private

Definition at line 121 of file EnergyStandardCandles_module.cc.

Referenced by IsContained().

MichelCandidate* calib::EnergyStandardCandles::fMichelCandidate
private

used for filling output ntuple

Definition at line 115 of file EnergyStandardCandles_module.cc.

Referenced by endJob(), FillMichelENtuple(), and PrepareMichelENtuple().

std::string calib::EnergyStandardCandles::fMichelLabel
private

name of Michel electron container in event record

Definition at line 106 of file EnergyStandardCandles_module.cc.

Referenced by FindStoppingMuons(), and reconfigure().

double calib::EnergyStandardCandles::fMinDistToEdge
private

minimum distance in cm to edge of detector to qualify as "contained"

Definition at line 108 of file EnergyStandardCandles_module.cc.

Referenced by IsContained(), and reconfigure().

std::string calib::EnergyStandardCandles::fNumiBeamLabel
private

name of NuMI spill information container in event record

Definition at line 107 of file EnergyStandardCandles_module.cc.

Referenced by analyze(), and reconfigure().

std::map<std::string, TTree*> calib::EnergyStandardCandles::fOutTrees
private

Definition at line 117 of file EnergyStandardCandles_module.cc.

Referenced by FillMichelENtuple(), and PrepareMichelENtuple().

std::vector<std::shared_ptr<Pi0> > calib::EnergyStandardCandles::fPi0s
private

Definition at line 101 of file EnergyStandardCandles_module.cc.

Referenced by analyze().

double calib::EnergyStandardCandles::fPOT
private

Definition at line 114 of file EnergyStandardCandles_module.cc.

Referenced by analyze(), beginJob(), and endJob().

TParameter<double>* calib::EnergyStandardCandles::fPOTStorage
private

container for POT that will go to output ntuple

Definition at line 113 of file EnergyStandardCandles_module.cc.

Referenced by beginJob(), and endJob().

std::string calib::EnergyStandardCandles::fScintillatorName
private

name of geometry TGeoMaterial corresponding to scintillator

Definition at line 109 of file EnergyStandardCandles_module.cc.

Referenced by FillTrueMichelInfo(), and reconfigure().

std::vector<std::shared_ptr<StoppingMu> > calib::EnergyStandardCandles::fStoppingMus
private

Definition at line 96 of file EnergyStandardCandles_module.cc.

Referenced by analyze(), FillMichelENtuple(), and FindStoppingMuons().

std::string calib::EnergyStandardCandles::fTrackLabel
private

name of tracks container in event record

Definition at line 110 of file EnergyStandardCandles_module.cc.

Referenced by FindStoppingMuons(), and reconfigure().


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