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

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

#include <L1CaloHVCorrectionsContainer.h>

Inheritance diagram for L1CaloHVCorrectionsContainer:
Collaboration diagram for L1CaloHVCorrectionsContainer:

Public Types

enum  eCoolFolders { eHVCorrections }
typedef std::map< unsigned int, L1CaloHVCorrectionsL1CaloHVCorrectionsMap
typedef L1CaloHVCorrectionsMap::const_iterator const_iterator

Public Member Functions

 L1CaloHVCorrectionsContainer ()
 L1CaloHVCorrectionsContainer (const std::map< L1CaloHVCorrectionsContainer::eCoolFolders, std::string > &folderKeysMap)
virtual ~L1CaloHVCorrectionsContainer ()
virtual DataObject * makePersistent () const
virtual void makeTransient (const std::map< std::string, const CondAttrListCollection * > &condAttrListCollectionMap)
const L1CaloHVCorrectionshvCorrections (unsigned int channelId) const
const L1CaloHVCorrectionshvCorrections (const L1CaloRxCoolChannelId &channelId) const
void addHVCorrections (unsigned int channelId, L1CaloHVCorrections &&hvCorrections)
void addHVCorrections (const L1CaloRxCoolChannelId &channelId, L1CaloHVCorrections &&hvCorrections)
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 {
  eRxMean , eAffectedCells1 , eAffectedCells2 , eAffectedCells3 ,
  eAffectedCells4 , eLayerMean1 , eLayerMean2 , eLayerMean3 ,
  eLayerMean4
}
typedef std::map< int, std::string > AttrSpecificationMap

Private Member Functions

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

Private Attributes

L1CaloHVCorrectionsMap m_mHVCorrectionsMap
std::map< L1CaloHVCorrectionsContainer::eCoolFolders, std::string > m_mCoolFoldersKeysMap
AttrSpecificationMap m_attrSpecificationNameMap
AttrSpecificationMap m_attrSpecificationTypeMap
std::string m_strConditionType

Detailed Description

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

Implement the IL1CaloPersistenceCapable interface.

Author
Peter Faulkner

Definition at line 28 of file L1CaloHVCorrectionsContainer.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 L1CaloHVCorrectionsMap::const_iterator L1CaloHVCorrectionsContainer::const_iterator

Definition at line 38 of file L1CaloHVCorrectionsContainer.h.

◆ L1CaloHVCorrectionsMap

Member Enumeration Documentation

◆ eAttrSpecification

◆ eCoolFolders

Constructor & Destructor Documentation

◆ L1CaloHVCorrectionsContainer() [1/2]

L1CaloHVCorrectionsContainer::L1CaloHVCorrectionsContainer ( )

Definition at line 14 of file L1CaloHVCorrectionsContainer.cxx.

14 :AbstractL1CaloPersistentCondition("CondAttrListCollection") {
15 // Define DB rows names and types in order to construct the AttributeListSpecification object
16 this->addSpecification(eRxMean, std::string("RxMean"), std::string("float"));
17 this->addSpecification(eAffectedCells1, std::string("AffectedCells1"), std::string("unsigned char"));
18 this->addSpecification(eAffectedCells2, std::string("AffectedCells2"), std::string("unsigned char"));
19 this->addSpecification(eAffectedCells3, std::string("AffectedCells3"), std::string("unsigned char"));
20 this->addSpecification(eAffectedCells4, std::string("AffectedCells4"), std::string("unsigned char"));
21 this->addSpecification(eLayerMean1, std::string("LayerMean1"), std::string("float"));
22 this->addSpecification(eLayerMean2, std::string("LayerMean2"), std::string("float"));
23 this->addSpecification(eLayerMean3, std::string("LayerMean3"), std::string("float"));
24 this->addSpecification(eLayerMean4, std::string("LayerMean4"), std::string("float"));
25
26 m_mCoolFoldersKeysMap[L1CaloHVCorrectionsContainer::eHVCorrections] = std::string("/TRIGGER/L1Calo/V1/Results/HVCorrections");
27}
AbstractL1CaloPersistentCondition(const std::string &condType)
void addSpecification(int specId, const std::string &specName, const std::string &specType)
std::map< L1CaloHVCorrectionsContainer::eCoolFolders, std::string > m_mCoolFoldersKeysMap

◆ L1CaloHVCorrectionsContainer() [2/2]

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

