Skip to content

Commit a595327

Browse files
hahassan7sawenzel
authored andcommitted
[EMCAL-679] Suppression of LG bunches
1 parent 0285db7 commit a595327

3 files changed

Lines changed: 47 additions & 41 deletions

File tree

DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Constants.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ namespace constants
9191
{
9292

9393
constexpr int OVERFLOWCUT = 950; ///< sample overflow
94+
constexpr int LG_SUPPRESSION_CUT = 880; ///< LG bunch suppression ADC value
9495
constexpr int ORDER = 2; ///< Order of shaping stages of the signal conditioning unit
9596
constexpr double TAU = 2.35; ///< Approximate shaping time
9697
constexpr Double_t EMCAL_TIMESAMPLE = 100.; ///< Width of a timebin in nanoseconds

Detectors/EMCAL/simulation/src/RawWriter.cxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ bool RawWriter::processTrigger(const o2::emcal::TriggerRecord& trg)
130130

131131
bool saturatedBunchHG = false;
132132
createPayload(channel, ChannelType_t::HIGH_GAIN, srucont.mSRUid, payload, saturatedBunchHG);
133-
createPayload(channel, ChannelType_t::LOW_GAIN, srucont.mSRUid, payload, saturatedBunchHG);
133+
if (saturatedBunchHG) {
134+
createPayload(channel, ChannelType_t::LOW_GAIN, srucont.mSRUid, payload, saturatedBunchHG);
135+
}
134136
}
135137

