Skip to content

Commit 56156b4

Browse files
Merge branch 'release/v10_14_00_01'
2 parents f9c394e + 1d329d3 commit 56156b4

14 files changed

Lines changed: 134 additions & 143 deletions

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.14.00)
18+
set(${PROJECT_NAME}_CMAKE_PROJECT_VERSION_STRING 10.14.00.01)
1919
find_package(cetmodules REQUIRED)
2020
project(sbndcode LANGUAGES CXX)
2121

sbndcode/Decoders/PMT/SBNDPMTDecoder_module.cc

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ sbndaq::SBNDPMTDecoder::SBNDPMTDecoder(fhicl::ParameterSet const& p)
195195

196196
produces< std::vector<int> >("MonPulses");
197197
produces< std::vector<int> >("MonPulseSizes");
198+
produces<int>("pairsOverThreshold");
198199
}
199200

200201
void sbndaq::SBNDPMTDecoder::produce(art::Event& evt)
@@ -278,6 +279,9 @@ void sbndaq::SBNDPMTDecoder::produce(art::Event& evt)
278279
auto sizesPtr = std::make_unique<std::vector<int>>();
279280
evt.put(std::move(flatPtr), "MonPulses");
280281
evt.put(std::move(sizesPtr), "MonPulseSizes");
282+
283+
auto pairFlag = std::make_unique<int>(-1);
284+
evt.put(std::move(pairFlag), "pairsOverThreshold");
281285
return;
282286
}
283287

@@ -623,30 +627,27 @@ void sbndaq::SBNDPMTDecoder::produce(art::Event& evt)
623627
std::vector<int> pulseSizes;
624628
MonPulsesFlat.clear();
625629
pulseSizes.clear();
626-
int TotalFlash = pmtwvfmVec->size()/((int)fn_caenboards*PMTPerBoard); // pmtwvfmVec = waveHandle ???
630+
int pmt_caenboards = (int)fn_caenboards-1;
631+
int TotalFlash = pmtwvfmVec->size()/(pmt_caenboards*PMTPerBoard);
632+
633+
int numPairsOverThreshold = 0;
627634
for (int FlashCounter=0; FlashCounter<TotalFlash; FlashCounter++)
628635
{
629636
int WaveIndex = FlashCounter*PMTPerBoard;
630637
int WaveformSize = (*pmtwvfmVec)[WaveIndex].size();
638+
int pairThisFlash = 0;
631639
std::vector<int> *MonPulse = new std::vector<int>(WaveformSize);
632-
fTriggerService->ConstructMonPulse(*pmtwvfmVec, fmon_threshold, MonPulse, FlashCounter);
640+
fTriggerService->ConstructMonPulse(*pmtwvfmVec, fmon_threshold, MonPulse, FlashCounter, &pairThisFlash);
633641
//MonPulsesAll.push_back(std::move(MonPulse));
634642
MonPulsesFlat.insert(MonPulsesFlat.end(), (*MonPulse).begin(), (*MonPulse).end());
635643
pulseSizes.push_back(MonPulse->size());
644+
numPairsOverThreshold = numPairsOverThreshold + pairThisFlash;
636645
delete MonPulse;
637646
}
638647
// make ptrs
639648
auto flatPtr = std::make_unique<std::vector<int>>(std::move(MonPulsesFlat));
640649
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+
auto pairFlag = std::make_unique<int>(numPairsOverThreshold);
650651

651652
board_frag_v.clear();
652653

@@ -663,6 +664,7 @@ void sbndaq::SBNDPMTDecoder::produce(art::Event& evt)
663664

664665
evt.put(std::move(flatPtr), "MonPulses");
665666
evt.put(std::move(sizesPtr), "MonPulseSizes");
667+
evt.put(std::move(pairFlag), "pairsOverThreshold");
666668
}
667669

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

sbndcode/Decoders/PMT/run_pmtdecoder.fcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services: {
1111
MonWidth: 12
1212
TotalCAENBoards: 8
1313
PMTPerBoard: 15
14-
Baseline: 14250
14+
Baseline: 14250 #Run 1: 14250, Run 2: 14257
1515
MC: false
1616
}
1717
}

