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

#include <CaloCellGroup.h>

Collaboration diagram for CaloCellGroup:

Public Member Functions

 CaloCellGroup ()
 
bool setDefinition (const CaloCell_Base_ID *caloCellId, const std::string &definition, MsgStream &logStr)
 
bool inGroup (const Identifier id) const
 
const std::vector< float > & getValue () const
 
void printDef () const
 

Private Types

enum  Fields {
  LAYER, REGION, ETA, PHI,
  NFIELDS
}
 

Static Private Member Functions

static void complain (MsgStream &, const std::string &)
 

Private Attributes

bool m_pos
 
bool m_neg
 
bool m_emb
 
bool m_emecow
 
bool m_emeciw
 
bool m_hec
 
bool m_fcal
 
std::vector< std::pair< int, int > > m_fieldBoundaries
 
std::vector< float > m_values
 
const CaloCell_Base_IDm_caloCellId
 

Detailed Description

Definition at line 11 of file CaloCellGroup.h.

Member Enumeration Documentation

◆ Fields

enum CaloCellGroup::Fields
private
Enumerator
LAYER 
REGION 
ETA 
PHI 
NFIELDS 

Definition at line 28 of file CaloCellGroup.h.

28  {
29  LAYER,
30  REGION,
31  ETA,
32  PHI,
33  NFIELDS
34  };

Constructor & Destructor Documentation

◆ CaloCellGroup()

CaloCellGroup::CaloCellGroup ( )

Definition at line 10 of file CaloCellGroup.cxx.

10  :
11  m_pos(false),
12  m_neg(false),
13  m_emb(false),
14  m_emecow(false),
15  m_emeciw(false),
16  m_hec(false),
17  m_fcal(false),
18  m_caloCellId(nullptr)
19 {
20 }

Member Function Documentation

◆ complain()

void CaloCellGroup::complain ( MsgStream &  logStr,
const std::string &  problem 
)
staticprivate

Definition at line 219 of file CaloCellGroup.cxx.

219  {
220  logStr << MSG::ERROR << "Malformed definition string '"<<problem << "'" << endmsg;
221 }

◆ getValue()

const std::vector<float>& CaloCellGroup::getValue ( ) const
inline

Definition at line 20 of file CaloCellGroup.h.

20 {return m_values;}

◆ inGroup()

bool CaloCellGroup::inGroup ( const Identifier  id) const

Definition at line 166 of file CaloCellGroup.cxx.

166  {
167  //std::cout << "Check if in Group..";
168  if (!m_caloCellId) {
169  //throw exception;
170  //std::cout << "No Calo Cell Id" << std::endl;
171  return false;
172  };
173 
174  if (!m_caloCellId->is_lar(id))
175  return false; //Not a lar cell
176 
177  //std::cout << "have calo..";
178 
179  if (m_caloCellId->is_em_barrel(id) && !m_emb) return false;
180  if (m_caloCellId->is_em_endcap_inner(id) && !m_emeciw) return false;
181  if (m_caloCellId->is_em_endcap_outer(id) && !m_emecow) return false;
182  if (m_caloCellId->is_hec(id) && !m_hec) return false;
183  if (m_caloCellId->is_fcal(id) && !m_fcal) return false;
184 
185  //std::cout << "have subcalo..";
186 
187  //Check side
188  const int pn=m_caloCellId->pos_neg(id);
189  if (pn<0 && !m_neg) return false;
190  if (pn>0 && !m_pos) return false;
191 
192  //std::cout << "have side..";
193 
194  const int layer=m_caloCellId->sampling(id);
195  if (layer<m_fieldBoundaries[0].first || layer>m_fieldBoundaries[0].second) return false;
196 
197  //std::cout << "have layer..";
198 
199  const int region=m_caloCellId->region(id);
200  if (region<m_fieldBoundaries[1].first || region>m_fieldBoundaries[1].second) return false;
201 
202  //std::cout << "have region..";
203 
204  const int eta=m_caloCellId->eta(id);
205  if (eta<m_fieldBoundaries[2].first || eta>m_fieldBoundaries[2].second) return false;
206 
207 
208  //std::cout << "have eta..";
209 
210  const int phi=m_caloCellId->phi(id);
211  if (phi<m_fieldBoundaries[3].first || phi>m_fieldBoundaries[3].second) return false;
212 
213  //std::cout << "have phi..match! ";
214  return true;
215 }

