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

#include <CaloCellGroup.h>

Collaboration diagram for CaloCellGroupList:

Public Member Functions

 CaloCellGroupList ()
 
bool setDefinition (const CaloCell_Base_ID *caloCellId, const std::vector< std::string > &definitions, MsgStream &logStr)
 
void dump (const CaloCell_Base_ID *caloCellId)
 
void printDef () const
 
const std::vector< float > & valuesForCell (const Identifier id)
 
const std::vector< float > & getDefaults () const
 

Private Attributes

std::vector< CaloCellGroupm_groups
 
std::vector< float > m_defaults
 
bool m_initialized
 

Detailed Description

Definition at line 59 of file CaloCellGroup.h.

Constructor & Destructor Documentation

◆ CaloCellGroupList()

CaloCellGroupList::CaloCellGroupList ( )
inline

Definition at line 61 of file CaloCellGroup.h.

61 :m_initialized(false) {};

Member Function Documentation

◆ dump()

void CaloCellGroupList::dump ( const CaloCell_Base_ID caloCellId)

Definition at line 283 of file CaloCellGroup.cxx.

283  {
284 
285  std::cout << "Definitions: " << std::endl;
286  for (size_t i=0;i<m_groups.size();i++) {
287  std::cout << "Group " << i << ":" << std::endl;
288  m_groups[i].printDef();
289  }
290  std::cout << "Results: "<< std::endl;
291  for (const Identifier& id : caloCellId->cell_range()) {
292  std::cout << "Values for " << caloCellId->show_to_string(id);
293  const std::vector<float>& x=this->valuesForCell(id);
294  std::cout << " [";
295  for (std::size_t i=0;i<x.size();i++)
296  std::cout << x[i] << " ";
297  std::cout << "]" << std::endl;
298  }
299  }

◆ getDefaults()

const std::vector<float>& CaloCellGroupList::getDefaults ( ) const
inline

Definition at line 72 of file CaloCellGroup.h.

72 {return m_defaults; }

◆ printDef()

void CaloCellGroupList::printDef ( ) const

Definition at line 301 of file CaloCellGroup.cxx.

301  {
302  std::cout << "Definitions: " << std::endl;
303  for (size_t i=0;i<m_groups.size();i++) {
304  std::cout << "Group " << i << ":" << std::endl;
305  m_groups[i].printDef();
306  }
307 
308 
309 
310 }

◆ setDefinition()

bool CaloCellGroupList::setDefinition ( const CaloCell_Base_ID caloCellId,
const std::vector< std::string > &  definitions,
MsgStream &  logStr 
)

Definition at line 225 of file CaloCellGroup.cxx.

226  {
227 
228  m_groups.clear();
229  m_defaults.clear();
230 
231  if (definitions.empty()) {
232  logStr << MSG::WARNING << "No definition string found" << endmsg;
233  return true;
234  }
235 
236 
237  const std::string& defaultValueStr=definitions[0];
238 
239  const char* ptr1=defaultValueStr.c_str();
240  char* ptr2;
241  float val;
242  //errno=0;
243  do {
244  val=strtof(ptr1,&ptr2);
245  if (ptr1!=ptr2)
246  m_defaults.push_back(val);
247  ptr1=const_cast<const char*>(ptr2+1);
248  }
249  while(*ptr2!='\0');
250 
251 
252  m_groups.resize(definitions.size()-1);
253  for (size_t i=0;i<m_groups.size();i++) {
254  bool s=m_groups[i].setDefinition(caloCellId,definitions[i+1],logStr);
255  if (!s) return false;
256  if (m_groups[i].getValue().size()!=m_defaults.size()) {
257  logStr << MSG::ERROR << "Incosistent number of values!" << endmsg;
258  return false;
259  }
260  }
261  m_initialized=true;
262  return true;
263 }

◆ valuesForCell()

const std::vector< float > & CaloCellGroupList::valuesForCell ( const Identifier  id)

Definition at line 266 of file CaloCellGroup.cxx.

266  {
267  if (!m_initialized) {
268  //throw exception
269  return m_defaults;
270  }
271 
272  const std::vector<float>* result=&m_defaults;
273 
274  std::vector<CaloCellGroup>::const_iterator it=m_groups.begin();
275  std::vector<CaloCellGroup>::const_iterator it_e=m_groups.end();
276  for(;it!=it_e;++it) {
277  //std::cout << " G " << i++;
278  if (it->inGroup(id)) result=&(it->getValue());
279  }
280  return *result;
281 }

Member Data Documentation

◆ m_defaults

std::vector<float> CaloCellGroupList::m_defaults
private

Definition at line 76 of file CaloCellGroup.h.

◆ m_groups

std::vector<CaloCellGroup> CaloCellGroupList::m_groups
private

Definition at line 75 of file CaloCellGroup.h.

◆ m_initialized

bool CaloCellGroupList::m_initialized
private

Definition at line 77 of file CaloCellGroup.h.


The documentation for this class was generated from the following files:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
get_generator_info.result
result
Definition: get_generator_info.py:21
skel.it
it
Definition: skel.GENtoEVGEN.py:396
x
#define x
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
CaloCellGroupList::m_initialized
bool m_initialized
Definition: CaloCellGroup.h:77
CaloCell_Base_ID::cell_range
id_range cell_range(void) const
Range over full set of Identifiers (LAr + Tiles)
CaloCellGroupList::m_groups
std::vector< CaloCellGroup > m_groups
Definition: CaloCellGroup.h:75
AtlasDetectorID::show_to_string
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:574
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
AsgConfigHelper::strtof
bool strtof(const std::string &input, T &f)
Definition: AsgEGammaConfigHelper.cxx:47
CaloCellGroupList::m_defaults
std::vector< float > m_defaults
Definition: CaloCellGroup.h:76
CaloCellGroupList::valuesForCell
const std::vector< float > & valuesForCell(const Identifier id)
Definition: CaloCellGroup.cxx:266
Identifier
Definition: IdentifierFieldParser.cxx:14