ATLAS Offline Software
LArOFCAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // LArOFC: Algorithm to calculate optimal filtering constants.
6 
8 
20 
21 #include "CoralBase/Blob.h"
23 
27 #include "CaloDetDescr/CaloDetDescrElement.h"
31 
32 #include <cassert>
33 #include <tuple> //std::ignore
34 
35 #include "tbb/parallel_for.h"
36 
37 //#define LAROFCALG_DEBUGOUTPUT
38 
39 
40 LArOFCAlg::LArOFCAlg(const std::string& name, ISvcLocator* pSvcLocator)
41  : AthAlgorithm(name, pSvcLocator),
42  m_calo_dd_man(nullptr),
43  m_onlineID(nullptr),
44  m_larPhysWaveBin(nullptr),
45  m_groupingType("SubDetector") // SubDetector, Single, FeedThrough
46 {
47 
48  declareProperty("Nsample",m_nSamples = 5);
49  declareProperty("Nphase", m_nPhases = 50);
50  declareProperty("Dphase", m_dPhases = 1);
51  declareProperty("Ndelay", m_nDelays = 24);
52 
53  declareProperty("KeyList", m_keylist);
54 
55  declareProperty("ReadCaliWave", m_readCaliWave=true); // false == PhysWave
56  declareProperty("FillShape", m_fillShape=false);
57  declareProperty("KeyOFC", m_ofcKey="LArOFC");
58  declareProperty("KeyOFCV2", m_ofcKeyV2="LArOFCV2");
59  declareProperty("KeyShape", m_shapeKey="LArShape");
60 
61  declareProperty("Normalize", m_normalize=false);
62  declareProperty("TimeShift", m_timeShift=false);
63  declareProperty("TimeShiftByIndex", m_timeShiftByIndex=-1);
64 
65  declareProperty("Verify", m_verify=true);
66  declareProperty("ErrAmplitude", m_errAmpl=0.01);
67  declareProperty("ErrTime", m_errTime=0.01);
68 
69  declareProperty("DumpOFCfile", m_dumpOFCfile=std::string(""));
70 
71  declareProperty("GroupingType", m_groupingType);
72  declareProperty("StoreMaxPhase", m_storeMaxPhase=false);
73  declareProperty("LArOFCBinKey", m_ofcBinKey="LArOFCPhase");
74 
75  declareProperty("LArPhysWaveBinKey", m_larPhysWaveBinKey="");
76 
77  declareProperty("AddTimeOffset", m_addOffset=0.);
78 
79  declareProperty("ComputeOFCV2", m_computeV2=false);
80 
81  declareProperty("UseDelta", m_useDelta=0); // 0= not use Delta, 1=only EMECIW/HEC/FCAL, 2=all , 3 = only EMECIW/HEC/FCAL1+high eta FCAL2-3
82  declareProperty("UseDeltaV2", m_useDeltaV2=0); // 0= not use Delta, 1=only EMECIW/HEC/FCAL, 2=all , 3 = only EMECIW/HEC/FCAL1+high eta FCAL2-3
83 
84  declareProperty("nThreads", m_nThreads=-1,"-1: No TBB, 0: Let TBB decide, >0 number of threads");
85 
86  declareProperty("ReadDSPConfig", m_readDSPConfig=false);
87  declareProperty("DSPConfigFolder", m_DSPConfigFolder="/LAR/Configuration/DSPConfiguration");
88 
89  declareProperty("ForceShift", m_forceShift=false);
90 
91  declareProperty("isSC", m_isSC=false);
92 
94 }
95 
96 
97 
99 
101 
102  if ( m_nSamples>32 ) {
103  ATH_MSG_ERROR( "You are not allowed to compute OFC for Nsamples = " << m_nSamples ) ;
104  return StatusCode::FAILURE;
105  }
106 
107  StatusCode sc = m_AutoCorrDecoder.retrieve();
108  if (sc.isFailure()) {
109  ATH_MSG_FATAL( "Could not retrieve AutoCorrDecoder " << m_AutoCorrDecoder );
110  return StatusCode::FAILURE;
111  } else {
112  ATH_MSG_INFO( "Retrieved Decoder Tool: "<< m_AutoCorrDecoder );
113  }
114 
115 
116  if (m_computeV2) {
117  sc = m_AutoCorrDecoderV2.retrieve();
118  if (sc.isFailure()) {
119  ATH_MSG_FATAL( "Could not retrieve AutoCorrDecoderV2 " << m_AutoCorrDecoderV2 );
120  return StatusCode::FAILURE;
121  } else {
122  ATH_MSG_INFO( "Retrieved Decoder Tool: "<< m_AutoCorrDecoderV2 );
123  }
124  }
125 
126  if ( m_isSC ) {
127  const LArOnline_SuperCellID* ll;
128  sc = detStore()->retrieve(ll, "LArOnline_SuperCellID");
129  if (sc.isFailure()) {
130  msg(MSG::ERROR) << "Could not get LArOnlineID helper !" << endmsg;
131  return StatusCode::FAILURE;
132  }
133  else {
134  m_onlineID = (const LArOnlineID_Base*)ll;
135  ATH_MSG_DEBUG("Found the LArOnlineID helper");
136  }
137  } else { // m_isSC
138  const LArOnlineID* ll;
139  sc = detStore()->retrieve(ll, "LArOnlineID");
140  if (sc.isFailure()) {
141  msg(MSG::ERROR) << "Could not get LArOnlineID helper !" << endmsg;
142  return StatusCode::FAILURE;
143  }
144  else {
145  m_onlineID = (const LArOnlineID_Base*)ll;
146  ATH_MSG_DEBUG(" Found the LArOnlineID helper. ");
147  }
148  }
149 
154 
155  ATH_MSG_INFO( "Number of wave points needed : " << m_nPoints ) ;
156  if (m_computeV2) {
157  ATH_MSG_INFO( "Will compute two flavors of OFCs" );
158  ATH_MSG_INFO( "Version 1: useDelta= " << m_useDelta <<", output key: " << m_ofcKey << " AutoCorrDecoder: " << m_AutoCorrDecoder.name() );
159  ATH_MSG_INFO( "Version 2: useDelta= " << m_useDeltaV2 <<", output key: " << m_ofcKeyV2 << " AutoCorrDecoder: " << m_AutoCorrDecoderV2.name() );
160  }
161  return StatusCode::SUCCESS;
162 }
163 
164 
166 {
167 
168  ATH_MSG_DEBUG( "In LArOFCAlg finalize()");
169 
170  ATH_MSG_INFO( "Number of samples : " << m_nSamples ) ;
171  ATH_MSG_INFO( "Number of delays acquired : " << m_nDelays ) ;
172  ATH_MSG_INFO( "Number of phases in OFC : " << m_nPhases ) ;
173  ATH_MSG_INFO( "Spacing between two phases : " << m_dPhases ) ;
174 
175 
176  const LArOnOffIdMapping* cabling{nullptr};
177  if(m_isSC) {
179  ATH_CHECK(cablingHdl.isValid());
180  cabling = *cablingHdl;
181 
182  if (m_useDelta == 3 || m_useDeltaV2==3){
184  ATH_CHECK(caloSuperCellMgrHandle.isValid());
185  m_calo_dd_man = *caloSuperCellMgrHandle;
186  }
187  }
188  else {
190  ATH_CHECK(cablingHdl.isValid());
191  cabling = *cablingHdl;
192 
193  if (m_useDelta == 3 || m_useDeltaV2==3){
195  ATH_CHECK(caloMgrHandle.isValid());
196  m_calo_dd_man = *caloMgrHandle;
197  }
198  }
199 
200  if ( m_timeShift ) {
201  if( m_timeShiftByIndex == -1 ) {
202  ATH_MSG_INFO( " Will use helper class for start time." );
203  } else {
204  ATH_MSG_INFO( " Manually shifting pulses by time index " << m_timeShiftByIndex );
205  }
206  }
207 
208  if (!m_larPhysWaveBinKey.empty()) {
210  }
211 
212  if (m_readCaliWave) {
214  }
215  else {
217  }
218 
219  if (m_readDSPConfig) {
220  const AthenaAttributeList* attrList=nullptr;
222 
223  const coral::Blob& blob = (attrList->coralList())["febdata"].data<coral::Blob>();
224  if (blob.size()<3) {
225  ATH_MSG_INFO( "Found empty blob, nothing to do");
226  } else {
227  m_DSPConfig = std::make_unique<LArDSPConfig>(attrList);
228  }
229  }
230 
231  if (m_allChannelData.empty()) {
232  ATH_MSG_ERROR( "No input waves found" );
233  return StatusCode::FAILURE;
234  }
235 
237  if (m_nThreads>-1) {
238  //There are sone external tools, etc. that potentially cached stuff.
239  //We need to call them at least once to make sure all caches are filled before we go multi-threaded
240  perChannelData_t& chanData=m_allChannelData[0];
241 
242  m_AutoCorrDecoder->AutoCorr(chanData.chid,(CaloGain::CaloGain)chanData.gain,m_nSamples);
243  if (m_computeV2)
244  m_AutoCorrDecoderV2->AutoCorr(chanData.chid,(CaloGain::CaloGain)chanData.gain,m_nSamples);
245 
246  Identifier id=cabling->cnvToIdentifier(chanData.chid);
247  if (m_useDelta==3 || m_useDeltaV2) {
249  }
250 
252 
253 
254  if (!m_larPhysWaveBinKey.empty()) {
255  m_larPhysWaveBin->bin(chanData.chid,(CaloGain::CaloGain)chanData.gain);
256  }
258  std::unique_ptr<tbb::global_control> tbbgc;
259 
260  if (m_nThreads>0) {
261  tbbgc=std::make_unique<tbb::global_control>( tbb::global_control::max_allowed_parallelism, m_nThreads);
262  }
263 
264  //Instanciated the functor and start parallel_for
265  Looper looper(&m_allChannelData,cabling, this);
266  tbb::blocked_range<size_t> range(0, m_allChannelData.size());
267  ATH_MSG_INFO( "Starting parallel execution" );
268  tbb::parallel_for(tbb::blocked_range<size_t>(0, m_allChannelData.size()),looper);
269 
270  ATH_MSG_INFO( "Done with parallel execution" );
271 
272  }
273  else {
274  ATH_MSG_INFO( "Single threaded execution" );
275  for (perChannelData_t& chanData : m_allChannelData) {
276  this->process(chanData,cabling);
277  }
278  }
279 
281 
282  // OFC persistent object
283  std::unique_ptr<LArOFCComplete> larOFCComplete=std::make_unique<LArOFCComplete>();
284  StatusCode sc = larOFCComplete->setGroupingType(m_groupingType,msg());
285  if (sc.isFailure()) {
286  ATH_MSG_ERROR( "Failed to set groupingType for LArOFCComplete object" );
287  return sc;
288  }
289  sc=larOFCComplete->initialize();
290  if (sc.isFailure()) {
291  ATH_MSG_ERROR( "Failed initialize LArOFCComplete object" );
292  return sc;
293  }
294 
295 
296  std::unique_ptr<LArOFCComplete> larOFCCompleteV2=std::make_unique<LArOFCComplete>();
297  sc = larOFCComplete->setGroupingType(m_groupingType,msg());
298  if (sc.isFailure()) {
299  ATH_MSG_ERROR( "Failed to set groupingType for LArOFCComplete object" );
300  return sc;
301  }
302  sc=larOFCCompleteV2->initialize();
303  if (sc.isFailure()) {
304  ATH_MSG_ERROR( "Failed initialize LArOFCComplete object" );
305  return sc;
306  }
307 
308 
309  std::unique_ptr<LArOFCBinComplete> larOFCBinComplete;
310  if (m_storeMaxPhase) {
311  larOFCBinComplete=std::make_unique<LArOFCBinComplete>();
312  sc=larOFCBinComplete->setGroupingType(m_groupingType,msg());
313  if (sc.isFailure()) {
314  ATH_MSG_ERROR( "Failed to set groupingType for LArOFCBinComplete object" );
315  return sc;
316  }
317  sc = larOFCBinComplete->initialize();
318  if ( sc.isFailure() ) {
319  ATH_MSG_ERROR( "Could not initialize LArOFCComplete data object - exit!" ) ;
320  return sc ;
321  }
322  }
323 
324  // LArShape persistent object
325  std::unique_ptr<LArShapeComplete> larShapeComplete;
326  if (m_fillShape) {
327  larShapeComplete = std::make_unique<LArShapeComplete>();
328  sc=larShapeComplete->setGroupingType(m_groupingType,msg());
329  if (sc.isFailure()) {
330  ATH_MSG_ERROR( "Failed to set groupingType for LArShapeComplete object" );
331  return sc;
332  }
333  sc=larShapeComplete->initialize();
334  if (sc.isFailure()) {
335  ATH_MSG_ERROR( "Failed initialize LArShapeComplete object" );
336  return sc;
337  }
338  }
339 
340 
341  //Counters (for information only):
342  unsigned nChannels=0;
343  unsigned nFailed=0;
344 
345  for (const perChannelData_t& chanData : m_allChannelData) {
346  ++nChannels;
347  if (chanData.faultyOFC) ++nFailed;
348  // register channel to LArOFCComplete
349  const HWIdentifier ch_id=chanData.chid;
350  const int gain=chanData.gain;
351  ATH_MSG_DEBUG( "add to LArOFCComplete, channel " << m_onlineID->channel_name(ch_id) << ", gain=" << (int)gain);
352  const std::vector<std::vector<float> > & allPhaseOFCa=chanData.ofc_a;
353  const std::vector<std::vector<float> > & allPhaseOFCb=chanData.ofc_b;
354  const std::vector<std::vector<float> > & allPhaseShape=chanData.shape;
355  const std::vector<std::vector<float> > & allPhaseShapeDer=chanData.shapeDer;
356  larOFCComplete->set(ch_id,gain,allPhaseOFCa,allPhaseOFCb,chanData.tstart,chanData.timeBinWidthOFC);
357  if (larOFCBinComplete) larOFCBinComplete->set(ch_id,gain,chanData.phasewMaxAt3);
358  if ( m_fillShape ) larShapeComplete->set(ch_id,gain,allPhaseShape,allPhaseShapeDer,chanData.tstart,chanData.timeBinWidthOFC);
359 
360 
361  if (m_computeV2) {
362  const std::vector<std::vector<float> > & allPhaseOFCV2a=chanData.ofcV2_a;
363  const std::vector<std::vector<float> > & allPhaseOFCV2b=chanData.ofcV2_b;
364  larOFCCompleteV2->set(ch_id,gain,allPhaseOFCV2a,allPhaseOFCV2b,chanData.tstart,chanData.timeBinWidthOFC);
365  }
366 
367  } // end loop over m_allChannelData
368 
369  ATH_MSG_INFO( " Summary : Computed OFCs for " << nChannels << " channels * gains" );
370  if (nFailed)
371  ATH_MSG_ERROR( "Number of channels * gains with failed OFC verification: " << nFailed );
372 
373  if ( !m_dumpOFCfile.empty()) {
374  ATH_MSG_INFO( "Dumping OFCs to file " << m_dumpOFCfile ) ;
375  larOFCComplete->dumpOFC(m_dumpOFCfile) ;
376  }
377 
378  sc = detStore()->record(std::move(larOFCComplete),m_ofcKey);
379  if (sc.isFailure()) {
380  ATH_MSG_ERROR( "Could not record LArOFCComplete to DetStore with key " << m_ofcKey );
381  return StatusCode::FAILURE;
382  }
383  ATH_MSG_INFO( "LArOFCComplete object recorded with key " << m_ofcKey ) ;
384 
386  if (sc.isFailure()) {
387  ATH_MSG_ERROR( "Could not symlink ILArOFC with LArOFCComplete." );
388  return StatusCode::FAILURE;
389  }
390  ATH_MSG_INFO( "Symlink with ILArOFC done" ) ;
391 
392 
393  // record and symlink second version of LArOFCComplete object
394  if (m_computeV2) {
395  sc = detStore()->record(std::move(larOFCCompleteV2),m_ofcKeyV2);
396  if (sc.isFailure()) {
397  ATH_MSG_ERROR( "Could not record LArOFCComplete to DetStore with key " << m_ofcKeyV2 );
398  return StatusCode::FAILURE;
399  }
400  ATH_MSG_INFO( "LArOFCComplete object recorded with key " << m_ofcKeyV2 ) ;
401 
403  if (sc.isFailure()) {
404  ATH_MSG_ERROR( "Could not symlink ILArOFC with LArOFCComplete." );
405  return StatusCode::FAILURE;
406  }
407  ATH_MSG_INFO( "Symlink with ILArOFC done" ) ;
408  }
409 
410  if (larOFCBinComplete) {
411  sc = detStore()->record(std::move(larOFCBinComplete),m_ofcBinKey);
412  if (sc.isFailure()) {
413  ATH_MSG_ERROR( "Could not record LArOFCBinCompete object" );
414  return StatusCode::FAILURE;
415  }
416  }
417 
418  // record and symlink LArShapeComplete object
419  if ( m_fillShape ) {
420  ATH_MSG_DEBUG( "Trying to record LArShapeComplete object to detector store, key = " << m_shapeKey);
421  sc = detStore()->record(std::move(larShapeComplete),m_shapeKey);
422  if (sc.isFailure()) {
423  ATH_MSG_ERROR( "Could not record LArShapeComplete to DetStore with key " << m_shapeKey );
424  return StatusCode::FAILURE;
425  }
426  ATH_MSG_INFO( "LArShapeComplete object recorded to DetStore successfully with key " << m_shapeKey ) ;
427  ATH_MSG_DEBUG( "Trying to symlink ILArShape with LArShapeComplete");
429  if (sc.isFailure()) {
430  ATH_MSG_ERROR( "Could not symlink ILArShape with LArShapeComplete." );
431  return StatusCode::FAILURE;
432  }
433  ATH_MSG_INFO( "ILArShape symlink with LArShapeComplete successfully" ) ;
434  }
435 
436 
437  //Undo corrections, if they are applied by this algo:
438  if (m_waveCnt_nc) {
440  ATH_MSG_INFO("Reverted corrections of non-cost wave container");
441  }
442 
443  return StatusCode::SUCCESS;
444 }
445 
446 
448 
449  LArWaveHelper larWaveHelper;
450  const LArWaveCumul* nextWave=chanData.inputWave;
451  if (!nextWave) {
452  ATH_MSG_ERROR( "input wave is 0" );
453  return;
454  }
455 
456  if ( nextWave->getFlag() == LArWave::dac0 ) return ; // skip dac0 waves
457 
458  const HWIdentifier ch_id=chanData.chid;
459  const unsigned gain=chanData.gain;
460  ATH_MSG_DEBUG( "Computing OFC for channel " << m_onlineID->channel_name(ch_id) << " in gain = " << gain);
461 
462 
463  // check constistency of settings
464  if ( m_nPoints > nextWave->getSize() ) {
465  ATH_MSG_ERROR( "Channel " << m_onlineID->channel_name(ch_id) <<": Wave size (" << nextWave->getSize()
466  << ") is too small to fit your OFC request (" << m_nPoints << " points)" ) ;
467  chanData.shortWave=true;
468  return;
469  }
470 
471  // the current waveform
472  LArWave aWave = *nextWave; // Actually *copying* the Wave to get rid of the const: need to manipulate Wave to normalize...
473 
474  if (m_larPhysWaveBin) {
475  const int bin = m_larPhysWaveBin->bin(ch_id,gain);
476  if (bin>-998) { //>ERRORCODE
477  ATH_MSG_VERBOSE("Channel " << m_onlineID->channel_name(ch_id) << ": shift by index " << bin);
478  aWave=larWaveHelper.translate(aWave,-bin,0);
479  }
480  else
481  ATH_MSG_VERBOSE("Channel 0x" << MSG::hex << ch_id.get_identifier32().get_compact() << MSG::dec << ": No valid index for shifting");
482  }//end if larPhysWaveBin
483 
484 
485  // normalize input wave, if requested
486  if (m_normalize) {
487  const double peak = aWave.getSample( larWaveHelper.getMax(aWave) );
488  if ( peak == 0 ) {
489  ATH_MSG_ERROR( "Wave maximum is zero, skipping channel " << m_onlineID->channel_name(ch_id) ) ;
490  return;
491  }
492 
493  ATH_MSG_VERBOSE("Channel 0x" << m_onlineID->channel_name(ch_id) << " has amplitude = " << peak << ": normalizing...");
494  aWave = aWave * (1./peak);
495  }
496 
497  ATH_MSG_VERBOSE("Channel " << m_onlineID->channel_name(ch_id) << " has now amplitude = " << aWave.getSample( larWaveHelper.getMax(aWave)));
498  // compute tstart to shift input wave, if requested
499  if ( m_timeShift ) {
500  if( m_timeShiftByIndex == -1 ) {
501  chanData.tstart = larWaveHelper.getStart(aWave) ;
502  } else {
503  chanData.tstart = m_timeShiftByIndex;
504  }
505  }
506 
507  ATH_MSG_DEBUG("Channel" << m_onlineID->channel_name(ch_id) << ", Tstart = " << chanData.tstart);
508 
509  //Calculate derivative for this wave
510  LArWave aDerivedWave = larWaveHelper.derive_smooth(aWave);
511 
512  chanData.timeBinWidthOFC = m_dPhases*aWave.getDt();
513 
514  float maxSampleValAt3=-1;
515 
516  //prepare output vectors
517  chanData.ofc_a.resize(m_nPhases);
518  chanData.ofc_b.resize(m_nPhases);
519  chanData.shape.resize(m_nPhases);
520  chanData.shapeDer.resize(m_nPhases);
521 
522  if (m_computeV2) {
523  chanData.ofcV2_a.resize(m_nPhases);
524  chanData.ofcV2_b.resize(m_nPhases);
525  }
526 
527 
528  const Eigen::MatrixXd acInverse=m_AutoCorrDecoder->AutoCorr(chanData.chid,(CaloGain::CaloGain)chanData.gain,m_nSamples).inverse();
529  Eigen::MatrixXd acInverseV2;
530  if (m_computeV2)
531  acInverseV2=m_AutoCorrDecoderV2->AutoCorr(chanData.chid,(CaloGain::CaloGain)chanData.gain,m_nSamples).inverse();
532 
533  unsigned tShift=0;
535  if(m_DSPConfig->peakSample(m_onlineID->feb_Id(ch_id)) < 2 ) { // 2 is canonical value for peak
536  tShift = 2 - m_DSPConfig->peakSample(m_onlineID->feb_Id(ch_id));
537  }
538  }
539  if(m_forceShift) tShift=1;
540 
541  ATH_MSG_DEBUG("Channel " << m_onlineID->channel_name(ch_id) << "shift: " << tShift);
542 
543  for (unsigned iPhase=0;iPhase<m_nPhases;iPhase++) { //Loop over all phases
544 
545  ATH_MSG_VERBOSE ("Channel " << m_onlineID->channel_name(ch_id)
546  << ", Gain = " << gain << ", Phase = " << iPhase << ":");
547 
548 
549  //Reference to the samples and deriviative to be filled
550  std::vector<float>& theSamples=chanData.shape[iPhase];
551  std::vector<float>& theSamplesDer=chanData.shapeDer[iPhase];
552 
553  //Extract the points where we compute the OFCs from the wave and the derived wave
554  //and fill the samples an derivative vector
555  theSamples.reserve(m_nSamples);
556  theSamplesDer.reserve(m_nSamples);
557  for (unsigned iSample=0;iSample<m_nSamples;++iSample){ //Loop over all samples
558  const unsigned tbin = chanData.tstart + iPhase*m_dPhases + (iSample+tShift)*m_nDelays ;
559  theSamples.push_back( aWave.getSample(tbin) );
560  theSamplesDer.push_back( aDerivedWave.getSample(tbin) );
561  } //End loop over samples
562 
563 
564  if (m_storeMaxPhase && m_nSamples>2 && theSamples[2]>maxSampleValAt3) {
565  maxSampleValAt3=theSamples[2];
566  chanData.phasewMaxAt3=iPhase;
567  }
568 
569  bool thisChanUseDelta=useDelta(ch_id,m_useDelta,cabling);
570  bool thisChanUseDeltaV2=m_computeV2 && useDelta(ch_id,m_useDeltaV2,cabling);
571  Eigen::VectorXd delta;
572 
573  if (thisChanUseDelta || thisChanUseDeltaV2) { // will need delta for at least one of the two versions
574  std::vector<float> theSamples32;
575  theSamples32.reserve(32);
576  for (unsigned iSample=0;iSample<32 ;++iSample){ //Loop over all samples
577  const unsigned tbin = chanData.tstart + iPhase*m_dPhases + (iSample+tShift)*m_nDelays ;
578  if (tbin>=aWave.getSize()) continue;
579  theSamples32.push_back( aWave.getSample(tbin) );
580  } //End loop over samples
581  delta=getDelta(theSamples32,ch_id,m_nSamples);
582  }
583 
584  //OFC V1 computiation (i.e. not pileup-optimized)
585  //Reference to the OFCa and OFCb to be filled
586  std::vector<float>& vOFC_a= chanData.ofc_a[iPhase];
587  std::vector<float>& vOFC_b= chanData.ofc_b[iPhase];
588 
589  if (thisChanUseDelta) {
590  optFiltDelta(theSamples,theSamplesDer,acInverse,delta,vOFC_a,vOFC_b);
591  }
592  else { //don't use Delta
593  optFilt(theSamples,theSamplesDer,acInverse,vOFC_a,vOFC_b);
594  }
595 
596  // verify OFC consistency
597  if (m_verify) {
598  chanData.faultyOFC |= verify(chanData.chid,vOFC_a,vOFC_b,theSamples,"OFC",iPhase);
599  }
600 
601 
602  if (m_computeV2) {
603  //OFC V2 computiation (i.e. pileup-optimized)
604  //Reference to the OFCa and OFCb to be filled
605  std::vector<float>& vOFCV2_a= chanData.ofcV2_a[iPhase];
606  std::vector<float>& vOFCV2_b= chanData.ofcV2_b[iPhase];
607 
608  if (thisChanUseDeltaV2) {
609  optFiltDelta(theSamples,theSamplesDer,acInverseV2,delta,vOFCV2_a,vOFCV2_b);
610  }
611  else { //don't use Delta
612  optFilt(theSamples,theSamplesDer,acInverseV2,vOFCV2_a,vOFCV2_b);
613  }
614 
615  // verify OFC consistency
616  if (m_verify) {
617  chanData.faultyOFC |= verify(chanData.chid,vOFCV2_a,vOFCV2_b,theSamples,"OFCV2",iPhase);
618  }
619  }//end if computeV2
620  } //End loop over all phases
621 
622  // in case we're dealing with a LArPhysWave, add any possible previous time shift
623  if (!m_readCaliWave) {
624  const LArPhysWave* pwave=dynamic_cast<const LArPhysWave*>(nextWave);
625  if (pwave)
626  chanData.tstart += pwave->getTimeOffset()+m_addOffset;
627  }
628  }
629 
630 
631 
632 
634 
636 
637  for (unsigned k=0 ; k<m_keylist.size() ; k++ ) { // Loop over all containers that are to be processed (e.g. different gains)
638  ATH_MSG_INFO( "Processing WaveContainer from StoreGate! key = " << m_keylist[k] );
639 
640  const LArPhysWaveContainer* waveCnt;
641  StatusCode sc=detStore()->retrieve(waveCnt,m_keylist[k]);
642  if (sc.isFailure()) {
643  ATH_MSG_ERROR( "Failed to retrieve a LArPhysWaveContainer with key " << m_keylist[k] );
644  return sc;
645  }
646 
647  m_allChannelData.reserve(m_allChannelData.size()+128*waveCnt->size());// Size doesn't give the expected response on a CondtitionsContainer
648 
649  for (unsigned gain = CaloGain::LARHIGHGAIN ; gain < CaloGain::LARNGAIN ; gain++ ) { // loop on possible gains
650  WAVEIT it=waveCnt->begin(gain);
651  WAVEIT it_e=waveCnt->end(gain);
652  for (;it!=it_e;++it) {
653  const HWIdentifier chid=it.channelId();
654  if (cabling->isOnlineConnected (chid)){
655  const LArWaveCumul* wave= &(*it); //down-cast
656  if (!wave->isEmpty()) {
657  m_allChannelData.emplace_back(wave, chid,gain);
658  }
659  }
660  } //end loop over channels
661  }//end loop over gains
662  }//end loop over SG keys
663  return StatusCode::SUCCESS;
664 }
665 
666 
668 
670  for (unsigned k=0 ; k<m_keylist.size() ; k++ ) { // Loop over all containers that are to be processed (e.g. different gains)
671  ATH_MSG_INFO( "Processing WaveContainer from StoreGate! key = " << m_keylist[k] );
672 
673  //Input cali-wave might come from the same job. In this case we see a non-const container in SG probably w/o corrections applied.
674  //Try non-const retrieve:
675  const LArCaliWaveContainer* waveCnt = nullptr;
677  if (m_waveCnt_nc) {
678  waveCnt=m_waveCnt_nc; //Retain const pointer
680  ATH_MSG_INFO( "LArCaliWaveContainer: Corrections not yet applied, applying them now..." );
681  if (m_waveCnt_nc->applyCorrections().isFailure()) {
682  ATH_MSG_ERROR( "Failed to apply corrections to LArCaliWaveContainer!" );
683  return StatusCode::FAILURE;
684  }
685  else {
686  ATH_MSG_INFO("Applied corrections to non-const Wave container");
687  }
688  }
689  }
690  else {
691  waveCnt=detStore()->tryConstRetrieve<LArCaliWaveContainer>(m_keylist[k]);
692  if (!waveCnt) {
693  ATH_MSG_ERROR( "Failed to retrieve a LArCaliWaveContainer with key " << m_keylist[k] );
694  return StatusCode::FAILURE;
695  }
696  }
697 
698 
699  m_allChannelData.reserve(m_allChannelData.size()+128*waveCnt->size());// Size doesn't give the expected response on a CondtitionsContainer
700 
701  for (unsigned gain = CaloGain::LARHIGHGAIN ; gain < CaloGain::LARNGAIN ; gain++ ) { // loop on possible gains
702  WAVEIT it=waveCnt->begin(gain);
703  WAVEIT it_e=waveCnt->end(gain);
704  for (;it!=it_e;++it) {
705  const LArCaliWaveVec& wVec=*it;
706  for (const auto& cw : wVec) {
707  const LArWaveCumul* wave= &(cw); //down-cast
708  if (!wave->isEmpty()) {
709  m_allChannelData.emplace_back(wave,it.channelId(),gain);
710  }
711  }
712  } //end loop over channels
713  }//end loop over gains
714  }//end loop over SG keys
715  return StatusCode::SUCCESS;
716 }
717 
718 
719 void LArOFCAlg::optFilt(const std::vector<float> &gWave, const std::vector<float> &gDerivWave, const Eigen::MatrixXd& acInverse, //input variables
720  std::vector<float>& vecOFCa, std::vector<float>& vecOFCb) { // Output variables;
721  assert(gWave.size()==gDerivWave.size());
722  //assert autoCorr size ....
723  const int optNpt = gWave.size();
724 
725  Eigen::VectorXd gResp(optNpt), gDerivResp(optNpt);
726  for (int i=0;i<optNpt;i++) {
727  gResp[i] = gWave[i];
728  gDerivResp[i] = gDerivWave[i];
729  }
730 
731  Eigen::Matrix2d isol;
732  isol <<
733  (gResp.transpose()*acInverse*gResp)[0],
734  (gResp.transpose()*acInverse*gDerivResp)[0],
735  (gDerivResp.transpose()*acInverse*gResp)[0],
736  (gDerivResp.transpose()*acInverse*gDerivResp)[0];
737 
738  Eigen::Vector2d Amp;
739  Eigen::Vector2d Atau;
740  Eigen::Vector2d Ktemp;
741  Eigen::Matrix2d isolInv = isol.inverse();
742 
743  // we solve for the lagrange multiplers
744  Ktemp[0] = 1.;
745  Ktemp[1] = 0.;
746  Amp = isolInv*Ktemp;
747 
748  Ktemp[0] = 0.;
749  Ktemp[1] = -1.;
750  Atau = isolInv*Ktemp;
751 
752  // we express the a and b vectors in terms of the lagrange multipliers
753  Eigen::VectorXd OFCa = Amp[0]*acInverse*gResp + Amp[1]*acInverse*gDerivResp;
754  Eigen::VectorXd OFCb = Atau[0]*acInverse*gResp + Atau[1]*acInverse*gDerivResp;
755 
756  //Convert back to std::vector
757  vecOFCa.resize(optNpt);
758  vecOFCb.resize(optNpt);
759  for (int i=0;i<optNpt;i++) {
760  vecOFCa[i]=OFCa[i];
761  vecOFCb[i]=OFCb[i];
762  }
763  }
764 
765 
766 
767 
768 
769 
770 void LArOFCAlg::optFiltDelta(const std::vector<float> &gWave, const std::vector<float> &gDerivWave,
771  const Eigen::MatrixXd& acInverse, const Eigen::VectorXd& delta,
772  std::vector<float>& vecOFCa, std::vector<float>& vecOFCb) {
773 
774 
775 
776  assert(gWave.size()==gDerivWave.size());
777  //assert autoCorr size ....
778  const int optNpt = gWave.size();
779 
780  Eigen::VectorXd gResp(optNpt), gDerivResp(optNpt);
781  for (int i=0;i<optNpt;i++) {
782  gResp[i] = gWave[i];
783  gDerivResp[i] = gDerivWave[i];
784  }
785 
786  // try 3X3 matrix with offsets
787 
788 
798  Eigen::Matrix3d isol;
799  isol <<
800  (gResp.transpose()*acInverse*gResp)[0],
801  (gResp.transpose()*acInverse*gDerivResp),
802  (gResp.transpose()*acInverse*delta)[0],
803 
804  (gDerivResp.transpose()*acInverse*gResp)[0],
805  (gDerivResp.transpose()*acInverse*gDerivResp)[0],
806  (gDerivResp.transpose()*acInverse*delta)[0],
807 
808  (delta.transpose()*acInverse*gResp)[0],
809  (delta.transpose()*acInverse*gDerivResp)[0],
810  (delta.transpose()*acInverse*delta)[0];
811 
812 
813  Eigen::Vector3d Amp;
814  Eigen::Vector3d Atau;
815  Eigen::Vector3d Ktemp;
816  Eigen::Matrix3d isolInv = isol.inverse();
817 
818  // we solve for the lagrange multiplers
819 
820  Ktemp[0] = 1.;
821  Ktemp[1] = 0.;
822  Ktemp[2] = 0.;
823 
824  Amp = isolInv*Ktemp;
825 
826  Ktemp[0] = 0.;
827  Ktemp[1] = -1.;
828  Atau = isolInv*Ktemp;
829 
830  // we express the a and b vectors in terms of the lagrange multipliers
831  Eigen::VectorXd OFCa = Amp[0]*acInverse*gResp + Amp[1]*acInverse*gDerivResp + Amp[2]*acInverse * delta;
832  Eigen::VectorXd OFCb = Atau[0]*acInverse*gResp + Atau[1]*acInverse*gDerivResp + Atau[2]*acInverse * delta ;
833 
834 
835  //Convert back to std::vector
836  vecOFCa.resize(optNpt);
837  vecOFCb.resize(optNpt);
838  for (int i=0;i<optNpt;i++) {
839  vecOFCa[i]=OFCa[i];
840  vecOFCb[i]=OFCb[i];
841  }
842  }
843 
844 
845 
846 const float LArOFCAlg::m_fcal3Delta[5] ={0.0790199937765, 0.0952000226825, 0.0790199937765, 0.0952000226825, 0.0790199937765};
847 const float LArOFCAlg::m_fcal2Delta[5]={-0.01589001104, -0.0740399733186, -0.01589001104, -0.0740399733186, -0.01589001104};
848 const float LArOFCAlg::m_fcal1Delta[5] ={0.0679600232979, -0.139479996869, 0.0679600232979, -0.139479996869, 0.0679600232979};
849 
850 Eigen::VectorXd LArOFCAlg::getDelta(std::vector<float>& samples, const HWIdentifier chid, unsigned nSamples) const{
851 
852  if (nSamples>5) nSamples=5;
853 
854  Eigen::VectorXd delta(nSamples); //return value
855 
856  if (m_onlineID->isFCALchannel(chid) ){
857  // FCAL use fixed delta from data.
858  const int slot = m_onlineID->slot(chid) ;
859  if ( slot <=9){ // FCAL 1
860  for (unsigned i=0;i<nSamples;++i) {
861  delta[i]=m_fcal1Delta[i];
862  }
863  }else
864  if(slot <=13){ // FCAL 2
865  for (unsigned i=0;i<nSamples;++i) {
866  delta[i]=m_fcal2Delta[i];
867  }
868  }else { //FCAL 3
869  for (unsigned i=0;i<nSamples;++i) {
870  delta[i]=m_fcal3Delta[i];
871  }
872  }
873 
874  }else
875  { // from Shape
876  float odd = 0.;
877  float even = 0.;
878  for (unsigned int i = 0;i<samples.size();++i) {
879  if (i%2==0){
880  even += samples[i];
881  }
882  else {
883  odd += samples[i];
884  }
885  }
886 
887  for (unsigned i=0;i<nSamples;++i) {
888  if (i%2==0)
889  delta[i]=even;
890  else
891  delta[i]=odd;
892  }
893  }
894 
895  return delta;
896 
897 }
898 
899 bool LArOFCAlg::useDelta(const HWIdentifier chid, const int jobOFlag, const LArOnOffIdMapping* cabling) const {
900 
901  if (jobOFlag==2){
902  return true;
903  }
904 
905  if(jobOFlag==1) { // only HEC/EMECIW/FCAL
906  if (m_onlineID->isEMECIW(chid) || m_onlineID->isFCALchannel(chid) || m_onlineID->isHECchannel(chid)) {
907  return true;
908  }
909  }
910 
911  if(jobOFlag==3) { // only HEC/EMECIW/FCAL1 and high eta FCAL2-3
912  if (m_onlineID->isEMECIW(chid) || m_onlineID->isHECchannel(chid)) {
913  return true;
914  }
915  else if (m_onlineID->isFCALchannel(chid) ){
916 
917  if (cabling->isOnlineConnected (chid)){
918  Identifier ofl_id = cabling->cnvToIdentifier(chid);
919  const CaloDetDescrElement* dde = m_calo_dd_man->get_element(ofl_id);
920  if (! dde) {
921  ATH_MSG_ERROR( " dde = 0 , onl_id, ofl_id= "<< chid<<" "<<ofl_id );
922  return false; // Exception better?
923  }
924  if ( m_isSC ) {
926  if (sampling==CaloCell_ID::FCAL0){
927  return true;
928  }
929  else {
930  if (fabs(dde->eta())>4.0){
931  return true;
932  }
933  }
934  } else {
935  CaloCell_ID::CaloSample sampling = dde->getSampling();
936  if (sampling==CaloCell_ID::FCAL0){
937  return true;
938  }
939  else {
940  if (fabs(dde->eta())>4.0){
941  return true;
942  }
943  }
944  }
945 
946  }//end if connected
947  }//end if isFCALchannel
948 
949  }//else if jobOFlag=3
950 
951  return false;
952 }
953 
954 
955 bool LArOFCAlg::verify(const HWIdentifier chid, const std::vector<float>& OFCa, const std::vector<float>& OFCb,
956  const std::vector<float>& Shape, const char* ofcversion, const unsigned phase) const {
957 
958  bool result=false;
959  float recAmpl=0, recTime=0;
960  for (unsigned iSample=0;iSample<m_nSamples;++iSample){
961 
962 #ifdef LAROFCALG_DEBUGOUTPUT
963  ATH_MSG_VERBOSE("a["<<iSample<<"]="<<vOFC_a[iSample] << " b["<<iSample<<"]="<<vOFC_b[iSample]
964  << " Sample=" << aWave.getSample(tbin));
965 #endif
966  recAmpl += OFCa[iSample] * Shape[iSample];
967  recTime += OFCb[iSample] * Shape[iSample];
968  } //End loop over samples
969 
970  recTime /= recAmpl ;
971 
972  // At this point the reconstructed amplitude must be = 1 by definition, whatever the initial normalisation!
973  ATH_MSG_VERBOSE("recAmp=" << recAmpl << " ; recTime=" << recTime);
974  if ( fabs(1.-recAmpl) > m_errAmpl ) {
975  ATH_MSG_WARNING( "Applying phase " << phase << " of " << ofcversion << " to original wave yields an Amplitude of "<< recAmpl
976  << " instead of 1. -> Wrong OFCs? channel " << m_onlineID->channel_name(chid) );
977  LArOFCAlg::printOFCVec(OFCa,msg());
978  result=true;
979  }
980  if ( fabs(recTime) > m_errTime ) {
981  ATH_MSG_WARNING( "Applying phase " << phase << " of " << ofcversion << " to original wave yields a time offset of " << recTime
982  << " -> Wrong OFCs? channel " << m_onlineID->channel_name(chid) );
983  LArOFCAlg::printOFCVec(OFCb,msg());
984  result=true;
985  }
986  return result;
987 }
988 
989 void LArOFCAlg::printOFCVec(const std::vector<float>& vec, MsgStream& mLog) {
990  mLog << MSG::WARNING << "OFCs";
991  for(float v : vec)
992  mLog << " " << v;
993  mLog << endmsg;
994 }
995 
996 
997 #ifdef LAROFCALG_DEBUGOUTPUT
998 #undef LAROFCALG_DEBUGOUTPUT
999 #endif
LArWave
Definition: LArWave.h:31
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArOFCAlg::m_DSPConfigFolder
std::string m_DSPConfigFolder
Definition: LArOFCAlg.h:163
LArOFCAlg::perChannelData_t::shapeDer
std::vector< std::vector< float > > shapeDer
Definition: LArOFCAlg.h:79
LArOFCAlg::m_normalize
bool m_normalize
Definition: LArOFCAlg.h:121
LArOFCAlg::getDelta
Eigen::VectorXd getDelta(std::vector< float > &samples, const HWIdentifier chid, unsigned nSamples) const
Definition: LArOFCAlg.cxx:850
RPDUtils::nChannels
unsigned constexpr int nChannels
Definition: RPDUtils.h:23
LArOFCAlg::optFilt
static void optFilt(const std::vector< float > &gWave_in, const std::vector< float > &gDerivWave_in, const Eigen::MatrixXd &autoCorrInv, std::vector< float > &OFCa, std::vector< float > &OFCb)
Definition: LArOFCAlg.cxx:719
LArOFCAlg::m_caloSuperCellMgrKey
SG::ReadCondHandleKey< CaloSuperCellDetDescrManager > m_caloSuperCellMgrKey
Definition: LArOFCAlg.h:60
ReadOfcFromCool.phase
phase
Definition: ReadOfcFromCool.py:127
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
LArConditionsContainer::applyCorrections
StatusCode applyCorrections()
apply correction set
LArOFCAlg::perChannelData_t::ofc_a
std::vector< std::vector< float > > ofc_a
Definition: LArOFCAlg.h:72
get_generator_info.result
result
Definition: get_generator_info.py:21
LArWaveCumul
Definition: LArWaveCumul.h:30
LArOFCComplete::set
void set(const HWIdentifier &CellID, int gain, const std::vector< std::vector< float > > &vOFC_a, const std::vector< std::vector< float > > &vOFC_b, float timeOffset=0, float timeBinWidth=25./24.)
Definition: LArOFCComplete.cxx:17
detail::ll
long long ll
Definition: PrimitiveHelpers.h:46
LArWave::getSize
size_t getSize() const
number of time samples
Definition: LArWave.h:62
LArCaliWaveContainer.h
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArOFCAlg::m_nThreads
int m_nThreads
Definition: LArOFCAlg.h:160
LArWaveHelper::getStart
unsigned getStart(const LArWave &theWave) const
Definition: LArWaveHelper.cxx:409
LArWave::getFlag
unsigned getFlag() const
flag: ...
Definition: LArWave.h:178
LArOFCBinComplete::bin
virtual const int & bin(const HWIdentifier &chid, const int &gain) const
Definition: LArOFCBinComplete.h:19
LArOFCAlg::perChannelData_t::shortWave
bool shortWave
Definition: LArOFCAlg.h:85
LArOFCAlg::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: LArOFCAlg.h:52
LArConditionsContainer::undoCorrections
StatusCode undoCorrections()
undo corrections that have been already applied
LArOFCAlg::m_verify
bool m_verify
Definition: LArOFCAlg.h:120
LArOFCAlg::m_fillShape
bool m_fillShape
Definition: LArOFCAlg.h:146
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LArOnlineID_Base::isEMECIW
virtual bool isEMECIW(const HWIdentifier id) const =0
LArOFCAlg::perChannelData_t
Definition: LArOFCAlg.h:65
LArPhysWaveContainer.h
LArConditionsContainerDB::iteratorT
Declaration of const iterator.
Definition: LArConditionsContainerDB.h:72
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
LArOFCAlg::perChannelData_t::ofc_b
std::vector< std::vector< float > > ofc_b
Definition: LArOFCAlg.h:73
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition: CaloDetDescrManager.cxx:159
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
LArOFCAlg::m_larPhysWaveBinKey
std::string m_larPhysWaveBinKey
Definition: LArOFCAlg.h:155
skel.it
it
Definition: skel.GENtoEVGEN.py:396
LArWave::getDt
const double & getDt() const
delta time
Definition: LArWave.h:50
LArOnlineID_Base::slot
int slot(const HWIdentifier id) const
Return the slot number of a hardware cell identifier: slot = [1,15] Slot-ID in top part of the crat...
Definition: LArOnlineID_Base.cxx:1957
bin
Definition: BinsDiffFromStripMedian.h:43
LArWaveHelper::translate
LArWave translate(const LArWave &theWave, int nShift, double baseline=0.) const
Definition: LArWaveHelper.cxx:11
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
LArOFCAlg::useDelta
bool useDelta(const HWIdentifier chid, const int jobOFlag, const LArOnOffIdMapping *cabling) const
Definition: LArOFCAlg.cxx:899
LArWaveHelper
Definition: LArWaveHelper.h:14
LArOFCAlg::perChannelData_t::inputWave
const LArWaveCumul * inputWave
Definition: LArOFCAlg.h:67
LArOFCAlg::Looper
Definition: LArOFCAlg.h:180
python.subdetectors.tile.Blob
Blob
Definition: tile.py:17
AthenaAttributeList::coralList
const coral::AttributeList & coralList() const
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:65
LArOFCAlg::m_isSC
bool m_isSC
Definition: LArOFCAlg.h:196
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
LArShapeComplete.h
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
LArWaveHelper::getMax
unsigned int getMax(const LArWave &theWave) const
return index of maximum sample
Definition: LArWaveHelper.cxx:89
LArOFCAlg::perChannelData_t::faultyOFC
bool faultyOFC
Definition: LArOFCAlg.h:84
LArOFCAlg::m_errAmpl
double m_errAmpl
Definition: LArOFCAlg.h:142
HWIdentifier
Definition: HWIdentifier.h:13
CaloGain::LARNGAIN
@ LARNGAIN
Definition: CaloGain.h:19
LArOFCAlg::m_fcal1Delta
static const float m_fcal1Delta[5]
Definition: LArOFCAlg.h:176
LArOFCAlg::perChannelData_t::ofcV2_a
std::vector< std::vector< float > > ofcV2_a
Definition: LArOFCAlg.h:75
AthenaAttributeList.h
LArOFCAlg::m_nDelays
unsigned int m_nDelays
Definition: LArOFCAlg.h:131
LArPhysWave
Definition: LArPhysWave.h:14
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
LArOFCAlg::m_readDSPConfig
bool m_readDSPConfig
Definition: LArOFCAlg.h:162
LArOFCAlg::m_timeShift
bool m_timeShift
Definition: LArOFCAlg.h:122
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
LArPhysWaveContainer
Liquid Argon Physics Wave Container.
Definition: LArPhysWaveContainer.h:23
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
CaloCell_ID.h
LArCaliWaveContainer
Liquid Argon Cumulative Wave Container.
Definition: LArCaliWaveContainer.h:33
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
LArOFCAlg::m_fcal3Delta
static const float m_fcal3Delta[5]
Definition: LArOFCAlg.h:174
LArOFCAlg::m_AutoCorrDecoder
ToolHandle< ILArAutoCorrDecoderTool > m_AutoCorrDecoder
Definition: LArOFCAlg.h:135
LArOFCAlg::process
void process(perChannelData_t &, const LArOnOffIdMapping *cabling) const
Definition: LArOFCAlg.cxx:447
LArOFCAlg::m_nSamples
unsigned int m_nSamples
Definition: LArOFCAlg.h:128
LArOnlineID_Base::isFCALchannel
bool isFCALchannel(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1653
LArOFCAlg::m_useDeltaV2
int m_useDeltaV2
Definition: LArOFCAlg.h:158
DiTauMassTools::ignore
void ignore(T &&)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:58
LArWave::getSample
const double & getSample(const unsigned int i) const
Amplitude per time bin.
Definition: LArWave.h:53
LArOFCAlg::m_allChannelData
std::vector< perChannelData_t > m_allChannelData
Definition: LArOFCAlg.h:94
LArOFCAlg::verify
bool verify(const HWIdentifier chid, const std::vector< float > &OFCa, const std::vector< float > &OFCb, const std::vector< float > &Shape, const char *ofcversion, const unsigned phase) const
Definition: LArOFCAlg.cxx:955
LArWave::isEmpty
bool isEmpty() const
is LArWave uninitialized?
Definition: LArWave.h:183
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArOFCAlg::m_ofcBinKey
std::string m_ofcBinKey
Definition: LArOFCAlg.h:151
LArOFCAlg::initPhysWaveContainer
StatusCode initPhysWaveContainer(const LArOnOffIdMapping *cabling)
Definition: LArOFCAlg.cxx:633
LArWave::dac0
@ dac0
Definition: LArWave.h:125
LArConditionsContainer::end
ConstConditionsMapIterator end(unsigned int gain) const
end of all channels for this gain
LArOFCAlg::perChannelData_t::ofcV2_b
std::vector< std::vector< float > > ofcV2_b
Definition: LArOFCAlg.h:76
LArOFCBinComplete.h
LArOFCAlg::m_onlineID
const LArOnlineID_Base * m_onlineID
Definition: LArOFCAlg.h:139
LArOFCAlg::m_useDelta
int m_useDelta
Definition: LArOFCAlg.h:157
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
LArOFCComplete.h
LArOnlineID_Base::isHECchannel
virtual bool isHECchannel(const HWIdentifier id) const =0
LArOFCAlg::m_calo_dd_man
const CaloDetDescrManager_Base * m_calo_dd_man
Definition: LArOFCAlg.h:138
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArOFCAlg::m_fcal2Delta
static const float m_fcal2Delta[5]
Definition: LArOFCAlg.h:175
LArOFCAlg::perChannelData_t::gain
unsigned gain
Definition: LArOFCAlg.h:69
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
LArOFCAlg::printOFCVec
static void printOFCVec(const std::vector< float > &vec, MsgStream &mLog)
Definition: LArOFCAlg.cxx:989
CaloCell_SuperCell_ID.h
Helper class for offline supercell identifiers.
LArCaliWaveVec
Definition: LArCaliWave.h:91
LArOFCAlg::perChannelData_t::shape
std::vector< std::vector< float > > shape
Definition: LArOFCAlg.h:78
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:45
LArOFCAlg::m_ofcKeyV2
std::string m_ofcKeyV2
Definition: LArOFCAlg.h:148
LArOFCAlg::m_nPoints
unsigned int m_nPoints
Definition: LArOFCAlg.h:132
LArOFCAlg::m_AutoCorrDecoderV2
ToolHandle< ILArAutoCorrDecoderTool > m_AutoCorrDecoderV2
Definition: LArOFCAlg.h:136
LArPhysWave::getTimeOffset
int getTimeOffset() const
Definition: LArPhysWave.h:97
LArOFCAlg::m_DSPConfig
std::unique_ptr< LArDSPConfig > m_DSPConfig
Definition: LArOFCAlg.h:164
LArOFCAlg::initCaliWaveContainer
StatusCode initCaliWaveContainer()
Definition: LArOFCAlg.cxx:667
AthAlgorithm
Definition: AthAlgorithm.h:47
LArOnlineID_Base::feb_Id
HWIdentifier feb_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Create feb_Id from fields.
Definition: LArOnlineID_Base.cxx:1479
LArOFCAlg::m_computeV2
bool m_computeV2
Definition: LArOFCAlg.h:159
LArOFCAlg::m_shapeKey
std::string m_shapeKey
Definition: LArOFCAlg.h:149
LArOFCAlg::optFiltDelta
static void optFiltDelta(const std::vector< float > &gWave_in, const std::vector< float > &gDerivWave_in, const Eigen::MatrixXd &autoCorrInv, const Eigen::VectorXd &delta, std::vector< float > &vecOFCa, std::vector< float > &vecOFCb)
Definition: LArOFCAlg.cxx:770
LArOFCAlg::m_addOffset
float m_addOffset
Definition: LArOFCAlg.h:133
LArOnlineID_Base
Helper for the Liquid Argon Calorimeter cell identifiers.
Definition: LArOnlineID_Base.h:105
LArOFCAlg.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
LArShapeComplete::set
void set(const HWIdentifier &CellID, int gain, const std::vector< std::vector< float > > &vShape, const std::vector< std::vector< float > > &vShapeDer, float timeOffset=0, float timeBinWidth=25./24.)
Definition: LArShapeComplete.cxx:17
LArOFCAlg::perChannelData_t::chid
HWIdentifier chid
Definition: LArOFCAlg.h:68
LArOFCAlg::perChannelData_t::tstart
float tstart
Definition: LArOFCAlg.h:81
LArOFCAlg::m_larPhysWaveBin
const LArOFCBinComplete * m_larPhysWaveBin
Definition: LArOFCAlg.h:140
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
LArOnlineID
Definition: LArOnlineID.h:20
CaloGain::LARHIGHGAIN
@ LARHIGHGAIN
Definition: CaloGain.h:18
LArOnline_SuperCellID
Definition: LArOnline_SuperCellID.h:20
CaloGain::CaloGain
CaloGain
Definition: CaloGain.h:11
LArOFCAlg::m_readCaliWave
bool m_readCaliWave
Definition: LArOFCAlg.h:145
LArOFCAlg::m_nPhases
unsigned int m_nPhases
Definition: LArOFCAlg.h:129
LArOFCAlg::m_cablingKeySC
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKeySC
Definition: LArOFCAlg.h:53
LArOFCAlg::m_dumpOFCfile
std::string m_dumpOFCfile
Definition: LArOFCAlg.h:118
LArOFCAlg::LArOFCAlg
LArOFCAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: LArOFCAlg.cxx:40
python.PyAthena.v
v
Definition: PyAthena.py:154
LArOFCAlg::m_storeMaxPhase
bool m_storeMaxPhase
Definition: LArOFCAlg.h:150
LArWaveHelper.h
LArOFCAlg::m_waveCnt_nc
LArCaliWaveContainer * m_waveCnt_nc
Definition: LArOFCAlg.h:126
CaloDetDescrElement::getSampling
CaloCell_ID::CaloSample getSampling() const
cell sampling
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:395
LArConditionsContainer::initialize
virtual StatusCode initialize()
Initialization done after creation or read back - derived classes may augment the functionality.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
LArConditionsContainer::begin
ConstConditionsMapIterator begin(unsigned int gain) const
get iterator for all channels for a gain
LArWaveCumul.h
LArWaveHelper::derive_smooth
LArWave derive_smooth(const LArWave &theWave) const
smoothed derivative
Definition: LArWaveHelper.cxx:270
LArOFCAlg::m_errTime
double m_errTime
Definition: LArOFCAlg.h:143
LArOFCAlg::m_groupingType
std::string m_groupingType
Definition: LArOFCAlg.h:154
LArOFCAlg::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition: LArOFCAlg.h:55
LArOnline_SuperCellID.h
LArOFCAlg::m_forceShift
bool m_forceShift
Definition: LArOFCAlg.h:166
LArPhysCaliTdiffComplete.h
CaloDetDescrElement::eta
float eta() const
cell eta
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:344
LArOFCAlg::m_ofcKey
std::string m_ofcKey
Definition: LArOFCAlg.h:147
LArDigits2NtupleDumper.nSamples
nSamples
Definition: LArDigits2NtupleDumper.py:70
LArOFCComplete::dumpOFC
void dumpOFC(const std::string &output_file_name) const
Definition: LArOFCComplete.cxx:92
LArOFCBinComplete::set
void set(const HWIdentifier &chid, const int &gain, const int &bin)
Definition: LArOFCBinComplete.cxx:11
LArOnlineID_Base::channel_name
std::string channel_name(const HWIdentifier id) const
Return a string corresponding to a feedthrough name given an identifier.
Definition: LArOnlineID_Base.cxx:219
CaloGain.h
LArOFCAlg::perChannelData_t::timeBinWidthOFC
float timeBinWidthOFC
Definition: LArOFCAlg.h:82
CaloCell_ID_FCS::FCAL0
@ FCAL0
Definition: FastCaloSim_CaloCell_ID.h:40
LArOFCAlg::perChannelData_t::phasewMaxAt3
unsigned phasewMaxAt3
Definition: LArOFCAlg.h:83
LArOFCAlg::stop
virtual StatusCode stop()
Definition: LArOFCAlg.cxx:165
CaloCondBlobAlgs_fillNoiseFromASCII.blob
blob
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:96
LArOFCAlg::initialize
StatusCode initialize()
Definition: LArOFCAlg.cxx:98
fitman.k
k
Definition: fitman.py:528
LArOnlineID.h
LArOFCAlg::m_timeShiftByIndex
int m_timeShiftByIndex
Definition: LArOFCAlg.h:123
LArConditionsContainer::correctionsApplied
bool correctionsApplied() const
Have corrections been applied?
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20
LArOFCAlg::m_dPhases
unsigned int m_dPhases
Definition: LArOFCAlg.h:130
LArOFCAlg::m_keylist
std::vector< std::string > m_keylist
Definition: LArOFCAlg.h:119
Identifier
Definition: IdentifierFieldParser.cxx:14