◆ printDef()

void CaloCellGroup::printDef ( ) const

Definition at line 313 of file CaloCellGroup.cxx.

313  {
314 
315  std::cout << "Values";
316  for (std::size_t i=0;i<m_values.size();i++)
317  std::cout << " " << m_values[i];
318  std::cout << " will be used for the following region:" << std::endl;
319  std::cout << "SubCalos: " <<m_emb<<m_emecow<<m_emeciw<<m_hec <<m_fcal <<std::endl;
320  std::cout << "pos=" << m_pos << " neg=" << m_neg << std::endl;
321  std::cout << "Layer [" << m_fieldBoundaries[0].first << " - " << m_fieldBoundaries[0].second << "]" << std::endl;
322  std::cout << "Region [" << m_fieldBoundaries[1].first << " - " << m_fieldBoundaries[1].second << "]" << std::endl;
323  std::cout << "Eta [" << m_fieldBoundaries[2].first << " - " << m_fieldBoundaries[2].second << "]" << std::endl;
324  std::cout << "Phi [" << m_fieldBoundaries[3].first << " - " << m_fieldBoundaries[3].second << "]" << std::endl << std::endl;
325 }

◆ setDefinition()

bool CaloCellGroup::setDefinition ( const CaloCell_Base_ID caloCellId,
const std::string &  definition,
MsgStream &  logStr 
)

Definition at line 23 of file CaloCellGroup.cxx.

