ATLAS Offline Software
CaloInfo.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <iostream>
7 
8 using namespace std;
9 using namespace TrigConf;
10 
11 CaloInfo::CaloInfo()
12  : L1DataBaseclass(),
13  m_GlobalScale( 1 ),
14  m_JetWeights(),
15  m_CaloSinCos(),
16  m_METSigParam(),
17  m_IsolationHAIsoForEMthr( 5 ),
18  m_IsolationEMIsoForEMthr( 5 ),
19  m_IsolationEMIsoForTAUthr( 5 ),
20  m_tobEM(),
21  m_tobTau(),
22  m_tobJetSmall(),
23  m_tobJetLarge(),
24  m_JetWindowSizeSmall( 0 ),
25  m_JetWindowSizeLarge( 0 )
26 {}
27 
28 void
30  m_JetWeights.push_back(jw);
31 }
32 
33 
34 void
36  m_CaloSinCos.push_back(csc);
37 }
38 
39 void
41  m_GlobalScale = 1;
42  m_CaloSinCos.clear();
43  m_JetWeights.clear();
44 
48 
49  m_IsolationHAIsoForEMthr.resize(5);
50  m_IsolationEMIsoForEMthr.resize(5);
51  m_IsolationEMIsoForTAUthr.resize(5);
52 
53 }
54 
55 
56 void
57 CaloInfo::setIsolation(const std::string & isothrtype, unsigned int bit, const IsolationParam & isopar) {
58  if(bit<1 || bit>5) {
59  cout << "Isolation bit is outside the range [1,5] : " << bit << " - not being used" << endl;
60  return;
61  }
62  if(isothrtype=="HAIsoForEMthr") {
63  m_IsolationHAIsoForEMthr[bit-1] = isopar;
64  } else if(isothrtype=="EMIsoForEMthr") {
65  m_IsolationEMIsoForEMthr[bit-1] = isopar;
66  } else if(isothrtype=="EMIsoForTAUthr") {
67  m_IsolationEMIsoForTAUthr[bit-1] = isopar;
68  } else {
69  cout << "Isolation threshold " << isothrtype << " is unknown [HAIsoForEMthr, EMIsoForEMthr, EMIsoForTAUthr] - not being used" << endl;
70  }
71 }
72 
73 
74 void
75 CaloInfo::print(const std::string& indent, unsigned int /*detail*/) const {
76 
77  cout << indent << "================================================ " << endl;
78  cout << indent << "CaloInfo: " << endl;
80  cout << indent << " Global em scale : " << globalEmScale() << endl;
81  cout << indent << " Global jet scale: " << globalJetScale() << endl;
82  if(m_JetWeights.size()>0) {
83  cout << indent << " JetWeights: ";
84  for(unsigned int i=0; i<m_JetWeights.size(); ++i) {
85  cout << i << ": " << m_JetWeights[i] << ", ";
86  if((i+1)%6==0) cout << endl;
87  if(i==5) cout << indent << " ";
88  }
89  }
91  for(const IsolationParam & isop : m_IsolationHAIsoForEMthr) {
92  isop.print(indent);
93  }
94  cout << "================================================ " << endl;
95 }
96 
97 void
98 TrigConf::CaloInfo::writeXML(std::ostream & xmlfile, int indentLevel, int indentWidth) const {
99 
100  indent(xmlfile, indentLevel, indentWidth)
101  << "<CaloInfo name=\""<< name() <<"\" global_em_scale=\""<< globalEmScale() <<"\" global_jet_scale=\""<< globalJetScale() <<"\">" << endl;
102 
103  bool hasJetWeights(false);
104  for(int jw : m_JetWeights) // check if there is a jetweight that is not 0
105  if(jw!=0) hasJetWeights = true;
106 
107  if(hasJetWeights) {
108  unsigned int num(1);
109  for(int jw : m_JetWeights)
110  indent(xmlfile, indentLevel+1, indentWidth)
111  << "<JetWeight num=\"" << num++ << "\" weight=\""<< jw <<"\"/>" << endl;
112  }
113 
114  metSigParam().writeXML(xmlfile, indentLevel+1, indentWidth);
115 
116  // isolation parametrization
117  indent(xmlfile, indentLevel+1, indentWidth)
118  << "<Isolation thrtype=\"HAIsoForEMthr\">" << endl;
119  for(const IsolationParam & isop : m_IsolationHAIsoForEMthr)
120  isop.writeXML(xmlfile, indentLevel+2, indentWidth);
121  indent(xmlfile, indentLevel+1, indentWidth)
122  << "</Isolation>" << endl;
123 
124  indent(xmlfile, indentLevel+1, indentWidth)
125  << "<Isolation thrtype=\"EMIsoForEMthr\">" << endl;
126  for(const IsolationParam & isop : m_IsolationEMIsoForEMthr)
127  isop.writeXML(xmlfile, indentLevel+2, indentWidth);
128  indent(xmlfile, indentLevel+1, indentWidth)
129  << "</Isolation>" << endl;
130 
131  indent(xmlfile, indentLevel+1, indentWidth)
132  << "<Isolation thrtype=\"EMIsoForTAUthr\">" << endl;
133  for(const IsolationParam & isop : m_IsolationEMIsoForTAUthr)
134  isop.writeXML(xmlfile, indentLevel+2, indentWidth);
135  indent(xmlfile, indentLevel+1, indentWidth)
136  << "</Isolation>" << endl;
137 
138 
139  indent(xmlfile, indentLevel+1, indentWidth)
140  << "<MinimumTOBPt thrtype=\"EM\" ptmin=\"" << m_tobEM.ptmin << "\" etamin=\"" << m_tobEM.etamin << "\" etamax=\"" << m_tobEM.etamax << "\" priority=\"" << m_tobEM.priority << "\"/>" << endl;
141  indent(xmlfile, indentLevel+1, indentWidth)
142  << "<MinimumTOBPt thrtype=\"TAU\" ptmin=\"" << m_tobTau.ptmin << "\" etamin=\"" << m_tobTau.etamin << "\" etamax=\"" << m_tobTau.etamax << "\" priority=\"" << m_tobTau.priority << "\"/>" << endl;
143  indent(xmlfile, indentLevel+1, indentWidth)
144  << "<MinimumTOBPt thrtype=\"JETS\" window=\"" << m_JetWindowSizeSmall << "\" ptmin=\"" << m_tobJetSmall.ptmin << "\" etamin=\"" << m_tobJetSmall.etamin << "\" etamax=\"" << m_tobJetSmall.etamax << "\" priority=\"" << m_tobJetSmall.priority << "\"/>" << endl;
145  indent(xmlfile, indentLevel+1, indentWidth)
146  << "<MinimumTOBPt thrtype=\"JETL\" window=\"" << m_JetWindowSizeLarge << "\" ptmin=\"" << m_tobJetLarge.ptmin << "\" etamin=\"" << m_tobJetLarge.etamin << "\" etamax=\"" << m_tobJetLarge.etamax << "\" priority=\"" << m_tobJetLarge.priority << "\"/>" << endl;
147 
148 
149  indent(xmlfile, indentLevel, indentWidth) << "</CaloInfo>" << endl;
150 
151 }
152 
TrigConf::CaloInfo::writeXML
void writeXML(std::ostream &xmlfile, int indentLevel=0, int indentWidth=2) const
Definition: CaloInfo.cxx:98
TrigConf::CaloSinCos
Definition: CaloSinCos.h:13
TrigConf::CaloInfo::addCaloSinCos
void addCaloSinCos(const CaloSinCos &)
Definition: CaloInfo.cxx:35
TrigConf::CaloInfo::m_IsolationHAIsoForEMthr
std::vector< IsolationParam > m_IsolationHAIsoForEMthr
Definition: CaloInfo.h:96
TrigConf::CaloInfo::m_GlobalScale
float m_GlobalScale
Definition: CaloInfo.h:89
TrigConf::CaloInfo::clear
void clear()
Definition: CaloInfo.cxx:40
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition: Config.h:22
TrigConf::CaloInfo::m_IsolationEMIsoForTAUthr
std::vector< IsolationParam > m_IsolationEMIsoForTAUthr
Definition: CaloInfo.h:98
TrigConf::CaloInfo::m_IsolationEMIsoForEMthr
std::vector< IsolationParam > m_IsolationEMIsoForEMthr
Definition: CaloInfo.h:97
geometry_dat_to_json.indent
indent
Definition: geometry_dat_to_json.py:18
lumiFormat.i
int i
Definition: lumiFormat.py:92
CaloInfo.h
TrigConf::IsolationParam
Definition: IsolationParam.h:16
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
TrigConf::CaloInfo::m_CaloSinCos
std::vector< CaloSinCos > m_CaloSinCos
Definition: CaloInfo.h:93
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
TrigConf::CaloInfo::globalJetScale
float globalJetScale() const
Definition: CaloInfo.h:44
TrigConf::CaloInfo::m_JetWeights
std::vector< int > m_JetWeights
Definition: CaloInfo.h:92
TrigConf::CaloInfo::setIsolation
void setIsolation(const std::string &isothrtype, unsigned int bit, const IsolationParam &isopar)
Definition: CaloInfo.cxx:57
TrigConf::TrigConfData::indent
std::ostream & indent(std::ostream &o, int lvl, int size) const
Definition: TrigConfData.cxx:23
TrigConf::CaloInfo::addJetWeight
void addJetWeight(int)
Definition: CaloInfo.cxx:29
TrigConf::L1DataBaseclass
Definition: L1DataBaseclass.h:22
TrigConf::METSigParam::print
virtual void print(const std::string &indent="", unsigned int detail=1) const
Definition: METSigParam.cxx:64
TrigConf::CaloInfo::globalEmScale
float globalEmScale() const
Definition: CaloInfo.h:43
TrigConf::CaloInfo::print
virtual void print(const std::string &indent="", unsigned int detail=1) const override
Definition: CaloInfo.cxx:75
TrigConf::CaloInfo::m_METSigParam
METSigParam m_METSigParam
Definition: CaloInfo.h:94
TrigConf::TrigConfData::printNameIdV
void printNameIdV(const std::string &indent="") const
Definition: TrigConfData.cxx:31