Skip to content

Commit 82bf998

Browse files
Merge branch 'develop' into feature/hlay_crt_calibration_database_interface
2 parents 1dc7a3c + 327befc commit 82bf998

77 files changed

Lines changed: 2738 additions & 123 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
1717

18-
set(${PROJECT_NAME}_CMAKE_PROJECT_VERSION_STRING 10.10.03.02)
18+
set(${PROJECT_NAME}_CMAKE_PROJECT_VERSION_STRING 10.12.02)
1919
find_package(cetmodules REQUIRED)
2020
project(sbndcode LANGUAGES CXX)
2121

sbndcode/BlipRecoSBND/blipreco_configs.fcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ BEGIN_PROLOG
55
# Main BlipAlg settings
66
sbnd_blipalg:
77
{
8-
HitProducer: "gaushit" #// input recob::Hits to use for blip reconstruction
9-
TrkProducer: "pandoraTrack" #// input recob::Tracks to use for blip reconstruction
8+
HitProducer: "specialblipgaushit" #// input recob::Hits to use for blip reconstruction
9+
TrkProducer: "blipPandoraTrackCopy" #// input recob::Tracks to use for blip reconstruction
1010
GeantProducer: "largeant" #// input sim::MCParticles (getting true particle info)
1111
SimEDepProducer: "ionandscint" #// input sim::SimEnergyDeposits (getting energy/electrons deposited)
1212
SimChanProducer: "simdrift" #// label for sim::SimChannels (getting drifted charge; optional)

sbndcode/CRT/CRTAna/CRTAnalysis_module.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,9 +1746,9 @@ void sbnd::crt::CRTAnalysis::AnalyseTPCMatching(const art::Event &e, const art::
17461746
_tpc_tr_ts1[nActualTracks] = crttrack->Ts1();
17471747
_tpc_tr_score[nActualTracks] = trackMatch.TriggerConfidence();
17481748

1749-
const std::set<CRTTagger> taggers = crttrack->Taggers();
1750-
const geo::Point_t start = crttrack->Start();
1751-
const geo::Point_t end = crttrack->End();
1749+
const std::vector<CRTTagger> taggers = crttrack->Taggers();
1750+
const geo::Point_t start = crttrack->Start();
1751+
const geo::Point_t end = crttrack->End();
17521752

17531753
_tpc_tr_taggers[nActualTracks] = std::vector<int>();
17541754

sbndcode/CRT/CRTAna/crtana_sbnd.fcl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ crtana_sbnd:
1717
crtana_data_sbnd: @local::crtana_sbnd
1818
crtana_data_sbnd.FEBDataModuleLabel: "crtdecoder"
1919
crtana_data_sbnd.DataMode: true
20-
crtana_data_sbnd.NoTPC: true
2120
crtana_data_sbnd.HasPTB: true
2221
crtana_data_sbnd.HasTDC: true
2322

sbndcode/CRT/CRTEventDisplay/CRTEventDisplayAlg.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ namespace sbnd::crt {
597597
if(trackTime < fMinTime || trackTime > fMaxTime)
598598
continue;
599599

600-
std::set<CRTTagger> taggers = track->Taggers();
600+
std::vector<CRTTagger> taggers = track->Taggers();
601601

602602
bool none = fChoseTaggers;
603603
for(auto const& tagger : taggers)

sbndcode/CRT/CRTReco/CRTTrackProducer_module.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ std::vector<std::pair<sbnd::crt::CRTTrack, std::set<unsigned>>> sbnd::crt::CRTTr
238238

239239
const double pe = primarySpacePoint->PE() + secondarySpacePoint->PE() + tertiarySpacePoint->PE();
240240

241-
const std::set<CRTTagger> used_taggers = {primaryCluster->Tagger(), secondaryCluster->Tagger(), tertiaryCluster->Tagger()};
241+
const std::vector<CRTTagger> used_taggers = {primaryCluster->Tagger(), secondaryCluster->Tagger(), tertiaryCluster->Tagger()};
242242

243243
geo::Point_t fitStart, fitMid, fitEnd;
244244
double gof;
@@ -264,7 +264,7 @@ std::vector<std::pair<sbnd::crt::CRTTrack, std::set<unsigned>>> sbnd::crt::CRTTr
264264

265265
const double pe = primarySpacePoint->PE() + secondarySpacePoint->PE();
266266

267-
const std::set<CRTTagger> used_taggers = {primaryCluster->Tagger(), secondaryCluster->Tagger()};
267+
const std::vector<CRTTagger> used_taggers = {primaryCluster->Tagger(), secondaryCluster->Tagger()};
268268

269269
const CRTTrack track(start, end, t0, et0, t1, et1, pe, tof, used_taggers);
270270
const std::set<unsigned> used_spacepoints = {i, ii};

sbndcode/Decoders/PMT/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ cet_build_plugin( SBNDPMTDecoder art::module
33
LIBRARIES
44
sbndaq_artdaq_core::sbndaq-artdaq-core_Overlays_SBND
55
sbnobj::SBND_Timing
6+
sbndcode_OpDetSim
67
lardata::Utilities
78
canvas::canvas
89
lardataobj::RecoBase

sbndcode/Decoders/PMT/SBNDPMTDecoder_module.cc

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
#include <bitset>
5050
#include <memory>
5151

52+
#include "sbndcode/OpDetSim/TriggerEmulationService.h"
53+
5254
namespace sbndaq {
5355
class SBNDPMTDecoder;
5456
}
@@ -123,6 +125,8 @@ class sbndaq::SBNDPMTDecoder : public art::EDProducer {
123125

124126
std::vector<uint> fch_map;
125127

128+
int fmon_threshold;
129+
126130
// histogram info
127131
std::stringstream histname; //raw waveform hist name
128132
art::ServiceHandle<art::TFileService> tfs;
@@ -177,6 +181,8 @@ sbndaq::SBNDPMTDecoder::SBNDPMTDecoder(fhicl::ParameterSet const& p)
177181

178182
fch_map = p.get<std::vector<uint>>("ch_map",{});
179183

184+
fmon_threshold = p.get<int>("mon_threshold", 15);
185+
180186
produces< std::vector< raw::OpDetWaveform > >(fpmt_instance_name);
181187
produces< std::vector< raw::OpDetWaveform > >(fflt_instance_name);
182188
produces< std::vector< raw::OpDetWaveform > >(ftim_instance_name);
@@ -186,6 +192,9 @@ sbndaq::SBNDPMTDecoder::SBNDPMTDecoder(fhicl::ParameterSet const& p)
186192
produces< art::Assns< raw::pmt::BoardTimingInfo, raw::OpDetWaveform > >(fpmt_timing_instance_name);
187193
produces< art::Assns< raw::pmt::BoardTimingInfo, raw::OpDetWaveform > >(fflt_timing_instance_name);
188194
produces< art::Assns< raw::pmt::BoardTimingInfo, raw::OpDetWaveform > >(ftim_timing_instance_name);
195+
196+
produces< std::vector<int> >("MonPulses");
197+
produces< std::vector<int> >("MonPulseSizes");
189198
}
190199

191200
void sbndaq::SBNDPMTDecoder::produce(art::Event& evt)
@@ -264,6 +273,11 @@ void sbndaq::SBNDPMTDecoder::produce(art::Event& evt)
264273
evt.put(std::move(pmtTimingAssns),fpmt_timing_instance_name);
265274
evt.put(std::move(fltTimingAssns),fflt_timing_instance_name);
266275
evt.put(std::move(timTimingAssns),ftim_timing_instance_name);
276+
277+
auto flatPtr = std::make_unique<std::vector<int>>();
278+
auto sizesPtr = std::make_unique<std::vector<int>>();
279+
evt.put(std::move(flatPtr), "MonPulses");
280+
evt.put(std::move(sizesPtr), "MonPulseSizes");
267281
return;
268282
}
269283

@@ -597,6 +611,43 @@ void sbndaq::SBNDPMTDecoder::produce(art::Event& evt)
597611
}
598612
}
599613
} // end board loop
614+
615+
// loop through flashes
616+
art::ServiceHandle<art::TFileService> tfs;
617+
art::ServiceHandle<calib::TriggerEmulationService> fTriggerService;
618+
int PMTPerBoard = fTriggerService->getPMTPerBoard();
619+
// int fTotalCAENBoards = fTriggerService->getTotalCAENBoards();
620+
//std::vector< std::vector<int> > MonPulsesAll;
621+
//MonPulseAll.clear();
622+
std::vector<int> MonPulsesFlat;
623+
std::vector<int> pulseSizes;
624+
MonPulsesFlat.clear();
625+
pulseSizes.clear();
626+
int TotalFlash = pmtwvfmVec->size()/((int)fn_caenboards*PMTPerBoard); // pmtwvfmVec = waveHandle ???
627+
for (int FlashCounter=0; FlashCounter<TotalFlash; FlashCounter++)
628+
{
629+
int WaveIndex = FlashCounter*PMTPerBoard;
630+
int WaveformSize = (*pmtwvfmVec)[WaveIndex].size();
631+
std::vector<int> *MonPulse = new std::vector<int>(WaveformSize);
632+
fTriggerService->ConstructMonPulse(*pmtwvfmVec, fmon_threshold, MonPulse, FlashCounter);
633+
//MonPulsesAll.push_back(std::move(MonPulse));
634+
MonPulsesFlat.insert(MonPulsesFlat.end(), (*MonPulse).begin(), (*MonPulse).end());
635+
pulseSizes.push_back(MonPulse->size());
636+
delete MonPulse;
637+
}
638+
// make ptrs
639+
auto flatPtr = std::make_unique<std::vector<int>>(std::move(MonPulsesFlat));
640+
auto sizesPtr = std::make_unique<std::vector<int>>(std::move(pulseSizes));
641+
642+
/*std::unique_ptr< std::vector< std::vector<int> > > MonPulsesPtr(std::make_unique< std::vector< std::vector<int> > > ());
643+
for (auto &pulse : MonPulsesAll) {
644+
MonPulsesPtr->reserve(MonPulsesPtr->size() + pulse.size());
645+
std::move(pulse.begin(), pulse.end(), std::back_inserter(*MonPulsesPtr));
646+
}
647+
// clean up the vector
648+
for (unsigned i = 0; i < MonPulsesAll.size(); i++) MonPulsesAll[i] = std::vector<int>();
649+
*/
650+
600651
board_frag_v.clear();
601652

