@@ -63,6 +63,8 @@ class sbnd::crt::CRTAnalysis : public art::EDAnalyzer {
6363 // Required functions.
6464 void analyze (art::Event const & e) override ;
6565
66+ void beginRun (art::Run const & r) override ;
67+
6668 void AnalysePTBs (std::vector<art::Ptr<raw::ptb::sbndptb>> &PTBVec);
6769
6870 void AnalyseTDCs (std::vector<art::Ptr<sbnd::timing::DAQTimestamp>> &TDCVec);
@@ -95,8 +97,10 @@ class sbnd::crt::CRTAnalysis : public art::EDAnalyzer {
9597
9698private:
9799
98- art::ServiceHandle<CRTGeoService> fCRTGeoService ;
99- TPCGeoAlg fTPCGeoAlg ;
100+ art::ServiceHandle<CRTGeoService> fCRTGeoService ;
101+ art::ServiceHandle<SBND::CRTChannelMapService> fCRTChannelMapService ;
102+
103+ TPCGeoAlg fTPCGeoAlg ;
100104 CRTBackTrackerAlg fCRTBackTrackerAlg ;
101105
102106 std::string fMCParticleModuleLabel , fSimDepositModuleLabel , fFEBDataModuleLabel , fCRTStripHitModuleLabel ,
@@ -640,37 +644,39 @@ sbnd::crt::CRTAnalysis::CRTAnalysis(fhicl::ParameterSet const& p)
640644 fTree ->Branch (" tdc_offset" , " std::vector<uint64_t>" , &_tdc_offset);
641645 fTree ->Branch (" tdc_name" , " std::vector<std::string>" , &_tdc_name);
642646 }
647+ }
643648
649+ void sbnd::crt::CRTAnalysis::beginRun (art::Run const & r)
650+ {
644651 if (fDebug )
645652 {
646- for (auto const &[name, tagger] : fCRTGeoService ->GetTaggers ())
647- {
648- std::cout << " Tagger: " << tagger.name << ' \n '
649- << " X - Min: " << tagger.minX << " Max: " << tagger.maxX << ' \n '
650- << " Y - Min: " << tagger.minY << " Max: " << tagger.maxY << ' \n '
651- << " Z - Min: " << tagger.minZ << " Max: " << tagger.maxZ << ' \n ' << std::endl;
652- }
653+ std::cout << " \n ==================================="
654+ << " \n Taggers!"
655+ << " \n ===================================" ;
653656
654- std::cout << std::endl;
657+ for (auto const &[name, tagger] : fCRTGeoService ->GetTaggers ())
658+ std::cout << std::endl << tagger;
655659
656- for (auto const &[name, module ] : fCRTGeoService ->GetModules ())
657- {
658- std::cout << " Module: " << module .name << " (" << module .taggerName << " )" << ' \n ' ;
659- if (module .minos )
660- std::cout << " MINOS module" << std::endl;
661- std::cout << " X - Min: " << module .minX << " Max: " << module .maxX << " Diff: " << module .maxX - module .minX << ' \n '
662- << " Y - Min: " << module .minY << " Max: " << module .maxY << " Diff: " << module .maxY - module .minY << ' \n '
663- << " Z - Min: " << module .minZ << " Max: " << module .maxZ << " Diff: " << module .maxZ - module .minZ << ' \n '
664- << " Orientation: " << module .orientation << ' \n ' << std::endl;
665- }
660+ std::cout << " \n ==================================="
661+ << " \n Modules!"
662+ << " \n ===================================" ;
666663
667- std::cout << std::endl;
664+ for (auto const &[name, module ] : fCRTGeoService ->GetModules ())
665+ std::cout << std::endl << module ;
668666
669- for (auto const &[name, sipm] : fCRTGeoService ->GetSiPMs ())
670- {
671- std::cout << " SiPM: " << sipm.channel << " (" << sipm.channel /32 << " - " << sipm.channel %32 << " )" << ' \n '
672- << " x: " << sipm.x << " y: " << sipm.y << " z: " << sipm.z << std::endl;
673- }
667+ std::cout << " \n ==================================="
668+ << " \n Strips!"
669+ << " \n ===================================" ;
670+
671+ for (auto const &[name, strip] : fCRTGeoService ->GetStrips ())
672+ std::cout << std::endl << strip;
673+
674+ std::cout << " \n ==================================="
675+ << " \n SiPMs!"
676+ << " \n ===================================" ;
677+
678+ for (auto const &[name, sipm] : fCRTGeoService ->GetSiPMs ())
679+ std::cout << std::endl << sipm;
674680 }
675681}
676682
@@ -1269,20 +1275,12 @@ void sbnd::crt::CRTAnalysis::AnalyseCRTClusters(const art::Event &e, const std::
12691275 for (unsigned ii = 0 ; ii < _cl_nhits[i]; ++ii)
12701276 {
12711277 const auto striphit = striphits[ii];
1272- _cl_channel_set[i][ii] = striphit->Channel ();
1273- _cl_adc_set[i][2 *ii] = striphit->ADC1 ();
1274- _cl_adc_set[i][2 *ii+1 ] = striphit->ADC2 ();
1275- _cl_sh_ts0_set[i][ii] = striphit->Ts0 ();
1276- _cl_sh_ts1_set[i][ii] = striphit->Ts1 ();
1277-
1278- if (fDataMode )
1279- {
1280- art::ServiceHandle<SBND::CRTChannelMapService> ChannelMapService;
1281- SBND::CRTChannelMapService::ModuleInfo_t module_info = ChannelMapService->GetModuleInfoFromOfflineID ( striphit->Channel () / 32 );
1282- _cl_sh_feb_mac5_set[i][ii] = ( module_info.valid ) ? module_info.feb_mac5 : 0 ;
1283- }
1284- else
1285- _cl_sh_feb_mac5_set[i][ii] = striphit->Channel () / 32 ;
1278+ _cl_channel_set[i][ii] = striphit->Channel ();
1279+ _cl_adc_set[i][2 *ii] = striphit->ADC1 ();
1280+ _cl_adc_set[i][2 *ii+1 ] = striphit->ADC2 ();
1281+ _cl_sh_ts0_set[i][ii] = striphit->Ts0 ();
1282+ _cl_sh_ts1_set[i][ii] = striphit->Ts1 ();
1283+ _cl_sh_feb_mac5_set[i][ii] = fCRTChannelMapService ->GetMAC5FromOfflineChannelID (striphit->Channel ());
12861284
12871285 /*
12881286 * The below segment reimplements the CorrectTime() method
0 commit comments