13 #include "art_root_io/TFileService.h" 14 #include "canvas/Persistency/Common/FindManyP.h" 32 #include "TLorentzVector.h" 201 const sim::ParticleList& plist = pi_serv->
ParticleList();
205 if (particle->
Process() !=
"primary")
continue;
207 TLorentzVector posvec = particle->
Position();
208 TVector3 pose(posvec.X(), posvec.Y(), posvec.Z());
211 if (particle->
PdgCode() == 111) {
214 TLorentzVector posvec3 = particle->
Position();
215 TVector3 pospi0(posvec3.X(), posvec3.Y(), posvec3.Z());
221 if (daughter1->
PdgCode() != 22)
continue;
224 if (daughter2->
PdgCode() != 22)
continue;
234 TVector3 mom1vec3(mom1.Px(), mom1.Py(), mom1.Pz());
236 TVector3 mom2vec3(mom2.Px(), mom2.Py(), mom2.Pz());
248 TVector3 vecnorm1 = mom1vec3.Unit();
250 TVector3 vecnorm2 = mom2vec3.Unit();
267 double dista = fabs(
fMinx - pvtx.X());
268 double distb = fabs(pvtx.X() -
fMaxx);
272 dista = fabs(
fMaxy - pvtx.Y());
273 distb = fabs(pvtx.Y() -
fMiny);
281 dista = fabs(
fMaxz - pvtx.Z());
282 distb = fabs(pvtx.Z() -
fMinz);
303 void endJob()
override;
310 TVector3
const& convmc,
397 fEvTree = tfs->make<TTree>(
"MultiShowers",
"showers3d");
415 fRecoTree = tfs->make<TTree>(
"Cascades",
"conv points");
427 fShTree = tfs->make<TTree>(
"Shower",
"conv point");
441 log <<
"******************** fEvFidVol = " <<
fEvFidVol <<
"\n";
442 log <<
"******************** fEvGMomCut = " <<
fEvGMomCut <<
"\n";
443 log <<
"******************** fEvComp = " <<
fEvComp <<
"\n";
444 log <<
"******************** fEvReco = " <<
fEvReco <<
"\n";
445 log <<
"******************** fEvInput = " <<
fEvInput <<
"\n";
446 log <<
"******************** fEv2Groups = " <<
fEv2Groups <<
"\n";
447 log <<
"******************** fEv2Good = " <<
fEv2Good <<
"\n";
449 log <<
"******************** reco % = " << double(fEvReco) / double(fEvInput) <<
"\n";
492 fMcth = 180.0F * (std::acos(cosinemc)) / TMath::Pi();
496 const double maxdist = 2.0;
518 art::FindManyP<recob::Cluster> cluFromShs(shsListHandle, e,
fShsModuleLabel);
520 art::FindManyP<recob::Vertex> vtxFromTrk(trkListHandle, e,
fVtxModuleLabel);
521 art::FindManyP<recob::Hit> hitFromClu(cluListHandle, e,
fCluModuleLabel);
529 for (
size_t s = 0;
s < shsListHandle->size(); ++
s) {
531 double mindist = maxdist;
534 for (
int i = 0; i <
fNgammas; ++i) {
536 if ((dist < mindist) && (idph != i)) {
554 for (
size_t s = 0;
s < shsListHandle->size(); ++
s) {
560 std::vector<double>
const& vecdedx = sh.
dEdx();
562 if (vecdedx.size() == 3) {
573 for (
size_t s = 0;
s < shsListHandle->size(); ++
s) {
575 double mindist = maxdist;
578 if (dist < mindist) {
583 std::vector<double> vecdedx = sh.
dEdx();
584 if (vecdedx.size() == 3) {
606 std::vector<std::pair<TVector3, TVector3>>
lines;
610 std::pair<TVector3, TVector3> frontback1(sh1.
ShowerStart(),
612 std::pair<TVector3, TVector3> frontback2(sh2.
ShowerStart(),
614 lines.push_back(frontback1);
615 lines.push_back(frontback2);
624 if ((dist1_0 > dist2_0) || (dist1_1 > dist2_1)) {}
631 fRecth = 180.0F * (std::acos(cosine_reco)) / TMath::Pi();
667 double vtx[3] = {convp[0].X(), convp[0].Y(), convp[0].Z()};
677 std::map<size_t, std::vector<size_t>> used;
682 double maxdist = 1.0;
683 if (geom->
HasTPC(idtpc)) {
689 for (
size_t view = 0; view < cryostat.
MaxPlanes(); view++) {
691 double mindist = maxdist;
693 for (
size_t c = 0;
c < cluListHandle->size(); ++
c) {
696 for (
auto const& ids : used)
697 for (
auto i : ids.second)
698 if (i ==
c) exist =
true;
701 std::vector<art::Ptr<recob::Hit>> hits = fbc.at(
c);
702 if (hits.size() < 20)
continue;
703 if (hits[0]->
WireID().Plane != view)
continue;
706 if (dist < mindist) {
711 if (mindist < maxdist) used[conv].push_back(clid);
720 for (
auto const& ids : used) {
721 if (ids.second.size() > 1)
735 TVector3
const& convmc,
740 double mindist = 9999;
745 for (
size_t h = 0;
h < v.size(); ++
h) {
746 if ((v[
h]->
WireID().
Plane == view) && (v[
h]->WireID().TPC == tpc)) {
751 if (dist < mindist) { mindist =
dist; }
def analyze(root, level, gtrees, gbranches, doprint)
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)
bool const & IsInside2() const
void Findtpcborders(const art::Event &evt)
const simb::MCParticle * TrackIdToParticle_P(int id) const
MultiEMShowers(fhicl::ParameterSet const &p)
art::InputTag fTrk3DModuleLabel
Geometry information for a single TPC.
void analyze(art::Event const &e) override
bool convCluster(art::Event const &evt)
std::pair< float, std::string > P
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
bool const & IsCompton() const
double GetMomGamma2() const
int NumberDaughters() const
art framework interface to geometry description
int Daughter(const int i) const
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
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)
art::InputTag fShsModuleLabel
art::InputTag fVtxModuleLabel
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
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
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
The data type to uniquely identify a TPC.
TVector3 const & GetPrimary() const
TVector3 const & GetDirgamma1() const
const sim::ParticleList & ParticleList() const
bool HasTPC(geo::TPCID const &tpcid) const
Returns whether we have the specified TPC.
Implementation of the Projection Matching Algorithm.
Declaration of signal hit object.
TVector3 const & GetPospi0() const
double GetMomGamma1() const
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
MCinfo(const art::Event &evt)
TVector2 GetProjectionToPlane(const TVector3 &p, unsigned int plane, unsigned int tpc, unsigned int cryo)
Provides recob::Track data product.
art::InputTag fCluModuleLabel
bool const & IsInside1() const
EventNumber_t event() const
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