602653
evt.put(std::move(pmtwvfmVec),fpmt_instance_name);
@@ -609,6 +660,9 @@ void sbndaq::SBNDPMTDecoder::produce(art::Event& evt)
609660
evt.put(std::move(pmtTimingAssns),fpmt_timing_instance_name);
610661
evt.put(std::move(fltTimingAssns),fflt_timing_instance_name);
611662
evt.put(std::move(timTimingAssns),ftim_timing_instance_name);
663+
664+
evt.put(std::move(flatPtr), "MonPulses");
665+
evt.put(std::move(sizesPtr), "MonPulseSizes");
612666
}
613667

614668
void sbndaq::SBNDPMTDecoder::get_fragments(artdaq::Fragment & frag, std::vector<std::vector<artdaq::Fragment>> & board_frag_v){

sbndcode/Decoders/PMT/pmtdecoder.fcl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ pmtdecoder:
4747
fragid_offset: 40960 # the offset to subtract to get single digit fragids; if use_set_map is true, should set this to 0
4848
hist_evt: 1 # the # of the event used to generate the histograms, 1st event by default
4949

50+
# trigger configurable
51+
mon_threshold: 15 # ADC channel value threshold to add 1 to the trigger response MON pulse
52+
5053
# for when the fragIDs are mapped to the old configuration or you need to hardcode fragids...
5154
## to use this, must set `fragid_offset` to 0!!!
5255
use_set_map: false
@@ -66,4 +69,4 @@ pmtdecoder:
6669
900,901,902,903,904,905,906,907,908,909,910,911,912,913,914] # digitizer 8 (TIMING CAEN)
6770
}
6871

69-
END_PROLOG
72+
END_PROLOG

sbndcode/Decoders/PMT/run_pmtdecoder.fcl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ process_name: PMTDecoder
66

77
services: {
88
TFileService : {fileName: "decoder_hist.root"}
9+
TriggerEmulationService: {
10+
service_type: TriggerEmulationService
11+
MonWidth: 12
12+
TotalCAENBoards: 8
13+
PMTPerBoard: 15
14+
Baseline: 14250
15+
MC: false
16+
}
917
}
1018

1119
#source is a root file
@@ -51,4 +59,4 @@ physics:
5159
# end_paths is a keyword and contains the paths that do not modify the art::Event,
5260
# ie analyzers and output streams. these all run simultaneously
5361
end_paths: [stream1]
54-
}
62+
}

0 commit comments

Comments
 (0)