Skip to content

Commit b3160f9

Browse files
committed
Consistent usage
1 parent b3e7576 commit b3160f9

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

sbndcode/CRT/CRTAna/CRTAnalysis_module.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,9 @@ sbnd::crt::CRTAnalysis::CRTAnalysis(fhicl::ParameterSet const& p)
670670

671671
for(auto const &[name, sipm] : fCRTGeoService->GetSiPMs())
672672
{
673-
std::cout << "SiPM: " << sipm.channel << " (" << sipm.channel/32 << " - " << sipm.channel%32 << ")" << '\n'
673+
std::cout << "SiPM: " << sipm.channel << " ("
674+
<< fCRTChannelMapService->GetOfflineModuleIDFromOfflineChannelID(sipm.channel) << " - "
675+
<< fCRTChannelMapService->GetLocalOfflineChannelFromOfflineChannelID(sipm.channel) << ")" << '\n'
674676
<< "x: " << sipm.x << " y: " << sipm.y << " z: " << sipm.z << std::endl;
675677
}
676678
}

sbndcode/CRT/CRTReco/CRTStripHitProducer_module.cc

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "sbndcode/Geometry/GeometryWrappers/CRTGeoService.h"
2929
#include "sbndcode/Decoders/PTB/sbndptb.h"
3030
#include "sbndcode/Timing/SBNDRawTimingObj.h"
31+
#include "sbndcode/ChannelMaps/CRT/CRTChannelMapService.h"
3132

3233
#include <memory>
3334
#include <bitset>
@@ -56,7 +57,8 @@ class sbnd::crt::CRTStripHitProducer : public art::EDProducer {
5657

5758
private:
5859

59-
art::ServiceHandle<CRTGeoService> fCRTGeoService;
60+
art::ServiceHandle<CRTGeoService> fCRTGeoService;
61+
art::ServiceHandle<SBND::CRTChannelMapService> fCRTChannelMapService;
6062

6163
std::string fFEBDataModuleLabel;
6264
uint16_t fADCThreshold;
@@ -205,14 +207,15 @@ std::vector<sbnd::crt::CRTStripHit> sbnd::crt::CRTStripHitProducer::CreateStripH
205207
{
206208
std::vector<CRTStripHit> stripHits;
207209

208-
const uint32_t mac5 = data->Mac5();
209-
uint32_t unixs = data->UnixS();
210+
const uint32_t offline_module_id = data->Mac5();
211+
uint32_t unixs = data->UnixS();
210212

211213
// Only consider "real data" readouts, not clock resets etc
212214
if(!(data->Flags() == 3 || (fAllowFlag1 && data->Flags() == 1)))
213215
return stripHits;
214-
215-
const CRTModuleGeo module = fCRTGeoService->GetModule(mac5 * 32);
216+
217+
const uint32_t offline_channel_id = fCRTChannelMapService->ConstructOfflineChannelIDFromOfflineModuleIDAndOfflineLocalChannel(offline_module_id, 0);
218+
const CRTModuleGeo module = fCRTGeoService->GetModule(offline_channel_id);
216219

217220
// Correct for FEB readout cable length
218221
// (time is FEB-by-FEB not channel-by-channel)
@@ -257,11 +260,11 @@ std::vector<sbnd::crt::CRTStripHit> sbnd::crt::CRTStripHitProducer::CreateStripH
257260
for(unsigned adc_i = 0; adc_i < 32; adc_i+=2)
258261
{
259262
// Calculate SiPM channel number
260-
const uint16_t channel = mac5 * 32 + adc_i;
263+
const uint16_t offline_channel_id = fCRTChannelMapService->ConstructOfflineChannelIDFromOfflineModuleIDAndOfflineLocalChannel(offline_module_id, adc_i);
261264

262-
const CRTStripGeo strip = fCRTGeoService->GetStrip(channel);
263-
const CRTSiPMGeo sipm1 = fCRTGeoService->GetSiPM(channel);
264-
const CRTSiPMGeo sipm2 = fCRTGeoService->GetSiPM(channel+1);
265+
const CRTStripGeo strip = fCRTGeoService->GetStrip(offline_channel_id);
266+
const CRTSiPMGeo sipm1 = fCRTGeoService->GetSiPM(offline_channel_id);
267+
const CRTSiPMGeo sipm2 = fCRTGeoService->GetSiPM(offline_channel_id+1);
265268

266269
if(sipm1.status == CRTChannelStatus::kDeadChannel || sipm2.status == CRTChannelStatus::kDeadChannel)
267270
continue;
@@ -287,7 +290,7 @@ std::vector<sbnd::crt::CRTStripHit> sbnd::crt::CRTStripHitProducer::CreateStripH
287290
if(pos - err < 0)
288291
err = pos;
289292

290-
stripHits.emplace_back(channel, t0, t1, ref_time_s, pos, err, adc1, adc2);
293+
stripHits.emplace_back(offline_channel_id, t0, t1, ref_time_s, pos, err, adc1, adc2);
291294
}
292295
}
293296

0 commit comments

Comments
 (0)