ATLAS Offline Software
Loading...
Searching...
No Matches
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 284 of file CaloCellGroup.cxx.

284 {
285
286 std::cout << "Definitions: " << std::endl;
287 for (size_t i=0;i<m_groups.size();i++) {
288 std::cout << "Group " << i << ":" << std::endl;
289 m_groups[i].printDef();
290 }
291 std::cout << "Results: "<< std::endl;
292 for (const Identifier& id : caloCellId->cell_range()) {
293 std::cout << "Values for " << caloCellId->show_to_string(id);
294 const std::vector<float>& x=this->valuesForCell(id);
295 std::cout << " [";
296 for (std::size_t i=0;i<x.size();i++)
297 std::cout << x[i] << " ";
298 std::cout << "]" << std::endl;
299 }
300 }
#define x
std::vector< CaloCellGroup > m_groups
const std::vector< float > & valuesForCell(const Identifier id)
std::string show_to_string(const Identifier id, const IdContext *context=0, char sep='.') const
id_range cell_range() const
Range over full set of Identifiers (LAr + Tiles)

◆ getDefaults()

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

Definition at line 72 of file CaloCellGroup.h.

72{return m_defaults; }
std::vector< float > m_defaults

◆ printDef()

void CaloCellGroupList::printDef ( ) const

Definition at line 302 of file CaloCellGroup.cxx.

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

◆ setDefinition()

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

Definition at line 226 of file CaloCellGroup.cxx.

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

◆ valuesForCell()

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

Definition at line 267 of file CaloCellGroup.cxx.

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

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: