@@ -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