ATLAS Offline Software
Loading...
Searching...
No Matches
L1CaloRxLayersContainer Class Reference

Container of L1CaloRxLayers objects, inherit from the abstract base class AbstractL1CaloConditionContainer. More...

#include <L1CaloRxLayersContainer.h>

Inheritance diagram for L1CaloRxLayersContainer:
Collaboration diagram for L1CaloRxLayersContainer:

Public Types

enum  eCoolFolders { eRxLayers }
typedef std::map< unsigned int, L1CaloRxLayersL1CaloRxLayersMap
typedef L1CaloRxLayersMap::const_iterator const_iterator

Public Member Functions

 L1CaloRxLayersContainer ()
 L1CaloRxLayersContainer (const std::map< L1CaloRxLayersContainer::eCoolFolders, std::string > &folderKeysMap)
virtual ~L1CaloRxLayersContainer ()
virtual DataObject * makePersistent () const
virtual void makeTransient (const std::map< std::string, const CondAttrListCollection * > &condAttrListCollectionMap)
const L1CaloRxLayersrxLayers (unsigned int channelId) const
const L1CaloRxLayersrxLayers (const L1CaloRxCoolChannelId &channelId) const
void addRxLayers (unsigned int channelId, L1CaloRxLayers &&rxLayers)
void addRxLayers (const L1CaloRxCoolChannelId &channelId, L1CaloRxLayers &&rxLayers)
const_iterator begin () const
const_iterator end () const
virtual std::vector< std::string > coolInputKeys () const
virtual std::string coolOutputKey () const
virtual void clear ()
virtual void makeTransient (const std::map< std::string, const AthenaAttributeList * > &condAttributeList)
std::string specificationName (int specId) const
std::string specificationType (int specId) const
void addSpecification (int specId, const std::string &specName, const std::string &specType)
coral::AttributeListSpecification * createAttributeListSpecification () const
virtual std::string conditionType () const

Private Types

enum  eAttrSpecification {
  eNLayers , eName1 , eName2 , eName3 ,
  eName4 , eNCells1 , eNCells2 , eNCells3 ,
  eNCells4
}
typedef std::map< int, std::string > AttrSpecificationMap

Private Member Functions

std::string coolFolderKey (L1CaloRxLayersContainer::eCoolFolders efolder) const

Private Attributes

L1CaloRxLayersMap m_mRxLayersMap
std::map< L1CaloRxLayersContainer::eCoolFolders, std::string > m_mCoolFoldersKeysMap
AttrSpecificationMap m_attrSpecificationNameMap
AttrSpecificationMap m_attrSpecificationTypeMap
std::string m_strConditionType

Detailed Description

Container of L1CaloRxLayers objects, inherit from the abstract base class AbstractL1CaloConditionContainer.

Implement the IL1CaloPersistenceCapable interface.

Author
Peter Faulkner

Definition at line 28 of file L1CaloRxLayersContainer.h.

Member Typedef Documentation

◆ AttrSpecificationMap

typedef std::map<int, std::string> AbstractL1CaloPersistentCondition::AttrSpecificationMap
privateinherited

Definition at line 50 of file AbstractL1CaloPersistentCondition.h.

◆ const_iterator

typedef L1CaloRxLayersMap::const_iterator L1CaloRxLayersContainer::const_iterator

Definition at line 37 of file L1CaloRxLayersContainer.h.

◆ L1CaloRxLayersMap

Definition at line 36 of file L1CaloRxLayersContainer.h.

Member Enumeration Documentation

◆ eAttrSpecification

◆ eCoolFolders

Enumerator
eRxLayers 

Definition at line 39 of file L1CaloRxLayersContainer.h.

Constructor & Destructor Documentation

◆ L1CaloRxLayersContainer() [1/2]

L1CaloRxLayersContainer::L1CaloRxLayersContainer ( )

Definition at line 14 of file L1CaloRxLayersContainer.cxx.

