1 #ifndef SHOWER_PROCESS_H 2 #define SHOWER_PROCESS_H 63 m_clockdata(&clockData),
65 m_showerLabel(showerLabel),
66 m_trackLabel(trackLabel),
67 m_simulationLabel(simulationLabel) {
68 m_mcparts.push_back(&mcpart);
80 m_clockdata(&clockData),
82 m_showerLabel(showerLabel),
83 m_trackLabel(trackLabel),
84 m_simulationLabel(simulationLabel) {
85 m_showers.push_back(&shower);
98 m_clockdata(&clockData),
100 m_showerLabel(showerLabel),
101 m_trackLabel(trackLabel),
102 m_simulationLabel(simulationLabel) {
103 m_mcparts.push_back(&mcpart);
104 m_showers.push_back(&shower);
112 return m_mcparts.size()!=0? m_mcparts[0]:
nullptr;
115 return m_showers.size()!=0? m_showers[0]:
nullptr;
118 return m_tracks.size()!=0? m_tracks[0]:
nullptr;
145 std::vector<std::pair<const recob::Shower*, double>>
showers =
148 for(
const std::pair<const recob::Shower*, double>& sh : showers) {
162 using weightedTrackPair = std::pair<const recob::Track*, double>;
163 std::vector<weightedTrackPair> outVec;
169 const art::FindManyP<recob::Hit> findTrackHits(allRecoTracks, *
m_evt,
m_trackLabel);
173 std::unordered_map<int, double> recoTrack;
179 std::unordered_map<int, double> mcpmap;
184 mcpmap[
abs(ide->trackID)] += ide->energy;
186 recoTrack[
track.
ID()] += ide->energy;
188 part_E += ide->energy;
193 if(recoTrack.size() > 0) {
194 int maxMCPID = mcpmap[0];
195 if(mcpmap.size() > 1) {
196 maxMCPID = std::max_element(mcpmap.begin(), mcpmap.end(),
197 [](
const std::pair<int, double>&
a,
const std::pair<int, double>&
b){
198 return a.second <
b.second;
211 for (std::pair<int, double>
const&
p : recoTrack)
213 auto const trackIt = std::find_if(allRecoTracks->begin(), allRecoTracks->end(),
215 outVec.push_back(std::make_pair(&*trackIt,
p.second));
217 std::sort(outVec.begin(), outVec.end(),
218 [](weightedTrackPair
a, weightedTrackPair
b){
return a.second >
b.second;});
221 if (part_E < 1
e-5) { part_E = 1; }
222 for (weightedTrackPair&
p : outVec)
244 TVector3 cstart, cdir;
266 if(
shower() ==
nullptr)
return totE;
269 const double Wion = 23.6e-6;
270 const double recob = 0.6417;
273 TFile* yzf =
new TFile(yzfile.c_str());
274 TH2F* yzcorrposhist =(TH2F*)yzf->Get(
"correction_dqdx_ZvsY_positiveX_hist_2");
275 TH2F* yzcorrneghist =(TH2F*)yzf->Get(
"correction_dqdx_ZvsY_negativeX_hist_2");
276 TFile* xf =
new TFile(xfile.c_str());
277 TH1F* xcorrhist = (TH1F*)xf->Get(
"dqdx_X_correction_hist_2");
280 std::vector<anab::Calorimetry> calovec =
285 if(
calo.PlaneID().Plane != 2)
continue;
288 for(
unsigned i = 0; i <
calo.dQdx().size(); ++i) {
290 double dQdx =
calo.dQdx()[i];
291 const double pitch =
calo.TrkPitchVec()[i];
293 const double x = pos.X();
294 const double y = pos.Y();
295 const double z = pos.Z();
297 if(x==0 && y==0 && z==0) {
298 totE += dQdx*pitch*norm/calib*Wion/recob * 1
e-3;
304 yzcorr = yzcorrposhist->GetBinContent(yzcorrposhist->FindBin(z,y));
306 yzcorr = yzcorrneghist->GetBinContent(yzcorrneghist->FindBin(z,y));
310 const double xcorr = xcorrhist->GetBinContent(xcorrhist->FindBin(x));
312 totE += xcorr*yzcorr*dQdx*pitch*norm/calib*Wion/recob * 1
e-3;
322 #endif // SHOWERPROCESS_H
float Length(const PFPStruct &pfp)
double energy(const std::string &caloLabel, const double calib, const double norm, const std::string &scefile, const std::string &yzfile, const std::string &xfile) const
Reconstruction base classes.
std::vector< const simb::MCParticle * > mcparticles() const
std::vector< const recob::Shower * > showers() const
detinfo::DetectorClocksData const * m_clockdata
std::vector< anab::Calorimetry > GetRecoShowerCalorimetry(const recob::Shower &shower, art::Event const &evt, const std::string showerModule, const std::string caloModule) const
Get shower calo info.
std::vector< const recob::Track * > m_tracks
ShowerProcess(const simb::MCParticle &mcpart, const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::string showerLabel="pandoraShower", std::string trackLabel="pandoraTrack", std::string simulationLabel="largeant")
std::string m_simulationLabel
std::vector< const simb::MCParticle * > m_mcparts
const simb::MCParticle * GetMCParticleFromReco(detinfo::DetectorClocksData const &clockData, const recob::PFParticle &pfpart, art::Event const &evt, std::string pfparticleModule) const
ShowerProcess(const recob::Shower &shower, const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::string showerLabel="pandoraShower", std::string trackLabel="pandoraTrack", std::string simulationLabel="largeant")
std::string m_showerLabel
Ionization at a point of the TPC sensitive volume.
std::vector< const recob::Track * > tracks() const
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
ShowerProcess(const simb::MCParticle &mcpart, const recob::Shower &shower, const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::string showerLabel="pandoraShower", std::string trackLabel="pandoraTrack", std::string simulationLabel="largeant")
std::vector< std::pair< const recob::Shower *, double > > GetRecoShowerListFromMCParticle(detinfo::DetectorClocksData const &clockData, const simb::MCParticle &part, art::Event const &evt, std::string showerModule) const
protoana::ProtoDUNEShowerUtils shUtils
auto norm(Vector const &v)
Return norm of the specified vector.
detinfo::DetectorPropertiesData const * m_detprop
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
const Cone * cone() const
std::vector< const recob::Shower * > m_showers
protoana::ProtoDUNETruthUtils truthUtils
Contains all timing reference information for the detector.
const recob::Track * track() const
std::vector< const sim::IDE * > HitToSimIDEs_Ps(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
const simb::MCParticle * mcparticle() const
const recob::Shower * shower() const
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track: