ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
CaloNoise Class Reference

#include <CaloNoise.h>

Collaboration diagram for CaloNoise:

Public Types

enum  NOISETYPE { ELEC =0, PILEUP, TOTAL }
 Conditions Data Object holding the calorimeter noise per cell and per gain. More...
 

Public Member Functions

 CaloNoise ()=delete
 
 ~CaloNoise ()
 
 CaloNoise (const size_t nLArCells, const size_t nLArGains, const size_t nTileCells, const size_t nTileGains, const CaloCell_Base_ID *caloCellId, const NOISETYPE noisetype)
 Explicit constructor with number of cells and gains and ptr to CaloCell_ID obj. More...
 
float getNoise (const IdentifierHash h, const int gain) const
 Accessor by IdentifierHash and gain. More...
 
float getNoise (const Identifier id, const int gain) const
 Accessor by Identifier and gain. More...
 
float getNoise (const HWIdentifier, const int) const =delete
 Safety net: Disallow access by HWIdentifier. More...
 
float getEffectiveSigma (const Identifier id, const int gain, const float energy) const
 
float getEffectiveSigma (const IdentifierHash h, const int gain, const float energy) const
 
boost::multi_array< float, 2 > & larStorage ()
 Non-const accessor to underlying storage for filling: More...
 
boost::multi_array< float, 2 > & tileStorage ()
 
const boost::multi_array< float, 2 > & larStorage () const
 Const accessor to underlying storage for GPU data structures. More...
 
const boost::multi_array< float, 2 > & tileStorage () const
 
void setTileBlob (const CaloCondBlobFlt *flt, const float lumi)
 
const CaloCondBlobFltgetTileBlob () const
 
float getLumi () const
 
NOISETYPE getNoiseType () const
 

Private Member Functions

float calcSig (const IdentifierHash tilehash, const int gain, const float energy) const
 
float getTileEffSigma (const IdentifierHash subHash, const int gain, const float e) const
 

Private Attributes

const CaloCell_Base_IDm_caloCellId
 
boost::multi_array< float, 2 > m_larNoise
 
boost::multi_array< float, 2 > m_tileNoise
 
unsigned m_tileHashOffset
 
const CaloCondBlobFltm_tileBlob =nullptr
 
float m_lumi =0
 
NOISETYPE m_noiseType =TOTAL
 

Detailed Description

Definition at line 16 of file CaloNoise.h.

Member Enumeration Documentation

◆ NOISETYPE

Conditions Data Object holding the calorimeter noise per cell and per gain.

Enumerator
ELEC 
PILEUP 
TOTAL 

Definition at line 21 of file CaloNoise.h.

21  {ELEC=0,
22  PILEUP,
23  TOTAL};

Constructor & Destructor Documentation

◆ CaloNoise() [1/2]

CaloNoise::CaloNoise ( )
delete

◆ ~CaloNoise()

CaloNoise::~CaloNoise ( )

Definition at line 36 of file CaloNoise.cxx.

36  {
37  if ( m_tileBlob) delete m_tileBlob;
38 }

◆ CaloNoise() [2/2]

CaloNoise::CaloNoise ( const size_t  nLArCells,
const size_t  nLArGains,
const size_t  nTileCells,
const size_t  nTileGains,
const CaloCell_Base_ID caloCellId,
const NOISETYPE  noisetype 
)

Explicit constructor with number of cells and gains and ptr to CaloCell_ID obj.

Definition at line 11 of file CaloNoise.cxx.

17  : m_caloCellId(caloCellId)
18  , m_noiseType(noisetype)
19 {
20 
21  boost::multi_array_types::extent_gen lar_extent_gen;
22  m_larNoise.resize(lar_extent_gen[nLArGains][nLArCells]);
23  boost::multi_array_types::extent_gen tile_extent_gen;
24  m_tileNoise.resize(tile_extent_gen[nTileGains][nTileCells]);
25 
26  IdentifierHash h1,h2;
29 }

Member Function Documentation

◆ calcSig()

float CaloNoise::calcSig ( const IdentifierHash  tilehash,
const int  gain,
const float  energy 
) const
private

Definition at line 42 of file CaloNoise.cxx.

42  {
43 
44  const double sigma1 = m_tileBlob->getData(subHash,dbGain,2);
45  const double sigma2 = m_tileBlob->getData(subHash,dbGain,3);
46  const double ratio = m_tileBlob->getData(subHash,dbGain,4);
47 
48 
49  if((sigma1 == 0. && sigma2 == 0.) || e == 0.) return 0.;
50  if(sigma1 == 0.) return e/sigma2;
51  if((ratio == 0.) || sigma2 == 0.) return e/sigma1;
52  const double x1 = e/sigma1;
53  const double x2 = e/sigma2;
54 
55  constexpr std::array<float,2> valid_range{0.9,7.5};
56  const float wide_gauss_sigma = std::min(std::abs(x1),std::abs(x2));
57  if(wide_gauss_sigma > valid_range[1]) return wide_gauss_sigma;
58 
59  const float narrow_gauss_sigma= std::max(std::abs(x1),std::abs(x2));
60  if(narrow_gauss_sigma < valid_range[0]) return narrow_gauss_sigma;
61 
62 
63  const double y1= TMath::Erf(M_SQRT1_2*x1);
64  const double y2= TMath::Erf(M_SQRT1_2*x2);
65 
66  const double z = ( y1*sigma1 + ratio*y2*sigma2 )/( sigma1 + ratio*sigma2);
67 
68  //return the C.L. probability (with sign!)
69  // return z;
70 
71  // if instead you want to return the sigma-equivalent C.L.
72  // (with sign!) use the following line
73  return M_SQRT2*TMath::ErfInverse(z);
74 }

