1 #ifndef PIZERO_PROCESS_H 2 #define PIZERO_PROCESS_H 8 #include <unordered_map> 31 const TVector3& lineStart,
const TVector3& lineDir) {
33 const TVector3 diff = p - lineStart;
35 const TVector3 proj = lineDir * diff.Dot(lineDir) * (1.0 / lineDir.Mag2());
38 return (diff - proj).Mag();
43 const TVector3&
b,
const TVector3& bdir) {
44 TVector3
result(-99999., -99999., -99999.);
47 const TVector3 n1 = adir.Cross(bdir.Cross(adir));
48 const TVector3 n2 = bdir.Cross(adir.Cross(bdir));
49 const TVector3
c1 = a + adir * ((b -
a).Dot(n2) / adir.Dot(n2));
50 const TVector3 c2 = b + bdir * ((a -
b).Dot(n1) / bdir.Dot(n1));
52 result = c1 + 0.5 * (c2 -
c1);
59 const TVector3 candidate =
68 const TVector3&
b,
const TVector3& bdir) {
70 const TVector3 unit = adir.Cross(bdir) * (1.0 / adir.Cross(bdir).Mag());
72 return abs((a - b).Dot(unit));
77 const TVector3 candidate =
84 if((startPlusDirA-candidate).Mag() < (startMinusDirA-candidate).Mag() ||
85 (startPlusDirB-candidate).Mag() < (startMinusDirB-candidate).Mag()) {
145 return _shProcess1? _shProcess1->mcparticle(): 0x0;
148 return _shProcess2? _shProcess2->mcparticle(): 0x0;
151 return _shProcess1? _shProcess1->shower(): 0x0;
154 return _shProcess2? _shProcess2->shower(): 0x0;
157 return _shProcess1? _shProcess1->track(): 0x0;
160 return _shProcess2? _shProcess2->track(): 0x0;
163 return _shProcess1? _shProcess1->cone(): 0x0;
166 return _shProcess2? _shProcess2->cone(): 0x0;
197 if(mcp.PdgCode() == 111) {
200 }
else if(mcp.PdgCode() == 22) {
202 if(mcp.Mother() == 0)
return;
220 if (!showerHandle)
return;
221 if(showerHandle->size() < 2)
return;
224 double min_dist = 100000;
227 if(&potMatch == &
shower)
continue;
230 if(this_dist < min_dist) {
231 min_dist = this_dist;
238 double reco_mismatch = 100000;
243 if(true_pi0->
PdgCode() != 111)
continue;
245 const double this_dist = (true_pi0->
Position().Vect() - reco_pi0_location).Mag();
246 if(this_dist < reco_mismatch) {
247 reco_mismatch = this_dist;
251 if(min_pi0 == 0)
return;
296 if(photon1->
E() < photon2->
E())
std::swap(photon1, photon2);
305 std::vector<PiZeroProcess>
result;
309 if (!showerHandle || showerHandle->size() < 2)
return result;
312 double showerDistThreshold = 50;
313 std::vector<std::pair<const recob::Shower*, const recob::Shower*>> showerPairs;
314 for(
unsigned si = 0; si < showerHandle->size()-1; ++si) {
315 for(
unsigned ssi = si+1; ssi < showerHandle->size(); ++ssi) {
319 showerPairs.push_back(std::make_pair(shower1, shower2));
323 std::cout << showerPairs.size() <<
" shower pairs.\n";
double E(const int i=0) const
const TVector3 & ShowerStart() const
const TLorentzVector & Position(const int i=0) const
std::vector< PiZeroProcess > findPiZeros(const art::Event &evt, std::string showerLabel="pandoraShower", std::string trackLabel="pandoraTrack")
TVector3 ClosestPoint(const TVector3 &a, const TVector3 &adir, const TVector3 &b, const TVector3 &bdir)
const art::Event * evt() const
const detinfo::DetectorPropertiesData & _detProp
Handle< PROD > getHandle(SelectorBase const &) const
const recob::Track * track2() const
const simb::MCParticle * TrackIdToParticle_P(int id) const
const std::string _showerLabel
const detinfo::DetectorClocksData & _clockData
const recob::Track * track1() const
std::unique_ptr< ShowerProcess > _shProcess1
int NumberDaughters() const
art framework interface to geometry description
int Daughter(const int i) const
void fillRecoInfo(calo::CalorimetryAlg caloAlg)
const recob::Shower * shower2() const
const simb::MCParticle * photon1() const
const simb::MCParticle * pi0() const
void swap(Handle< T > &a, Handle< T > &b)
void setPi0(const simb::MCParticle &newPi0)
double ClosestDistanceToPoint(const TVector3 &p, const TVector3 &lineStart, const TVector3 &lineDir)
const ShowerProcess * showerProcess1() const
const TVector3 & Direction() const
art::ServiceHandle< cheat::ParticleInventoryService > pi_serv
Definition of data types for geometry description.
const sim::ParticleList & ParticleList() const
const Cone * cone1() const
const recob::Shower * shower1() const
Declaration of signal hit object.
const simb::MCParticle * _pi0
const simb::MCParticle * photon2() const
double ClosestDistance(const TVector3 &a, const TVector3 &adir, const TVector3 &b, const TVector3 &bdir)
Contains all timing reference information for the detector.
void createBranches(TTree *tree)
std::unique_ptr< ShowerProcess > _shProcess2
Access the description of detector geometry.
protoana::ProtoDUNETruthUtils truthUtils
const Cone * cone2() const
PiZeroProcess(const simb::MCParticle &mcp, const art::Event &evt, const detinfo::DetectorClocksData &clockData, const detinfo::DetectorPropertiesData &detProp, std::string showerLabel)
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
std::string showerLabel() const
const ShowerProcess * showerProcess2() const