13 #include "art_root_io/TFileService.h" 34 #include "TLorentzVector.h" 71 double fMinx{std::numeric_limits<double>::max()};
72 double fMaxx{std::numeric_limits<double>::min()};
73 double fMiny{std::numeric_limits<double>::max()};
74 double fMaxy{std::numeric_limits<double>::min()};
75 double fMinz{std::numeric_limits<double>::max()};
76 double fMaxz{std::numeric_limits<double>::min()};
111 fMaxx = std::max(fMaxx, tpcg.MaxX());
112 fMiny = std::min(fMiny, tpcg.MinY());
113 fMaxy = std::max(fMaxy, tpcg.MaxY());
114 fMinz = std::min(fMinz, tpcg.MinZ());
115 fMaxz = std::max(fMaxz, tpcg.MaxZ());
141 if (particle->
Process() !=
"primary")
continue;
143 TLorentzVector posvec = particle->
Position();
144 TVector3 pose(posvec.X(), posvec.Y(), posvec.Z());
147 if (particle->
PdgCode() == 111) {
150 TLorentzVector posvec3 = particle->
Position();
151 TVector3 pospi0(posvec3.X(), posvec3.Y(), posvec3.Z());
157 if (daughter1->
PdgCode() != 22)
continue;
160 if (daughter2->
PdgCode() != 22)
continue;
170 TVector3 mom1vec3(mom1.Px(), mom1.Py(), mom1.Pz());
172 TVector3 mom2vec3(mom2.Px(), mom2.Py(), mom2.Pz());
184 TVector3 vecnorm1 = mom1vec3.Unit();
186 TVector3 vecnorm2 = mom2vec3.Unit();
202 double dista = fabs(
fMinx - pvtx.X());
203 double distb = fabs(pvtx.X() -
fMaxx);
207 dista = fabs(
fMaxy - pvtx.Y());
208 distb = fabs(pvtx.Y() -
fMiny);
216 dista = fabs(
fMaxz - pvtx.Z());
217 distb = fabs(pvtx.Z() -
fMinz);
238 void endJob()
override;
245 TVector3
const& convmc,
331 fEvTree = tfs->make<TTree>(
"MultiShowers",
"showers3d");
349 fRecoTree = tfs->make<TTree>(
"Cascades",
"conv points");
361 fShTree = tfs->make<TTree>(
"Shower",
"conv point");
374 log <<
"******************** fEvFidVol = " <<
fEvFidVol <<
"\n";
375 log <<
"******************** fEvGMomCut = " <<
fEvGMomCut <<
"\n";
376 log <<
"******************** fEvComp = " <<
fEvComp <<
"\n";
377 log <<
"******************** fEvReco = " <<
fEvReco <<
"\n";
378 log <<
"******************** fEvInput = " <<
fEvInput <<
"\n";
379 log <<
"******************** fEv2Groups = " <<
fEv2Groups <<
"\n";
380 log <<
"******************** fEv2Good = " <<
fEv2Good <<
"\n";
382 log <<
"******************** reco % = " << double(fEvReco) / double(fEvInput) <<
"\n";
424 fMcth = 180.0F * (std::acos(cosinemc)) / TMath::Pi();
428 const double maxdist = 2.0;
461 for (
size_t s = 0; s < shsListHandle->size(); ++s) {
463 double mindist = maxdist;
466 for (
int i = 0; i <
fNgammas; ++i) {
468 if ((dist < mindist) && (idph != i)) {
486 for (
size_t s = 0; s < shsListHandle->size(); ++s) {
492 std::vector<double>
const& vecdedx = sh.
dEdx();
494 if (vecdedx.size() == 3) {
505 for (
size_t s = 0; s < shsListHandle->size(); ++s) {
507 double mindist = maxdist;
510 if (dist < mindist) {
515 std::vector<double> vecdedx = sh.
dEdx();
516 if (vecdedx.size() == 3) {
538 std::vector<std::pair<TVector3, TVector3>> lines;
542 std::pair<TVector3, TVector3> frontback1(sh1.
ShowerStart(),
544 std::pair<TVector3, TVector3> frontback2(sh2.
ShowerStart(),
546 lines.push_back(frontback1);
547 lines.push_back(frontback2);
556 if ((dist1_0 > dist2_0) || (dist1_1 > dist2_1)) {}
563 fRecth = 180.0F * (std::acos(cosine_reco)) / TMath::Pi();
596 geo::Point_t const vtx{convp[0].X(), convp[0].Y(), convp[0].Z()};
606 std::map<size_t, std::vector<size_t>> used;
611 double maxdist = 1.0;
612 if (geom->
HasTPC(idtpc)) {
618 for (
size_t view = 0; view < cryostat.
MaxPlanes(); view++) {
620 double mindist = maxdist;
622 for (
size_t c = 0; c < cluListHandle->size(); ++c) {
625 for (
auto const& ids : used)
626 for (
auto i : ids.second)
627 if (i == c) exist =
true;
630 std::vector<art::Ptr<recob::Hit>>
hits = fbc.at(c);
631 if (hits.size() < 20)
continue;
632 if (hits[0]->
WireID().Plane != view)
continue;
635 if (dist < mindist) {
640 if (mindist < maxdist) used[conv].push_back(clid);
649 for (
auto const& ids : used) {
650 if (ids.second.size() > 1)
663 TVector3
const& convmc,
668 double mindist = 9999;
673 for (
size_t h = 0; h < v.size(); ++h) {
674 if ((v[h]->
WireID().
Plane == view) && (v[h]->WireID().TPC == tpc)) {
679 if (dist < mindist) { mindist =
dist; }
details::range_type< T > Iterate() const
Initializes the specified ID with the ID of the first cryostat.
const TVector3 & ShowerStart() const
TVector3 const & GetDirgamma2() const
const TLorentzVector & Position(const int i=0) const
double SolveLeastSquares3D(const std::vector< std::pair< TVector3, TVector3 >> &lines, TVector3 &result)
unsigned int MaxPlanes() const
Returns the largest number of planes among the TPCs in this cryostat.
double Dist2(const TVector2 &v1, const TVector2 &v2)
const simb::MCParticle * TrackIdToParticle_P(int id) const
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)
CryostatID_t Cryostat
Index of cryostat.
TVector2 WireDriftToCm(detinfo::DetectorPropertiesData const &detProp, unsigned int wire, float drift, unsigned int plane, unsigned int tpc, unsigned int cryo)
Geometry information for a single cryostat.
std::string Process() const
CryostatGeo const & Cryostat(CryostatID const &cryoid=cryostat_zero) const
Returns the specified cryostat.
double GetMomGamma2() const
int NumberDaughters() const
int Daughter(const int i) const
double getMinDist(detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::Hit >> const &v, TVector3 const &convmc, size_t view, size_t tpc, size_t cryo)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
art::InputTag fShsModuleLabel
art::InputTag fVtxModuleLabel
TPCID FindTPCAtPosition(Point_t const &point) const
Returns the ID of the TPC at specified location.
const std::vector< double > & dEdx() const
#define DEFINE_ART_MODULE(klass)
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::string EndProcess() const
art::InputTag fHitsModuleLabel
TVector3 const & GetPosgamma1() const
double P(const int i=0) const
T get(std::string const &key) const
Provides recob::Track data product.
const TVector3 & Direction() const
The data type to uniquely identify a TPC.
Declaration of cluster object.
TVector3 const & GetPrimary() const
TVector3 const & GetDirgamma1() const
const sim::ParticleList & ParticleList() const
CryostatID PositionToCryostatID(Point_t const &point) const
Returns the ID of the cryostat at specified location.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Implementation of the Projection Matching Algorithm.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
TVector3 const & GetPospi0() const
double GetMomGamma1() const
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
TVector2 GetProjectionToPlane(const TVector3 &p, unsigned int plane, unsigned int tpc, unsigned int cryo)
art::InputTag fCluModuleLabel
EventNumber_t event() const
TPCID_t TPC
Index of the TPC within its cryostat.
TVector3 const & GetPosgamma2() const
recob::tracking::Plane Plane
bool HasTPC(TPCID const &tpcid) const
Returns whether we have the specified TPC.
art framework interface to geometry description
The data type to uniquely identify a cryostat.
bool insideFidVol(const TLorentzVector &pvtx) const