◆ getEffectiveSigma() [1/2]

float CaloNoise::getEffectiveSigma ( const Identifier  id,
const int  gain,
const float  energy 
) const
inline

Definition at line 55 of file CaloNoise.h.

55  {
58  }

◆ getEffectiveSigma() [2/2]

float CaloNoise::getEffectiveSigma ( const IdentifierHash  h,
const int  gain,
const float  energy 
) const
inline

Definition at line 61 of file CaloNoise.h.

61  {
62  if (h<m_tileHashOffset) {
63  return m_larNoise[gain][h];
64  }
65  else {
67  }
68  }

◆ getLumi()

float CaloNoise::getLumi ( ) const
inline

Definition at line 85 of file CaloNoise.h.

85 { return m_lumi; }

◆ getNoise() [1/3]

float CaloNoise::getNoise ( const  HWIdentifier,
const int   
) const
delete

Safety net: Disallow access by HWIdentifier.

◆ getNoise() [2/3]

float CaloNoise::getNoise ( const Identifier  id,
const int  gain 
) const
inline

Accessor by Identifier and gain.

Definition at line 45 of file CaloNoise.h.

45  {
47  return getNoise(h,gain);
48  }

◆ getNoise() [3/3]

float CaloNoise::getNoise ( const IdentifierHash  h,
const int  gain 
) const
inline

Accessor by IdentifierHash and gain.

Definition at line 34 of file CaloNoise.h.

34  {
35  if (h<m_tileHashOffset) {
36  return m_larNoise[gain][h];
37  }
38  else {
39  const unsigned int dbGain = CaloCondUtils::getDbCaloGain(gain);
40  return m_tileNoise[dbGain][h-m_tileHashOffset];
41  }
42  }

◆ getNoiseType()

NOISETYPE CaloNoise::getNoiseType ( ) const
inline

Definition at line 87 of file CaloNoise.h.

87 { return m_noiseType; }

◆ getTileBlob()

const CaloCondBlobFlt* CaloNoise::getTileBlob ( ) const
inline

Definition at line 83 of file CaloNoise.h.

83 { return m_tileBlob; }

◆ getTileEffSigma()

float CaloNoise::getTileEffSigma ( const IdentifierHash  subHash,
const int  gain,
const float  e 
) const
private

Definition at line 77 of file CaloNoise.cxx.

77  {
78  // Tell clang to optimize assuming that FP exceptions can trap.
79  // Otherwise, it can vectorize the division, which can lead to
80  // spurious division-by-zero traps from unused vector lanes.
82 
83  const unsigned int dbGain = CaloCondUtils::getDbCaloGain(gain);
84  if (!m_tileBlob) {
85  //No data (pilup-noise only): return cached noise
86  return m_tileNoise[dbGain][subHash];
87  }
88 
89  const float sigma=calcSig(subHash,dbGain,e);
90  const float a= (sigma != 0.) ? std::abs(e/sigma) : 0.0;
91 
93  return a;
94  }
95 
96  //Case: Total Noise
97  const float b= m_tileBlob->getData(subHash,dbGain,1);
98  const int objver = m_tileBlob->getObjVersion();
99  float x=0;
100  if(objver==1){
101  //=== Total noise parameterized as
102  //=== Sigma**2 = a**2 + b**2 * Lumi
103  x = std::sqrt( a*a + b*b*m_lumi );
104  }
105  else if (objver==2) {
106  //== parameterization for pedestal = a + b*Lumi
107  x = a+b*m_lumi;
108  }
109  else{
110  throw CaloCond::VersionConflict("CaloNoise::get2dEffSigma ",objver);
111  }
112  return x;
113 }

◆ larStorage() [1/2]

boost::multi_array<float, 2>& CaloNoise::larStorage ( )
inline

Non-const accessor to underlying storage for filling:

Definition at line 71 of file CaloNoise.h.

71 {return m_larNoise;}

◆ larStorage() [2/2]

const boost::multi_array<float, 2>& CaloNoise::larStorage ( ) const
inline

Const accessor to underlying storage for GPU data structures.

Definition at line 75 of file CaloNoise.h.

75 {return m_larNoise;}

◆ setTileBlob()

void CaloNoise::setTileBlob ( const CaloCondBlobFlt flt,
const float  lumi 
)

Definition at line 31 of file CaloNoise.cxx.