23  {
24  m_caloCellId=caloCellId;
25  m_fieldBoundaries.clear();
26  m_values.clear();
27  m_emb=false;
28  m_emecow=false;
29  m_emeciw=false;
30  m_hec=false;
31  m_fcal=false;
32  m_pos=false;
33  m_neg=false;
34 
35  std::vector<std::string> subdefs(2+NFIELDS);
36  std::string valuesStr;
37 
38  std::size_t pos1,pos2;
39  pos1=definition.find('[');
40  if( pos1==std::string::npos) {
41  complain(logStr,definition);
42  return false;
43  }
44 
45  std::size_t i,iField=0;
46  for (i=1+pos1;i<definition.size();i++) {
47  char c=definition[i];
48  if (isspace(c)) continue;
49  if (c==']') break;
50  if (c=='/') {
51  //std::cout << "Subfield " << iField << ": " << subdefs[iField] << std::endl;
52  iField++;
53  if (iField >= subdefs.size()) break;
54  }
55  else
56  subdefs[iField].push_back(c);
57  }
58 
59  if (iField!=subdefs.size()-1 || i==definition.size()) {
60  logStr << MSG::ERROR << "Definition String [" << definition << "] malformed. Expect "
61  << NFIELDS << " fileds separated by '/'" << endmsg;
62  return false;
63  }
64 
65  valuesStr=definition.substr(i+1);
66  //std::cout << "ValueStr " << valuesStr << std::endl;
67 
68  //Interpret subcalo-string (first field)
69  std::string& subCaloStr=subdefs[0];
70  size_t len;
71  pos1=0;
72  do {
73  pos2=subCaloStr.find(',',pos1);
74  if (pos2==std::string::npos)
75  len=subCaloStr.size();
76  else {
77  len=pos2-pos1;
78  pos1=pos2+1;
79  }
80  if (subCaloStr.compare(pos1,len,"EMB")==0)
81  m_emb=true;
82  else if(subCaloStr.compare(pos1,len,"EMECIW")==0)
83  m_emeciw=true;
84  else if(subCaloStr.compare(pos1,len,"EMECOW")==0)
85  m_emecow=true;
86  else if(subCaloStr.compare(pos1,len,"HEC")==0)
87  m_hec=true;
88  else if(subCaloStr.compare(pos1,len,"FCAL")==0)
89  m_fcal=true;
90  else {
91  logStr << MSG::ERROR << "Unknown sub-calo name '"<< subCaloStr.substr(pos1,len) <<"'found. "
92  << "Allowed values are EMB, EMECIW, EMECOW, HEC and FCAL" << endmsg;
93  return false;
94  }
95  }
96  while(pos2!=std::string::npos);
97 
98  //Interpret side-field (second field)
99  if (subdefs[1].size()!=1) {
100  complain(logStr,subdefs[1]);
101  return false;
102  }
103 
104  if (subdefs[1][0]=='A')
105  m_pos=true;
106  else if (subdefs[1][0]=='C')
107  m_neg=true;
108  else if (subdefs[1][0]=='*')
109  m_pos=m_neg=true;
110  else {
111  logStr << MSG::ERROR << "Allowed values for side are: A,C or * (means both), found " << subdefs[1] << endmsg;
112  return false;
113  }
114  //Interpret remaining fields
115  for (std::size_t i=0;i<NFIELDS;i++) {
116  std::string& subdef=subdefs[i+2];
117  int lower=std::numeric_limits<int>::min();
119  if (subdef.compare("*")!=0) {
120  std::size_t pos1=subdef.find('-');
121  if (pos1==std::string::npos) {
122  if (isdigit(subdef[0]))
123  lower=upper=atol(subdef.c_str());
124  else
125  logStr << MSG::ERROR << "Malformed string [" << subdef << "], expected numerical value!" << endmsg;
126  }
127  else {//Found '-'
128  std::string lStr=subdef.substr(0,pos1);
129  std::string uStr=subdef.substr(pos1+1);
130  if (!lStr.empty()) {
131  if (isdigit(lStr[0]))
132  lower=atol(lStr.c_str());
133  else
134  logStr << MSG::ERROR << "Malformed string [" << subdef << "], expected numerical value!" << endmsg;
135  }
136  if (!uStr.empty()) {
137  if (isdigit(uStr[0]))
138  upper=atol(uStr.c_str());
139  else
140  logStr << MSG::ERROR << "Malformed string [" << subdef << "], expected numerical value!" << endmsg;
141  }
142  }
143  }//end not *
144  m_fieldBoundaries.emplace_back(lower,upper);
145  }//end loop over fields
146 
147 
148  const char* ptr1=valuesStr.c_str();
149  char* ptr2;
150  float val;
151  //errno=0;
152  do {
153  val=strtof(ptr1,&ptr2);
154  if (ptr1!=ptr2)
155  m_values.push_back(val);
156  ptr1=const_cast<const char*>(ptr2+1);
157  }
158  while(*ptr2!='\0');
159 
160  logStr << MSG::INFO << "Sussefully parsed defintion string" << endmsg;
161  return true;
162 }

Member Data Documentation

◆ m_caloCellId

const CaloCell_Base_ID* CaloCellGroup::m_caloCellId
private

Definition at line 55 of file CaloCellGroup.h.

◆ m_emb

bool CaloCellGroup::m_emb
private

Definition at line 51 of file CaloCellGroup.h.

◆ m_emeciw

bool CaloCellGroup::m_emeciw
private

Definition at line 51 of file CaloCellGroup.h.

◆ m_emecow

bool CaloCellGroup::m_emecow
private

Definition at line 51 of file CaloCellGroup.h.

◆ m_fcal

bool CaloCellGroup::m_fcal
private

Definition at line 51 of file CaloCellGroup.h.

◆ m_fieldBoundaries

std::vector<std::pair<int,int> > CaloCellGroup::m_fieldBoundaries
private

Definition at line 52 of file CaloCellGroup.h.

◆ m_hec

bool CaloCellGroup::m_hec
private

Definition at line 51 of file CaloCellGroup.h.

