Skip to content

Commit 8e4ab73

Browse files
authored
Merge pull request #541 from SBNSoftware/feature/aheggest_RWMinCAF
Add PMT Beam Signal timing to ICARUS CAFs
2 parents 45b7e0c + aad2ae1 commit 8e4ab73

File tree

5 files changed

+27
-2
lines changed

5 files changed

+27
-2
lines changed

sbncode/CAFMaker/CAFMakerParams.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,12 @@ namespace caf
374374
"OpFlash"
375375
};
376376

377+
Atom<string> PMTBeamSignalLabel {
378+
Name("PMTBeamSignalLabel"),
379+
Comment("Label for special PMT beam timing signals used to build the beam bunch structure"),
380+
"beamTiming:RWM"
381+
};
382+
377383
Atom<long long> CRTSimT0Offset {
378384
Name("CRTSimT0Offset"),
379385
Comment("start of beam gate/simulation time in the simulated CRT clock"),

sbncode/CAFMaker/CAFMaker_module.cc

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,14 +1668,18 @@ void CAFMaker::produce(art::Event& evt) noexcept {
16681668
std::vector<caf::SROpFlash> srflashes;
16691669
if(fDet == kICARUS)
16701670
{
1671+
//Get all of the special PMT Beam Signals (to use as an opFlash reference time below)
1672+
art::Handle<std::vector<sbn::timing::PMTBeamSignal>> PMTBeamSignal_handle;
1673+
GetByLabelIfExists(evt, fParams.PMTBeamSignalLabel(), PMTBeamSignal_handle);
1674+
16711675
for (const std::string& pandora_tag_suffix : pandora_tag_suffixes) {
16721676
art::Handle<std::vector<recob::OpFlash>> flashes_handle;
16731677
GetByLabelStrict(evt, fParams.OpFlashLabel() + pandora_tag_suffix, flashes_handle);
16741678
// fill into event
16751679
if (flashes_handle.isValid()) {
16761680
const std::vector<recob::OpFlash> &opflashes = *flashes_handle;
16771681
int cryostat = ( pandora_tag_suffix.find("W") != std::string::npos ) ? 1 : 0;
1678-
1682+
16791683
// get associated OpHits for each OpFlash
16801684
art::FindMany<recob::OpHit> findManyHits(flashes_handle, evt, fParams.OpFlashLabel() + pandora_tag_suffix);
16811685

@@ -1685,7 +1689,14 @@ void CAFMaker::produce(art::Event& evt) noexcept {
16851689
std::vector<recob::OpHit const*> const& ophits = findManyHits.at(iflash);
16861690

16871691
srflashes.emplace_back();
1688-
FillICARUSOpFlash(flash, ophits, cryostat, srflashes.back());
1692+
if(PMTBeamSignal_handle.isValid() && isRealData){
1693+
const std::vector<sbn::timing::PMTBeamSignal> &pmtbeamsignals = *PMTBeamSignal_handle;
1694+
FillICARUSOpFlash(flash, ophits, cryostat, pmtbeamsignals, srflashes.back());
1695+
}
1696+
else{
1697+
const std::vector<sbn::timing::PMTBeamSignal> pmtbeamsignals;
1698+
FillICARUSOpFlash(flash, ophits, cryostat, pmtbeamsignals, srflashes.back());
1699+
}
16891700
iflash++;
16901701
}
16911702
}

sbncode/CAFMaker/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ art_make_library( LIBRARY_NAME sbncode_CAFMaker
3535
sbnobj::Common_CRT
3636
sbnobj::Common_Reco
3737
sbnobj::Common_Analysis
38+
sbnobj::Common_PMT_Data
3839
sbnobj::SBND_CRT
3940
lardataalg::DetectorInfo
4041
art::Framework_Services_System_TriggerNamesService_service

sbncode/CAFMaker/FillReco.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ namespace caf
183183
void FillICARUSOpFlash(const recob::OpFlash &flash,
184184
std::vector<recob::OpHit const*> const& hits,
185185
int cryo,
186+
std::vector<sbn::timing::PMTBeamSignal> RWMTimes,
186187
caf::SROpFlash &srflash,
187188
bool allowEmpty) {
188189

@@ -192,11 +193,15 @@ namespace caf
192193
srflash.timewidth = flash.TimeWidth();
193194

194195
double firstTime = std::numeric_limits<double>::max();
196+
std::map<int, double> risemap;
195197
for(const auto& hit: hits){
196198
double const hitTime = hit->HasStartTime()? hit->StartTime(): hit->PeakTime();
197199
if (firstTime > hitTime)
198200
firstTime = hitTime;
201+
if (!RWMTimes.empty())
202+
sbn::timing::SelectFirstOpHitByTime(hit,risemap);
199203
}
204+
srflash.rwmtime = getFlashBunchTime(risemap, RWMTimes);
200205
srflash.firsttime = firstTime;
201206

202207
srflash.cryo = cryo; // 0 in SBND, 0/1 for E/W in ICARUS

sbncode/CAFMaker/FillReco.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "sbnobj/SBND/CRT/CRTTrack.hh"
4343
#include "sbnobj/Common/CRT/CRTPMTMatching.hh"
4444
#include "sbnobj/Common/CRT/CRTHitT0TaggingInfo.hh"
45+
#include "sbnobj/Common/PMT/Data/PMTBeamSignal.hh"
4546
#include "nusimdata/SimulationBase/MCParticle.h"
4647
#include "nusimdata/SimulationBase/MCTruth.h"
4748

@@ -256,6 +257,7 @@ namespace caf
256257
void FillICARUSOpFlash(const recob::OpFlash &flash,
257258
std::vector<recob::OpHit const*> const& hits,
258259
int cryo,
260+
std::vector<sbn::timing::PMTBeamSignal> RWMTimes,
259261
caf::SROpFlash &srflash,
260262
bool allowEmpty = false);
261263

0 commit comments

Comments
 (0)