Skip to content

Commit 5c8f9d4

Browse files
committed
Better debug statements
1 parent b3160f9 commit 5c8f9d4

3 files changed

Lines changed: 135 additions & 26 deletions

File tree

sbndcode/CRT/CRTAna/CRTAnalysis_module.cc

Lines changed: 62 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -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);
@@ -645,36 +647,70 @@ sbnd::crt::CRTAnalysis::CRTAnalysis(fhicl::ParameterSet const& p)
645647

646648
if(fDebug)
647649
{
648-
for(auto const &[name, tagger] : fCRTGeoService->GetTaggers())
649-
{
650-
std::cout << "Tagger: " << tagger.name << '\n'
651-
<< "X - Min: " << tagger.minX << " Max: " << tagger.maxX << '\n'
652-
<< "Y - Min: " << tagger.minY << " Max: " << tagger.maxY << '\n'
653-
<< "Z - Min: " << tagger.minZ << " Max: " << tagger.maxZ << '\n' << std::endl;
654-
}
650+
// for(auto const &[name, tagger] : fCRTGeoService->GetTaggers())
651+
// {
652+
// std::cout << "Tagger: " << tagger.name << '\n'
653+
// << "X - Min: " << tagger.minX << " Max: " << tagger.maxX << '\n'
654+
// << "Y - Min: " << tagger.minY << " Max: " << tagger.maxY << '\n'
655+
// << "Z - Min: " << tagger.minZ << " Max: " << tagger.maxZ << '\n' << std::endl;
656+
// }
657+
658+
// std::cout << std::endl;
659+
660+
// for(auto const &[name, module] : fCRTGeoService->GetModules())
661+
// {
662+
// std::cout << "Module: " << module.name << " (" << module.taggerName << ")" << '\n';
663+
// if(module.minos)
664+
// std::cout << "MINOS module" << std::endl;
665+
// std::cout << "X - Min: " << module.minX << " Max: " << module.maxX << " Diff: " << module.maxX - module.minX << '\n'
666+
// << "Y - Min: " << module.minY << " Max: " << module.maxY << " Diff: " << module.maxY - module.minY << '\n'
667+
// << "Z - Min: " << module.minZ << " Max: " << module.maxZ << " Diff: " << module.maxZ - module.minZ << '\n'
668+
// << "Orientation: " << module.orientation << '\n' << std::endl;
669+
// }
670+
671+
// std::cout << std::endl;
672+
673+
// for(auto const &[name, sipm] : fCRTGeoService->GetSiPMs())
674+
// {
675+
// std::cout << "SiPM: " << sipm.channel << " ("
676+
// << fCRTChannelMapService->GetOfflineModuleIDFromOfflineChannelID(sipm.channel) << " - "
677+
// << fCRTChannelMapService->GetLocalOfflineChannelFromOfflineChannelID(sipm.channel) << ")" << '\n'
678+
// << "x: " << sipm.x << " y: " << sipm.y << " z: " << sipm.z << std::endl;
679+
// }
680+
}
681+
}
682+
683+
void sbnd::crt::CRTAnalysis::beginRun(art::Run const& r)
684+
{
685+
if(fDebug)
686+
{
687+
std::cout << "\n==================================="
688+
<< "\nTaggers!"
689+
<< "\n===================================";
655690

656-
std::cout << std::endl;
691+
for (auto const &[name, tagger] : fCRTGeoService->GetTaggers())
692+
std::cout << std::endl << tagger;
657693

658-
for(auto const &[name, module] : fCRTGeoService->GetModules())
659-
{
660-
std::cout << "Module: " << module.name << " (" << module.taggerName << ")" << '\n';
661-
if(module.minos)
662-
std::cout << "MINOS module" << std::endl;
663-
std::cout << "X - Min: " << module.minX << " Max: " << module.maxX << " Diff: " << module.maxX - module.minX << '\n'
664-
<< "Y - Min: " << module.minY << " Max: " << module.maxY << " Diff: " << module.maxY - module.minY << '\n'
665-
<< "Z - Min: " << module.minZ << " Max: " << module.maxZ << " Diff: " << module.maxZ - module.minZ << '\n'
666-
<< "Orientation: " << module.orientation << '\n' << std::endl;
667-
}
694+
std::cout << "\n==================================="
695+
<< "\nModules!"
696+
<< "\n===================================";
668697

669-
std::cout << std::endl;
698+
for (auto const &[name, module] : fCRTGeoService->GetModules())
699+
std::cout << std::endl << module;
670700

671-
for(auto const &[name, sipm] : fCRTGeoService->GetSiPMs())
672-
{
673-
std::cout << "SiPM: " << sipm.channel << " ("
674-
<< fCRTChannelMapService->GetOfflineModuleIDFromOfflineChannelID(sipm.channel) << " - "
675-
<< fCRTChannelMapService->GetLocalOfflineChannelFromOfflineChannelID(sipm.channel) << ")" << '\n'
676-
<< "x: " << sipm.x << " y: " << sipm.y << " z: " << sipm.z << std::endl;
677-
}
701+
std::cout << "\n==================================="
702+
<< "\nStrips!"
703+
<< "\n===================================";
704+
705+
for (auto const &[name, strip] : fCRTGeoService->GetStrips())
706+
std::cout << std::endl << strip;
707+
708+
std::cout << "\n==================================="
709+
<< "\nSiPMs!"
710+
<< "\n===================================";
711+
712+
for (auto const &[name, sipm] : fCRTGeoService->GetSiPMs())
713+
std::cout << std::endl << sipm;
678714
}
679715
}
680716