14 :AbstractL1CaloPersistentCondition("CondAttrListCollection") {
15 // Define DB rows names and types in order to construct the AttributeListSpecification object
16 this->addSpecification(eNLayers, std::string("NLayers"), std::string("unsigned char"));
17 this->addSpecification(eName1, std::string("Name1"), std::string("unsigned char"));
18 this->addSpecification(eName2, std::string("Name2"), std::string("unsigned char"));
19 this->addSpecification(eName3, std::string("Name3"), std::string("unsigned char"));
20 this->addSpecification(eName4, std::string("Name4"), std::string("unsigned char"));
21 this->addSpecification(eNCells1, std::string("NCells1"), std::string("unsigned char"));
22 this->addSpecification(eNCells2, std::string("NCells2"), std::string("unsigned char"));
23 this->addSpecification(eNCells3, std::string("NCells3"), std::string("unsigned char"));
24 this->addSpecification(eNCells4, std::string("NCells4"), std::string("unsigned char"));
25
26 m_mCoolFoldersKeysMap[L1CaloRxLayersContainer::eRxLayers] = std::string("/TRIGGER/L1Calo/V1/Results/RxLayers");
27}
AbstractL1CaloPersistentCondition(const std::string &condType)
void addSpecification(int specId, const std::string &specName, const std::string &specType)
std::map< L1CaloRxLayersContainer::eCoolFolders, std::string > m_mCoolFoldersKeysMap

◆ L1CaloRxLayersContainer() [2/2]

L1CaloRxLayersContainer::L1CaloRxLayersContainer ( const std::map< L1CaloRxLayersContainer::eCoolFolders, std::string > & folderKeysMap)

Definition at line 29 of file L1CaloRxLayersContainer.cxx.

29 :
30 AbstractL1CaloPersistentCondition("CondAttrListCollection"),
31 m_mCoolFoldersKeysMap(folderKeysMap)
32{
33 // Define DB rows names and types in order to construct the AttributeListSpecification object
34 this->addSpecification(eNLayers, std::string("NLayers"), std::string("unsigned char"));
35 this->addSpecification(eName1, std::string("Name1"), std::string("unsigned char"));
36 this->addSpecification(eName2, std::string("Name2"), std::string("unsigned char"));
37 this->addSpecification(eName3, std::string("Name3"), std::string("unsigned char"));
38 this->addSpecification(eName4, std::string("Name4"), std::string("unsigned char"));
39 this->addSpecification(eNCells1, std::string("NCells1"), std::string("unsigned char"));
40 this->addSpecification(eNCells2, std::string("NCells2"), std::string("unsigned char"));
41 this->addSpecification(eNCells3, std::string("NCells3"), std::string("unsigned char"));
42 this->addSpecification(eNCells4, std::string("NCells4"), std::string("unsigned char"));
43}

◆ ~L1CaloRxLayersContainer()

virtual L1CaloRxLayersContainer::~L1CaloRxLayersContainer ( )
inlinevirtual

Definition at line 43 of file L1CaloRxLayersContainer.h.

43{};

Member Function Documentation

◆ addRxLayers() [1/2]

void L1CaloRxLayersContainer::addRxLayers ( const L1CaloRxCoolChannelId & channelId,
L1CaloRxLayers && rxLayers )

Definition at line 175 of file L1CaloRxLayersContainer.cxx.

175 {
176 this->addRxLayers(channelId.id(), std::move(rxLayers));
177}
const L1CaloRxLayers * rxLayers(unsigned int channelId) const
void addRxLayers(unsigned int channelId, L1CaloRxLayers &&rxLayers)

◆ addRxLayers() [2/2]

void L1CaloRxLayersContainer::addRxLayers ( unsigned int channelId,
L1CaloRxLayers && rxLayers )

Definition at line 171 of file L1CaloRxLayersContainer.cxx.

171 {
172 m_mRxLayersMap[channelId] = std::move(rxLayers);
173}