136138
if (!payload.size()) {
@@ -174,7 +176,7 @@ void RawWriter::createPayload(o2::emcal::ChannelData channel, o2::emcal::Channel
174176
rawbunches.push_back(bunch.mStarttime);
175177
for (auto adc : bunch.mADCs) {
176178
rawbunches.push_back(adc);
177-
if (adc > o2::emcal::constants::OVERFLOWCUT) {
179+
if (adc > o2::emcal::constants::LG_SUPPRESSION_CUT) {
178180
saturatedBunch = true;
179181
}
180182
}

Detectors/EMCAL/workflow/src/CellConverterSpec.cxx

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -108,45 +108,41 @@ void CellConverterSpec::run(framework::ProcessingContext& ctx)
108108
}
109109
mOutputCells.emplace_back(tower, fitResults.getAmp() * CONVADCGEV, fitResults.getTime() - timeshift, channelType);
110110

111-
} catch (CaloRawFitter::RawFitterError_t& fiterror) {
112-
if (fiterror != CaloRawFitter::RawFitterError_t::BUNCH_NOT_OK) {
113-
LOG(error) << "Failure in raw fitting: " << CaloRawFitter::createErrorMessage(fiterror);
114-
}
115-
}
116-
117-
if (fitResults.getStatus() < 0) {
118-
continue;
119-
}
120-
121-
if (mPropagateMC) {
122-
Int_t LabelIndex = mOutputLabels.getIndexedSize();
123-
if (channelType == ChannelType_t::HIGH_GAIN) {
124-
// if this channel has no bunches, then fill an empty label
125-
if (channelData.mChannelLabelsHG.size() == 0) {
126-
const o2::emcal::MCLabel label = o2::emcal::MCLabel(false, 1.);
127-
mOutputLabels.addElementRandomAccess(LabelIndex, label);
128-
} else {
129-
// Fill only labels that corresponds to bunches with maximum ADC
130-
const int bunchindex = selectMaximumBunch(channelData.mChannelsBunchesHG);
131-
for (const auto& label : channelData.mChannelLabelsHG[bunchindex]) {
111+
if (mPropagateMC) {
112+
Int_t LabelIndex = mOutputLabels.getIndexedSize();
113+
if (channelType == ChannelType_t::HIGH_GAIN) {
114+
// if this channel has no bunches, then fill an empty label
115+
if (channelData.mChannelLabelsHG.size() == 0) {
116+
const o2::emcal::MCLabel label = o2::emcal::MCLabel(false, 1.);
132117
mOutputLabels.addElementRandomAccess(LabelIndex, label);
118+
} else {
119+
// Fill only labels that corresponds to bunches with maximum ADC
120+
const int bunchindex = selectMaximumBunch(channelData.mChannelsBunchesHG);
121+
for (const auto& label : channelData.mChannelLabelsHG[bunchindex]) {
122+
mOutputLabels.addElementRandomAccess(LabelIndex, label);
123+
}
133124
}
134-
}
135-
} else {
136-
// if this channel has no bunches, then fill an empty label
137-
if (channelData.mChannelLabelsLG.size() == 0) {
138-
const o2::emcal::MCLabel label = o2::emcal::MCLabel(false, 1.);
139-
mOutputLabels.addElementRandomAccess(LabelIndex, label);
140125
} else {
141-
// Fill only labels that corresponds to bunches with maximum ADC
142-
const int bunchindex = selectMaximumBunch(channelData.mChannelsBunchesLG);
143-
for (const auto& label : channelData.mChannelLabelsLG[bunchindex]) {
126+
// if this channel has no bunches, then fill an empty label
127+
if (channelData.mChannelLabelsLG.size() == 0) {
128+
const o2::emcal::MCLabel label = o2::emcal::MCLabel(false, 1.);
144129
mOutputLabels.addElementRandomAccess(LabelIndex, label);
130+
} else {
131+
// Fill only labels that corresponds to bunches with maximum ADC
132+
const int bunchindex = selectMaximumBunch(channelData.mChannelsBunchesLG);
133+
for (const auto& label : channelData.mChannelLabelsLG[bunchindex]) {
134+
mOutputLabels.addElementRandomAccess(LabelIndex, label);
135+
}
145136
}
146137
}
147138
}
139+
ncellsTrigger++;
140+
141+
} catch (CaloRawFitter::RawFitterError_t& fiterror) {
142+
if (fiterror != CaloRawFitter::RawFitterError_t::BUNCH_NOT_OK) {
143+
LOG(error) << "Failure in raw fitting: " << CaloRawFitter::createErrorMessage(fiterror);
144+
}
148145
}
149-
ncellsTrigger++;
150146
}
151147
}
152148
mOutputTriggers.emplace_back(trg.getBCData(), trg.getTriggerBits(), currentstart, ncellsTrigger);
@@ -236,25 +232,32 @@ std::vector<o2::emcal::SRUBunchContainer> CellConverterSpec::digitsToBunches(gsl
236232
std::vector<std::vector<o2::emcal::MCLabel>> rawLabelsHG;
237233
std::vector<std::vector<o2::emcal::MCLabel>> rawLabelsLG;
238234

235+
bool saturatedBunch = false;
236+
239237
// Creating the high gain bunch with labels
240238
for (auto& bunch : findBunches(channelDigits.mChannelDigits, channelDigits.mChannelLabels, ChannelType_t::HIGH_GAIN)) {
241239
rawbunchesHG.emplace_back(bunch.mADCs.size(), bunch.mStarttime);
242240
for (auto adc : bunch.mADCs) {
243241
rawbunchesHG.back().addADC(adc);
242+
if (adc > o2::emcal::constants::LG_SUPPRESSION_CUT) {
243+
saturatedBunch = true;
244+
}
244245
}
245246
if (mPropagateMC) {
246247
rawLabelsHG.push_back(bunch.mLabels);
247248
}
248249
}
249250

250-
// Creating the low gain bunch with labels
251-
for (auto& bunch : findBunches(channelDigits.mChannelDigits, channelDigits.mChannelLabels, ChannelType_t::LOW_GAIN)) {
252-
rawbunchesLG.emplace_back(bunch.mADCs.size(), bunch.mStarttime);
253-
for (auto adc : bunch.mADCs) {
254-
rawbunchesLG.back().addADC(adc);
255-
}
256-
if (mPropagateMC) {
257-
rawLabelsLG.push_back(bunch.mLabels);
251+
// Creating the low gain bunch with labels if the HG bunch is saturated
252+
if (saturatedBunch) {
253+
for (auto& bunch : findBunches(channelDigits.mChannelDigits, channelDigits.mChannelLabels, ChannelType_t::LOW_GAIN)) {
254+
rawbunchesLG.emplace_back(bunch.mADCs.size(), bunch.mStarttime);
255+
for (auto adc : bunch.mADCs) {
256+
rawbunchesLG.back().addADC(adc);
257+
}
258+
if (mPropagateMC) {
259+
rawLabelsLG.push_back(bunch.mLabels);
260+
}
258261
}
259262
}
260263

0 commit comments

Comments
 (0)