Public Member Functions | Private Member Functions | Private Attributes | List of all members
dune::EnergyReco Class Reference
Inheritance diagram for dune::EnergyReco:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 EnergyReco (fhicl::ParameterSet const &pset)
 
void produce (art::Event &evt) override
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

art::Ptr< recob::TrackGetLongestTrack (const art::Event &event)
 
art::Ptr< recob::ShowerGetHighestChargeShower (detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const art::Event &event)
 

Private Attributes

std::string fWireLabel
 
std::string fHitLabel
 
std::string fTrackLabel
 
std::string fShowerLabel
 
std::string fTrackToHitLabel
 
std::string fShowerToHitLabel
 
std::string fHitToSpacePointLabel
 
int fRecoMethod
 
NeutrinoEnergyRecoAlg fNeutrinoEnergyRecoAlg
 

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 41 of file EnergyReco_module.cc.

Constructor & Destructor Documentation

dune::EnergyReco::EnergyReco ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 70 of file EnergyReco_module.cc.

70  :
71  EDProducer(pset),
72  fWireLabel(pset.get<std::string>("WireLabel")),
73  fHitLabel(pset.get<std::string>("HitLabel")),
74  fTrackLabel(pset.get<std::string>("TrackLabel")),
75  fShowerLabel(pset.get<std::string>("ShowerLabel")),
76  fTrackToHitLabel(pset.get<std::string>("TrackToHitLabel")),
77  fShowerToHitLabel(pset.get<std::string>("ShowerToHitLabel")),
78  fHitToSpacePointLabel(pset.get<std::string>("HitToSpacePointLabel")),
79  fRecoMethod(pset.get<int>("RecoMethod")),
80  fNeutrinoEnergyRecoAlg(pset.get<fhicl::ParameterSet>("NeutrinoEnergyRecoAlg"),fTrackLabel,fShowerLabel,
82 {
83  produces<dune::EnergyRecoOutput>();
84  produces<art::Assns<dune::EnergyRecoOutput, recob::Track>>();
85  produces<art::Assns<dune::EnergyRecoOutput, recob::Shower>>();
86 }
std::string string
Definition: nybbler.cc:12
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
std::string fTrackToHitLabel
NeutrinoEnergyRecoAlg fNeutrinoEnergyRecoAlg
std::string fTrackLabel
std::string fWireLabel
std::string fShowerLabel
std::string fShowerToHitLabel
std::string fHitToSpacePointLabel

Member Function Documentation

art::Ptr< recob::Shower > dune::EnergyReco::GetHighestChargeShower ( detinfo::DetectorClocksData const &  clockData,
detinfo::DetectorPropertiesData const &  detProp,
const art::Event event 
)
private

Definition at line 142 of file EnergyReco_module.cc.

145 {
147  const std::vector<art::Ptr<recob::Shower> > showers(dune_ana::DUNEAnaEventUtils::GetShowers(event, fShowerLabel));
148  if (0 == showers.size())
149  return pShower;
150 
151  double maxCharge(std::numeric_limits<double>::lowest());
152  for (unsigned int iShower = 0; iShower < showers.size(); ++iShower)
153  {
154  const std::vector<art::Ptr<recob::Hit> > showerHits(dune_ana::DUNEAnaHitUtils::GetHitsOnPlane(dune_ana::DUNEAnaShowerUtils::GetHits(showers[iShower],
155  event,fShowerToHitLabel),2));
156  const double showerCharge(dune_ana::DUNEAnaHitUtils::LifetimeCorrectedTotalHitCharge(clockData, detProp, showerHits));
157  if (showerCharge-maxCharge > std::numeric_limits<double>::epsilon())
158  {
159  maxCharge = showerCharge;
160  pShower = showers[iShower];
161  }
162  }
163  return pShower;
164 }
static double LifetimeCorrectedTotalHitCharge(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const std::vector< art::Ptr< recob::Hit > > &hits)
get the total hit charge, corrected for lifetime
std::string fShowerLabel
static std::vector< art::Ptr< recob::Hit > > GetHits(const art::Ptr< recob::Shower > &pShower, const art::Event &evt, const std::string &label)
Get the hits associated with the shower.
std::string fShowerToHitLabel
static std::vector< art::Ptr< recob::Shower > > GetShowers(const art::Event &evt, const std::string &label)
Get the showers from the event. This function shouldn&#39;t be used as the basis of an analysis...
static std::vector< art::Ptr< recob::Hit > > GetHitsOnPlane(const std::vector< art::Ptr< recob::Hit >> &hits, const geo::PlaneID::PlaneID_t planeID)
Get all hits on a specific plane.
art::Ptr< recob::Track > dune::EnergyReco::GetLongestTrack ( const art::Event event)
private

Definition at line 120 of file EnergyReco_module.cc.

121 {
123  const std::vector<art::Ptr<recob::Track> > tracks(dune_ana::DUNEAnaEventUtils::GetTracks(event, fTrackLabel));
124  if (0 == tracks.size())
125  return pTrack;
126 
127  double longestLength(std::numeric_limits<double>::lowest());
128  for (unsigned int iTrack = 0; iTrack < tracks.size(); ++iTrack)
129  {
130  const double length(tracks[iTrack]->Length());
131  if (length-longestLength > std::numeric_limits<double>::epsilon())
132  {
133  longestLength = length;
134  pTrack = tracks[iTrack];
135  }
136  }
137  return pTrack;
138 }
float Length(const PFPStruct &pfp)
Definition: PFPUtils.cxx:3303
static std::vector< art::Ptr< recob::Track > > GetTracks(const art::Event &evt, const std::string &label)
Get the tracks from the event. This function shouldn&#39;t be used as the basis of an analysis...
std::string fTrackLabel
Definition: tracks.py:1
void dune::EnergyReco::produce ( art::Event evt)
overridevirtual

Implements art::EDProducer.

Definition at line 90 of file EnergyReco_module.cc.

91 {
92  std::unique_ptr<dune::EnergyRecoOutput> energyRecoOutput;
93  auto assnstrk = std::make_unique<art::Assns<dune::EnergyRecoOutput, recob::Track>>();
94  auto assnsshw = std::make_unique<art::Assns<dune::EnergyRecoOutput, recob::Shower>>();
95 
96  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService>()->DataFor(evt);
97  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService>()->DataFor(evt, clockData);
98  art::Ptr<recob::Track> longestTrack(this->GetLongestTrack(evt));
99  art::Ptr<recob::Shower> highestChargeShower(this->GetHighestChargeShower(clockData, detProp, evt));
100 
101  if (fRecoMethod == 1)
102  energyRecoOutput = std::make_unique<dune::EnergyRecoOutput>(fNeutrinoEnergyRecoAlg.CalculateNeutrinoEnergy(longestTrack, evt));
103  else if (fRecoMethod == 2)
104  energyRecoOutput = std::make_unique<dune::EnergyRecoOutput>(fNeutrinoEnergyRecoAlg.CalculateNeutrinoEnergy(highestChargeShower, evt));
105  else if (fRecoMethod == 3)
106  energyRecoOutput = std::make_unique<dune::EnergyRecoOutput>(fNeutrinoEnergyRecoAlg.CalculateNeutrinoEnergy(evt));
107 
108  art::ProductID const prodId = evt.getProductID<dune::EnergyRecoOutput>();
109  art::EDProductGetter const* prodGetter = evt.productGetter(prodId);
110  art::Ptr<dune::EnergyRecoOutput> EnergyRecoOutputPtr{ prodId, 0U, prodGetter };
111  if (longestTrack.isAvailable()) assnstrk->addSingle(EnergyRecoOutputPtr, longestTrack);
112  if (highestChargeShower.isAvailable()) assnsshw->addSingle(EnergyRecoOutputPtr, highestChargeShower);
113  evt.put(std::move(energyRecoOutput));
114  evt.put(std::move(assnstrk));
115  evt.put(std::move(assnsshw));
116  }
ProductID getProductID(std::string const &instance_name="") const
Definition: DataViewImpl.h:338
art::Ptr< recob::Shower > GetHighestChargeShower(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const art::Event &event)
def move(depos, offset)
Definition: depos.py:107
EDProductGetter const * productGetter(ProductID const pid) const
art::Ptr< recob::Track > GetLongestTrack(const art::Event &event)
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
NeutrinoEnergyRecoAlg fNeutrinoEnergyRecoAlg
dune::EnergyRecoOutput CalculateNeutrinoEnergy(const art::Ptr< recob::Track > &pMuonTrack, const art::Event &event)
Calculates neutrino energy using a muon track (the muon track may be ignored if it isn&#39;t of a suitabl...

Member Data Documentation

std::string dune::EnergyReco::fHitLabel
private

Definition at line 55 of file EnergyReco_module.cc.

std::string dune::EnergyReco::fHitToSpacePointLabel
private

Definition at line 60 of file EnergyReco_module.cc.

NeutrinoEnergyRecoAlg dune::EnergyReco::fNeutrinoEnergyRecoAlg
private

Definition at line 65 of file EnergyReco_module.cc.

int dune::EnergyReco::fRecoMethod
private

Definition at line 62 of file EnergyReco_module.cc.

std::string dune::EnergyReco::fShowerLabel
private

Definition at line 57 of file EnergyReco_module.cc.

std::string dune::EnergyReco::fShowerToHitLabel
private

Definition at line 59 of file EnergyReco_module.cc.

std::string dune::EnergyReco::fTrackLabel
private

Definition at line 56 of file EnergyReco_module.cc.

std::string dune::EnergyReco::fTrackToHitLabel
private

Definition at line 58 of file EnergyReco_module.cc.

std::string dune::EnergyReco::fWireLabel
private

Definition at line 54 of file EnergyReco_module.cc.


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