◆ addSpecification()

void AbstractL1CaloPersistentCondition::addSpecification ( int specId,
const std::string & specName,
const std::string & specType )
inherited

Definition at line 26 of file AbstractL1CaloPersistentCondition.cxx.

26 {
27 m_attrSpecificationNameMap[specId] = specName;
28 m_attrSpecificationTypeMap[specId] = specType;
29}

◆ begin()

const_iterator L1CaloRxLayersContainer::begin ( ) const
inline

Definition at line 58 of file L1CaloRxLayersContainer.h.

58{ return m_mRxLayersMap.begin(); };

◆ clear()

void L1CaloRxLayersContainer::clear ( )
virtual

Reimplemented from AbstractL1CaloPersistentCondition.

Definition at line 179 of file L1CaloRxLayersContainer.cxx.

179 {
180 m_mRxLayersMap.clear();
181}

◆ conditionType()

virtual std::string AbstractL1CaloPersistentCondition::conditionType ( ) const
inlinevirtualinherited

◆ coolFolderKey()

std::string L1CaloRxLayersContainer::coolFolderKey ( L1CaloRxLayersContainer::eCoolFolders efolder) const
private

Definition at line 45 of file L1CaloRxLayersContainer.cxx.

45 {
46
47 std::map<L1CaloRxLayersContainer::eCoolFolders, std::string>::const_iterator it = m_mCoolFoldersKeysMap.find(efolder);
48 if(it!=m_mCoolFoldersKeysMap.end()) {
49 return it->second;
50 } else {
51 return std::string("");
52 }
53}

◆ coolInputKeys()

std::vector< std::string > L1CaloRxLayersContainer::coolInputKeys ( ) const
virtual

Reimplemented from AbstractL1CaloPersistentCondition.

Definition at line 55 of file L1CaloRxLayersContainer.cxx.

55 {
56 std::vector<std::string> v;
58 return v;
59}
std::string coolFolderKey(L1CaloRxLayersContainer::eCoolFolders efolder) const

◆ coolOutputKey()

std::string L1CaloRxLayersContainer::coolOutputKey ( ) const
virtual

Reimplemented from AbstractL1CaloPersistentCondition.

Definition at line 61 of file L1CaloRxLayersContainer.cxx.

◆ createAttributeListSpecification()

coral::AttributeListSpecification * AbstractL1CaloPersistentCondition::createAttributeListSpecification ( ) const
inherited

Definition at line 31 of file AbstractL1CaloPersistentCondition.cxx.

31 {
32
33 coral::AttributeListSpecification* attrSpecification = new coral::AttributeListSpecification();
34
35 AttrSpecificationMap::const_iterator it_name = m_attrSpecificationNameMap.begin();
36 AttrSpecificationMap::const_iterator it_type = m_attrSpecificationTypeMap.begin();
37
38 for(;it_name!=m_attrSpecificationNameMap.end();++it_name,++it_type) {
39 attrSpecification->extend(it_name->second, it_type->second);
40 }
41 return attrSpecification;
42}

◆ end()

const_iterator L1CaloRxLayersContainer::end ( ) const
inline

Definition at line 59 of file L1CaloRxLayersContainer.h.

59{ return m_mRxLayersMap.end(); };

◆ makePersistent()

DataObject * L1CaloRxLayersContainer::makePersistent ( ) const
virtual

Reimplemented from AbstractL1CaloPersistentCondition.

Definition at line 65 of file L1CaloRxLayersContainer.cxx.