sbndcode/CRT/CRTAna/crtana_sbnd.fcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ crtana_sbnd:
1111
TimeWalkNorm: @local::sbnd_crtsim.DetSimParams.TDelayNorm
1212
TimeWalkScale: @local::sbnd_crtsim.DetSimParams.TDelayScale
1313
TruthMatch: false
14+
Debug: true
1415
module_type: "CRTAnalysis"
1516
}
1617

sbndcode/Geometry/GeometryWrappers/CRTGeoService.h

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,21 @@ namespace sbnd::crt {
7171
double gain;
7272
};
7373

74+
std::ostream& operator<<(std::ostream& os, const CRTSiPMGeo& geo) {
75+
os << "CRTSiPMGeo {\n"
76+
<< "\tstripName: " << geo.stripName << "\n"
77+
<< "\tchannel: " << geo.channel << "\n"
78+
<< "\tx: " << geo.x << "\n"
79+
<< "\ty: " << geo.y << "\n"
80+
<< "\tz: " << geo.z << "\n"
81+
<< "\tnull: " << (geo.null ? "true" : "false") << "\n"
82+
<< "\tpedestal: " << geo.pedestal << "\n"
83+
<< "\tgain: " << geo.gain << "\n"
84+
<< "\tstatus: " << geo.status << "\n"
85+
<< "}";
86+
return os;
87+
}
88+
7489
// CRT strip geometry struct contains dimensions and mother module
7590
struct CRTStripGeo{
7691
CRTStripGeo(const TGeoNode *stripNode, const geo::AuxDetSensitiveGeo &auxDetSensitive,
@@ -123,6 +138,26 @@ namespace sbnd::crt {
123138
bool null;
124139
};
125140

141+
std::ostream& operator<<(std::ostream& os, const CRTStripGeo& s)
142+
{
143+
os << "CRTStripGeo {\n"
144+
<< "\tname: " << s.name << "\n"
145+
<< "\tmoduleName: " << s.moduleName << "\n"
146+
<< "\tchannel0: " << s.channel0 << "\n"
147+
<< "\tchannel1: " << s.channel1 << "\n"
148+
<< "\tminX: " << s.minX << "\n"
149+
<< "\tmaxX: " << s.maxX << "\n"
150+
<< "\tminY: " << s.minY << "\n"
151+
<< "\tmaxY: " << s.maxY << "\n"
152+
<< "\tminZ: " << s.minZ << "\n"
153+
<< "\tmaxZ: " << s.maxZ << "\n"
154+
<< "\twidth: " << s.width << "\n"
155+
<< "\tadsID: " << s.adsID << "\n"
156+
<< "\tnull: " << (s.null ? "true" : "false") << "\n"
157+
<< "}";
158+
return os;
159+
}
160+
126161
// CRT module geometry struct contains dimensions, daughter strips and mother tagger
127162
struct CRTModuleGeo{
128163
CRTModuleGeo()
@@ -210,6 +245,29 @@ namespace sbnd::crt {
210245
bool null;
211246
};
212247

248+
std::ostream& operator<<(std::ostream& os, const CRTModuleGeo& m)
249+
{
250+
os << "CRTModuleGeo {\n"
251+
<< "\tname: " << m.name << "\n"
252+
<< "\ttaggerName: " << m.taggerName << "\n"
253+
<< "\tminX: " << m.minX << "\n"
254+
<< "\tmaxX: " << m.maxX << "\n"
255+
<< "\tminY: " << m.minY << "\n"
256+
<< "\tmaxY: " << m.maxY << "\n"
257+
<< "\tminZ: " << m.minZ << "\n"
258+
<< "\tmaxZ: " << m.maxZ << "\n"
259+
<< "\torientation: " << m.orientation << "\n"
260+
<< "\ttop: " << (m.top ? "true" : "false") << "\n"
261+
<< "\tadID: " << m.adID << "\n"
262+
<< "\tt0DelayCorrection: " << m.t0DelayCorrection << "\n"
263+
<< "\tt1DelayCorrection: " << m.t1DelayCorrection << "\n"
264+
<< "\tinvertedOrdering: " << (m.invertedOrdering ? "true" : "false") << "\n"
265+
<< "\tminos: " << (m.minos ? "true" : "false") << "\n"
266+
<< "\tnull: " << (m.null ? "true" : "false") << "\n"
267+
<< "}";
268+
return os;
269+
}
270+
213271
// CRT tagger geometry struct contains dimensions and daughter modules
214272
struct CRTTaggerGeo{
215273
CRTTaggerGeo(const TGeoNode *taggerNode, const TGeoNode *detNode)
@@ -255,6 +313,20 @@ namespace sbnd::crt {
255313
bool null;
256314
};
257315

316+
std::ostream& operator<<(std::ostream& os, const CRTTaggerGeo& t)
317+
{
318+
os << "CRTTaggerGeo {\n"
319+
<< "\tname: " << t.name << "\n"
320+
<< "\tminX: " << t.minX << "\n"
321+
<< "\tmaxX: " << t.maxX << "\n"
322+
<< "\tminY: " << t.minY << "\n"
323+
<< "\tmaxY: " << t.maxY << "\n"
324+
<< "\tminZ: " << t.minZ << "\n"
325+
<< "\tmaxZ: " << t.maxZ << "\n"
326+
<< "\tnull: " << (t.null ? "true" : "false") << "\n"
327+
<< "}";
328+
return os;
329+
}
258330

259331
class CRTGeoService {
260332
public:

0 commit comments

Comments
 (0)