31  {
33  m_lumi=lumi;
34 }

◆ tileStorage() [1/2]

boost::multi_array<float, 2>& CaloNoise::tileStorage ( )
inline

Definition at line 72 of file CaloNoise.h.

72 {return m_tileNoise;}

◆ tileStorage() [2/2]

const boost::multi_array<float, 2>& CaloNoise::tileStorage ( ) const
inline

Definition at line 76 of file CaloNoise.h.

76 {return m_tileNoise;}

Member Data Documentation

◆ m_caloCellId

const CaloCell_Base_ID* CaloNoise::m_caloCellId
private

Definition at line 93 of file CaloNoise.h.

◆ m_larNoise

boost::multi_array<float, 2> CaloNoise::m_larNoise
private

Definition at line 96 of file CaloNoise.h.

◆ m_lumi

float CaloNoise::m_lumi =0
private

Definition at line 103 of file CaloNoise.h.

◆ m_noiseType

NOISETYPE CaloNoise::m_noiseType =TOTAL
private

Definition at line 104 of file CaloNoise.h.

◆ m_tileBlob

const CaloCondBlobFlt* CaloNoise::m_tileBlob =nullptr
private

Definition at line 102 of file CaloNoise.h.

◆ m_tileHashOffset

unsigned CaloNoise::m_tileHashOffset
private

Definition at line 98 of file CaloNoise.h.

◆ m_tileNoise

boost::multi_array<float, 2> CaloNoise::m_tileNoise
private

Definition at line 97 of file CaloNoise.h.


The documentation for this class was generated from the following files:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
CXXUTILS_TRAPPING_FP
#define CXXUTILS_TRAPPING_FP
Definition: trapping_fp.h:24
CaloCondBlobDat::getData
T getData(const unsigned int channel, const unsigned int adc, const unsigned int idx) const
Returns a single T belonging to a channel/gain.
Definition: CaloCondBlobDat.h:134
CaloNoise::getEffectiveSigma
float getEffectiveSigma(const Identifier id, const int gain, const float energy) const
Definition: CaloNoise.h:55
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
CaloCell_Base_ID::calo_cell_hash
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
CaloNoise::TOTAL
@ TOTAL
Definition: CaloNoise.h:23
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
CaloNoise::calcSig
float calcSig(const IdentifierHash tilehash, const int gain, const float energy) const
Definition: CaloNoise.cxx:42
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
CaloNoise::ELEC
@ ELEC
Definition: CaloNoise.h:21
read_hist_ntuple.h1
h1
Definition: read_hist_ntuple.py:21
CaloNoise::m_larNoise
boost::multi_array< float, 2 > m_larNoise
Definition: CaloNoise.h:96
CaloNoise::getNoise
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
Definition: CaloNoise.h:34
x
#define x
CaloNoise::m_tileNoise
boost::multi_array< float, 2 > m_tileNoise
Definition: CaloNoise.h:97
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
CaloNoise::m_noiseType
NOISETYPE m_noiseType
Definition: CaloNoise.h:104
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
z
#define z
CaloCondBlobBase::getObjVersion
uint16_t getObjVersion() const
Returns the BLOB object version.
Definition: CaloCondBlobBase.h:203
CaloCell_Base_ID::calo_cell_hash_range
void calo_cell_hash_range(const Identifier id, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' cell hashes of one sub-calorimeter alone
extractSporadic.h
list h
Definition: extractSporadic.py:97
CaloNoise::m_caloCellId
const CaloCell_Base_ID * m_caloCellId
Definition: CaloNoise.h:93
makeTRTBarrelCans.y2
tuple y2
Definition: makeTRTBarrelCans.py:18
CaloCell_Base_ID::TILE
@ TILE
Definition: CaloCell_Base_ID.h:46
CaloCond::VersionConflict
Thrown if object version in BLOB does not agree with class version.
Definition: Calorimeter/CaloCondBlobObjs/CaloCondBlobObjs/Exception.h:64
CaloNoise::m_lumi
float m_lumi
Definition: CaloNoise.h:103
CaloCondBlobAlgs_fillNoiseFromASCII.flt
flt
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:97
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
CaloNoise::getTileEffSigma
float getTileEffSigma(const IdentifierHash subHash, const int gain, const float e) const
Definition: CaloNoise.cxx:77
CaloCondUtils::getDbCaloGain
static unsigned int getDbCaloGain(int caloGain)
Returns the non-negative gainId to be used with the COOL DB.
Definition: CaloCondUtils.cxx:86
CaloNoise::PILEUP
@ PILEUP
Definition: CaloNoise.h:22
lumiFormat.lumi
lumi
Definition: lumiFormat.py:106
a
TList * a
Definition: liststreamerinfos.cxx:10
h
python.compareTCTs.ratio
ratio
Definition: compareTCTs.py:295
CaloNoise::m_tileHashOffset
unsigned m_tileHashOffset
Definition: CaloNoise.h:98
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
CaloNoise::m_tileBlob
const CaloCondBlobFlt * m_tileBlob
Definition: CaloNoise.h:102