NeutrinoEnergyRecoAlg.h
Go to the documentation of this file.
1 /**
2 * @file dunereco/FDSensOpt/NeutrinoEnergyRecoAlg/NeutrinoEnergyRecoAlg.h
3 *
4 * @brief Header file for the neutrino energy reconstruction algorithm. A heavily refactored version of Nick Grant's module
5 *
6 * $Log: $
7 */
8 #ifndef DUNE_NEUTRINO_ENERGY_RECO_ALG_H
9 #define DUNE_NEUTRINO_ENERGY_RECO_ALG_H
10 
11 //STL
12 #include <string>
13 #include <iostream>
14 //ROOT
15 #include "Math/GenVector/LorentzVector.h"
16 //ART
18 #include "fhiclcpp/ParameterSet.h"
19 //LArSoft
21 //DUNE
23 
24 namespace dune
25 {
26 /**
27  *
28  * @brief NeutrinoEnergyRecoAlg class
29  *
30 */
32 {
33  public:
34  /**
35  * @brief Constructor
36  *
37  * @param pset the FCL parameter set
38  * @param trackLabel the track label
39  * @param showerLabel the shower label
40  * @param hitLabel the hit label
41  * @param wireLabel the wire label
42  * @param trackToHitLabel the associated track-to-hit label
43  * @param showerToHitLabel the associated shower-to-hit label
44  * @param hitToSpacePointLabel the associated hit-to-space point label
45  */
46  NeutrinoEnergyRecoAlg(const fhicl::ParameterSet &pset, const std::string &trackLabel, const std::string &showerLabel,
47  const std::string &hitLabel, const std::string wireLabel, const std::string &trackToHitLabel,
48  const std::string &showerToHitLabel, const std::string &hitToSpacePointLabel);
49 
50  /**
51  * @brief Calculates neutrino energy using a muon track (the muon track may be ignored if it isn't of a suitable quality)
52  *
53  * @param pMuonTrack the muon track
54  * @param event the art event
55  *
56  * @return the neutrino energy summary object
57  */
59 
60  /**
61  * @brief Calculates neutrino energy using an electron shower(the electron may be ignored if it isn't of a suitable quality)
62  *
63  * @param pElectronShower the electron shower
64  * @param event the art event
65  *
66  * @return the neutrino energy summary object
67  */
69 
70  /**
71  * @brief Calculates neutrino energy by summing wire charges
72  *
73  * @param event the art event
74  *
75  * @return the neutrino energy summary object
76  */
78 
79  /**
80  * @brief Calculates neutrino energy explicitly using muon momentum by range
81  *
82  * @param pMuonTrack the muon track
83  * @param event the art event
84  *
85  * @return the neutrino energy summary object
86  */
88 
89  /**
90  * @brief Calculates neutrino energy explicitly using muon multiple scattering
91  *
92  * @param pMuonTrack the muon track
93  * @param event the art event
94  *
95  * @return the neutrino energy summary object
96  */
98 
99  private:
100 
102 
103  double kMuonMass = 0.1056583745; ///< the muon mass (hardcoded unfortunately)
104  double kElectronMass = 0.0005109989461; ///< the electron mass (hardcoded unfortunately);
105 
106  ///The energy reconstruction method
108  {
109  kRecoMethodNotSet = -1, ///< method not set
110  kMuonAndHadronic = 1, ///< muon momentum and hadronic deposited energy method
111  kElectronAndHadronic, ///< electron deposited energy and hadronic deposited energy method
112  kAllCharges ///< summed wire charges
113  };
114  ///The muon momentum reconstruction method
116  {
117  kTrackMethodNotSet = -1, ///< method not set
118  kMCS, ///< muon momentum by multiple scattering
119  kContained ///< muon momentum by range
120  };
121  ///The muon containment status
123  {
124  kContainmentNotSet = -1, ///< Containment not set
125  kIsExiting, ///< Muon exits
126  kIsContained ///< Muon is contained
127  };
128 
129  /**
130  *
131  * @brief EnergyRecoInputHolder struct
132  *
133  */
135  {
136  /**
137  * @brief Constructor
138  *
139  * @param vertex the reconstructed vertex
140  * @param leptonMomentum the reconstructed lepton momentum
141  * @param energyRecoMethod the neutrino energy reconstruction method
142  * @param muonTrackMethod the muon momentum reconstruction method
143  * @param muonContainmentStatus the muon containment status
144  * @param hadronicCorrectionGradient the linear correction gradient for reconstructed hadronic energy
145  * @param hadronicCorrectionIntercept the linear correction intercept for reconstructed hadronic energy
146  */
147  EnergyRecoInputHolder(const Point_t &vertex, const Momentum4_t &leptonMomentum, const EnergyRecoMethod energyRecoMethod,
148  const MuonTrackMethod muonTrackMethod, const MuonContainmentStatus muonContainmentStatus,
149  const double hadronicCorrectionGradient, const double hadronicCorrectionIntercept) :
150  fVertex(vertex),
151  fLeptonMomentum(leptonMomentum),
152  fEnergyRecoMethod(energyRecoMethod),
153  fMuonTrackMethod(muonTrackMethod),
154  fMuonContainmentStatus(muonContainmentStatus),
155  fHadronicCorrectionGradient(hadronicCorrectionGradient),
156  fHadronicCorrectionIntercept(hadronicCorrectionIntercept) {};
157 
158  const Point_t fVertex; ///< the reconstructed vertex
159  const Momentum4_t fLeptonMomentum; ///< the reconstructed lepton four-momentum
160  const EnergyRecoMethod fEnergyRecoMethod; ///< the neutrino energy reconstruction method
161  const MuonTrackMethod fMuonTrackMethod; ///< the muon momentum reconstruction method
162  const MuonContainmentStatus fMuonContainmentStatus; ///< the muon containment status
163  const double fHadronicCorrectionGradient; ///< the hadronic energy reconstruction linear correction gradient
164  const double fHadronicCorrectionIntercept; ///< the hadronic energy reconstruction linear correction intercept
165  };
166 
167  /**
168  * @brief Calculates muon momentum by range
169  *
170  * @param pMuonTrack the muon track
171  *
172  * @return the reconstructed muon momentum
173  */
174  double CalculateMuonMomentumByRange(const art::Ptr<recob::Track> pMuonTrack);
175 
176  /**
177  * @brief Calculates muon momentum by multiple coulomb scattering
178  *
179  * @param pMuonTrack the muon track
180  *
181  * @return the reconstructed muon momentum
182  */
183  double CalculateMuonMomentumByMCS(const art::Ptr<recob::Track> pMuonTrack);
184 
185  /**
186  * @brief Calculates an electron shower's deposited energy by converting its deposited charge
187  *
188  * @param pElectronShower the electron shower
189  * @param event the art event
190  *
191  * @return the reconstructed electron energy
192  */
193  double CalculateElectronEnergy(const art::Ptr<recob::Shower> &pElectronShower, const art::Event &event);
194 
195  /**
196  * @brief Converts deposited charge into energy by converting to number of electrons and correcting for average recombination
197  *
198  * @param charge the deposited charge
199  *
200  * @return the reconstructed deposited energy
201  */
202  double CalculateEnergyFromCharge(const double charge);
203 
204  /**
205  * @brief Checks if a set of track hits are contained within a central volume of the detector
206  *
207  * @param hits the track hits
208  *
209  * @return an is contained bool
210  */
211  bool IsContained(const std::vector<art::Ptr<recob::Hit> > &hits, const art::Event &event);
212 
213  /**
214  * @brief Calculates a particle's four-momentum vector
215  *
216  * @param mass the particle mass
217  * @param momentum the particle momentum
218  * @param directionX direction X component
219  * @param directionY direction X component
220  * @param directionZ direction X component
221  *
222  * @return the particle's four-momenutm vector
223  */
224  Momentum4_t CalculateParticle4Momentum(const double mass, const double momentum,
225  const double directionX, const double directionY, const double directionZ);
226 
227  /**
228  * @brief Linearly corrects a value
229  *
230  * @param value the raw value
231  * @param correctionGradient the linear correction gradient
232  * @param correctionIntercept the linear correction intercept
233  *
234  * @return the linearly corrected value
235  */
236  double CalculateLinearlyCorrectedValue(const double value, const double correctionGradient,
237  const double correctionIntercept);
238 
239  /**
240  * @brief Calculates the raw muon momentum by multiple coulomb scattering
241  *
242  * @param pMuonTrack the muon track
243  *
244  * @return the uncorrected reconstructed muon momentum
245  */
247 
248  /**
249  * @brief Calculates neutrino energy by summing hadronic deposited energy and lepton energy
250  *
251  * @param leptonHits the lepton hits
252  * @param event the art event
253  * @param energyRecoInputHolder the holder object holding pre-calculated or pre-existing information
254  *
255  * @return the neutrino energy summary object
256  */
258  const EnergyRecoInputHolder &energyRecoInputHolder);
259 
260  /**
261  * @brief Check's if a point is contained within a central detector volume
262  *
263  * @param x the x component of the position
264  * @param y the y component of the position
265  * @param z the z component of the position
266  *
267  * @return an is contained bool
268  */
269  bool IsPointContained(const double x, const double y, const double z);
270 
271  calo::CalorimetryAlg fCalorimetryAlg; ///< the calorimetry algorithm
272 
273  double fGradTrkMomRange; ///< the correction gradient for muon momentum by range
274  double fIntTrkMomRange; ///< the correction intercept for muon momentum by range
275  double fGradTrkMomMCS; ///< the correction gradient for muom momentum by MCS
276  double fIntTrkMomMCS; ///< the correction intercept for muon momentum by MCS
277  double fGradNuMuHadEnCont; ///< the hqdronic energy correction gradient for numu+contained muon
278  double fIntNuMuHadEnCont; ///< the hadronic energy correction intercept for numu+contained muon
279  double fGradNuMuHadEnExit; ///< the hadronic energy correction gradient for numu+exiting muon
280  double fIntNuMuHadEnExit; ///< the hadronic energy correction intercept for numu+exiting muon
281  double fGradShwEnergy; ///< the electron shower energy correction gradient
282  double fIntShwEnergy; ///< the electron shower energy correction intercept
283  double fGradNuEHadEn; ///< the hadronic energy correction gradient for nue
284  double fIntNuEHadEn; ///< the hadronic energy correction intercept for nue
285  double fDistanceToWallThreshold; ///< the min distance from a detector wall to be considered contained
286  double fMuonRangeToMCSThreshold; ///< the ratio threshold at which MCS is used for contained muons
287  double fRecombFactor; ///< the average reccombination factor
288 
289  std::string fTrackLabel; ///< the track label
290  std::string fShowerLabel; ///< the shower label
291  std::string fHitLabel; ///< the hit label
292  std::string fWireLabel; ///< the wire label
293  std::string fTrackToHitLabel; ///< the associated track-to-hit label
294  std::string fShowerToHitLabel; ///< the associated shower-to-hit label
295  std::string fHitToSpacePointLabel; ///< the associated hit-to-space point label
296 };
297 } //namespace dune_ana
298 #endif //DUNE_NEUTRINO_ENERGY_RECO_ALG_H
Momentum4_t CalculateParticle4Momentum(const double mass, const double momentum, const double directionX, const double directionY, const double directionZ)
Calculates a particle&#39;s four-momentum vector.
double fGradNuMuHadEnExit
the hadronic energy correction gradient for numu+exiting muon
std::string fTrackLabel
the track label
const double fHadronicCorrectionIntercept
the hadronic energy reconstruction linear correction intercept
double CalculateEnergyFromCharge(const double charge)
Converts deposited charge into energy by converting to number of electrons and correcting for average...
double fIntShwEnergy
the electron shower energy correction intercept
double kMuonMass
the muon mass (hardcoded unfortunately)
std::string fHitLabel
the hit label
double CalculateLinearlyCorrectedValue(const double value, const double correctionGradient, const double correctionIntercept)
Linearly corrects a value.
std::string fShowerToHitLabel
the associated shower-to-hit label
std::string string
Definition: nybbler.cc:12
double fGradNuMuHadEnCont
the hqdronic energy correction gradient for numu+contained muon
NeutrinoEnergyRecoAlg class.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >> Point_t
std::string fWireLabel
the wire label
struct vector vector
const EnergyRecoMethod fEnergyRecoMethod
the neutrino energy reconstruction method
double fIntNuMuHadEnExit
the hadronic energy correction intercept for numu+exiting muon
double CalculateMuonMomentumByRange(const art::Ptr< recob::Track > pMuonTrack)
Calculates muon momentum by range.
const MuonContainmentStatus fMuonContainmentStatus
the muon containment status
double CalculateMuonMomentumByMCS(const art::Ptr< recob::Track > pMuonTrack)
Calculates muon momentum by multiple coulomb scattering.
const MuonTrackMethod fMuonTrackMethod
the muon momentum reconstruction method
muon momentum and hadronic deposited energy method
NeutrinoEnergyRecoAlg(const fhicl::ParameterSet &pset, const std::string &trackLabel, const std::string &showerLabel, const std::string &hitLabel, const std::string wireLabel, const std::string &trackToHitLabel, const std::string &showerToHitLabel, const std::string &hitToSpacePointLabel)
Constructor.
double CalculateUncorrectedMuonMomentumByMCS(const art::Ptr< recob::Track > &pMuonTrack)
Calculates the raw muon momentum by multiple coulomb scattering.
double fRecombFactor
the average reccombination factor
std::string fShowerLabel
the shower label
double fGradTrkMomRange
the correction gradient for muon momentum by range
const double fHadronicCorrectionGradient
the hadronic energy reconstruction linear correction gradient
bool IsContained(const std::vector< art::Ptr< recob::Hit > > &hits, const art::Event &event)
Checks if a set of track hits are contained within a central volume of the detector.
electron deposited energy and hadronic deposited energy method
double CalculateElectronEnergy(const art::Ptr< recob::Shower > &pElectronShower, const art::Event &event)
Calculates an electron shower&#39;s deposited energy by converting its deposited charge.
double fDistanceToWallThreshold
the min distance from a detector wall to be considered contained
double fIntTrkMomMCS
the correction intercept for muon momentum by MCS
double fIntTrkMomRange
the correction intercept for muon momentum by range
MuonContainmentStatus
The muon containment status.
dune::EnergyRecoOutput CalculateNeutrinoEnergyViaMuonRanging(const art::Ptr< recob::Track > &pMuonTrack, const art::Event &event)
Calculates neutrino energy explicitly using muon momentum by range.
EnergyRecoInputHolder(const Point_t &vertex, const Momentum4_t &leptonMomentum, const EnergyRecoMethod energyRecoMethod, const MuonTrackMethod muonTrackMethod, const MuonContainmentStatus muonContainmentStatus, const double hadronicCorrectionGradient, const double hadronicCorrectionIntercept)
Constructor.
MuonTrackMethod
The muon momentum reconstruction method.
double fIntNuEHadEn
the hadronic energy correction intercept for nue
double fGradShwEnergy
the electron shower energy correction gradient
double fMuonRangeToMCSThreshold
the ratio threshold at which MCS is used for contained muons
const Point_t fVertex
the reconstructed vertex
list x
Definition: train.py:276
dune::EnergyRecoOutput CalculateNeutrinoEnergyViaMuonMCS(const art::Ptr< recob::Track > &pMuonTrack, const art::Event &event)
Calculates neutrino energy explicitly using muon multiple scattering.
double fGradNuEHadEn
the hadronic energy correction gradient for nue
const Momentum4_t fLeptonMomentum
the reconstructed lepton four-momentum
std::string fHitToSpacePointLabel
the associated hit-to-space point label
def momentum(x1, x2, x3, scale=1.)
double fGradTrkMomMCS
the correction gradient for muom momentum by MCS
calo::CalorimetryAlg fCalorimetryAlg
the calorimetry algorithm
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double >> Position4_t
muon momentum by multiple scattering
double kElectronMass
the electron mass (hardcoded unfortunately);
Event finding and building.
EnergyRecoMethod
The energy reconstruction method.
bool IsPointContained(const double x, const double y, const double z)
Check&#39;s if a point is contained within a central detector volume.
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...
std::string fTrackToHitLabel
the associated track-to-hit label
double fIntNuMuHadEnCont
the hadronic energy correction intercept for numu+contained muon
vertex reconstruction