◆ m_neg

bool CaloCellGroup::m_neg
private

Definition at line 50 of file CaloCellGroup.h.

◆ m_pos

bool CaloCellGroup::m_pos
private

Definition at line 50 of file CaloCellGroup.h.

◆ m_values

std::vector<float> CaloCellGroup::m_values
private

Definition at line 53 of file CaloCellGroup.h.


The documentation for this class was generated from the following files:
CaloCell_Base_ID::is_em_endcap_outer
bool is_em_endcap_outer(const Identifier id) const
test if the id belongs to the EM Endcap outer wheel
CaloCellGroup::m_fieldBoundaries
std::vector< std::pair< int, int > > m_fieldBoundaries
Definition: CaloCellGroup.h:52
CaloCellGroup::m_emecow
bool m_emecow
Definition: CaloCellGroup.h:51
CaloCell_Base_ID::region
int region(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
CaloCellGroup::ETA
@ ETA
Definition: CaloCellGroup.h:31
python.ZdcOnlineRecMonitorConfig.pn
pn
Definition: ZdcOnlineRecMonitorConfig.py:341
AtlasDetectorID::is_lar
bool is_lar(Identifier id) const
Definition: AtlasDetectorID.h:684
CaloCellGroup::REGION
@ REGION
Definition: CaloCellGroup.h:30
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
CaloCell_Base_ID::pos_neg
int pos_neg(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
python.SystemOfUnits.second
float second
Definition: SystemOfUnits.py:135
CaloCellGroup::NFIELDS
@ NFIELDS
Definition: CaloCellGroup.h:33
upper
int upper(int c)
Definition: LArBadChannelParser.cxx:49
CaloCellGroup::LAYER
@ LAYER
Definition: CaloCellGroup.h:29
CaloCell_Base_ID::is_hec
bool is_hec(const Identifier id) const
test if the id belongs to the HEC
CaloCellGroup::PHI
@ PHI
Definition: CaloCellGroup.h:32
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
CaloCellGroup::m_caloCellId
const CaloCell_Base_ID * m_caloCellId
Definition: CaloCellGroup.h:55
CaloCellGroup::m_emb
bool m_emb
Definition: CaloCellGroup.h:51
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloCell_Base_ID::is_fcal
bool is_fcal(const Identifier id) const
test if the id belongs to the FCAL - true also for MiniFCAL
CaloCell_Base_ID::sampling
int sampling(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
CaloCell_Base_ID::is_em_endcap_inner
bool is_em_endcap_inner(const Identifier id) const
test if the id belongs to the EM Endcap inner wheel
CaloCell_Base_ID::eta
int eta(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
CaloCellGroup::m_emeciw
bool m_emeciw
Definition: CaloCellGroup.h:51
CaloCell_Base_ID::is_em_barrel
bool is_em_barrel(const Identifier id) const
test if the id belongs to the EM barrel
CaloCellGroup::m_hec
bool m_hec
Definition: CaloCellGroup.h:51
CaloCellGroup::m_neg
bool m_neg
Definition: CaloCellGroup.h:50
CaloCell_Base_ID::phi
int phi(const Identifier id) const
LAr field values (NOT_VALID == invalid request)
CaloCellGroup::m_pos
bool m_pos
Definition: CaloCellGroup.h:50
python.Constants.INFO
int INFO
Definition: Control/AthenaCommon/python/Constants.py:15
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
AsgConfigHelper::strtof
bool strtof(const std::string &input, T &f)
Definition: AsgEGammaConfigHelper.cxx:48
DeMoScan.first
bool first
Definition: DeMoScan.py:534
CaloCellGroup::m_values
std::vector< float > m_values
Definition: CaloCellGroup.h:53
python.compressB64.c
def c
Definition: compressB64.py:93
CaloCellGroup::m_fcal
bool m_fcal
Definition: CaloCellGroup.h:51
CaloCellGroup::complain
static void complain(MsgStream &, const std::string &)
Definition: CaloCellGroup.cxx:219