sbndcode/JobConfigurations/base/detsim_drops.fcl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ detsim_drops: [ @sequence::g4_drops
2525
, "drop sim::SimEnergyDeposits_ionandscintout__*"
2626
, "drop sim::SimEnergyDeposits_ionandscint_*_*"
2727
, "drop sim::SimEnergyDeposits_largeant_*_*"
28-
, "keep sim::SimEnergyDeposits_ionandscint_priorSCE_*"]
28+
, "keep sim::SimEnergyDeposits_ionandscint_priorSCE_*"
29+
, "drop raw::OpDetWaveforms_opdaq_*_*"]
2930

3031
END_PROLOG
3132

sbndcode/OpDetReco/OpDeconvolution/job/run_decohitfinder.fcl

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,27 @@ physics:
4141
{
4242
producers:
4343
{
44-
opdecopmt: @local::SBNDOpDeconvolutionPMT
45-
ophitpmt: @local::SBNDDecoOpHitFinderPMT
46-
opflashtpc0: @local::SBNDDecoSimpleFlashTPC0
47-
opflashtpc1: @local::SBNDDecoSimpleFlashTPC1
44+
opdecopmt: @local::SBNDOpDeconvolutionPMT_realisticMC
45+
ophitpmt: @local::SBNDDecoOpHitFinderPMT_realisticMC
46+
opflashtpc0: @local::SBNDDecoSimpleFlashTPC0_realisticMC
47+
opflashtpc1: @local::SBNDDecoSimpleFlashTPC1_realisticMC
4848

4949
opdecoxarapuca: @local::SBNDOpDeconvolutionXARAPUCA
5050
ophitxarapuca: @local::SBNDDecoOpHitFinderXArapuca
5151
opflashdecotpc0arapuca: @local::SBNDDecoSimpleFlashTPC0Arapuca
5252
opflashdecotpc1arapuca: @local::SBNDDecoSimpleFlashTPC1Arapuca
53-
5453
}
5554

5655
reco: [
5756
opdecopmt,
5857
ophitpmt,
5958
opflashtpc0,
60-
opflashtpc1,
59+
opflashtpc1
6160

62-
opdecoxarapuca,
63-
ophitxarapuca,
64-
opflashdecotpc0arapuca,
65-
opflashdecotpc1arapuca
61+
#opdecoxarapuca,
62+
#ophitxarapuca,
63+
#opflashdecotpc0arapuca,
64+
#opflashdecotpc1arapuca
6665
]
6766

6867

sbndcode/OpDetReco/OpDeconvolution/job/sbnd_flashfinder_deco.fcl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ SBNDDecoSimpleFlashTPC0_realisticMC.OpHitInputTime: "RiseTime"
6262
SBNDDecoSimpleFlashTPC0_realisticMC.UseT0Tool: true
6363
SBNDDecoSimpleFlashTPC0_realisticMC.ReadoutDelay: 0 //cable time delay in us
6464
SBNDDecoSimpleFlashTPC0_realisticMC.CorrectLightPropagation: true
65+
SBNDDecoSimpleFlashTPC0_realisticMC.DriftEstimatorConfig.CalibrationFile: "OpDetReco/PMTRatioCalibration_MC2.root"
6566

6667
#TPC1
6768
SBNDDecoSimpleFlashTPC1_realisticMC: @local::SBNDSimpleFlashTPC1
@@ -73,7 +74,7 @@ SBNDDecoSimpleFlashTPC1_realisticMC.OpHitInputTime: "RiseTime"
7374
SBNDDecoSimpleFlashTPC1_realisticMC.UseT0Tool: true
7475
SBNDDecoSimpleFlashTPC1_realisticMC.ReadoutDelay: 0 //cable time delay in us
7576
SBNDDecoSimpleFlashTPC1_realisticMC.CorrectLightPropagation: true
76-
SBNDDecoSimpleFlashTPC1_realisticMC.DriftEstimatorConfig.CalibrationFile: "OpDetReco/PMTRatioCalibration_data_v2.root"
77+
SBNDDecoSimpleFlashTPC1_realisticMC.DriftEstimatorConfig.CalibrationFile: "OpDetReco/PMTRatioCalibration_MC2.root"
7778

7879

7980
###### XA IDEAL MC ######

sbndcode/OpDetReco/OpDeconvolution/job/sbnd_ophitfinder_deco.fcl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,5 @@ SBNDDecoOpHitFinderPMT_data.PedAlgoPset.Method:2
103103

104104
#####OpHit finder for PMT deconvolved waveforms#####
105105
SBNDDecoOpHitFinderPMT_realisticMC: @local::SBNDDecoOpHitFinderPMT_data
106-
####SPE area must be 1./DecoWaveformPrecision
107-
SBNDDecoOpHitFinderPMT_realisticMC.InputModule: "pmtpulseoscillation"
108106

109-
END_PROLOG
107+
END_PROLOG

sbndcode/OpDetSim/TriggerEmulationService.cc

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace calib {
1717
: fMonWidth(pset.get<int>("MonWidth", 12)),
1818
fTotalCAENBoards(pset.get<int>("TotalCAENBoards", 8)),
1919
PMTPerBoard(pset.get<int>("PMTPerBoard", 15)),
20-
Baseline(pset.get<int>("Baseline", 14250)),
20+
Baseline(pset.get<int>("Baseline")),
2121
fMC(pset.get<bool>("MC", true))
2222
{}
2323

@@ -29,9 +29,11 @@ namespace calib {
2929
int MonThreshold,
3030
std::vector<int> *MonPulse,
3131
int FlashCounter,
32-
int *numPairsOverThreshold
32+
int *numPairsOverThreshold,
33+
std::vector<int> PMT_Channels
3334
)
3435
{
36+
3537
// Loop over the entries in our waveform vector
3638
// We care about getting the pairing correct
3739

@@ -44,22 +46,37 @@ namespace calib {
4446
}
4547

4648
std::map<int, const raw::OpDetWaveform*> channel_to_waveform;
47-
for (const auto& wvf : fWaveforms)
49+
for (const auto& wvf : fWaveforms) {
4850
channel_to_waveform[wvf.ChannelNumber()] = &wvf;
51+
}
4952

5053
std::vector<int> Pair2 = { 6, 8, 10, 12, 14, 16, 36, 38, 40, 60, 62, 66, 68, 70, 84, 86, 88, 90, 92, 94, 114, 116, 118, 138, 140, 144, 146, 148, 162, 164, 168, 170, 172, 192, 194, 196, 216, 218, 220, 222, 224, 226, 240, 242, 246, 248, 250, 270, 272, 274, 294, 296, 298, 300, 302, 304};
5154
std::vector<int> Pair1 = { 7, 9, 11, 13, 15, 17, 37, 39, 41, 61, 63, 67, 69, 71, 85, 87, 89, 91, 93, 95, 115, 117, 119, 139, 141, 145, 147, 149, 163, 165, 169, 171, 173, 193, 195, 197, 217, 219, 221, 223, 225, 227, 241, 243, 247, 249, 251, 271, 273, 275, 295, 297, 299, 301, 303, 305};
5255
std::vector<int> Unpaired = {65, 64, 143, 142, 167, 166, 245, 244};
5356
std::set<int> used_channels;
5457

5558
// resize
56-
int ReadoutSize = fWaveforms[0].size();
59+
int ReadoutSize;
60+
if (PMT_Channels.empty()) { std::cout<<"Warning: Please provide PMT channels list."<<std::endl; ReadoutSize = fWaveforms[Pair1[0]].size(); }
61+
else ReadoutSize = fWaveforms[PMT_Channels[0]].size();
5762
MonPulse->assign(ReadoutSize, 0);
5863

5964
for (size_t i = 0; i < Pair1.size(); ++i) {
6065
int ch1 = Pair1[i];
6166
int ch2 = Pair2[i];
6267

68+
// check that ch1 and ch2 show up in PMT_Channels
69+
if (PMT_Channels.empty()) std::cout<<"Warning: Please provide PMT channels list to check if channels are PMT channels."<<std::endl;
70+
else {
71+
if (!(std::find(PMT_Channels.begin(), PMT_Channels.end(), ch1) != PMT_Channels.end())) {
72+
throw cet::exception("TriggerEmulationService") << "Paired channel " << ch1 << " is not PMT channel. Check Pairs list. Skipping..." << std::endl;
73+
continue;
74+
} if (!(std::find(PMT_Channels.begin(), PMT_Channels.end(), ch2) != PMT_Channels.end())) {
75+
throw cet::exception("TriggerEmulationService") << "Paired channel " << ch2 << " is not PMT channel. Check Pairs list. Skipping..." << std::endl;
76+
continue;
77+
}
78+
}
79+
6380
// skip if either waveform is missing
6481
if (channel_to_waveform.count(ch1) == 0 || channel_to_waveform.count(ch2) == 0) continue;
6582
// skip if already processed
@@ -82,6 +99,16 @@ namespace calib {
8299
}
83100

84101
for (int ch : Unpaired) { // Unpaired channels
102+
103+
// check that ch1 and ch2 show up in PMT_Channels
104+
if (PMT_Channels.empty()) std::cout<<"Warning: Please provide PMT channels list to check if channels are PMT channels."<<std::endl;
105+
else {
106+
if (!(std::find(PMT_Channels.begin(), PMT_Channels.end(), ch) != PMT_Channels.end())) {
107+
throw cet::exception("TriggerEmulationService") << "Unpaired channel " << ch << " is not PMT channel. Check list. Skipping..." << std::endl;
108+
continue;
109+
}
110+
}
111+
85112
if (used_channels.count(ch)) continue;
86113
if (channel_to_waveform.count(ch) == 0) continue;
87114

@@ -143,6 +170,9 @@ namespace calib {
143170
CAENChannel=CAENChannel+ChannelStep;
144171
} //loop over channels
145172
} //loop over boards
173+
174+
if (numPairsOverThreshold) *numPairsOverThreshold = *std::max_element(MonPulse->begin(), MonPulse->end());
175+
146176
} // data
147177
} // ConstructMonPulse
148178

sbndcode/OpDetSim/TriggerEmulationService.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
int MonThreshold,
3838
std::vector<int> *MonPulse,
3939
int FlashCounter,
40-
int *numPairsOverThreshold = nullptr
40+
int *numPairsOverThreshold = nullptr,
41+
std::vector<int> PMT_Channels={}
4142
);
4243

4344
int getTotalCAENBoards() const { return fTotalCAENBoards; }

sbndcode/OpDetSim/digi_pmt_sbnd.fcl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ sbnd_digipmt_alg:
2323
CableTime: 135 #time delay of the 30 m long readout cable in ns
2424

2525
# Digitizer simulation
26-
PMTADCDynamicRange: 14745 #in ADC values
27-
PMTBaseline: 14745 #in ADC
26+
PMTADCDynamicRange: 14250 #in ADC values
27+
PMTBaseline: 14250 #in ADC
2828
PMTBaselineRMS: 2.6 #in ADC
2929

3030
#Sample noise from data
@@ -35,13 +35,13 @@ sbnd_digipmt_alg:
3535
PMTDarkNoiseRate: 1000.0 #in Hz
3636

3737
# Detection efficiencies
38-
PMTCoatedVUVEff_tpc0: 0.0315 #PMT coated detection efficiency for direct (VUV) light
39-
PMTCoatedVISEff_tpc0: 0.03493 #PMT coated detection efficiency for reflected (VIS) light
40-
PMTUncoatedEff_tpc0: 0.03382 #PMT uncoated detection efficiency
38+
PMTCoatedVUVEff_tpc0: 0.0392 #PMT coated detection efficiency for direct (VUV) light
39+
PMTCoatedVISEff_tpc0: 0.026 #PMT coated detection efficiency for reflected (VIS) light
40+
PMTUncoatedEff_tpc0: 0.0357 #PMT uncoated detection efficiency
4141

42-
PMTCoatedVUVEff_tpc1: 0.027 #PMT coated detection efficiency for direct (VUV) light
43-
PMTCoatedVISEff_tpc1: 0.03493 #PMT coated detection efficiency for reflected (VIS) light
44-
PMTUncoatedEff_tpc1: 0.03382 #PMT uncoated detection efficiency
42+
PMTCoatedVUVEff_tpc1: 0.0392 #PMT coated detection efficiency for direct (VUV) light
43+
PMTCoatedVISEff_tpc1: 0.026 #PMT coated detection efficiency for reflected (VIS) light
44+
PMTUncoatedEff_tpc1: 0.0357 #PMT uncoated detection efficiency
4545

4646
# Simulate gain fluctuations
4747
# (comment-out to skip gain fluctuations simulation)

0 commit comments

Comments
 (0)