41 #include "TLorentzVector.h" 42 #include "TMathBase.h" 152 if (particle->
Process() !=
"primary")
continue;
154 TLorentzVector posvec = particle->
Position();
155 TVector3 pose(posvec.X(), posvec.Y(), posvec.Z());
159 if (particle->
PdgCode() == 111)
163 TLorentzVector posvec3 = particle->
Position();
164 TVector3 pospi0(posvec3.X(), posvec3.Y(), posvec3.Z());
170 if (daughter1->
PdgCode() != 22)
continue;
173 if (daughter2->
PdgCode() != 22)
continue;
183 TVector3 mom1vec3(mom1.Px(), mom1.Py(), mom1.Pz());
185 TVector3 mom2vec3(mom2.Px(), mom2.Py(), mom2.Pz());
198 TVector3 vecnorm1 = mom1vec3.Unit();
200 TVector3 vecnorm2 = mom2vec3.Unit();
217 double dista = fabs(
fMinx - pvtx.X());
218 double distb = fabs(pvtx.X() -
fMaxx);
219 if ((pvtx.X() >
fMinx) && (pvtx.X() <
fMaxx) &&
222 dista = fabs(
fMaxy - pvtx.Y());
223 distb = fabs(pvtx.Y() -
fMiny);
224 if (inside && (pvtx.Y() >
fMiny) && (pvtx.Y() <
fMaxy) &&
229 dista = fabs(
fMaxz - pvtx.Z());
230 distb = fabs(pvtx.Z() -
fMinz);
231 if (inside && (pvtx.Z() >
fMinz) && (pvtx.Z() <
fMaxz) &&
248 void endJob()
override;
257 TVector3
const & convmc,
258 size_t view,
size_t tpc,
size_t cryo);
292 double fStartX;
double fStartY;
double fStartZ;
293 double fDedxZ;
double fDedxV;
double fDedxU;
341 fEvTree = tfs->
make<TTree>(
"MultiShowers",
"showers3d");
371 fShTree = tfs->
make<TTree>(
"Shower",
"conv point");
384 log <<
"******************** fEvFidVol = " <<
fEvFidVol <<
"\n";
385 log <<
"******************** fEvGMomCut = " <<
fEvGMomCut <<
"\n";
386 log <<
"******************** fEvComp = " <<
fEvComp <<
"\n";
387 log <<
"******************** fEvReco = " <<
fEvReco <<
"\n";
388 log <<
"******************** fEvInput = " <<
fEvInput <<
"\n";
389 log <<
"******************** fEv2Groups = " <<
fEv2Groups <<
"\n";
390 log <<
"******************** fEv2Good = " <<
fEv2Good <<
"\n";
392 log <<
"******************** reco % = " << double(fEvReco)/double(fEvInput) <<
"\n";
428 fMcth = 180.0F * (std::acos(cosinemc)) / TMath::Pi();
432 const double maxdist = 2.0;
467 for (
size_t s = 0;
s < shsListHandle->size(); ++
s)
470 double mindist = maxdist;
bool found =
false;
475 if ((dist < mindist) && (idph != i))
476 { mindist = dist; idph = i; found =
true; }
485 for (
size_t s = 0;
s < shsListHandle->size(); ++
s)
490 std::vector<double>
const& vecdedx = sh.
dEdx();
492 if (vecdedx.size() == 3)
502 for (
size_t s = 0;
s < shsListHandle->size(); ++
s)
505 double mindist = maxdist;
512 std::vector<double> vecdedx = sh.
dEdx();
513 if (vecdedx.size() == 3)
535 std::vector< std::pair<TVector3, TVector3> > lines;
541 lines.push_back(frontback1); lines.push_back(frontback2);
550 if ((dist1_0 > dist2_0) || (dist1_1 > dist2_1)) {}
558 fRecth = 180.0F * (std::acos(cosine_reco)) / TMath::Pi();
594 double vtx[3] = {convp[0].X(), convp[0].Y(), convp[0].Z()};
604 std::map < size_t, std::vector< size_t > > used;
609 double maxdist = 1.0;
619 for (
size_t view = 0; view < cryostat.
MaxPlanes(); view++)
622 double mindist = maxdist;
int clid = 0;
623 for (
size_t c = 0; c < cluListHandle->size(); ++c)
627 for (
auto const & ids : used)
628 for (
auto i : ids.second)
629 if (i == c) exist =
true;
632 std::vector< art::Ptr<recob::Hit> >
hits = fbc.at(c);
633 if (hits.size() < 20)
continue;
634 if (hits[0]->WireID().Plane != view)
continue;
636 double dist =
getMinDist(hits, convp[conv], view, idtpc.
TPC, cryoid);
643 if (mindist < maxdist) used[conv].push_back(clid);
652 for (
auto const & ids : used)
654 if (ids.second.size() > 1) result =
true;
655 else {result =
false;
break;}
662 TVector3
const & convmc,
663 size_t view,
size_t tpc,
size_t cryo)
665 double mindist = 9999;
670 for (
size_t h = 0; h < v.size(); ++h)
672 if ((v[h]->WireID().
Plane == view) &&
673 (v[h]->WireID().TPC == tpc))
675 TVector2 hpoint =
pma::WireDriftToCm(v[h]->WireID().Wire, v[h]->PeakTime(), view, tpc, cryo);
const simb::MCParticle * TrackIdToParticle_P(int const &id)
const TVector3 & ShowerStart() const
TVector3 const & GetDirgamma2() const
const TLorentzVector & Position(const int i=0) const
unsigned int MaxPlanes() const
Returns the largest number of planes among the TPCs in this cryostat.
Implementation of the Projection Matching Algorithm.
double Dist2(const TVector2 &v1, const TVector2 &v2)
bool const & IsInside2() const
void Findtpcborders(const art::Event &evt)
MultiEMShowers(fhicl::ParameterSet const &p)
Declaration of signal hit object.
list_type::const_iterator const_iterator
art::InputTag fTrk3DModuleLabel
Geometry information for a single TPC.
void analyze(art::Event const &e) override
bool convCluster(art::Event const &evt)
Geometry information for a single cryostat.
std::string Process() const
bool const & IsCompton() const
double GetMomGamma2() const
int NumberDaughters() const
int Daughter(const int i) const
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
art::InputTag fShsModuleLabel
art::InputTag fVtxModuleLabel
const std::vector< double > & dEdx() const
#define DEFINE_ART_MODULE(klass)
Provides recob::Track data product.
std::string EndProcess() const
art::InputTag fHitsModuleLabel
TVector3 const & GetPosgamma1() const
IteratorBox< TPC_iterator,&GeometryCore::begin_TPC,&GeometryCore::end_TPC > IterateTPCs() const
Enables ranged-for loops on all TPCs of the detector.
double P(const int i=0) const
T get(std::string const &key) const
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
const TVector3 & Direction() const
double SolveLeastSquares3D(const std::vector< std::pair< TVector3, TVector3 > > &lines, TVector3 &result)
The data type to uniquely identify a TPC.
Declaration of cluster object.
TVector3 const & GetPrimary() const
TVector3 const & GetDirgamma1() const
bool HasTPC(geo::TPCID const &tpcid) const
Returns whether we have the specified TPC.
Implementation of the Projection Matching Algorithm.
T * make(ARGS...args) const
Utility object to perform functions of association.
TVector3 const & GetPospi0() const
double GetMomGamma1() const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
TVector2 WireDriftToCm(unsigned int wire, float drift, unsigned int plane, unsigned int tpc, unsigned int cryo)
double getMinDist(std::vector< art::Ptr< recob::Hit > > const &v, TVector3 const &convmc, size_t view, size_t tpc, size_t cryo)
MCinfo(const art::Event &evt)
TVector2 GetProjectionToPlane(const TVector3 &p, unsigned int plane, unsigned int tpc, unsigned int cryo)
art::InputTag fCluModuleLabel
bool const & IsInside1() const
EventNumber_t event() const
const sim::ParticleList & ParticleList()
TPCID_t TPC
Index of the TPC within its cryostat.
void Info(const art::Event &evt)
TVector3 const & GetPosgamma2() const
recob::tracking::Plane Plane
geo::CryostatID::CryostatID_t FindCryostatAtPosition(geo::Point_t const &worldLoc) const
Returns the index of the cryostat at specified location.
bool insideFidVol(const TLorentzVector &pvtx) const
void reconfigure(fhicl::ParameterSet const &p)