69 return StatusCode::FAILURE;
77 sc=
detStore()->retrieve(calibParams,
"LArCalibParams");
79 {
ATH_MSG_ERROR(
"Cannot load LArCalibParams from DetStore." );
80 return StatusCode::FAILURE;
92 ATH_MSG_ERROR(
"Can't retrieve LArCalibDigitContainer with key " <<
key <<
"from StoreGate." );
93 return StatusCode::SUCCESS;
95 ATH_MSG_DEBUG(
"Retrieved LArCalibDigitContainer with key " <<
key <<
" from StoreGate." );
100 if(calibDigitContainer->
empty()) {
103 ATH_MSG_DEBUG(
"LArCalibDigitContainer with key=" <<
key <<
" has size = " << calibDigitContainer->
size() );
107 std::vector<unsigned int> ntrigger, nTriggerPerStep, nStepTrigger, iStepTrigger;
109 ntrigger.resize(calibDigitContainer->
size(),0);
136 const std::vector<HWIdentifier>& calibLineID=clcabling->calibSlotLine(chid);
138 if(!calibLineID.empty()){
140 nTriggerPerStep[febhash] = calibParams->
NTrigger(calibModuleID);
141 ATH_MSG_DEBUG(
"Ntrigger per step = " << nTriggerPerStep[febhash] );
142 if(nTriggerPerStep[febhash] > 1000) nTriggerPerStep[febhash]=100;
144 nTriggerPerStep[febhash] = 100;
156 ATH_MSG_DEBUG(
"Delay is changing to " <<
digit->delay() <<
" from " <<
m_delay <<
": book a new LArAccumulatedCalibDigitContainer" );
164 delete larAccuCalibDigitContainerHG;
165 delete larAccuCalibDigitContainerMG;
166 delete larAccuCalibDigitContainerLG;
167 return StatusCode::FAILURE;
175 cellAccumulatedHG.m_ntrigger++;
176 ATH_MSG_DEBUG(
"HG chid = " << chid <<
", trigger = " << cellAccumulatedHG.m_ntrigger <<
", DAC = " <<
digit->DAC() );
178 unsigned int sizeSamples =
digit->samples().size();
179 ATH_MSG_DEBUG(
"sizeSteps = " << sizeSteps <<
", # of samples = " << sizeSamples );
180 if(cellAccumulatedHG.m_ntrigger==1){
181 cellAccumulatedHG.m_sum.clear();
182 cellAccumulatedHG.m_sum2.clear();
183 cellAccumulatedHG.m_sum.resize(sizeSamples,0);
184 cellAccumulatedHG.m_sum2.resize(sizeSamples,0);
186 for(
unsigned int j=0;j<sizeSamples;j++) {
187 cellAccumulatedHG.m_sum[j] +=
digit->samples()[j];
188 cellAccumulatedHG.m_sum2[j] +=
digit->samples()[j]*
digit->samples()[j];
199 cellAccumulatedMG.m_ntrigger++;
200 ATH_MSG_DEBUG(
"MG chid = " << chid <<
", trigger = " << cellAccumulatedMG.m_ntrigger <<
", DAC = " <<
digit->DAC() );
202 unsigned int sizeSamples =
digit->samples().size();
203 ATH_MSG_DEBUG(
"sizeSteps = " << sizeSteps <<
", # of samples = " << sizeSamples );
204 if(cellAccumulatedMG.m_ntrigger==1){
205 cellAccumulatedMG.m_sum.clear();
206 cellAccumulatedMG.m_sum2.clear();
207 cellAccumulatedMG.m_sum.resize(sizeSamples,0);
208 cellAccumulatedMG.m_sum2.resize(sizeSamples,0);
210 for(
unsigned int j=0;j<sizeSamples;j++){
211 cellAccumulatedMG.m_sum[j] +=
digit->samples()[j];
212 cellAccumulatedMG.m_sum2[j] +=
digit->samples()[j]*
digit->samples()[j];
222 if (chid==959628800) std::cout <<
"---> in loop LG - DAC = " <<
digit->DAC() << std::endl;
223 cellAccumulatedLG.m_ntrigger++;
224 unsigned int sizeSamples =
digit->samples().size();
225 if(cellAccumulatedLG.m_ntrigger==1){
226 cellAccumulatedLG.m_sum.clear();
227 cellAccumulatedLG.m_sum2.clear();
228 cellAccumulatedLG.m_sum.resize(sizeSamples,0);
229 cellAccumulatedLG.m_sum2.resize(sizeSamples,0);
231 for(
unsigned int j=0;j<sizeSamples;j++){
232 cellAccumulatedLG.m_sum[j] +=
digit->samples()[j];
233 cellAccumulatedLG.m_sum2[j] +=
digit->samples()[j]*
digit->samples()[j];
241 if( (cellAccumulatedHG.m_ntrigger+cellAccumulatedMG.m_ntrigger+cellAccumulatedLG.m_ntrigger)==nTriggerPerStep[febhash]){
243 ATH_MSG_DEBUG(
"chid = " << chid <<
", gain = " <<
gain <<
", DAC = " <<
digit->DAC() <<
", isPulsed = " <<
m_isPulsed <<
", delay = " <<
m_delay <<
", trigPerStep = " << nTriggerPerStep[febhash] <<
", istep = " << iStepTrigger[febhash] );
244 iStepTrigger[febhash]++;
245 unsigned int sizeSamples =
digit->samples().size();
247 if (cellAccumulatedHG.m_ntrigger>0) {
249 std::vector < uint64_t > sampleSumHG;
250 std::vector < uint64_t > sample2SumHG;
251 sampleSumHG.resize(sizeSamples,0);
252 sample2SumHG.resize(sizeSamples,0);
254 accuCalibDigitHG->
setAddSubStep(cellAccumulatedHG.m_sum,cellAccumulatedHG.m_sum2,cellAccumulatedHG.m_ntrigger);
255 larAccuCalibDigitContainerHG->
push_back(accuCalibDigitHG);
258 if (cellAccumulatedMG.m_ntrigger>0) {
260 std::vector < uint64_t > sampleSumMG;
261 std::vector < uint64_t > sample2SumMG;
262 sampleSumMG.resize(sizeSamples,0);
263 sample2SumMG.resize(sizeSamples,0);
265 accuCalibDigitMG->
setAddSubStep(cellAccumulatedMG.m_sum,cellAccumulatedMG.m_sum2,cellAccumulatedMG.m_ntrigger);
266 larAccuCalibDigitContainerMG->
push_back(accuCalibDigitMG);
269 if (cellAccumulatedLG.m_ntrigger>0) {
271 std::vector < uint64_t > sampleSumLG;
272 std::vector < uint64_t > sample2SumLG;
273 sampleSumLG.resize(sizeSamples,0);
274 sample2SumLG.resize(sizeSamples,0);
276 accuCalibDigitLG->
setAddSubStep(cellAccumulatedLG.m_sum,cellAccumulatedLG.m_sum2,cellAccumulatedLG.m_ntrigger);
277 larAccuCalibDigitContainerLG->
push_back(accuCalibDigitLG);
280 cellAccumulatedHG.m_ntrigger = 0;
281 cellAccumulatedMG.m_ntrigger = 0;
282 cellAccumulatedLG.m_ntrigger = 0;
294 sc =
evtStore()->record(larAccuCalibDigitContainerHG,
"HIGH");
295 if (
sc!=StatusCode::SUCCESS)
296 ATH_MSG_WARNING(
"Unable to record LArAccumulatedCalibDigitContainer with key HIGH from DetectorStore. " );
298 ATH_MSG_DEBUG(
"Recorded succesfully LArAccumulatedCalibDigitContainer with key HIGH" );
299 sc =
evtStore()->setConst(larAccuCalibDigitContainerHG);
300 if (
sc.isFailure()) {
301 ATH_MSG_ERROR(
" Cannot lock LArAccumulatedCalibDigitContainerHG " );
302 delete larAccuCalibDigitContainerMG;
303 delete larAccuCalibDigitContainerLG;
304 return(StatusCode::FAILURE);
307 sc =
evtStore()->record(larAccuCalibDigitContainerMG,
"MEDIUM");
308 if (
sc!=StatusCode::SUCCESS)
309 ATH_MSG_WARNING(
"Unable to record LArAccumulatedCalibDigitContainer with key MEDIUM from DetectorStore. " );
311 ATH_MSG_DEBUG(
"Recorded succesfully LArAccumulatedCalibDigitContainer with key MEDIUM" );
312 sc =
evtStore()->setConst(larAccuCalibDigitContainerMG);
313 if (
sc.isFailure()) {
314 ATH_MSG_ERROR(
" Cannot lock LArAccumulatedCalibDigitContainerMG " );
315 delete larAccuCalibDigitContainerLG;
316 return(StatusCode::FAILURE);
319 sc =
evtStore()->record(larAccuCalibDigitContainerLG,
"LOW");
320 if (
sc!=StatusCode::SUCCESS)
321 ATH_MSG_WARNING(
"Unable to record LArAccumulatedCalibDigitContainer with key LOW from DetectorStore. " );
323 ATH_MSG_DEBUG(
"Recorded succesfully LArAccumulatedCalibDigitContainer with key LOW" );
324 sc =
evtStore()->setConst(larAccuCalibDigitContainerLG);
325 if (
sc.isFailure()) {
326 ATH_MSG_ERROR(
" Cannot lock LArAccumulatedCalibDigitContainerLG " );
327 return(StatusCode::FAILURE);
330 return StatusCode::SUCCESS;