65 {
66 if(m_mRxLayersMap.size()==0) return 0;
67
68 // Create AttributeListSpecification according to the attributes to be recorded
69 // this is required to create the AttributeList objs
70 coral::AttributeListSpecification* attrSpecification = this->createAttributeListSpecification();
71 if(!attrSpecification->size()) return NULL;
72
73 CondAttrListCollection* attrListCollection = new CondAttrListCollection(true);
74
75 L1CaloRxLayersMap::const_iterator pos = m_mRxLayersMap.begin();
76 L1CaloRxLayersMap::const_iterator end = m_mRxLayersMap.end();
77 for(; pos!=end; ++pos) {
78 const unsigned int channelId = pos->first;
79 const L1CaloRxLayers& p = pos->second;
80 const std::vector<int>& names(p.names());
81 const std::vector<int>& ncells(p.ncells());
82 const unsigned char nlayers = names.size();
83 const unsigned char name1 = (nlayers > 0) ? names[0] : 0;
84 const unsigned char name2 = (nlayers > 1) ? names[1] : 0;
85 const unsigned char name3 = (nlayers > 2) ? names[2] : 0;
86 const unsigned char name4 = (nlayers > 3) ? names[3] : 0;
87 const unsigned char ncells1 = (nlayers > 0) ? ncells[0] : 0;
88 const unsigned char ncells2 = (nlayers > 1) ? ncells[1] : 0;
89 const unsigned char ncells3 = (nlayers > 2) ? ncells[2] : 0;
90 const unsigned char ncells4 = (nlayers > 3) ? ncells[3] : 0;
91
92 AthenaAttributeList attrList(*attrSpecification);
93
94 // Set value of each row for the current channel
95 attrList[ this->specificationName(eNLayers) ].setValue(nlayers);
96 attrList[ this->specificationName(eName1) ].setValue(name1);
97 attrList[ this->specificationName(eName2) ].setValue(name2);
98 attrList[ this->specificationName(eName3) ].setValue(name3);
99 attrList[ this->specificationName(eName4) ].setValue(name4);
100 attrList[ this->specificationName(eNCells1) ].setValue(ncells1);
101 attrList[ this->specificationName(eNCells2) ].setValue(ncells2);
102 attrList[ this->specificationName(eNCells3) ].setValue(ncells3);
103 attrList[ this->specificationName(eNCells4) ].setValue(ncells4);
104
105 attrListCollection->add(channelId, attrList);
106 }
107
108 return attrListCollection;
109}
coral::AttributeListSpecification * createAttributeListSpecification() const
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.

◆ makeTransient() [1/2]

void AbstractL1CaloPersistentCondition::makeTransient ( const std::map< std::string, const AthenaAttributeList * > & condAttributeList)
virtual

Reimplemented from AbstractL1CaloPersistentCondition.

Definition at line 30 of file AbstractL1CaloPersistentCondition.cxx.

21 {
22 std::cout << "ERROR - The makeTransient(const map<std::string, const AthenaAttributeList*>) method you are calling is not implemented by the current class !" << std::endl;
23 return;
24}

◆ makeTransient() [2/2]

void L1CaloRxLayersContainer::makeTransient ( const std::map< std::string, const CondAttrListCollection * > & condAttrListCollectionMap)
virtual

Reimplemented from AbstractL1CaloPersistentCondition.

Definition at line 111 of file L1CaloRxLayersContainer.cxx.

