3535#include " sbnobj/SBND/CRT/CRTTrack.hh"
3636#include " sbnobj/SBND/Timing/DAQTimestamp.hh"
3737
38- #include " sbndcode/Geometry/GeometryWrappers/CRTGeoAlg .h"
38+ #include " sbndcode/Geometry/GeometryWrappers/CRTGeoService .h"
3939#include " sbndcode/Geometry/GeometryWrappers/TPCGeoAlg.h"
4040#include " sbndcode/ChannelMaps/CRT/CRTChannelMapService.h"
4141#include " sbndcode/CRT/CRTBackTracker/CRTBackTrackerAlg.h"
@@ -95,7 +95,7 @@ class sbnd::crt::CRTAnalysis : public art::EDAnalyzer {
9595
9696private:
9797
98- CRTGeoAlg fCRTGeoAlg ;
98+ art::ServiceHandle<CRTGeoService> fCRTGeoService ;
9999 TPCGeoAlg fTPCGeoAlg ;
100100 CRTBackTrackerAlg fCRTBackTrackerAlg ;
101101
@@ -351,7 +351,6 @@ class sbnd::crt::CRTAnalysis : public art::EDAnalyzer {
351351
352352sbnd::crt::CRTAnalysis::CRTAnalysis (fhicl::ParameterSet const & p)
353353 : EDAnalyzer{p}
354- , fCRTGeoAlg (p.get<fhicl::ParameterSet>(" CRTGeoAlg" ))
355354 , fCRTBackTrackerAlg (p.get<fhicl::ParameterSet>(" CRTBackTrackerAlg" , fhicl::ParameterSet()))
356355{
357356 fMCParticleModuleLabel = p.get <std::string>(" MCParticleModuleLabel" , " largeant" );
@@ -644,7 +643,7 @@ sbnd::crt::CRTAnalysis::CRTAnalysis(fhicl::ParameterSet const& p)
644643
645644 if (fDebug )
646645 {
647- for (auto const &[name, tagger] : fCRTGeoAlg . GetTaggers ())
646+ for (auto const &[name, tagger] : fCRTGeoService -> GetTaggers ())
648647 {
649648 std::cout << " Tagger: " << tagger.name << ' \n '
650649 << " X - Min: " << tagger.minX << " Max: " << tagger.maxX << ' \n '
@@ -654,7 +653,7 @@ sbnd::crt::CRTAnalysis::CRTAnalysis(fhicl::ParameterSet const& p)
654653
655654 std::cout << std::endl;
656655
657- for (auto const &[name, module ] : fCRTGeoAlg . GetModules ())
656+ for (auto const &[name, module ] : fCRTGeoService -> GetModules ())
658657 {
659658 std::cout << " Module: " << module .name << " (" << module .taggerName << " )" << ' \n ' ;
660659 if (module .minos )
@@ -667,7 +666,7 @@ sbnd::crt::CRTAnalysis::CRTAnalysis(fhicl::ParameterSet const& p)
667666
668667 std::cout << std::endl;
669668
670- for (auto const &[name, sipm] : fCRTGeoAlg . GetSiPMs ())
669+ for (auto const &[name, sipm] : fCRTGeoService -> GetSiPMs ())
671670 {
672671 std::cout << " SiPM: " << sipm.channel << " (" << sipm.channel /32 << " - " << sipm.channel %32 << " )" << ' \n '
673672 << " x: " << sipm.x << " y: " << sipm.y << " z: " << sipm.z << std::endl;
@@ -1127,7 +1126,7 @@ void sbnd::crt::CRTAnalysis::AnalyseFEBDatas(std::vector<art::Ptr<FEBData>> &FEB
11271126 const auto data = FEBDataVec[i];
11281127
11291128 _feb_mac5[i] = data->Mac5 ();
1130- _feb_tagger[i] = fCRTGeoAlg . AuxDetIndexToTaggerEnum (data->Mac5 ());
1129+ _feb_tagger[i] = fCRTGeoService -> AuxDetIndexToTaggerEnum (data->Mac5 ());
11311130 _feb_flags[i] = data->Flags ();
11321131 _feb_ts0[i] = data->Ts0 ();
11331132 _feb_ts1[i] = data->Ts1 ();
@@ -1166,7 +1165,7 @@ void sbnd::crt::CRTAnalysis::AnalyseCRTStripHits(const art::Event &e, const std:
11661165 const auto hit = CRTStripHitVec[i];
11671166
11681167 _sh_channel[i] = hit->Channel ();
1169- _sh_tagger[i] = fCRTGeoAlg . ChannelToTaggerEnum (hit->Channel ());
1168+ _sh_tagger[i] = fCRTGeoService -> ChannelToTaggerEnum (hit->Channel ());
11701169 _sh_ts0[i] = hit->Ts0 ();
11711170 _sh_ts1[i] = hit->Ts1 ();
11721171 _sh_unixs[i] = hit->UnixS ();
@@ -1180,8 +1179,8 @@ void sbnd::crt::CRTAnalysis::AnalyseCRTStripHits(const art::Event &e, const std:
11801179 if (!fDataMode && fTruthMatch )
11811180 {
11821181 const CRTBackTrackerAlg::TruthMatchMetrics truthMatch = fCRTBackTrackerAlg .TruthMatching (e, hit);
1183- const std::vector<double > localpos = fCRTGeoAlg . StripWorldToLocalPos (hit->Channel (), truthMatch.deposit .x , truthMatch.deposit .y , truthMatch.deposit .z );
1184- const double width = fCRTGeoAlg . GetStrip (hit->Channel ()).width ;
1182+ const std::vector<double > localpos = fCRTGeoService -> StripWorldToLocalPos (hit->Channel (), truthMatch.deposit .x , truthMatch.deposit .y , truthMatch.deposit .z );
1183+ const double width = fCRTGeoService -> GetStrip (hit->Channel ()).width ;
11851184
11861185 _sh_truth_trackid[i] = truthMatch.trackid ;
11871186 _sh_truth_completeness[i] = truthMatch.completeness ;
@@ -1293,11 +1292,11 @@ void sbnd::crt::CRTAnalysis::AnalyseCRTClusters(const art::Event &e, const std::
12931292 */
12941293 if (spacepoints.size () == 1 )
12951294 {
1296- double pe0 = fCRTGeoAlg . GetSiPM ( striphit->Channel () ).gain * striphit->ADC1 ();
1297- double pe1 = fCRTGeoAlg . GetSiPM ( striphit->Channel () + 1 ).gain * striphit->ADC2 ();
1295+ double pe0 = fCRTGeoService -> GetSiPM ( striphit->Channel () ).gain * striphit->ADC1 ();
1296+ double pe1 = fCRTGeoService -> GetSiPM ( striphit->Channel () + 1 ).gain * striphit->ADC2 ();
12981297 double pe = pe0 + pe1;
12991298
1300- double dist = fCRTGeoAlg . DistanceDownStrip ( spacepoints[0 ]->Pos (), striphit->Channel () );
1299+ double dist = fCRTGeoService -> DistanceDownStrip ( spacepoints[0 ]->Pos (), striphit->Channel () );
13011300
13021301 double corr = std::pow ( dist - fPEAttenuation , 2.0 ) / std::pow ( fPEAttenuation , 2.0 );
13031302 double tw_pe = pe * corr;
0 commit comments