ATLAS Offline Software
Loading...
Searching...
No Matches
TileDigiNoiseCalibAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5// ********************************************************************
6//
7// NAME: TileDigiNoiseCalib.cxx
8// PACKAGE: TileCalib
9//
10// AUTHOR: Luca Fiorini (Luca.Fiorini@cern.ch)
11//
12// February 2008
13// ********************************************************************
14
15// Gaudi includes
16#include "GaudiKernel/ServiceHandle.h"
17#include "GaudiKernel/ThreadLocalContext.h"
18
19//Event info
24
25// Tile includes
33#include "TileOFCorrelation.h"
35
36#include "TFile.h"
37#include "TTree.h"
38#include "TF1.h"
39#include "TGraphErrors.h"
40#include "TClonesArray.h"
41#include <cmath>
42#include <ctime>
43
44TileDigiNoiseCalibAlg::TileDigiNoiseCalibAlg(const std::string& name, ISvcLocator* pSvcLocator)
45 : AthAlgorithm(name, pSvcLocator)
46 , m_beamCnv(nullptr)
47 , m_cabling(nullptr)
48 , m_tileOFCorrelation(nullptr)
49 , m_tileID(nullptr)
50 , m_tileHWID(nullptr)
51 , m_cispar(nullptr)
52// , m_nDrawers(0)
53 , m_time(0)
54 , m_year(0)
55 , m_month(0)
56 , m_day(0)
57 , m_yday(0)
58 , m_hour(0)
59 , m_min(0)
60 , m_trigType(0)
61{
62 declareProperty("TileBeamElemContainer", m_beamElemContainer = "TileBeamElemCnt");
63 /* declareProperty("TileRawChannelContainerFlat", m_flatRawChannelContainer = "TileRawChannelFlat");
64 declareProperty("TileRawChannelContainerFit", m_fitRawChannelContainer = ""); // don't create
65 declareProperty("TileRawChannelContainerOpt", m_optRawChannelContainer = ""); // by default */
66 declareProperty("TileRawChannelContainerDsp", m_dspRawChannelContainer = "TileRawChannelCnt");
67 declareProperty("CalibMode", m_calibMode = true);
68 declareProperty("usePMT", m_usePMT = false);
69 declareProperty("RunNumber", m_run = 0);
70 declareProperty("FileNamePrefix", m_file = "Digi_NoiseCalib");
71 declareProperty("NtupleID", m_ntupleID = "Digi_NoiseCalib");
72 declareProperty("TreeSize", m_treeSize = 16000000000LL);
73 declareProperty("NSamples", m_nSamples = 7);
74 declareProperty("DoAvgCorr", m_doAvgCorr = false);
75 declareProperty("DoRobustCov", m_doRobustCov = false);
76 declareProperty("TileDQstatus", m_dqStatusKey = "TileDQstatus");
77
78 m_run = 0;
79 m_evtNr = -1;
80
95}
96
98
99 delete[] m_sumPed2;
100 delete[] m_sumRms2;
101 delete[] m_meanAmp;
102 delete[] m_meanAmp_ij;
103 delete[] m_evt;
104 delete[] m_ros;
105 delete[] m_drawer;
106 delete[] m_channel;
107 delete[] m_gain;
108 delete[] m_ped;
109 delete[] m_lfn;
110 delete[] m_hfn;
111 delete[] m_noise_cov;
112 delete[] m_auto_corr;
113}
114
118
119 CHECK( m_dqStatusKey.initialize() );
120
121 if (!m_eventInfoKey.key().empty()) {
122 ATH_CHECK( m_eventInfoKey.initialize() );
123 }
124 // TileDigitsContainer initialization
125 ATH_CHECK( m_digitsContainerKey.initialize() );
126
127 return StatusCode::SUCCESS;
128}
129
133
134 // find TileCablingService
136
137 // retrieve TileID helper from det store
138 CHECK( detStore()->retrieve(m_tileID) );
139
140 CHECK( detStore()->retrieve(m_tileHWID) );
141
142 CHECK( m_adderFilterAlgTool.retrieve() );
143
144 StatusCode sc;
145 sc &= m_adderFilterAlgTool->setProperty("TileRawChannelContainer", "TileAdderFlat");
146 sc &= m_adderFilterAlgTool->setProperty("calibrateEnergy", "true");
147 sc &= m_adderFilterAlgTool->setProperty("PedStart", "0");
148 sc &= m_adderFilterAlgTool->setProperty("PedLength", "1");
149 sc &= m_adderFilterAlgTool->setProperty("PedOffset", "0");
150 sc &= m_adderFilterAlgTool->setProperty("SignalStart", "1");
151 sc &= m_adderFilterAlgTool->setProperty("SignalLength", "15");
152 sc &= m_adderFilterAlgTool->setProperty("FilterLength", "5");
153 sc &= m_adderFilterAlgTool->setProperty("FrameLength", "16");
154 sc &= m_adderFilterAlgTool->setProperty("DeltaCutLo", "9.5");
155 sc &= m_adderFilterAlgTool->setProperty("DeltaCutHi", "9.5");
156 sc &= m_adderFilterAlgTool->setProperty("RMSCutLo", "1.0");
157 sc &= m_adderFilterAlgTool->setProperty("RMSCutHi", "1.0");
158
159 if (sc.isFailure()) {
160 ATH_MSG_ERROR("Failure setting properties of " << m_adderFilterAlgTool);
161 return StatusCode::FAILURE;
162 }
163
165 m_tileOFCorrelation->SetCorrelationZero(msg(), m_nSamples);
166
167 ATH_MSG_INFO( "calibMode " << m_calibMode );
168 ATH_MSG_INFO( "number of samples " << m_nSamples );
169
170 // set event number to 0 before first event
171 m_evtNr = 0;
172
173 if (m_evtNr == 0) {
174 if (m_beamElemContainer.length() > 0) {
175 ServiceHandle<IConversionSvc> cnvSvc("ByteStreamCnvSvc", "");
176 if (cnvSvc.retrieve().isFailure()) {
177 ATH_MSG_ERROR( " Can't get ByteStreamCnvSvc " );
178 m_beamCnv = nullptr;
179 } else {
181 if (m_beamCnv == nullptr) {
182 ATH_MSG_ERROR( " Can't get TileBeamElemContByteStreamCnv " );
183 }
184 }
185
186 } else {
187 m_beamCnv = nullptr;
188 }
189 }
190
191 ATH_MSG_INFO( "initialization completed" );
192 return StatusCode::SUCCESS;
193}
194
197
198 const EventContext& ctx = Gaudi::Hive::currentContext();
199 const TileDQstatus * dqStatus = SG::makeHandle (m_dqStatusKey, ctx).get();
200
201 StatusCode sc;
202 bool empty(false);
203
204 if (m_evtNr < 0) {
205
206 if (FirstEvt_initialize().isFailure()) {
207 ATH_MSG_ERROR( "FirstEvt_initialize failed" );
208 }
209
210 bool calibMode = (dqStatus->calibMode() == 1);
211 if (calibMode != m_calibMode) {
212 ATH_MSG_INFO( "Calib mode from data is " );
213 ATH_MSG_INFO( " Overwriting calib mode " );
214 m_calibMode = calibMode;
215 }
216
217 m_cispar = dqStatus->cispar();
218 StoreRunInfo(dqStatus); // done only once
219 }
220
221 m_cispar = dqStatus->cispar();
222 if (m_evtNr % 1000 == 0)
223 ATH_MSG_WARNING( m_evtNr << " events processed so far" );
224
225 // store TileDigits
226 if (m_nSamples > 0) sc = fillDigits (dqStatus);
227 empty &= (sc.isFailure());
228
229 if (empty) {
230 ATH_MSG_WARNING( "Error in execute " );
231 }
232 ++m_evtNr;
233 return StatusCode::SUCCESS;
234}
235
238
239 ATH_MSG_INFO( "Finalizing TileDigiNoiseCalibAlg" );
240
241 finalDigits();
242
243 std::ostringstream sStr;
244 std::string trig_str;
245
246 if (m_trigType == Phys) trig_str = "Phys";
247 else if (m_trigType == Las) trig_str = "Las";
248 else if (m_trigType == Ped) trig_str = "Ped";
249 else if (m_trigType == Cis) trig_str = "Cis";
250 else {
251 ATH_MSG_WARNING( "Unknown trigger type " << m_trigType );
252 trig_str = "Unk";
253 }
254 sStr << m_file << "_" << m_run << "_" << trig_str << ".root";
255 m_file = sStr.str();
256 ATH_MSG_INFO( "Writing calibrations to file " << m_file );
257
258 // Create output file: for now creating file for just this
259 // algorithm; want to add to ntuple file eventually??
260 TFile* fout = new TFile(m_file.c_str(), "recreate");
261
262 // Create tree with branches
263 TTree* t = new TTree(m_ntupleID.c_str(), "TileCalib-Ntuple");
264
265 t->Branch("RunNumber", &m_run, "RunNumber/I");
266 t->Branch("TrigType", &m_trigType, "TrigType/I");
267 t->Branch("Time", &m_time, "Time/I");
268 t->Branch("Year", &m_year, "Year/I");
269 t->Branch("Month", &m_month, "Month/I");
270 t->Branch("Day", &m_day, "Day/I");
271 t->Branch("YDay", &m_yday, "YDay/I");
272 t->Branch("Hour", &m_hour, "Hour/I");
273 t->Branch("Min", &m_min, "Min/I");
274 t->Branch("nSamples", &m_nSamples, "nSamples/I");
275 t->Branch("nEvt", &m_evtNr, "nEvt/I"); // events processed
276 t->Branch("ros", *m_ros, "ros[5][64][48][2]/b");
277 t->Branch("drawer", *m_drawer, "drawer[5][64][48][2]/b");
278 t->Branch("channel", *m_channel, "channel[5][64][48][2]/b");
279 t->Branch("gain", *m_gain, "gain[5][64][48][2]/O");
280 t->Branch("EvtGood", *m_evt, "Evt[5][64][48][2]/I"); // events used in the noise calculation for every channel
281 t->Branch("ped", *m_ped, "ped[5][64][48][2]/F");
282 t->Branch("lfn", *m_lfn, "lfn[5][64][48][2]/F");
283 t->Branch("hfn", *m_hfn, "hfn[5][64][48][2]/F");
284 t->Branch("noise_cov", *m_noise_cov, "noise_cov[5][64][2]/F");
285 // AutoCorrelation Matrix: Store only non-diagonal half of symmetric matrix
286 t->Branch("auto_corr", *m_auto_corr, "auto_corr[5][64][48][2][36]/F");
287
288 // Fill with current values (i.e. tree will have only one entry for this whole run)
289
290 t->Fill();
291 t->Write();
292
293 fout->Close();
294
295 return StatusCode::SUCCESS;
296}
297
300 if (not dqStatus){
301 m_time = 0;
302 m_year = 0;
303 m_month = 0;
304 m_day = 0;
305 m_yday = 0;
306 m_hour = 0;
307 m_min = 0;
308 m_trigType = 0;
309 ATH_MSG_WARNING( "TileDigiNoiseCalibAlg::StoreRunInfo : dqStatus pointer is null" );
310 return;
311 }
312 if (dqStatus->calibMode() == 1 && m_beamElemContainer.length() > 0) {// Bigain can use cispar
313 if (m_beamCnv) {
314 // std::cout << "LUCA m_time= "<< m_time << " bc_time_seconds= "<< m_beamCnv->eventFragment()->bc_time_seconds() <<
315 // " bc_time_nanoseconds= " << m_beamCnv->eventFragment()->bc_time_nanoseconds() << std::endl;
316 if (m_beamCnv->validBeamFrag()) {
317 m_run = m_beamCnv->robFragment()->rod_run_no(); // take it from beam ROD header
318 } else {
319 m_run = 0;
320 }
321 } else
322 m_run = 0;
323
324 if (m_cispar) {
325 m_time = m_cispar[10]; //time in sc from 1970
326 m_trigType = m_cispar[12];
327 } else {
328 m_time = 0;
329 m_year = 0;
330 m_month = 0;
331 m_day = 0;
332 m_yday = 0;
333 m_hour = 0;
334 m_min = 0;
335 m_trigType = 0;
336 }
337 } else {// monogain can use eventinfo
338
340 if ( !eventInfo.isValid() ) {
341 ATH_MSG_ERROR( "No EventInfo object found! Can't read run number!" );
342 m_run = 0;
343 m_time = 0;
344 m_trigType = 0;
345 } else {
346 m_run = eventInfo->runNumber();
347 m_time = eventInfo->timeStamp();
348 if (!(eventInfo->eventType(xAOD::EventInfo::IS_CALIBRATION))) // if not calibration, physics
349 m_trigType = 1;
350 else
351 m_trigType = 0;
352 }
353
354 }
355
356 if (m_time != 0) {
357 struct tm t;
358 time_t t_time = m_time;
359 localtime_r(&t_time, &t);
360 m_year = t.tm_year + 1900;
361 m_month = t.tm_mon + 1;
362 m_day = t.tm_mday;
363 m_yday = t.tm_yday + 1;
364 m_hour = t.tm_hour;
365 m_min = t.tm_min;
366 } else {
367 m_year = 0;
368 m_month = 0;
369 m_day = 0;
370 m_yday = 0;
371 m_hour = 0;
372 m_min = 0;
373 }
374}
375
378/*---------------------------------------------------------*/
379StatusCode TileDigiNoiseCalibAlg::fillDigits (const TileDQstatus* theDQstatus) {
380/*---------------------------------------------------------*/
381
383 ATH_CHECK( digitsCnt.isValid() );
384
385 TileDigitsContainer::const_iterator collItr = digitsCnt->begin();
386 TileDigitsContainer::const_iterator lastColl = digitsCnt->end();
387
388 for (; collItr != lastColl; ++collItr) {
389
390 TileDigitsCollection::const_iterator digitsItr = (*collItr)->begin();
391 TileDigitsCollection::const_iterator lastDigits = (*collItr)->end();
392
393 if (digitsItr != lastDigits) { //loop over all the drawers in the data
394
395 HWIdentifier adc_id = (*digitsItr)->adc_HWID();
396 int ros = m_tileHWID->ros(adc_id);
397 // IMPORTANT! ros for TileCal partitions goes like LBA=1 LBC=2 EBA=3 EBC=4
398
399 int drawer = m_tileHWID->drawer(adc_id);
400 // IMPORTANT! Drawers are from 0 to 63!
401
402 //coverity[STACK_USE]
403 double mean_tmp[48][16][2] = {};
404
405
406 for (; digitsItr != lastDigits; ++digitsItr) { // loop over all channels in the drawer
407
408 adc_id = (*digitsItr)->adc_HWID();
409 int chan = m_tileHWID->channel(adc_id);
410 if (m_usePMT) {
411 chan = digiChannel2PMT(ros, chan); // IMPORTANT: 0-47 PMT format!
412 // by default we use CHANNELS.
413 // PMTs usage is possible by switching on m_usePMT
414 }
415 int gain = m_tileHWID->adc(adc_id);
416
417 std::vector<float> vdigits = (*digitsItr)->samples();
418
419 // Needed to calculate the AutoCorrealtion matrix at end of run
420 //m_tileOFCorrelation->RunningCorrelation(vdigits,ros-1,drawer,chan,gain,msg(),false,m_nSamples,100);
421
422 // if (theDQstatus->isChEmpty(ros, drawer, chan)) {
423 // ATH_MSG_DEBUG( "Skipping Module: " << TileCalibUtils::getDrawerString(ros, drawer)
424 // << " channel: " << chan
425 // << " ADC: " << gain
426 // << " because empty" );
427 // continue;
428 // }
429
430 // If DQ problem, do not fill calib ntuple
431 if (m_calibMode == 1) {// Bigain: check indivual adc's
432 if (!(theDQstatus->isAdcDQgood(ros, drawer, chan, gain))) {
433 ATH_MSG_DEBUG( "Skipping Module: " << TileCalibUtils::getDrawerString(ros, drawer)
434 << " channel: " << chan
435 << " ADC: " << gain
436 << " due to DQ error found." );
437 continue;
438 }
439 } else {// monogain, just check channel
440
441 if (!(theDQstatus->isChanDQgood(ros, drawer, chan))) {
442 ATH_MSG_DEBUG( "Skipping Module: " << TileCalibUtils::getDrawerString(ros, drawer)
443 << " channel: " << chan
444 << " due to DQ error found." );
445 continue;
446 }
447 }
448
449 double meansamp = 0.0;
450 double rmssamp = 0.0;
451 unsigned int dsize = vdigits.size();
452
453 if (dsize > 16) {
454 ATH_MSG_ERROR( "length of digits vector " << dsize << " - greater than 16 !" );
455 dsize = 16;
456 }
457
458 for (unsigned int i = 0; i < dsize; ++i) {
459 double dig = vdigits[i];
460 meansamp += dig;
461 rmssamp += dig * dig;
462 mean_tmp[chan][i][gain] = dig;
463 }
464 if (dsize > 0) {
465 m_ped[ros][drawer][chan][gain] += vdigits[0];
466 m_sumPed2[ros][drawer][chan][gain] += vdigits[0] * vdigits[0];
467
468 if (dsize > 1) {
469 m_evt[ros][drawer][chan][gain]++;
470 meansamp /= dsize;
471 rmssamp = rmssamp / dsize - meansamp * meansamp;
472 rmssamp = (rmssamp > 0.0) ? sqrt(rmssamp * dsize / (dsize - 1)) : 0.0;
473 m_hfn[ros][drawer][chan][gain] += rmssamp;
474 m_sumRms2[ros][drawer][chan][gain] += rmssamp * rmssamp;
475 }
476 }
477
478 // Fill event-by-event correlation values
479 if (m_doAvgCorr)
480 m_tileOFCorrelation->RunningCorrelation(vdigits, ros - 1, drawer, chan, gain, msg(), false, m_nSamples, 100);
481 else
482 m_tileOFCorrelation->Sum(vdigits, ros - 1, drawer, chan, gain, msg(), false, m_nSamples, m_doRobustCov);
483
484 } // loop over channels
485
486 //For cor&cov
487 for (int sample = 0; sample < m_nSamples; ++sample) {
488 for (unsigned int gain = 0; gain < TileCalibUtils::MAX_GAIN; ++gain) {
489 for (unsigned int chan_i = 0; chan_i < TileCalibUtils::MAX_CHAN; ++chan_i) {
490 m_meanAmp[ros][drawer][chan_i][gain] += mean_tmp[chan_i][sample][gain];
491 for (unsigned int chan_j = 0; chan_j < TileCalibUtils::MAX_CHAN; ++chan_j)
492 m_meanAmp_ij[ros][drawer][chan_i][chan_j][gain] += mean_tmp[chan_i][sample][gain] * mean_tmp[chan_j][sample][gain];
493 }
494 }
495 }
496 } //check if Digits in module
497 } //loop over drawers
498
499 return StatusCode::SUCCESS;
500}
501
504/*---------------------------------------------------------*/
506/*---------------------------------------------------------*/
507
508
509 // Calculate AutoCorrealtion matrix
510 // --Average calculation (Assumes matrix is Toeplitz)
511 if (m_doAvgCorr)
512 m_tileOFCorrelation->CalcRunningCorrelation(msg(), m_nSamples, 100, false);
513 // --Rigorous calculation
514 else
515 m_tileOFCorrelation->CalcCorrelation(msg(), m_nSamples, false, m_doRobustCov);
516
517 // Needed to store autoCorrelation matrix
518 float tmpCorr[9][9] = {};
519
520
521 for (unsigned int ros = 1; ros < TileCalibUtils::MAX_ROS; ++ros) {
522 for (unsigned int drawer = 0; drawer < TileCalibUtils::MAX_DRAWER; ++drawer) {
523 for (unsigned int gain = 0; gain < TileCalibUtils::MAX_GAIN; ++gain) {
524 for (unsigned int chan = 0; chan < TileCalibUtils::MAX_CHAN; ++chan) {
525
526 m_ros[ros][drawer][chan][gain] = ros;
527 m_drawer[ros][drawer][chan][gain] = drawer;
528 m_channel[ros][drawer][chan][gain] = chan;
529 m_gain[ros][drawer][chan][gain] = gain;
530
531 if (m_evt[ros][drawer][chan][gain] > 0) {
532 int nev = m_evt[ros][drawer][chan][gain];
533 m_ped[ros][drawer][chan][gain] /= nev;
534 double Ped = m_ped[ros][drawer][chan][gain];
535 m_hfn[ros][drawer][chan][gain] /= nev;
536
537 if (nev > 1) {
538 double PedRMS = m_sumPed2[ros][drawer][chan][gain] / nev - Ped * Ped;
539 PedRMS = m_sumPed2[ros][drawer][chan][gain] / nev - Ped * Ped;
540 PedRMS = (PedRMS > 0.0) ? sqrt(PedRMS * nev / (nev - 1)) : 0.0;
541 m_lfn[ros][drawer][chan][gain] = PedRMS;
542 }
543 }
544
545 // Get values from AutoCorrelation matrix
546 // matrix is symmetric, so only half-retrieved and stored
547 m_tileOFCorrelation->GetCorrelation(m_nSamples, tmpCorr, ros - 1, drawer, chan, gain);
548 //std::cout << "Printing AutoCorr values: " << std::endl;
549 int nVals = 0;
550 if (m_doRobustCov){ //save 28 elements for robust method
551 for (int i = 0; i < m_nSamples; i++) {
552 for (int j = i; j < m_nSamples; j++) {
553 //std::cout << "Auto Corr [" << i << "][" << j << "]:" << tmpCorr[i][j] << std::endl;
554 //std::cout << "Auto CorrSym [" << j << "][" << i << "]:" << tmpCorr[j][i] << std::endl;
555 m_auto_corr[ros][drawer][chan][gain][nVals] = tmpCorr[i][j];
556 nVals++;
557 }
558 }
559 } else {
560 for (int i = 0; i < m_nSamples; i++) {
561 for (int j = i+1; j < m_nSamples; j++) {
562 //std::cout << "Auto Corr [" << i << "][" << j << "]:" << tmpCorr[i][j] << std::endl;
563 //std::cout << "Auto CorrSym [" << j << "][" << i << "]:" << tmpCorr[j][i] << std::endl;
564 m_auto_corr[ros][drawer][chan][gain][nVals] = tmpCorr[i][j];
565 nVals++;
566 }
567 }
568 }
569
570 } // end chan loop
571
572 //Calculate covariance loop over chan_i, chan_j
573 if (m_evtNr * m_nSamples > 0) {
574 // Avoid a spurious FPE from clang.
576 //replace m_evtNr with sqrt(m_evt[ch_i]*m_evt[ch_j])
577
578 for (unsigned int chan_i = 0; chan_i < TileCalibUtils::MAX_CHAN; ++chan_i) {
579 m_meanAmp[ros][drawer][chan_i][gain] /= m_evtNr * m_nSamples;
580 for (unsigned int chan_j = 0; chan_j < TileCalibUtils::MAX_CHAN; ++chan_j)
581 m_meanAmp_ij[ros][drawer][chan_i][chan_j][gain] /= m_evtNr * m_nSamples;
582 }
583
584 //coverity[STACK_USE]
585 double covar[48][48];
586 double mean_cov_ii = 0.; // mean values of covar in diag terms
587 double mean_cov_ij = 0.; // mean values of covar in off diag terms
588
589 for (unsigned int chan_i = 0; chan_i < TileCalibUtils::MAX_CHAN; ++chan_i) {
590 for (unsigned int chan_j = 0; chan_j < TileCalibUtils::MAX_CHAN; ++chan_j) {
591 covar[chan_i][chan_j] = m_meanAmp_ij[ros][drawer][chan_i][chan_j][gain] - m_meanAmp[ros][drawer][chan_i][gain] * m_meanAmp[ros][drawer][chan_j][gain];
592
593 if (chan_j < chan_i) {
594 mean_cov_ij += covar[chan_i][chan_j]; //LF: we take C_ij with its sign
595 }
596 }
597 mean_cov_ii += covar[chan_i][chan_i];
598 }
599
600 if (mean_cov_ii != 0.) {
601 m_noise_cov[ros][drawer][gain] = (2. * mean_cov_ij) / (mean_cov_ii * 47.); //(2*cov_ij/(48*47))/(cov_ii/48)
602
603 } else {
604 m_noise_cov[ros][drawer][gain] = 0.;
605 }
606
607 }
608 }
609 }
610 }
611}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
static Double_t sc
Handle class for reading from StoreGate.
#define NVALS
static const Attributes_t empty
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
MsgStream & msg() const
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition DataVector.h:838
virtual bool isValid() override final
Can the handle be successfully dereferenced?
This AthConstConverter class provides conversion from ByteStream to TileBeamElemContainer.
static const TileCablingService * getInstance()
get pointer to service instance
static const unsigned int MAX_ROS
Number of ROSs.
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.
static const unsigned int MAX_GAIN
Number of gains per channel.
static const unsigned int MAX_DRAWER
Number of drawers in ROS 1-4.
static const unsigned int MAX_CHAN
Number of channels in drawer.
Class that holds Data Quality fragment information and provides functions to extract the data quality...
bool isAdcDQgood(int partition, int drawer, int ch, int gain) const
returns status of single ADC returns False if there are any errors
bool isChanDQgood(int partition, int drawer, int ch) const
returns status of single channel (if bigain, returns AND of ADCs' status
uint32_t calibMode() const
Calibration mode.
const uint32_t * cispar() const
CIS parameters.
TileOFCorrelation * m_tileOFCorrelation
double(* m_meanAmp_ij)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_CHAN][Tile::MAX_GAIN]
ToolHandle< TileRawChannelBuilderFlatFilter > m_adderFilterAlgTool
double(* m_sumRms2)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
float(* m_auto_corr)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN][NVALS]
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
virtual StatusCode initialize() override
Only array initialization is done here All the helpers initialization is done at the first event.
uint8_t(* m_channel)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
bool(* m_gain)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
TileDigiNoiseCalibAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute() override
Main method.
SG::ReadHandleKey< TileDQstatus > m_dqStatusKey
float(* m_hfn)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
StatusCode fillDigits(const TileDQstatus *theDQstatus)
fillDigits is called at every events.
float(* m_noise_cov)[Tile::MAX_DRAWER][Tile::MAX_GAIN]
uint8_t(* m_ros)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
void finalDigits()
finalDigits is called during finalize Here the average Ped, m_lfn, m_hfn and covariance are calculate...
TileBeamElemContByteStreamCnv * m_beamCnv
virtual StatusCode finalize() override
The output ntuple is created in finalize method.
double(* m_meanAmp)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
StatusCode FirstEvt_initialize()
Initialization done at the first event.
SG::ReadHandleKey< TileDigitsContainer > m_digitsContainerKey
void StoreRunInfo(const TileDQstatus *dqStatus)
StoreRunInfo is called only during the first event.
const TileCablingService * m_cabling
float(* m_lfn)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
int digiChannel2PMT(int ros, int chan)
double(* m_sumPed2)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
int(* m_evt)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
uint8_t(* m_drawer)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
float(* m_ped)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
@ IS_CALIBRATION
true: calibration, false: physics
static TFile * fout
Definition listroot.cxx:40
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Tell the compiler to optimize assuming that FP may trap.
#define CXXUTILS_TRAPPING_FP
Definition trapping_fp.h:24