Definition at line 29 of file L1CaloHVCorrectionsContainer.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(eRxMean, std::string("RxMean"), std::string("float"));
35 this->addSpecification(eAffectedCells1, std::string("AffectedCells1"), std::string("unsigned char"));
36 this->addSpecification(eAffectedCells2, std::string("AffectedCells2"), std::string("unsigned char"));
37 this->addSpecification(eAffectedCells3, std::string("AffectedCells3"), std::string("unsigned char"));
38 this->addSpecification(eAffectedCells4, std::string("AffectedCells4"), std::string("unsigned char"));
39 this->addSpecification(eLayerMean1, std::string("LayerMean1"), std::string("float"));
40 this->addSpecification(eLayerMean2, std::string("LayerMean2"), std::string("float"));
41 this->addSpecification(eLayerMean3, std::string("LayerMean3"), std::string("float"));
42 this->addSpecification(eLayerMean4, std::string("LayerMean4"), std::string("float"));
43}

◆ ~L1CaloHVCorrectionsContainer()

virtual L1CaloHVCorrectionsContainer::~L1CaloHVCorrectionsContainer ( )
inlinevirtual

Definition at line 44 of file L1CaloHVCorrectionsContainer.h.

44{};

Member Function Documentation

◆ addHVCorrections() [1/2]

void L1CaloHVCorrectionsContainer::addHVCorrections ( const L1CaloRxCoolChannelId & channelId,
L1CaloHVCorrections && hvCorrections )

Definition at line 179 of file L1CaloHVCorrectionsContainer.cxx.

179 {
180 this->addHVCorrections(channelId.id(), std::move(hvCorrections));
181}
void addHVCorrections(unsigned int channelId, L1CaloHVCorrections &&hvCorrections)
const L1CaloHVCorrections * hvCorrections(unsigned int channelId) const

◆ addHVCorrections() [2/2]

void L1CaloHVCorrectionsContainer::addHVCorrections ( unsigned int channelId,
L1CaloHVCorrections && hvCorrections )

Definition at line 175 of file L1CaloHVCorrectionsContainer.cxx.

175 {
177}

◆ 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 L1CaloHVCorrectionsContainer::begin ( ) const
inline

Definition at line 59 of file L1CaloHVCorrectionsContainer.h.

59{ return m_mHVCorrectionsMap.begin(); };

◆ clear()

void L1CaloHVCorrectionsContainer::clear ( )
virtual

Reimplemented from AbstractL1CaloPersistentCondition.

Definition at line 183 of file L1CaloHVCorrectionsContainer.cxx.

183 {
184 m_mHVCorrectionsMap.clear();
185}

◆ conditionType()

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

◆ coolFolderKey()

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

Definition at line 45 of file L1CaloHVCorrectionsContainer.cxx.

