ATLAS Offline Software
CaloCondUtils.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "GaudiKernel/MsgStream.h"
9 #include <iomanip>
10 
11 //
12 //___________________________________________________________
13 //std::map<CaloCondUtils::SYSTEM,unsigned int> CaloCondUtils::m_nCells;
14 
15 //
16 //___________________________________________________________
17 unsigned int
19 {
20  return static_cast<unsigned int>(sys);
21 }
22 
23 //
24 //___________________________________________________________
25 unsigned int
27 {
28  /*
29  //=== initialize on first usage
30  if(!m_nCells.size()){
31  m_nCells[EMECZNEG] = 31872;
32  m_nCells[EMBZNEG ] = 54784;
33  m_nCells[EMBZPOS ] = 54784;
34  m_nCells[EMECZPOS] = 31872;
35  m_nCells[HEC ] = 5632;
36  m_nCells[FCAL ] = 3524;
37  m_nCells[TILE ] = 5184;
38  }
39  */
40 
41  switch (sys) {
42  case EMBZNEG:
43  return 54784;
44  break;
45  case EMBZPOS:
46  return 54784;
47  break;
48  case EMECZNEG:
49  return 31872;
50  break;
51  case EMECZPOS:
52  return 31872;
53  break;
54  case HEC:
55  return 5632;
56  break;
57  case TILE:
58  return 5184;
59  break;
60  case FCAL:
61  return 3524;
62  break;
63  }
64 
65  return 0;
66 }
67 
68 //
69 //_____________________________________________________________________________
70 std::string
71 CaloCondUtils::getFullTag(const std::string& folder, const std::string& tag)
72 {
73  std::string folderTag("");
74  //Copy folder name, ommiting slashes
75  for (const char i : folder) {
76  if (i!='/') {
77  folderTag+=i;
78  }
79  }
80  return (folderTag+"-"+tag);
81 }
82 
83 //
84 //_____________________________________________________________________________
85 unsigned int
87  // enum CaloGain {
88  // TILELOWLOW =-16 ,
89  // TILELOWHIGH =-15 ,
90  // TILEHIGHLOW = -12,
91  // TILEHIGHHIGH = -11,
92  // TILEONELOW =-4,
93  // TILEONEHIGH =-3,
94  // INVALIDGAIN = -1, LARHIGHGAIN = 0, LARMEDIUMGAIN = 1, LARLOWGAIN = 2,
95  // LARNGAIN =3,
96  // UNKNOWNGAIN=4};
97 {
98 
99  //=== do nothing for LAr gains
100  if(caloGain>=0 && caloGain<=2) return static_cast<unsigned int>(caloGain);
101 
102  //=== translate tile gains
103  if(caloGain==-16) return 0; //LOWLOW
104  if(caloGain==-15) return 1; //LOWHIGH
105  if(caloGain==-12) return 2; //HIGHLOW
106  if(caloGain==-11) return 3; //HIGHHIGH
107  if(caloGain== -4) return 0; //ONELOW
108  if(caloGain== -3) return 3; //ONEHIGH
109 
110  //=== invalid gain
111  {
112  MsgStream log(Athena::getMessageSvc(), "CaloCondUtils::getDbCaloGain");
113  log << MSG::WARNING << "invalid gain found... probably corrupted data /badly decoded ? returns DbCaloGain 0" << endmsg;
114  return 0;
115  }
116  //throw CaloCond::InvalidCaloGain("CaloCondUtils::getDbCaloGain()", caloGain);
117 }
118 
119 
120 
CaloCondUtils::EMECZPOS
@ EMECZPOS
Definition: CaloCondUtils.h:22
CaloCondUtils::FCAL
@ FCAL
Definition: CaloCondUtils.h:24
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
CaloCondUtils::HEC
@ HEC
Definition: CaloCondUtils.h:23
CaloCondUtils::TILE
@ TILE
Definition: CaloCondUtils.h:25
CaloCondUtils::SYSTEM
SYSTEM
Definition: CaloCondUtils.h:19
CaloCondUtils.h
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
Exception.h
CaloCondUtils::getFullTag
static std::string getFullTag(const std::string &folder, const std::string &tag)
Returns the full tag string, composed of camelized folder name and tag part.
Definition: CaloCondUtils.cxx:71
CaloCondUtils::EMECZNEG
@ EMECZNEG
Definition: CaloCondUtils.h:19
lumiFormat.i
int i
Definition: lumiFormat.py:92
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
CaloCondUtils::EMBZNEG
@ EMBZNEG
Definition: CaloCondUtils.h:20
CaloCondUtils::getNCells
static unsigned int getNCells(const SYSTEM sys)
Returns the number of cells for a given system.
Definition: CaloCondUtils.cxx:26
CaloCondUtils::getDbCaloGain
static unsigned int getDbCaloGain(int caloGain)
Returns the non-negative gainId to be used with the COOL DB.
Definition: CaloCondUtils.cxx:86
CaloCondBlobAlgs_fillNoiseFromASCII.folderTag
folderTag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:52
CaloCondUtils::getCoolChannelId
static unsigned int getCoolChannelId(const SYSTEM sys)
Returns the cool channel id associated with a given system.
Definition: CaloCondUtils.cxx:18
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
CaloCondBlobAlgs_fillNoiseFromASCII.folder
folder
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:56
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
CaloCondUtils::EMBZPOS
@ EMBZPOS
Definition: CaloCondUtils.h:21