111 {
112
113 this->clear();
114
115 std::map<std::string, const CondAttrListCollection*>::const_iterator
116 it_map(condAttrListCollectionMap.find(this->coolFolderKey(L1CaloRxLayersContainer::eRxLayers)));
117
118 if(it_map!=condAttrListCollectionMap.end()) {
119
120 const CondAttrListCollection* attrListCollection = it_map->second;
121
122 //loop over CondAttrListCollection
123 CondAttrListCollection::const_iterator pos = attrListCollection->begin();
124 CondAttrListCollection::const_iterator end = attrListCollection->end();
125 for(; pos!= end; ++pos) {
126
127 const coral::AttributeList& attrList = pos->second;
128
129 // Get value of each row for the current channel
131
132 unsigned char nlayers = attrList[ this->specificationName(eNLayers) ].data<unsigned char>();
133 std::vector<int> names;
134 std::vector<int> ncells;
135 if (nlayers > 0) {
136 names.push_back((int)attrList[ this->specificationName(eName1) ].data<unsigned char>());
137 ncells.push_back((int)attrList[ this->specificationName(eNCells1) ].data<unsigned char>());
138 }
139 if (nlayers > 1) {
140 names.push_back((int)attrList[ this->specificationName(eName2) ].data<unsigned char>());
141 ncells.push_back((int)attrList[ this->specificationName(eNCells2) ].data<unsigned char>());
142 }
143 if (nlayers > 2) {
144 names.push_back((int)attrList[ this->specificationName(eName3) ].data<unsigned char>());
145 ncells.push_back((int)attrList[ this->specificationName(eNCells3) ].data<unsigned char>());
146 }
147 if (nlayers > 3) {
148 names.push_back((int)attrList[ this->specificationName(eName4) ].data<unsigned char>());
149 ncells.push_back((int)attrList[ this->specificationName(eNCells4) ].data<unsigned char>());
150 }
151
152 L1CaloRxLayers l1CaloRxLayers(chanNum, std::move(names), std::move(ncells));
153 m_mRxLayersMap[chanNum] = std::move(l1CaloRxLayers);
154 }
155 } else {
156 std::cout << "L1CaloRxLayersContainer : Could not find requested CondAttrListCollection "
158 }
159}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
const_iterator end() const
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
ChanAttrListMap::const_iterator const_iterator

◆ rxLayers() [1/2]

const L1CaloRxLayers * L1CaloRxLayersContainer::rxLayers ( const L1CaloRxCoolChannelId & channelId) const

Definition at line 167 of file L1CaloRxLayersContainer.cxx.

167 {
168 return this->rxLayers(channelId.id());
169}

◆ rxLayers() [2/2]

const L1CaloRxLayers * L1CaloRxLayersContainer::rxLayers ( unsigned int channelId) const

Definition at line 161 of file L1CaloRxLayersContainer.cxx.

161 {
162 L1CaloRxLayersMap::const_iterator pos = m_mRxLayersMap.find(channelId);
163 if(pos==m_mRxLayersMap.end()) return 0;
164 else return &(pos->second);
165}

◆ specificationName()

std::string AbstractL1CaloPersistentCondition::specificationName ( int specId) const
inherited

Definition at line 44 of file AbstractL1CaloPersistentCondition.cxx.

44 {
45 return m_attrSpecificationNameMap.find(specId)->second;
46}

◆ specificationType()

std::string AbstractL1CaloPersistentCondition::specificationType ( int specId) const
inherited

Definition at line 48 of file AbstractL1CaloPersistentCondition.cxx.

48 {
49 return m_attrSpecificationTypeMap.find(specId)->second;
50}

Member Data Documentation

◆ m_attrSpecificationNameMap

AttrSpecificationMap AbstractL1CaloPersistentCondition::m_attrSpecificationNameMap
privateinherited

Definition at line 51 of file AbstractL1CaloPersistentCondition.h.

◆ m_attrSpecificationTypeMap

AttrSpecificationMap AbstractL1CaloPersistentCondition::m_attrSpecificationTypeMap
privateinherited

Definition at line 52 of file AbstractL1CaloPersistentCondition.h.

◆ m_mCoolFoldersKeysMap

std::map<L1CaloRxLayersContainer::eCoolFolders, std::string> L1CaloRxLayersContainer::m_mCoolFoldersKeysMap
private

Definition at line 70 of file L1CaloRxLayersContainer.h.

◆ m_mRxLayersMap

L1CaloRxLayersMap L1CaloRxLayersContainer::m_mRxLayersMap
private

Definition at line 69 of file L1CaloRxLayersContainer.h.

◆ m_strConditionType

std::string AbstractL1CaloPersistentCondition::m_strConditionType
privateinherited

Definition at line 53 of file AbstractL1CaloPersistentCondition.h.


The documentation for this class was generated from the following files: