Skip to content

Commit

Permalink
Revert "Merge pull request #38 from knoepfel/geom-iterator-interface"…
Browse files Browse the repository at this point in the history
… as this requires larsoft v09_65_00, not yet availavble in sbndcode/icaruscode

This reverts commit 117ee1c, reversing
changes made to 4bc7352.
  • Loading branch information
chilge committed Dec 28, 2022
1 parent 117ee1c commit cfc3229
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
30 changes: 19 additions & 11 deletions sbnci/Common/Modules/MCRecoUtils/RecoUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ int RecoUtils::TrueParticleIDFromTotalRecoHits(const detinfo::DetectorClocksData


bool RecoUtils::IsInsideTPC(TVector3 position, double distance_buffer){
double vtx[3] = {position.X(), position.Y(), position.Z()};
bool inside = false;
art::ServiceHandle<geo::Geometry> geom;
geo::TPCID idtpc = geom->FindTPCAtPosition(geo::vect::toPoint(position));
geo::TPCID idtpc = geom->FindTPCAtPosition(vtx);

if (geom->HasTPC(idtpc))
{
Expand All @@ -110,14 +111,19 @@ bool RecoUtils::IsInsideTPC(TVector3 position, double distance_buffer){
double miny = tpcgeo.MinY(); double maxy = tpcgeo.MaxY();
double minz = tpcgeo.MinZ(); double maxz = tpcgeo.MaxZ();

for (auto const& tpcg : geom->Iterate<geo::TPCGeo>())
for (size_t c = 0; c < geom->Ncryostats(); c++)
{
if (tpcg.MinX() < minx) minx = tpcg.MinX();
if (tpcg.MaxX() > maxx) maxx = tpcg.MaxX();
if (tpcg.MinY() < miny) miny = tpcg.MinY();
if (tpcg.MaxY() > maxy) maxy = tpcg.MaxY();
if (tpcg.MinZ() < minz) minz = tpcg.MinZ();
if (tpcg.MaxZ() > maxz) maxz = tpcg.MaxZ();
const geo::CryostatGeo& cryostat = geom->Cryostat(c);
for (size_t t = 0; t < cryostat.NTPC(); t++)
{
const geo::TPCGeo& tpcg = cryostat.TPC(t);
if (tpcg.MinX() < minx) minx = tpcg.MinX();
if (tpcg.MaxX() > maxx) maxx = tpcg.MaxX();
if (tpcg.MinY() < miny) miny = tpcg.MinY();
if (tpcg.MaxY() > maxy) maxy = tpcg.MaxY();
if (tpcg.MinZ() < minz) minz = tpcg.MinZ();
if (tpcg.MaxZ() > maxz) maxz = tpcg.MaxZ();
}
}

//x
Expand Down Expand Up @@ -333,7 +339,7 @@ std::map<geo::PlaneID,int> RecoUtils::NumberofHitsThatContainEnergyDepositedByTr

//Loop over the planes and create the initial PlaneMap
std::map<geo::PlaneID,int> HitPlaneMap;
for(geo::PlaneID plane_id: geom->Iterate<geo::PlaneID>()){HitPlaneMap[plane_id] = 0;}
for(geo::PlaneID plane_id: geom->IteratePlaneIDs()){HitPlaneMap[plane_id] = 0;}

//Loop over the hits and find the IDE
for (std::vector<art::Ptr<recob::Hit> >::const_iterator hitIt = hits.begin(); hitIt != hits.end(); ++hitIt) {
Expand All @@ -358,7 +364,7 @@ std::map<geo::PlaneID,int> RecoUtils::NumberofHitsThatContainEnergyDepositedByTr
//Loop over the planes and create the initial PlaneMap
art::ServiceHandle<geo::Geometry> geom;
std::map<geo::PlaneID,int> HitPlaneMap;
for(geo::PlaneID plane_id: geom->Iterate<geo::PlaneID>()){HitPlaneMap[plane_id] = 0;}
for(geo::PlaneID plane_id: geom->IteratePlaneIDs()){HitPlaneMap[plane_id] = 0;}

//Loop over the hits and find the IDE
for (std::vector<art::Ptr<recob::Hit> >::const_iterator hitIt = hits.begin(); hitIt != hits.end(); ++hitIt) {
Expand Down Expand Up @@ -388,7 +394,7 @@ std::map<geo::PlaneID,int> RecoUtils::NumberofMCWiresHit(int TrackID, const std:

int breaking_int = 0;

for(geo::PlaneID plane_id: geom->Iterate<geo::PlaneID>()){WirePlaneMap[plane_id] = 0;}
for(geo::PlaneID plane_id: geom->IteratePlaneIDs()){WirePlaneMap[plane_id] = 0;}

// Loop over SimChannel
for(size_t simch_index=0; simch_index<simchannels.size(); ++simch_index) {
Expand Down Expand Up @@ -612,3 +618,5 @@ float RecoUtils::TotalEnergyDepinHitsFromTrack(const detinfo::DetectorClocksData

return DepEnergy;
}


Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ void ana::ShowerValidation::analyze(const art::Event& evt) {
art::Handle<std::vector<recob::Hit> > hitListHandle;
std::vector<art::Ptr<recob::Hit> > hits;
for(auto const& fHitModuleLabel: fHitModuleLabels){

if(evt.getByLabel(fHitModuleLabel,hitListHandle)){
art::fill_ptr_vector(hits, hitListHandle);
}
Expand Down Expand Up @@ -613,7 +613,7 @@ void ana::ShowerValidation::analyze(const art::Event& evt) {
}

//Calculate how much energy was deposited in the hits
for(geo::PlaneID plane_id: geom->Iterate<geo::PlaneID>()){
for(geo::PlaneID plane_id: geom->IteratePlaneIDs()){

float TotalEnergyDepinHits = RecoUtils::TotalEnergyDepinHits(clockData, hits,plane_id.Plane);
float hitCompleteness = TotalEnergyDepinHits!=0 ? TotalEnergyDepinHits/TotalEnergyDeposited : -99999;
Expand Down Expand Up @@ -649,7 +649,7 @@ void ana::ShowerValidation::analyze(const art::Event& evt) {

art::Handle<std::vector<recob::PFParticle> > pfpListHandle;
std::vector<art::Ptr<recob::PFParticle> > pfps;

if(evt.getByLabel(fPFParticleLabel,pfpListHandle)){
art::fill_ptr_vector(pfps,pfpListHandle);
}
Expand Down Expand Up @@ -905,7 +905,7 @@ void ana::ShowerValidation::analyze(const art::Event& evt) {
//Calculate the true Energy deposited By Shower
for (auto const& daughter: showerMothers[ShowerTrackID]){
TrueEnergyDep_FromShower += MCTrack_Energy_map[daughter];
for(geo::PlaneID plane_id: geom->Iterate<geo::PlaneID>()){
for(geo::PlaneID plane_id: geom->IteratePlaneIDs()){
TrueHitDep_FromTrueShower += MCTrack_hit_map[showerhit_productid][daughter][plane_id];
}
}
Expand Down Expand Up @@ -1374,7 +1374,7 @@ void ana::ShowerValidation::analyze(const art::Event& evt) {
for (auto const& showermother: showerMothers){
int TrueHitDep_FromTrueShowers = 0;
for (auto const& track_id: showermother.second){
for(geo::PlaneID plane_id: geom->Iterate<geo::PlaneID>()){
for(geo::PlaneID plane_id: geom->IteratePlaneIDs()){
TrueHitDep_FromTrueShowers += MCTrack_hit_map[showerhit_productid][track_id][plane_id];
}
}
Expand Down

0 comments on commit cfc3229

Please sign in to comment.