ATLAS Offline Software
Loading...
Searching...
No Matches
CaloCondBlobFlt.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include <iostream>
7#include <cmath>
8
9//
10//_____________________________________________________________
13{
14 return (new CaloCondBlobFlt(blob));
15}
16//
17//_____________________________________________________________
18const CaloCondBlobFlt*
19CaloCondBlobFlt::getInstance(const coral::Blob& blob)
20{
21 return (new CaloCondBlobFlt(blob));
22}
23
24//
25//_______________________________________________________________
26CaloCondBlobFlt::CaloCondBlobFlt(const coral::Blob& blob)
27 : CaloCondBlobDat<float>(blob)
28{
29 //=== check for correct blob type
30 if(getBlobSize()){
32 throw CaloCond::TypeConflict("CaloCondBlobFlt::Ctor",getObjType(),CaloCondBlobFlt::getType());
33 }
34 }
35}
36
37//
38//_______________________________________________________________
40 : CaloCondBlobDat<float>(blob)
41{
42 //=== check for correct blob type
43 if(getBlobSize()){
45 throw CaloCond::TypeConflict("CaloCondBlobFlt::Ctor",getObjType(),CaloCondBlobFlt::getType());
46 }
47 }
48}
49
50//
51//______________________________________________________________
52float
53CaloCondBlobFlt::getCalib(unsigned int channel, unsigned int adc, float x, bool invert) const
54{
55 //=== interpretation of data depends on the objVersion
56 if(getObjVersion()==1){
57 //=== Total noise parameterized as
58 //=== Sigma**2 = a**2 + b**2 * Lumi
59 float a = getData(channel,adc,0);
60 float b = getData(channel,adc,1);
61 if(invert){ x = (x*x - a*a) / (b*b) ;}
62 else { x = std::sqrt( a*a + b*b*x );}
63 }
64 else if (getObjVersion()==2) {
65 //== parameterization for pedestal = a + b*Lumi
66 float a = getData(channel,adc,0);
67 float b = getData(channel,adc,1);
68 if(invert){ x = (x - a) / (b) ;}
69 else { x = a+b*x;}
70 }
71 else{
72 throw CaloCond::VersionConflict("CaloCondBlobFlt::getCalib",getObjVersion());
73 }
74
75 return x;
76}
static Double_t a
#define x
uint16_t getObjVersion() const
CaloCondBlobDat(const coral::Blob &blob)
float getData(const unsigned int channel, const unsigned int adc, const unsigned int idx) const
Class for storing a number of floats (Flt) and functions on those.
virtual uint16_t getType() const
Returns CaloCondType::FLT.
static CaloCondBlobFlt * getInstance(coral::Blob &blob)
Returns a pointer to a non-const CaloCondBlobFlt.
float getCalib(unsigned int channel, unsigned int adc, float x, bool invert=false) const
Returns the calibrated energy for a given channel/gain and input energy.
CaloCondBlobFlt(const coral::Blob &blob)
Ctor.
Thrown if object type in BLOB does not agree with class type.
Thrown if object version in BLOB does not agree with class version.