ATLAS Offline Software
TileEMScale.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TILECONDITIONS_TILEEMSCALE_H
6 #define TILECONDITIONS_TILEEMSCALE_H
7 
79 // Tile includes
83 
84 #include <vector>
85 #include <array>
86 
87 class TileEMScale {
88  public:
89 
90  TileEMScale();
91  virtual ~TileEMScale();
92 
93  bool initialize();
94 
107  float calibrateChannel(unsigned int drawerIdx, unsigned int channel, unsigned int adc, float amplitude,
108  TileRawChannelUnit::UNIT rawDataUnitIn, TileRawChannelUnit::UNIT rawDataUnitOut) const;
109 
117  float applyEMScaleCalibration(unsigned int drawerIdx, unsigned int channel, float amplitude) const;
118 
127  float applyCesiumCalibration(unsigned int drawerIdx, unsigned int channel,
128  float amplitude, bool applyLasCorr = true) const;
129 
138  float applyLaserCalibration(unsigned int drawerIdx, unsigned int channel, float amplitude) const;
139 
148  float applyLaserLinearCalibration(unsigned int drawerIdx, unsigned int channel, float amplitude) const;
149 
158  float applyLaserNonLinearCalibration(unsigned int drawerIdx, unsigned int channel, float amplitude) const;
159 
169  float applyChargeCalibration(unsigned int drawerIdx, unsigned int channel, unsigned int adc,
170  float amplitude) const;
171 
181  float applyChargLinearCalibration(unsigned int drawerIdx, unsigned int channel, unsigned int adc,
182  float amplitude) const;
183 
193  float applyChargeNonLinearCalibration(unsigned int drawerIdx, unsigned int channel, unsigned int adc,
194  float amplitude) const;
195 
196 
210  float calibrateOnlineChannel(unsigned int drawerIdx, unsigned int channel, unsigned int adc,
211  float amplitude, TileRawChannelUnit::UNIT onlUnit) const;
212 
221  float applyOnlineEMScaleCalibration(unsigned int drawerIdx, unsigned int channel, float amplitude) const;
222 
231  float applyOnlineCesiumCalibration(unsigned int drawerIdx, unsigned int channel,
232  float amplitude, bool applyLasCorr = true) const;
233 
242  float applyOnlineLaserCalibration(unsigned int drawerIdx, unsigned int channel, float amplitude) const;
243 
253  float applyOnlineChargeCalibration(unsigned int drawerIdx, unsigned int channel, unsigned int adc,
254  float amplitude) const;
255 
270  float undoOnlineChannelCalibration(unsigned int drawerIdx, unsigned int channel, unsigned int adc,
271  float amplitude, TileRawChannelUnit::UNIT onlUnit) const;
272 
283  float getCesiumReferenceLaserGain(unsigned int drawerIdx, unsigned int channel, unsigned int adc) const;
284 
291  float getCesiumReferenceHV(unsigned int drawerIdx, unsigned int channel) const;
292 
299  float getCesiumReferenceTemperature(unsigned int drawerIdx, unsigned int channel) const;
300 
306  float getLaserFiberVariation(unsigned int drawerIdx, unsigned int channel) const;
307 
317  float getLaserPartitionVariation(unsigned int drawerIdx) const;
318 
325  float getLaserReferenceHV(unsigned int drawerIdx, unsigned int channel) const;
326 
331 
336  void setOnlineCacheUnit(TileRawChannelUnit::UNIT onlCacheUnit);
337 
338  void setCalibOflCisLin(std::unique_ptr<TileCalibDataFlt> calibData);
339  void setCalibOflCisNln(std::unique_ptr<TileCalibDataFlt> calibData);
340  void setCalibOflLasLin(std::unique_ptr<TileCalibDataFlt> calibData);
341  void setCalibOflLasNln(std::unique_ptr<TileCalibDataFlt> calibData);
342  void setCalibOflLasFib(std::unique_ptr<TileCalibDataFlt> calibData);
343  void setCalibOflCes(std::unique_ptr<TileCalibDataFlt> calibData);
344  void setCalibOflEms(std::unique_ptr<TileCalibDataFlt> calibData);
345 
346  void setCalibOnlCis(std::unique_ptr<TileCalibDataFlt> calibData);
347  void setCalibOnlLas(std::unique_ptr<TileCalibDataFlt> calibData);
348  void setCalibOnlCes(std::unique_ptr<TileCalibDataFlt> calibData);
349  void setCalibOnlEms(std::unique_ptr<TileCalibDataFlt> calibData);
350 
351  void setMaxChannels(unsigned int maxChannels);
352  void setMaxGains(unsigned int maxGains);
353 
354  protected:
355 
363  void resetOnlineCache();
364 
372  float getOnlineCalibration(unsigned int drawerIdx, unsigned int channel, unsigned int adc,
373  TileRawChannelUnit::UNIT onlUnit) const;
374 
381 
388 
397  unsigned int getCacheIndex(unsigned int drawerIdx, unsigned int channel, unsigned int adc) const;
398 
399  //=== cache of total online calibration factors
401  std::vector<float> m_onlCache;
402 
405 
406  //=== TileCondProxies are needed by the TileCalibEms
407  //--- offline TileCalibData
408  std::unique_ptr<TileCalibDataFlt> m_calibOflCisLin;
409  std::unique_ptr<TileCalibDataFlt> m_calibOflCisNln;
410  std::unique_ptr<TileCalibDataFlt> m_calibOflLasLin;
411  std::unique_ptr<TileCalibDataFlt> m_calibOflLasNln;
412  std::unique_ptr<TileCalibDataFlt> m_calibOflLasFib;
413  std::unique_ptr<TileCalibDataFlt> m_calibOflCes;
414  std::unique_ptr<TileCalibDataFlt> m_calibOflEms;
415 
416  //--- online TileCalibData
417  std::unique_ptr<TileCalibDataFlt> m_calibOnlCis;
418  std::unique_ptr<TileCalibDataFlt> m_calibOnlLas;
419  std::unique_ptr<TileCalibDataFlt> m_calibOnlCes;
420  std::unique_ptr<TileCalibDataFlt> m_calibOnlEms;
421 
423 
424  unsigned int m_maxChannels;
425  unsigned int m_maxGains;
426  unsigned int m_drawerCacheSize;
427 
428  const float m_epsilon = 1.e-5;
429 };
430 
431 #include "AthenaKernel/CLASS_DEF.h"
432 #include "AthenaKernel/CondCont.h"
433 CLASS_DEF(TileEMScale, 166690091, 0)
435 
436 
437 // inlines
438 
439 inline
440 TileRawChannelUnit::UNIT TileEMScale::getOnlineCacheUnit() const {
441  return m_onlCacheUnit;
442 }
443 
444 inline
446  m_onlCacheUnit = onlCacheUnit;
447 }
448 
449 inline
450 void TileEMScale::setMaxChannels(unsigned int maxChannels) {
451  m_maxChannels = maxChannels;
452 }
453 
454 inline
455 void TileEMScale::setMaxGains(unsigned int maxGains) {
456  m_maxGains = maxGains;
457 }
458 
459 inline
460 unsigned int TileEMScale::getCacheIndex(unsigned int drawerIdx, unsigned int channel, unsigned int adc) const {
461  return m_drawerCacheSize * drawerIdx + m_maxChannels * adc + channel;
462 }
463 
464 #endif // TILECONDITIONS_TILEEMSCALE_H
TileEMScale::setCalibOnlLas
void setCalibOnlLas(std::unique_ptr< TileCalibDataFlt > calibData)
Definition: TileEMScale.cxx:441
TileEMScale::m_onlCache
std::vector< float > m_onlCache
Definition: TileEMScale.h:401
TileEMScale
Condition object to keep calibration factors of TileCal channels.
Definition: TileEMScale.h:87
TileRawChannelUnit
Definition: TileRawChannelUnit.h:13
TileEMScale::m_onlCacheUnit
TileRawChannelUnit::UNIT m_onlCacheUnit
Definition: TileEMScale.h:400
TileEMScale::getCesiumReferenceTemperature
float getCesiumReferenceTemperature(unsigned int drawerIdx, unsigned int channel) const
Return the drawer temperature as measured during last cesium equalization.
Definition: TileEMScale.cxx:372
TileEMScale::checkIfOflLaserLinearCalibrationUsed
bool checkIfOflLaserLinearCalibrationUsed() const
Check if offline linear laser calibration will be used.
Definition: TileEMScale.cxx:454
TileEMScale::applyOnlineCesiumCalibration
float applyOnlineCesiumCalibration(unsigned int drawerIdx, unsigned int channel, float amplitude, bool applyLasCorr=true) const
Apply online cesium calibration constant.
Definition: TileEMScale.cxx:327
TileCalibDrawerFlt.h
TileEMScale::setCalibOnlEms
void setCalibOnlEms(std::unique_ptr< TileCalibDataFlt > calibData)
Definition: TileEMScale.cxx:449
CondCont.h
Hold mappings of ranges to condition objects.
TileEMScale::m_calibOnlLas
std::unique_ptr< TileCalibDataFlt > m_calibOnlLas
Definition: TileEMScale.h:418
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
TileEMScale::m_isOflLasLinUsed
bool m_isOflLasLinUsed
Definition: TileEMScale.h:403
TileEMScale::getCesiumReferenceLaserGain
float getCesiumReferenceLaserGain(unsigned int drawerIdx, unsigned int channel, unsigned int adc) const
Return the PMT gain reference as measured by the laser system.
Definition: TileEMScale.cxx:358
TileCalibData.h
TileEMScale::applyOnlineEMScaleCalibration
float applyOnlineEMScaleCalibration(unsigned int drawerIdx, unsigned int channel, float amplitude) const
Calibrate online chnnel to EM scale: Equalized pC -> MeV.
Definition: TileEMScale.cxx:320
TileEMScale::getOnlineCalibration
float getOnlineCalibration(unsigned int drawerIdx, unsigned int channel, unsigned int adc, TileRawChannelUnit::UNIT onlUnit) const
Return the calibration constant applied in the DSP.
Definition: TileEMScale.cxx:71
TileEMScale::TileEMScale
TileEMScale()
Definition: TileEMScale.cxx:15
TileEMScale::m_maxGains
unsigned int m_maxGains
Definition: TileEMScale.h:425
TileEMScale::applyLaserCalibration
float applyLaserCalibration(unsigned int drawerIdx, unsigned int channel, float amplitude) const
Apply laser correction.
Definition: TileEMScale.cxx:222
TileEMScale::getOnlineCacheUnit
TileRawChannelUnit::UNIT getOnlineCacheUnit() const
Return the unit of cached online calibration constants.
Definition: TileEMScale.h:440
TileEMScale::applyChargeNonLinearCalibration
float applyChargeNonLinearCalibration(unsigned int drawerIdx, unsigned int channel, unsigned int adc, float amplitude) const
Apply CIS non-linear calibration: ADC counts -> pC.
Definition: TileEMScale.cxx:284
TileEMScale::setCalibOflCes
void setCalibOflCes(std::unique_ptr< TileCalibDataFlt > calibData)
Definition: TileEMScale.cxx:428
TileEMScale::m_calibOnlCis
std::unique_ptr< TileCalibDataFlt > m_calibOnlCis
Definition: TileEMScale.h:417
TileEMScale::applyChargLinearCalibration
float applyChargLinearCalibration(unsigned int drawerIdx, unsigned int channel, unsigned int adc, float amplitude) const
Apply CIS linear calibration: ADC counts -> pC.
Definition: TileEMScale.cxx:275
TileEMScale::setOnlineCacheUnit
void setOnlineCacheUnit(TileRawChannelUnit::UNIT onlCacheUnit)
Set online cache unit.
Definition: TileEMScale.h:445
TileEMScale::applyOnlineLaserCalibration
float applyOnlineLaserCalibration(unsigned int drawerIdx, unsigned int channel, float amplitude) const
Apply online laser (PMT linearity) correction.
Definition: TileEMScale.cxx:341
TileEMScale::m_drawerCacheSize
unsigned int m_drawerCacheSize
Definition: TileEMScale.h:426
TileEMScale::setMaxChannels
void setMaxChannels(unsigned int maxChannels)
Definition: TileEMScale.h:450
TileEMScale::setCalibOflCisNln
void setCalibOflCisNln(std::unique_ptr< TileCalibDataFlt > calibData)
Definition: TileEMScale.cxx:412
TileEMScale::setMaxGains
void setMaxGains(unsigned int maxGains)
Definition: TileEMScale.h:455
TileEMScale::m_calibOnlCes
std::unique_ptr< TileCalibDataFlt > m_calibOnlCes
Definition: TileEMScale.h:419
TileEMScale::calibrateChannel
float calibrateChannel(unsigned int drawerIdx, unsigned int channel, unsigned int adc, float amplitude, TileRawChannelUnit::UNIT rawDataUnitIn, TileRawChannelUnit::UNIT rawDataUnitOut) const
Calibrate a Tile channel.
Definition: TileEMScale.cxx:136
TileEMScale::m_calibOflCes
std::unique_ptr< TileCalibDataFlt > m_calibOflCes
Definition: TileEMScale.h:413
TileEMScale::setCalibOnlCis
void setCalibOnlCis(std::unique_ptr< TileCalibDataFlt > calibData)
Definition: TileEMScale.cxx:437
TileEMScale::getLaserReferenceHV
float getLaserReferenceHV(unsigned int drawerIdx, unsigned int channel) const
Returns the reference PMT HV from appropriate laser calibration.
Definition: TileEMScale.cxx:394
TileEMScale::setCalibOflLasLin
void setCalibOflLasLin(std::unique_ptr< TileCalibDataFlt > calibData)
Definition: TileEMScale.cxx:416
TileEMScale::applyChargeCalibration
float applyChargeCalibration(unsigned int drawerIdx, unsigned int channel, unsigned int adc, float amplitude) const
Apply CIS calibration: ADC counts -> pC.
Definition: TileEMScale.cxx:264
TileRawChannelUnit::UNIT
UNIT
Definition: TileRawChannelUnit.h:16
TileEMScale::m_calibOflLasNln
std::unique_ptr< TileCalibDataFlt > m_calibOflLasNln
Definition: TileEMScale.h:411
TileEMScale::m_calibOflEms
std::unique_ptr< TileCalibDataFlt > m_calibOflEms
Definition: TileEMScale.h:414
TileEMScale::applyLaserLinearCalibration
float applyLaserLinearCalibration(unsigned int drawerIdx, unsigned int channel, float amplitude) const
Apply laser (PMT linearity) correction.
Definition: TileEMScale.cxx:239
CONDCONT_DEF
CONDCONT_DEF(TileEMScale, 177875727)
TileEMScale::setCalibOnlCes
void setCalibOnlCes(std::unique_ptr< TileCalibDataFlt > calibData)
Definition: TileEMScale.cxx:445
TileEMScale::m_calibOflCisLin
std::unique_ptr< TileCalibDataFlt > m_calibOflCisLin
Definition: TileEMScale.h:408
TileEMScale::m_calibOflLasLin
std::unique_ptr< TileCalibDataFlt > m_calibOflLasLin
Definition: TileEMScale.h:410
TileEMScale::applyCesiumCalibration
float applyCesiumCalibration(unsigned int drawerIdx, unsigned int channel, float amplitude, bool applyLasCorr=true) const
Apply cesium calibration constant.
Definition: TileEMScale.cxx:208
TileEMScale::setCalibOflEms
void setCalibOflEms(std::unique_ptr< TileCalibDataFlt > calibData)
Definition: TileEMScale.cxx:432
TileEMScale::getLaserPartitionVariation
float getLaserPartitionVariation(unsigned int drawerIdx) const
Return laser partition relative variation.
Definition: TileEMScale.cxx:386
TileEMScale::getLaserFiberVariation
float getLaserFiberVariation(unsigned int drawerIdx, unsigned int channel) const
Return laser fiber relative variation.
Definition: TileEMScale.cxx:379
UNIT
#define UNIT(NAME)
Definition: Units.h:74
TileEMScale::m_calibOflCisNln
std::unique_ptr< TileCalibDataFlt > m_calibOflCisNln
Definition: TileEMScale.h:409
TileEMScale::setCalibOflCisLin
void setCalibOflCisLin(std::unique_ptr< TileCalibDataFlt > calibData)
Definition: TileEMScale.cxx:408
TileEMScale::m_calibOnlEms
std::unique_ptr< TileCalibDataFlt > m_calibOnlEms
Definition: TileEMScale.h:420
TileRawChannelUnit.h
TileEMScale::applyLaserNonLinearCalibration
float applyLaserNonLinearCalibration(unsigned int drawerIdx, unsigned int channel, float amplitude) const
Apply laser (PMT nonlinearity) correction.
Definition: TileEMScale.cxx:251
TileEMScale::m_isOflLasNlnUsed
bool m_isOflLasNlnUsed
Definition: TileEMScale.h:404
TileEMScale::undoOnlineChannelCalibration
float undoOnlineChannelCalibration(unsigned int drawerIdx, unsigned int channel, unsigned int adc, float amplitude, TileRawChannelUnit::UNIT onlUnit) const
Undo the calibration applied in ROD signal reconstruction.
Definition: TileEMScale.cxx:97
TileEMScale::~TileEMScale
virtual ~TileEMScale()
Definition: TileEMScale.cxx:30
TileEMScale::setCalibOflLasFib
void setCalibOflLasFib(std::unique_ptr< TileCalibDataFlt > calibData)
Definition: TileEMScale.cxx:424
ReadFloatFromCool.adc
adc
Definition: ReadFloatFromCool.py:48
TileEMScale::applyOnlineChargeCalibration
float applyOnlineChargeCalibration(unsigned int drawerIdx, unsigned int channel, unsigned int adc, float amplitude) const
Apply online CIS calibration: ADC counts -> pC.
Definition: TileEMScale.cxx:349
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
TileEMScale::resetOnlineCache
void resetOnlineCache()
Recache the total online calibration constant applied in ROD.
Definition: TileEMScale.cxx:56
TileEMScale::calibrateOnlineChannel
float calibrateOnlineChannel(unsigned int drawerIdx, unsigned int channel, unsigned int adc, float amplitude, TileRawChannelUnit::UNIT onlUnit) const
Calibrate an online Tile channel from OnlineADCcounts to an arbitrary Online unit,...
Definition: TileEMScale.cxx:292
TileEMScale::m_useOflLasFib
bool m_useOflLasFib
Definition: TileEMScale.h:422
TileEMScale::initialize
bool initialize()
Definition: TileEMScale.cxx:35
TileEMScale::checkIfOflLaserNonLinearCalibrationUsed
bool checkIfOflLaserNonLinearCalibrationUsed() const
Check if offline nonlinear laser calibration will be used.
Definition: TileEMScale.cxx:471
TileEMScale::m_maxChannels
unsigned int m_maxChannels
Definition: TileEMScale.h:424
TileEMScale::getCesiumReferenceHV
float getCesiumReferenceHV(unsigned int drawerIdx, unsigned int channel) const
Return the reference PMT HV set in last cesium calibration.
Definition: TileEMScale.cxx:365
CLASS_DEF.h
macros to associate a CLID to a type
TileEMScale::applyEMScaleCalibration
float applyEMScaleCalibration(unsigned int drawerIdx, unsigned int channel, float amplitude) const
Calibrate a Tile channel to EM scale: Equalized pC -> MeV.
Definition: TileEMScale.cxx:201
TileEMScale::setCalibOflLasNln
void setCalibOflLasNln(std::unique_ptr< TileCalibDataFlt > calibData)
Definition: TileEMScale.cxx:420
TileEMScale::m_epsilon
const float m_epsilon
Definition: TileEMScale.h:428
TileEMScale::getCacheIndex
unsigned int getCacheIndex(unsigned int drawerIdx, unsigned int channel, unsigned int adc) const
Return cache index used for online calibration constants.
Definition: TileEMScale.h:460
TileEMScale::m_calibOflLasFib
std::unique_ptr< TileCalibDataFlt > m_calibOflLasFib
Definition: TileEMScale.h:412