45 {
46
47 std::map<L1CaloHVCorrectionsContainer::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 > L1CaloHVCorrectionsContainer::coolInputKeys ( ) const
virtual

Reimplemented from AbstractL1CaloPersistentCondition.

Definition at line 55 of file L1CaloHVCorrectionsContainer.cxx.

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

◆ coolOutputKey()

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

◆ 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 L1CaloHVCorrectionsContainer::end ( ) const
inline

Definition at line 60 of file L1CaloHVCorrectionsContainer.h.

60{ return m_mHVCorrectionsMap.end(); };

◆ hvCorrections() [1/2]

const L1CaloHVCorrections * L1CaloHVCorrectionsContainer::hvCorrections ( const L1CaloRxCoolChannelId & channelId) const

Definition at line 171 of file L1CaloHVCorrectionsContainer.cxx.

171 {
172 return this->hvCorrections(channelId.id());
173}

◆ hvCorrections() [2/2]

const L1CaloHVCorrections * L1CaloHVCorrectionsContainer::hvCorrections ( unsigned int channelId) const

Definition at line 165 of file L1CaloHVCorrectionsContainer.cxx.

165 {
166 L1CaloHVCorrectionsMap::const_iterator pos = m_mHVCorrectionsMap.find(channelId);
167 if(pos==m_mHVCorrectionsMap.end()) return 0;
168 else return &(pos->second);
169}

◆ makePersistent()

DataObject * L1CaloHVCorrectionsContainer::makePersistent ( ) const
virtual

Reimplemented from AbstractL1CaloPersistentCondition.

Definition at line 65 of file L1CaloHVCorrectionsContainer.cxx.

65 {
66 if(m_mHVCorrectionsMap.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 L1CaloHVCorrectionsMap::const_iterator pos = m_mHVCorrectionsMap.begin();
76 L1CaloHVCorrectionsMap::const_iterator end = m_mHVCorrectionsMap.end();
77 for(; pos!=end; ++pos) {
78 const unsigned int channelId = pos->first;
79 const L1CaloHVCorrections& p = pos->second;
80 const std::vector<int>& affectedCells(p.affectedCells());
81 const std::vector<float>& layerMeans(p.layerMeans());
82 const unsigned char nlayers = affectedCells.size();
83 const unsigned char affectedCells1 = (nlayers > 0) ? affectedCells[0] : 0;
84 const unsigned char affectedCells2 = (nlayers > 1) ? affectedCells[1] : 0;
85 const unsigned char affectedCells3 = (nlayers > 2) ? affectedCells[2] : 0;
86 const unsigned char affectedCells4 = (nlayers > 3) ? affectedCells[3] : 0;
87 const float layerMean1 = (nlayers > 0) ? layerMeans[0] : 0.;
88 const float layerMean2 = (nlayers > 1) ? layerMeans[1] : 0.;
89 const float layerMean3 = (nlayers > 2) ? layerMeans[2] : 0.;
90 const float layerMean4 = (nlayers > 3) ? layerMeans[3] : 0.;
91
92 AthenaAttributeList attrList(*attrSpecification);
93
94 // Set value of each row for the current channel
95 attrList[ this->specificationName(eRxMean) ].setValue(p.rxMean());
96 attrList[ this->specificationName(eAffectedCells1) ].setValue(affectedCells1);
97 attrList[ this->specificationName(eAffectedCells2) ].setValue(affectedCells2);
98 attrList[ this->specificationName(eAffectedCells3) ].setValue(affectedCells3);
99 attrList[ this->specificationName(eAffectedCells4) ].setValue(affectedCells4);
100 attrList[ this->specificationName(eLayerMean1) ].setValue(layerMean1);
101 attrList[ this->specificationName(eLayerMean2) ].setValue(layerMean2);
102 attrList[ this->specificationName(eLayerMean3) ].setValue(layerMean3);
103 attrList[ this->specificationName(eLayerMean4) ].setValue(layerMean4);
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 L1CaloHVCorrectionsContainer::makeTransient ( const std::map< std::string, const CondAttrListCollection * > & condAttrListCollectionMap)
virtual

Reimplemented from AbstractL1CaloPersistentCondition.

Definition at line 111 of file L1CaloHVCorrectionsContainer.cxx.

111 {
112
113 this->clear();
114
115 std::map<std::string, const CondAttrListCollection*>::const_iterator
116 it_map(condAttrListCollectionMap.find(this->coolFolderKey(L1CaloHVCorrectionsContainer::eHVCorrections)));
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 float rxMean = attrList[ this->specificationName(eRxMean) ].data<float>();
133 std::vector<int> affectedCells;
134 std::vector<float> layerMeans;
135 float layerMean1 = attrList[ this->specificationName(eLayerMean1) ].data<float>();
136 if (layerMean1 >= 1.) {
137 layerMeans.push_back(layerMean1);
138 affectedCells.push_back((int)attrList[ this->specificationName(eAffectedCells1) ].data<unsigned char>());
139 float layerMean2 = attrList[ this->specificationName(eLayerMean2) ].data<float>();
140 if (layerMean2 >= 1.) {
141 layerMeans.push_back(layerMean2);
142 affectedCells.push_back((int)attrList[ this->specificationName(eAffectedCells2) ].data<unsigned char>());
143 float layerMean3 = attrList[ this->specificationName(eLayerMean3) ].data<float>();
144 if (layerMean3 >= 1.) {
145 layerMeans.push_back(layerMean3);
146 affectedCells.push_back((int)attrList[ this->specificationName(eAffectedCells3) ].data<unsigned char>());
147 float layerMean4 = attrList[ this->specificationName(eLayerMean4) ].data<float>();
148 if (layerMean4 >= 1.) {
149 layerMeans.push_back(layerMean4);
150 affectedCells.push_back((int)attrList[ this->specificationName(eAffectedCells4) ].data<unsigned char>());
151 }
152 }
153 }
154 }
155
156 L1CaloHVCorrections l1CaloHVCorrections(chanNum, rxMean, std::move(affectedCells), std::move(layerMeans));
157 m_mHVCorrectionsMap[chanNum] = std::move(l1CaloHVCorrections);
158 }
159 } else {
160 std::cout << "L1CaloHVCorrectionsContainer : Could not find requested CondAttrListCollection "
162 }
163}
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

◆ 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<L1CaloHVCorrectionsContainer::eCoolFolders, std::string> L1CaloHVCorrectionsContainer::m_mCoolFoldersKeysMap
private

Definition at line 71 of file L1CaloHVCorrectionsContainer.h.

◆ m_mHVCorrectionsMap

L1CaloHVCorrectionsMap L1CaloHVCorrectionsContainer::m_mHVCorrectionsMap
private

Definition at line 70 of file L1CaloHVCorrectionsContainer.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: