36 fCalorimetryAlg(pset.
get<
fhicl::ParameterSet>(
"CalorimetryAlg")),
37 fGradTrkMomRange(pset.
get<double>(
"GradTrkMomRange")),
38 fIntTrkMomRange(pset.
get<double>(
"IntTrkMomRange")),
39 fGradTrkMomMCS(pset.
get<double>(
"GradTrkMomMCS")),
40 fIntTrkMomMCS(pset.
get<double>(
"IntTrkMomMCS")),
41 fGradNuMuHadEnCont(pset.
get<double>(
"GradNuMuHadEnCont")),
42 fIntNuMuHadEnCont(pset.
get<double>(
"IntNuMuHadEnCont")),
43 fGradNuMuHadEnExit(pset.
get<double>(
"GradNuMuHadEnExit")),
44 fIntNuMuHadEnExit(pset.
get<double>(
"IntNuMuHadEnExit")),
45 fGradShwEnergy(pset.
get<double>(
"GradShwEnergy")),
46 fIntShwEnergy(pset.
get<double>(
"IntShwEnergy")),
47 fGradNuEHadEn(pset.
get<double>(
"GradNuEHadEn")),
48 fIntNuEHadEn(pset.
get<double>(
"IntNuEHadEn")),
49 fDistanceToWallThreshold(pset.
get<double>(
"DistanceToWallThreshold")),
50 fMuonRangeToMCSThreshold(pset.
get<double>(
"MuonRangeToMCSThreshold")),
51 fRecombFactor(pset.
get<double>(
"RecombFactor")),
52 fTrackLabel(trackLabel),
53 fShowerLabel(showerLabel),
55 fWireLabel(wireLabel),
56 fTrackToHitLabel(trackToHitLabel),
57 fShowerToHitLabel(showerToHitLabel),
58 fHitToSpacePointLabel(hitToSpacePointLabel)
68 mf::LogWarning(
"NeutrinoEnergyRecoAlg") <<
" Cannot access the muon track which is needed for this energy reconstructio method.\n" 69 <<
"Swapping to energy reconstruction method " <<
kAllCharges <<
" for this calculation." <<
std::endl;
76 bool isContained(this->
IsContained(muonHits, event));
81 if (uncorrectedMuonMomentumMCS > std::numeric_limits<double>::epsilon())
96 if (uncorrectedMuonMomentumMCS > std::numeric_limits<double>::epsilon()
126 <<
" Cannot access the electron shower which is needed for this energy reconstructio method.\n" 127 <<
"Swapping to energy reconstruction method " <<
kAllCharges <<
" for this calculation." <<
std::endl;
154 const double triggerTme(clockData.TriggerTime());
157 double wireCharge(0);
159 for (
unsigned int iWire = 0; iWire < wires.size(); ++iWire)
167 const std::vector<float>& signal(range.data());
169 for (
unsigned int iSignal = 0; iSignal < signal.size(); ++iSignal)
194 bool isContained(this->
IsContained(muonHits, event));
212 bool isContained(this->
IsContained(muonHits, event));
225 const double directionX,
const double directionY,
const double directionZ)
227 const double E(std::sqrt(momentum*momentum + mass*mass));
228 const double pX(directionX * momentum);
229 const double pY(directionY * momentum);
230 const double pZ(directionZ * momentum);
273 for (
unsigned int iHit = 0; iHit < hits.size(); ++iHit)
277 for (
unsigned int iSpacePoint = 0; iSpacePoint < spacePoints.size(); ++iSpacePoint)
290 const double correctionIntercept)
292 return (value - correctionIntercept) / correctionGradient;
315 const double hadronicObservedCharge(eventObservedCharge-leptonObservedCharge);
317 const double correctedHadronicEnergy(
321 const double neutrinoEnergy(energyRecoInputHolder.
fLeptonMomentum.E()+correctedHadronicEnergy);
324 output.recoMethodUsed =
static_cast<int>(energyRecoInputHolder.
fEnergyRecoMethod);
325 output.fRecoVertex = energyRecoInputHolder.
fVertex;
326 output.fNuLorentzVector.SetE(neutrinoEnergy);
328 output.fHadLorentzVector.SetE(correctedHadronicEnergy);
330 output.trackMomMethod =
static_cast<int>(energyRecoInputHolder.
fMuonTrackMethod);
342 if (!(fGeometry->
HasTPC(tpcID)))
346 double maxX(std::numeric_limits<double>::lowest());
348 double maxY(std::numeric_limits<double>::lowest());
350 double maxZ(std::numeric_limits<double>::lowest());
351 for (
unsigned int iCryostat = 0; iCryostat < fGeometry->
Ncryostats(); ++iCryostat)
354 for (
unsigned int iTPC = 0; iTPC < cryostat.NTPC(); ++iTPC)
373 if (x - minX < -1.*std::numeric_limits<double>::epsilon() ||
374 x - maxX > std::numeric_limits<double>::epsilon())
376 if (y - minY < -1.*std::numeric_limits<double>::epsilon() ||
377 y - maxY > std::numeric_limits<double>::epsilon())
379 if (z - minZ < -1.*std::numeric_limits<double>::epsilon() ||
380 z - maxZ > std::numeric_limits<double>::epsilon())
Momentum4_t CalculateParticle4Momentum(const double mass, const double momentum, const double directionX, const double directionY, const double directionZ)
Calculates a particle's four-momentum vector.
double fGradNuMuHadEnExit
the hadronic energy correction gradient for numu+exiting muon
Utility containing helpful functions for end users to access information about Hits.
const TVector3 & ShowerStart() const
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 GetMomentumMultiScatterChi2(art::Ptr< recob::Track > const &trk)
double CalculateLinearlyCorrectedValue(const double value, const double correctionGradient, const double correctionIntercept)
Linearly corrects a value.
std::string fShowerToHitLabel
the associated shower-to-hit label
Utility containing helpful functions for end users to access information about Tracks.
double fGradNuMuHadEnCont
the hqdronic energy correction gradient for numu+contained muon
static std::vector< art::Ptr< recob::SpacePoint > > GetSpacePoints(const art::Ptr< recob::Hit > &pHit, const art::Event &evt, const std::string &hitLabel, const std::string &hitToSpacePointLabel)
Get the space points associated with the hit.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >> Point_t
Geometry information for a single TPC.
std::string fWireLabel
the wire label
Vector_t VertexDirection() const
static std::vector< art::Ptr< recob::Hit > > GetHits(const art::Event &evt, const std::string &label)
Get the hits from the event.
const range_list_t & get_ranges() const
Returns the internal list of non-void ranges.
double fIntNuMuHadEnExit
the hadronic energy correction intercept for numu+exiting muon
static std::vector< art::Ptr< recob::Wire > > GetWires(const art::Event &evt, const std::string &label)
Get the wires from the event.
double CalculateMuonMomentumByRange(const art::Ptr< recob::Track > pMuonTrack)
Calculates muon momentum by range.
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
Geometry information for a single cryostat.
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
static std::vector< art::Ptr< recob::Hit > > GetHits(const art::Ptr< recob::Track > &pTrack, const art::Event &evt, const std::string &label)
Get the hits associated with the track.
double CalculateMuonMomentumByMCS(const art::Ptr< recob::Track > pMuonTrack)
Calculates muon momentum by multiple coulomb scattering.
art framework interface to geometry description
int TDCtick_t
Type representing a TDC tick.
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
muon momentum and hadronic deposited energy method
double ElectronsFromADCArea(double area, unsigned short plane) const
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.
constexpr double kGeVToElectrons
23.6eV per ion pair, 1e9 eV/GeV
double fRecombFactor
the average reccombination factor
double Length(size_t p=0) const
Access to various track properties.
Point_t const & Start() const
Access to track position at different points.
Utility containing helpful functions for end users to access information about Showers.
static double LifetimeCorrection(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const art::Ptr< recob::Hit > &pHit)
get the lifetime correction for a hit, assumes the detector properties GetTriggerOffset is T0 ...
double fGradTrkMomRange
the correction gradient for muon momentum by range
bool isNull() const noexcept
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
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.
Utility containing helpful functions for end users to access products from events.
const TVector3 & Direction() const
electron deposited energy and hadronic deposited energy method
double CalculateElectronEnergy(const art::Ptr< recob::Shower > &pElectronShower, const art::Event &event)
Calculates an electron shower's deposited energy by converting its deposited charge.
double fDistanceToWallThreshold
the min distance from a detector wall to be considered contained
static int max(int a, int b)
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
The data type to uniquely identify a TPC.
double fIntTrkMomMCS
the correction intercept for muon momentum by MCS
double fIntTrkMomRange
the correction intercept for muon momentum by range
bool HasTPC(geo::TPCID const &tpcid) const
Returns whether we have the specified TPC.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Header file for the neutrino energy reconstruction algorithm. A heavily refactored version of Nick Gr...
Declaration of signal hit object.
dune::EnergyRecoOutput CalculateNeutrinoEnergyViaMuonRanging(const art::Ptr< recob::Track > &pMuonTrack, const art::Event &event)
Calculates neutrino energy explicitly using muon momentum by range.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
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.
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
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
const Double32_t * XYZ() const
Range class, with range and data.
Position4_t fNuLorentzVector
Declaration of basic channel signal object.
Position4_t fHadLorentzVector
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
auto const & get(AssnsNode< L, R, D > const &r)
std::string fHitToSpacePointLabel
the associated hit-to-space point label
int longestTrackContained
def momentum(x1, x2, x3, scale=1.)
double fGradTrkMomMCS
the correction gradient for muom momentum by MCS
calo::CalorimetryAlg fCalorimetryAlg
the calorimetry algorithm
muon momentum by multiple scattering
QTextStream & endl(QTextStream &s)
double kElectronMass
the electron mass (hardcoded unfortunately);
Event finding and building.
bool IsPointContained(const double x, const double y, const double z)
Check's if a point is contained within a central detector volume.
Signal from collection planes.
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't of a suitabl...
Position4_t fLepLorentzVector
std::string fTrackToHitLabel
the associated track-to-hit label
double fIntNuMuHadEnCont
the hadronic energy correction intercept for numu+contained muon
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.