Skip to content

Commit e8f5c16

Browse files
committed
Merge branch 'release/v10_14_00'
2 parents 813ca27 + ab51be1 commit e8f5c16

20 files changed

Lines changed: 226 additions & 1381 deletions

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.12.02 LANGUAGES CXX)
19+
project(sbncode VERSION 10.14.00 LANGUAGES CXX)
2020

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

sbncode/BeamSpillInfoRetriever/POTTools.cpp

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -68,42 +68,42 @@ namespace sbn::pot{
6868
// initializing all of our device carriers
6969
// device definitions can be found in BNBSpillInfo.h
7070

71-
double TOR860 = 0; // units e12 protons
72-
double TOR875 = 0; // units e12 protons
73-
double LM875A = 0; // units R/s
74-
double LM875B = 0; // units R/s
75-
double LM875C = 0; // units R/s
76-
double HP873 = 0; // units mm
77-
double VP873 = 0; // units mm; not in the first IFBeam query bunch
78-
double HP875 = 0; // units mm
79-
double VP875 = 0; // units mm
80-
double HPTG1 = 0; // units mm
81-
double VPTG1 = 0; // units mm
82-
double HPTG2 = 0; // units mm
83-
double VPTG2 = 0; // units mm
84-
double BTJT2 = 0; // units Deg C
85-
double THCURR = 0; // units kiloAmps
86-
double M875HS = 0; // units mm
87-
double M875VS = 0; // units mm
88-
double M875HM = 0; // units mm
89-
double M875VM = 0; // units mm
90-
double M876HS = 0; // units mm
91-
double M876VS = 0; // units mm
92-
double M876HM = 0; // units mm
93-
double M876VM = 0; // units mm
71+
double TOR860 = -999; // units e12 protons
72+
double TOR875 = -999; // units e12 protons
73+
double LM875A = -999; // units R/s
74+
double LM875B = -999; // units R/s
75+
double LM875C = -999; // units R/s
76+
double HP873 = -999; // units mm
77+
double VP873 = -999; // units mm; not in the first IFBeam query bunch
78+
double HP875 = -999; // units mm
79+
double VP875 = -999; // units mm
80+
double HPTG1 = -999; // units mm
81+
double VPTG1 = -999; // units mm
82+
double HPTG2 = -999; // units mm
83+
double VPTG2 = -999; // units mm
84+
double BTJT2 = -999; // units Deg C
85+
double THCURR = -999; // units kiloAmps
86+
double M875HS = -999; // units mm
87+
double M875VS = -999; // units mm
88+
double M875HM = -999; // units mm
89+
double M875VM = -999; // units mm
90+
double M876HS = -999; // units mm
91+
double M876VS = -999; // units mm
92+
double M876HM = -999; // units mm
93+
double M876VM = -999; // units mm
9494

9595

96-
double HP875Offset =0;//units mm; make a another separate IFBeam query bunch for offsets
97-
double VP875Offset =0;//units mm
98-
double VP873Offset =0;//units mm
99-
double HPTG1Offset =0;//units mm
100-
double HPTG2Offset =0;//units mm
101-
double VPTG1Offset =0;//units mm
102-
double VPTG2Offset =0;//units mm
96+
double HP875Offset =-999;//units mm; make a another separate IFBeam query bunch for offsets
97+
double VP875Offset =-999;//units mm
98+
double VP873Offset =-999;//units mm
99+
double HPTG1Offset =-999;//units mm
100+
double HPTG2Offset =-999;//units mm
101+
double VPTG1Offset =-999;//units mm
102+
double VPTG2Offset =-999;//units mm
103103

104-
double TOR860_time = 0; // units s
104+
double TOR860_time = -999; // units s
105105

106-
double FOM =0;
106+
double FOM =-999;
107107

108108
// Here we request all the devices
109109
// since sometimes devices fail to report we'll
@@ -116,7 +116,7 @@ namespace sbn::pot{
116116
try{bfp->GetNamedData(time, "E:LM875B",&LM875B);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
117117
try{bfp->GetNamedData(time, "E:LM875C",&LM875C);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
118118
try{bfp->GetNamedData(time, "E:HP873",&HP873);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
119-
try{bfp->GetNamedData(time, "E:VP873",&VP873);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
119+
try{vp873->GetNamedData(time, "E:VP873",&VP873);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
120120
try{bfp->GetNamedData(time, "E:HP875",&HP875);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
121121
try{bfp->GetNamedData(time, "E:VP875",&VP875);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
122122
try{bfp->GetNamedData(time, "E:HPTG1",&HPTG1);}catch (WebAPIException &we) {mf::LogDebug("BNBRetriever")<< "At time : " << time << " " << "got exception: " << we.what() << "\n";}
@@ -231,21 +231,21 @@ namespace sbn::pot{
231231

232232
bool BrokenClock(double time, std::unique_ptr<ifbeam_ns::BeamFolder> const& bfp)
233233
{
234-
double TOR860 = 0; // units e12 protons
235-
double TOR875 = 0; // units e12 protons
236-
double LM875A = 0; // units R/s
237-
double LM875B = 0; // units R/s
238-
double LM875C = 0; // units R/s
239-
double HP875 = 0; // units mm
240-
double VP875 = 0; // units mm
241-
double HPTG1 = 0; // units mm
242-
double VPTG1 = 0; // units mm
243-
double HPTG2 = 0; // units mm
244-
double VPTG2 = 0; // units mm
245-
double BTJT2 = 0; // units Deg C
246-
double THCURR = 0; // units kiloAmps
234+
double TOR860 = -999; // units e12 protons
235+
double TOR875 = -999; // units e12 protons
236+
double LM875A = -999; // units R/s
237+
double LM875B = -999; // units R/s
238+
double LM875C = -999; // units R/s
239+
double HP875 = -999; // units mm
240+
double VP875 = -999; // units mm
241+
double HPTG1 = -999; // units mm
242+
double VPTG1 = -999; // units mm
243+
double HPTG2 = -999; // units mm
244+
double VPTG2 = -999; // units mm
245+
double BTJT2 = -999; // units Deg C
246+
double THCURR = -999; // units kiloAmps
247247

248-
double TOR860_time = 0; // units s
248+
double TOR860_time = -999; // units s
249249

250250
// Here we request all the devices
251251
// since sometimes devices fail to report we'll

sbncode/BeamSpillInfoRetriever/SBNDBNBRetriever/SBNDBNBRetriever_module.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ sbn::SBNDBNBRetriever::SBNDBNBRetriever(fhicl::ParameterSet const & params)
7171
vp873->set_epsilon(0.02);
7272

7373
offsets = ifbeam_handle->getBeamFolder(params.get<std::string>("OffsetBundle"), params.get<std::string>("URL"), timeWindow);
74-
offsets->set_epsilon(600);
74+
offsets->set_epsilon(1000);
7575

7676
}
7777

sbncode/BeamSpillInfoRetriever/job/sbndbnbdefaults.fcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ sbndbnbspillinfo: {
1212
OffsetBundle: "BNB_BPM_settings"
1313

1414
TimeWindow: "700" #seconds
15-
MWR_TimeWindow: "3601" #seconds
15+
MWR_TimeWindow: "700" #seconds
1616
DeviceUsedForTiming: "E:TOR860"
1717
}
1818

sbncode/CAFMaker/CAFMakerParams.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ namespace caf
255255
"pandoraPid"
256256
};
257257

258+
Atom<string> TrackLikePidLabel {
259+
Name("TrackLikePidLabel"),
260+
Comment("Base label of track likelihood particle-id producer."),
261+
"pandoraLikePid"
262+
};
263+
258264
Atom<string> TrackScatterClosestApproachLabel {
259265
Name("TrackScatterClosestApproachLabel"),
260266
Comment("Base label of track track scatter closestapproach producer."),
@@ -363,6 +369,12 @@ namespace caf
363369
"" // sbnd
364370
};
365371

372+
Atom<string> SBNDSoftwareTriggerLabel{
373+
Name("SBNDSoftwareTriggerLabel"),
374+
Comment("Label for software trigger producer"),
375+
"" // sbnd
376+
};
377+
366378
Atom<string> CRTPMTLabel {
367379
Name("CRTPMTLabel"),
368380
Comment("Label for the CRTPMT Matched variables from the crtpmt data product"),

sbncode/CAFMaker/CAFMaker_module.cc

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1703,6 +1703,8 @@ void CAFMaker::produce(art::Event& evt) noexcept {
17031703
caf::SRTrigger srtrigger;
17041704
if (isValidTrigger) {
17051705
FillTrigger(*extratrig_handle, trig_handle->at(0), srtrigger, triggerShift);
1706+
if (fDet == kICARUS)
1707+
FillTriggerICARUS(*extratrig_handle, srtrigger);
17061708
}
17071709
// Fill trigger emulation information
17081710
if (isValidEmulationTrigger) {
@@ -1739,6 +1741,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
17391741
caf::SRSBNDCRTVeto srsbndcrtveto;
17401742
caf::SRSBNDFrameShiftInfo srsbndframeshiftinfo;
17411743
caf::SRSBNDTimingInfo srsbndtiminginfo;
1744+
caf::SRSoftwareTrigger srsbndsofttrig;
17421745

17431746
// Mapping of (feb, channel) to truth information (AuxDetSimChannel) -- filled for ICARUS
17441747
std::map<std::pair<int, int>, sim::AuxDetSimChannel> crtsimchanmap;
@@ -1841,6 +1844,15 @@ void CAFMaker::produce(art::Event& evt) noexcept {
18411844
sbnd::timing::TimingInfo const& sbndtiminginfo(*sbndtiminginfo_handle);
18421845
FillSBNDTimingInfo(sbndtiminginfo, srsbndtiminginfo);
18431846
}
1847+
1848+
art::Handle<std::vector<sbnd::trigger::pmtSoftwareTrigger>> sbndsofttrig_handle;
1849+
GetByLabelStrict(evt, fParams.SBNDSoftwareTriggerLabel(), sbndsofttrig_handle);
1850+
if (sbndsofttrig_handle.isValid()){
1851+
const std::vector<sbnd::trigger::pmtSoftwareTrigger> &sbndsofttrig = *sbndsofttrig_handle;
1852+
if (sbndsofttrig.size()==1){
1853+
FillSoftwareTriggerSBND(sbndsofttrig.at(0), srsbndsofttrig);
1854+
}
1855+
}
18441856
}
18451857

18461858
// Get all of the CRTPMT Matches
@@ -2167,6 +2179,10 @@ void CAFMaker::produce(art::Event& evt) noexcept {
21672179
FindManyPStrict<anab::ParticleID>(slcTracks, evt,
21682180
fParams.TrackChi2PidLabel() + slice_tag_suff);
21692181

2182+
art::FindManyP<anab::ParticleID> fmLikePID =
2183+
FindManyPStrict<anab::ParticleID>(slcTracks, evt,
2184+
fParams.TrackLikePidLabel() + slice_tag_suff);
2185+
21702186
art::FindManyP<sbn::ScatterClosestApproach> fmScatterClosestApproach =
21712187
FindManyPStrict<sbn::ScatterClosestApproach>(slcTracks, evt,
21722188
fParams.TrackScatterClosestApproachLabel() + slice_tag_suff);
@@ -2458,6 +2474,9 @@ void CAFMaker::produce(art::Event& evt) noexcept {
24582474
if (fmChi2PID.isValid()) {
24592475
FillTrackChi2PID(fmChi2PID.at(iPart), trk);
24602476
}
2477+
if (fmLikePID.isValid()) {
2478+
FillTrackLikePID(fmLikePID.at(iPart), trk);
2479+
}
24612480
if (fmScatterClosestApproach.isValid() && fmScatterClosestApproach.at(iPart).size()==1) {
24622481
FillTrackScatterClosestApproach(fmScatterClosestApproach.at(iPart).front(), trk);
24632482
}
@@ -2523,7 +2542,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
25232542
assert(thisShower.size() == 1);
25242543

25252544
SRShower& shw = pfp.shw;
2526-
FillShowerVars(*thisShower[0], vertex, fmShowerHit.at(iPart), wireReadout, producer, shw);
2545+
FillShowerVars(*thisShower[0], vertex, fmShowerHit.at(iPart), wireReadout, producer, shw, fDet);
25272546

25282547
// We may have many residuals per shower depending on how many showers ar in the slice
25292548
if (fmShowerRazzle.isValid() && fmShowerRazzle.at(iPart).size()==1) {
@@ -2588,6 +2607,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
25882607
rec.nopflashes = srflashes.size();
25892608
rec.sbnd_frames = srsbndframeshiftinfo;
25902609
rec.sbnd_timings = srsbndtiminginfo;
2610+
rec.soft_trig = srsbndsofttrig;
25912611

25922612
if (fParams.FillTrueParticles()) {
25932613
rec.true_particles = true_particles;

sbncode/CAFMaker/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ art_make_library( LIBRARY_NAME sbncode_CAFMaker
4343
art::Framework_Services_System_TriggerNamesService_service
4444
sbncode_Metadata_MetadataSBN_service
4545
larsim::Utils
46-
larevt::SpaceCharge
46+
larevt::SpaceCharge
4747
systematicstools::interface
4848
systematicstools::interpreters
4949
systematicstools::utility
5050
${GENIE_LIB_LIST}
5151
nugen::EventGeneratorBase_GENIE
52+
sbndaq_artdaq_core::sbndaq-artdaq-core_Obj_SBND
5253
)
5354

5455
cet_build_plugin ( CAFMaker art::module

sbncode/CAFMaker/FillExposure.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ namespace caf
2626
single_store.FOM = info.FOM;
2727
single_store.VP873 = info.VP873;
2828
single_store.VP875Offset = info.VP875Offset;
29+
single_store.VP873Offset = info.VP873Offset;
2930
single_store.HP875Offset = info.HP875Offset;
3031
single_store.VPTG1Offset = info.VPTG1Offset;
3132
single_store.HPTG1Offset = info.HPTG1Offset;

sbncode/CAFMaker/FillReco.cxx

Lines changed: 93 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ namespace caf
391391
const geo::WireReadoutGeom& wireReadout,
392392
unsigned producer,
393393
caf::SRShower &srshower,
394+
Det_t det,
394395
bool allowEmpty)
395396
{
396397

@@ -411,11 +412,56 @@ namespace caf
411412
// It's sth like this but not quite. And will need to pass a simb::MCtruth object vtx position anyway.
412413
// srshower.conversion_gap = (shower.ShowerStart() - vertex.Position()).Mag();
413414

414-
if(shower.best_plane() != -999){
415-
srshower.bestplane = shower.best_plane();
416-
srshower.bestplane_dEdx = srshower.plane[shower.best_plane()].dEdx;
417-
srshower.bestplane_energy = srshower.plane[shower.best_plane()].energy;
418-
}
415+
for(int p = 0; p < 3; ++p) srshower.plane[p].nHits = 0;
416+
for (auto const& hit:hits) ++srshower.plane[hit->WireID().Plane].nHits;
417+
418+
if(det == kSBND)
419+
{
420+
int bestplane_for_energy = -999;
421+
int mosthits = -1;
422+
for(int p = 0; p < 3; ++p)
423+
{
424+
if((int)srshower.plane[p].nHits > mosthits)
425+
{
426+
mosthits = srshower.plane[p].nHits;
427+
bestplane_for_energy = p;
428+
}
429+
}
430+
431+
if(bestplane_for_energy != -999)
432+
{
433+
srshower.bestplane_for_energy = bestplane_for_energy;
434+
srshower.bestplane_energy = srshower.plane[bestplane_for_energy].energy;
435+
}
436+
437+
if(shower.best_plane() != -999 && srshower.plane[shower.best_plane()].dEdx != -999)
438+
{
439+
srshower.bestplane_for_dedx = shower.best_plane();
440+
srshower.bestplane_dEdx = srshower.plane[shower.best_plane()].dEdx;
441+
}
442+
else
443+
{
444+
for(int p = 2; p >= 0; --p)
445+
{
446+
if(srshower.plane[p].dEdx != -999)
447+
{
448+
srshower.bestplane_for_dedx = p;
449+
srshower.bestplane_dEdx = srshower.plane[shower.best_plane()].dEdx;
450+
break;
451+
}
452+
}
453+
}
454+
}
455+
else
456+
{
457+
if(shower.best_plane() != -999)
458+
{
459+
srshower.bestplane_for_energy = shower.best_plane();
460+
srshower.bestplane_for_dedx = shower.best_plane();
461+
srshower.bestplane_dEdx = srshower.plane[shower.best_plane()].dEdx;
462+
srshower.bestplane_energy = srshower.plane[shower.best_plane()].energy;
463+
}
464+
}
419465

420466
if(shower.has_open_angle())
421467
srshower.open_angle = shower.OpenAngle();
@@ -438,9 +484,6 @@ namespace caf
438484
srshower.end = shower.ShowerStart()+ (shower.Length() * shower.Direction());
439485
}
440486

441-
for(int p = 0; p < 3; ++p) srshower.plane[p].nHits = 0;
442-
for (auto const& hit:hits) ++srshower.plane[hit->WireID().Plane].nHits;
443-
444487
for (geo::PlaneGeo const& plane: wireReadout.Iterate<geo::PlaneGeo>()) {
445488

446489
const double angleToVert(wireReadout.WireAngleToVertical(plane.View(), plane.ID()) - 0.5*M_PI);
@@ -908,6 +951,48 @@ namespace caf
908951
}
909952
}
910953

954+
void FillPlaneLikePID(const anab::ParticleID &particle_id, caf::SRTrkLikelihoodPID &srlikepid) {
955+
956+
// Loop over algorithm scores and extract the ones we want.
957+
// Get the ndof from any likelihood pid algorithm
958+
srlikepid.setDefault();
959+
960+
std::vector<anab::sParticleIDAlgScores> const& AlgScoresVec = particle_id.ParticleIDAlgScores();
961+
for (anab::sParticleIDAlgScores const& AlgScore: AlgScoresVec){
962+
if (AlgScore.fAlgName == "Likelihood"){
963+
switch (std::abs(AlgScore.fAssumedPdg)) {
964+
case 13: // lambda_mu
965+
srlikepid.lambda_muon = AlgScore.fValue;
966+
srlikepid.pid_ndof = AlgScore.fNdf;
967+
break;
968+
case 211: // lambda_pi
969+
srlikepid.lambda_pion = AlgScore.fValue;
970+
srlikepid.pid_ndof = AlgScore.fNdf;
971+
break;
972+
case 2212: // lambda_pr
973+
srlikepid.lambda_proton = AlgScore.fValue;
974+
srlikepid.pid_ndof = AlgScore.fNdf;
975+
break;
976+
}
977+
}
978+
}
979+
}
980+
981+
void FillTrackLikePID(const std::vector<art::Ptr<anab::ParticleID>>& particleIDs,
982+
caf::SRTrack& srtrack,
983+
bool allowEmpty)
984+
{
985+
// get the particle ID's
986+
for (art::Ptr<anab::ParticleID> const& pidPtr: particleIDs) {
987+
const anab::ParticleID &particle_id = *pidPtr;
988+
if (particle_id.PlaneID()) {
989+
unsigned plane_id = particle_id.PlaneID().Plane;
990+
assert(plane_id < 3);
991+
FillPlaneLikePID(particle_id, srtrack.likepid[plane_id]);
992+
}
993+
}
994+
}
995+
911996
void FillTrackPlaneCalo(const anab::Calorimetry &calo,
912997
const std::vector<art::Ptr<recob::Hit>> &hits,
913998
bool fill_calo_points, float fillhit_rrstart, float fillhit_rrend,

0 commit comments

Comments
 (0)