Skip to content

Commit 49a5a72

Browse files
authored
Merge branch 'develop' into lnguyen/frame_shift_pr_dev
2 parents 40d50a1 + 508e45f commit 49a5a72

File tree

13 files changed

+78
-20
lines changed

13 files changed

+78
-20
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
1717

1818
find_package(cetmodules 3.20.00 REQUIRED)
19-
project(sbncode VERSION 10.06.00.01 LANGUAGES CXX)
19+
project(sbncode VERSION 10.09.00 LANGUAGES CXX)
2020

2121
message(STATUS "\n\n ========================== ${PROJECT_NAME} ==========================")
2222

sbncode/BeamSpillInfoRetriever/BNBEXTRetriever/BNBEXTRetriever_module.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ void sbn::BNBEXTRetriever::endSubRun(art::SubRun& sr)
173173
std::cout << "FAILED! " << std::endl;
174174
// probably want to throw an exception here
175175

176-
for(auto ExtInfo : fOutExtInfos){
176+
for(auto &ExtInfo : fOutExtInfos){
177177

178178
ExtInfo.gates_since_last_trigger *= scale_factor;
179179

sbncode/BeamSpillInfoRetriever/BNBRetriever/BNBRetriever_module.cc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,8 @@ sbn::BNBSpillInfo sbn::BNBRetriever::makeBNBSpillInfo
663663
double LM875A = 0; // units R/s
664664
double LM875B = 0; // units R/s
665665
double LM875C = 0; // units R/s
666+
double HP873 = 0; // units mm
667+
double VP873 = 0; // units mm
666668
double HP875 = 0; // units mm
667669
double VP875 = 0; // units mm
668670
double HPTG1 = 0; // units mm
@@ -671,6 +673,14 @@ sbn::BNBSpillInfo sbn::BNBRetriever::makeBNBSpillInfo
671673
double VPTG2 = 0; // units mm
672674
double BTJT2 = 0; // units Deg C
673675
double THCURR = 0; // units kiloAmps
676+
double M875HS = 0; // units mm
677+
double M875VS = 0; // units mm
678+
double M875HM = 0; // units mm
679+
double M875VM = 0; // units mm
680+
double M876HS = 0; // units mm
681+
double M876VS = 0; // units mm
682+
double M876HM = 0; // units mm
683+
double M876VM = 0; // units mm
674684

675685
double TOR860_time = 0; // units s
676686

@@ -683,6 +693,8 @@ sbn::BNBSpillInfo sbn::BNBRetriever::makeBNBSpillInfo
683693
try{bfp->GetNamedData(time, "E:LM875A",&LM875A);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
684694
try{bfp->GetNamedData(time, "E:LM875B",&LM875B);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
685695
try{bfp->GetNamedData(time, "E:LM875C",&LM875C);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
696+
try{bfp->GetNamedData(time, "E:HP873",&HP873);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
697+
try{bfp->GetNamedData(time, "E:VP873",&VP873);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
686698
try{bfp->GetNamedData(time, "E:HP875",&HP875);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
687699
try{bfp->GetNamedData(time, "E:VP875",&VP875);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
688700
try{bfp->GetNamedData(time, "E:HPTG1",&HPTG1);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
@@ -691,6 +703,14 @@ sbn::BNBSpillInfo sbn::BNBRetriever::makeBNBSpillInfo
691703
try{bfp->GetNamedData(time, "E:VPTG2",&VPTG2);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
692704
try{bfp->GetNamedData(time, "E:BTJT2",&BTJT2);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
693705
try{bfp->GetNamedData(time, "E:THCURR",&THCURR);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
706+
try{bfp->GetNamedData(time, "E:M875HS",&M875HS);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
707+
try{bfp->GetNamedData(time, "E:M875VS",&M875VS);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
708+
try{bfp->GetNamedData(time, "E:M875HM",&M875HM);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
709+
try{bfp->GetNamedData(time, "E:M875VM",&M875VM);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
710+
try{bfp->GetNamedData(time, "E:M876HS",&M876HS);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
711+
try{bfp->GetNamedData(time, "E:M876VS",&M876VS);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
712+
try{bfp->GetNamedData(time, "E:M876HM",&M876HM);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
713+
try{bfp->GetNamedData(time, "E:M876VM",&M876VM);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
694714

695715
//crunch the times
696716
unsigned long int time_closest_int = (int) TOR860_time;
@@ -703,6 +723,8 @@ sbn::BNBSpillInfo sbn::BNBRetriever::makeBNBSpillInfo
703723
beamInfo.LM875A = LM875A;
704724
beamInfo.LM875B = LM875B;
705725
beamInfo.LM875C = LM875C;
726+
beamInfo.HP873 = HP873;
727+
beamInfo.VP873 = VP873;
706728
beamInfo.HP875 = HP875;
707729
beamInfo.VP875 = VP875;
708730
beamInfo.HPTG1 = HPTG1;
@@ -711,6 +733,14 @@ sbn::BNBSpillInfo sbn::BNBRetriever::makeBNBSpillInfo
711733
beamInfo.VPTG2 = VPTG2;
712734
beamInfo.BTJT2 = BTJT2;
713735
beamInfo.THCURR = THCURR;
736+
beamInfo.M875HS = M875HS;
737+
beamInfo.M875VS = M875VS;
738+
beamInfo.M875HM = M875HM;
739+
beamInfo.M875VM = M875VM;
740+
beamInfo.M876HS = M876HS;
741+
beamInfo.M876VS = M876VS;
742+
beamInfo.M876HM = M876HM;
743+
beamInfo.M876VM = M876VM;
714744
beamInfo.spill_time_s = time_closest_int;
715745
beamInfo.spill_time_ns = time_closest_ns;
716746

sbncode/CAFMaker/CAFMakerParams.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,12 @@ namespace caf
386386
"OpFlash"
387387
};
388388

389+
Atom<string> PMTBeamSignalLabel {
390+
Name("PMTBeamSignalLabel"),
391+
Comment("Label for special PMT beam timing signals used to build the beam bunch structure"),
392+
"beamTiming:RWM"
393+
};
394+
389395
Atom<long long> CRTSimT0Offset {
390396
Name("CRTSimT0Offset"),
391397
Comment("start of beam gate/simulation time in the simulated CRT clock"),

sbncode/CAFMaker/CAFMaker_module.cc

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,6 @@ void CAFMaker::InitializeOutfiles()
10911091

10921092
}
10931093

1094-
10951094
if(fParams.CreateFlatCAF()){
10961095
mf::LogInfo("CAFMaker") << "Output flat filename is " << fFlatCafFilename;
10971096

@@ -1727,14 +1726,18 @@ void CAFMaker::produce(art::Event& evt) noexcept {
17271726
std::vector<caf::SROpFlash> srflashes;
17281727
if(fDet == kICARUS)
17291728
{
1729+
//Get all of the special PMT Beam Signals (to use as an opFlash reference time below)
1730+
art::Handle<std::vector<sbn::timing::PMTBeamSignal>> PMTBeamSignal_handle;
1731+
GetByLabelIfExists(evt, fParams.PMTBeamSignalLabel(), PMTBeamSignal_handle);
1732+
17301733
for (const std::string& pandora_tag_suffix : pandora_tag_suffixes) {
17311734
art::Handle<std::vector<recob::OpFlash>> flashes_handle;
17321735
GetByLabelStrict(evt, fParams.OpFlashLabel() + pandora_tag_suffix, flashes_handle);
17331736
// fill into event
17341737
if (flashes_handle.isValid()) {
17351738
const std::vector<recob::OpFlash> &opflashes = *flashes_handle;
17361739
int cryostat = ( pandora_tag_suffix.find("W") != std::string::npos ) ? 1 : 0;
1737-
1740+
17381741
// get associated OpHits for each OpFlash
17391742
art::FindMany<recob::OpHit> findManyHits(flashes_handle, evt, fParams.OpFlashLabel() + pandora_tag_suffix);
17401743

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

17461749
srflashes.emplace_back();
1747-
FillICARUSOpFlash(flash, ophits, cryostat, srflashes.back());
1750+
if(PMTBeamSignal_handle.isValid() && isRealData){
1751+
const std::vector<sbn::timing::PMTBeamSignal> &pmtbeamsignals = *PMTBeamSignal_handle;
1752+
FillICARUSOpFlash(flash, ophits, cryostat, pmtbeamsignals, srflashes.back());
1753+
}
1754+
else{
1755+
const std::vector<sbn::timing::PMTBeamSignal> pmtbeamsignals;
1756+
FillICARUSOpFlash(flash, ophits, cryostat, pmtbeamsignals, srflashes.back());
1757+
}
17481758
iflash++;
17491759
}
17501760
}

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
sbnobj::SBND_Timing
4041
lardataalg::DetectorInfo

sbncode/CAFMaker/FillExposure.cxx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ namespace caf
1515
single_store.LM875A = info.LM875A;
1616
single_store.LM875B = info.LM875B;
1717
single_store.LM875C = info.LM875C;
18+
single_store.HP873 = info.HP873;
19+
single_store.VP873 = info.VP873;
1820
single_store.HP875 = info.HP875;
1921
single_store.VP875 = info.VP875;
2022
single_store.HPTG1 = info.HPTG1;
@@ -23,6 +25,14 @@ namespace caf
2325
single_store.VPTG2 = info.VPTG2;
2426
single_store.BTJT2 = info.BTJT2;
2527
single_store.THCURR = info.THCURR;
28+
single_store.M875HS = info.M875HS;
29+
single_store.M875VS = info.M875VS;
30+
single_store.M875HM = info.M875HM;
31+
single_store.M875VM = info.M875VM;
32+
single_store.M876HS = info.M876HS;
33+
single_store.M876VS = info.M876VS;
34+
single_store.M876HM = info.M876HM;
35+
single_store.M876VM = info.M876VM;
2636
single_store.M875BB = info.M875BB;
2737
single_store.M876BB = info.M876BB;
2838
single_store.MMBTBB = info.MMBTBB;

sbncode/CAFMaker/FillReco.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ namespace caf
210210
void FillICARUSOpFlash(const recob::OpFlash &flash,
211211
std::vector<recob::OpHit const*> const& hits,
212212
int cryo,
213+
std::vector<sbn::timing::PMTBeamSignal> RWMTimes,
213214
caf::SROpFlash &srflash,
214215
bool allowEmpty) {
215216

@@ -219,11 +220,15 @@ namespace caf
219220
srflash.timewidth = flash.TimeWidth();
220221

221222
double firstTime = std::numeric_limits<double>::max();
223+
std::map<int, double> risemap;
222224
for(const auto& hit: hits){
223225
double const hitTime = hit->HasStartTime()? hit->StartTime(): hit->PeakTime();
224226
if (firstTime > hitTime)
225227
firstTime = hitTime;
228+
if (!RWMTimes.empty())
229+
sbn::timing::SelectFirstOpHitByTime(hit,risemap);
226230
}
231+
srflash.rwmtime = getFlashBunchTime(risemap, RWMTimes);
227232
srflash.firsttime = firstTime;
228233

229234
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 "sbnobj/SBND/Timing/TimingInfo.hh"
4647
#include "sbnobj/SBND/Timing/FrameShiftInfo.hh"
4748

@@ -259,6 +260,7 @@ namespace caf
259260
void FillICARUSOpFlash(const recob::OpFlash &flash,
260261
std::vector<recob::OpHit const*> const& hits,
261262
int cryo,
263+
std::vector<sbn::timing::PMTBeamSignal> RWMTimes,
262264
caf::SROpFlash &srflash,
263265
bool allowEmpty = false);
264266

sbncode/Calibration/TrackCaloSkimmer_module.cc

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,15 +1140,10 @@ void sbn::TrackCaloSkimmer::FillTrack(const recob::Track &track,
11401140
fTrack->start.x = track.Start().X();
11411141
fTrack->end.x = track.End().X();
11421142
} else if (t0Info.hasT0CRTTrack) {
1143+
int driftDir = geo->TPC(hits[0]->WireID()).DriftDir().X();
11431144
const double driftv(dprop.DriftVelocity(dprop.Efield(), dprop.Temperature()));
1144-
// Comment from Francesco: I am not sure of the below formula.
1145-
// SBND has two TPCs with a common cathode like ICARUS, the driftvelocity
1146-
// returns the absolute value, but the displacement (basically the + below)
1147-
// depends on the TPC, in one case is + and in the other is negative.
1148-
// In this way the displacement is always in the same direction, working for
1149-
// one TPC, but not for the other.
1150-
fTrack->start.x = track.Start().X() + driftv*t0Info.t0CRTTrack*1e-3;
1151-
fTrack->end.x = track.End().X() + driftv*t0Info.t0CRTTrack*1e-3;
1145+
fTrack->start.x = track.Start().X() + driftDir*driftv*t0Info.t0CRTTrack*1e-3;
1146+
fTrack->end.x = track.End().X() + driftDir*driftv*t0Info.t0CRTTrack*1e-3;
11521147
} else if (t0Info.hasT0CRTHit){
11531148
// If the track does not have a a Pandora T0, the tracks will always be either on the left or (ex Or) right of the cathode.
11541149
int driftDir = geo->TPC(hits[0]->WireID()).DriftDir().X();

0 commit comments

Comments
 (0)