ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloCalibConditions
src
L1CaloEnergyScanResultsContainer.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigT1CaloCalibConditions/L1CaloEnergyScanResultsContainer.h
"
6
7
#include "CoralBase/AttributeListSpecification.h"
8
#include "
AthenaPoolUtilities/CondAttrListCollection.h
"
9
#include "
AthenaPoolUtilities/AthenaAttributeList.h
"
10
11
#include "
TrigT1CaloCalibConditions/ChanFitErrorCode.h
"
12
13
#include <string>
14
#include <iostream>
15
16
L1CaloEnergyScanResultsContainer::L1CaloEnergyScanResultsContainer
():
AbstractL1CaloPersistentCondition
(
"CondAttrListCollection"
) {
17
// Define DB rows names and types in order to construct the AttributeListSpecification object
18
this->
addSpecification
(
eOffset
, std::string(
"Offset"
), std::string(
"double"
));
19
this->
addSpecification
(
eSlope
, std::string(
"Slope"
), std::string(
"double"
));
20
this->
addSpecification
(
eChi2
, std::string(
"Chi2"
), std::string(
"double"
));
21
this->
addSpecification
(
eNdf
, std::string(
"Ndf"
), std::string(
"unsigned char"
));
22
this->
addSpecification
(
eBlob
, std::string(
"Blob"
), std::string(
"blob"
));
23
this->
addSpecification
(
eBlobStrategy
,std::string(
"BlobStrategy"
),std::string(
"unsigned char"
));
24
this->
addSpecification
(
eErrorCode
, std::string(
"ErrorCode"
), std::string(
"unsigned int"
));
25
26
m_mCoolFoldersKeysMap
[
L1CaloEnergyScanResultsContainer::eEnergyScanResults
] = std::string(
"/TRIGGER/L1Calo/V1/Results/EnergyScanResults"
);
27
}
28
29
L1CaloEnergyScanResultsContainer::L1CaloEnergyScanResultsContainer
(
const
std::map<L1CaloEnergyScanResultsContainer::eCoolFolders, std::string>& folderKeysMap) :
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
(
eOffset
, std::string(
"Offset"
), std::string(
"double"
));
35
this->
addSpecification
(
eSlope
, std::string(
"Slope"
), std::string(
"double"
));
36
this->
addSpecification
(
eChi2
, std::string(
"Chi2"
), std::string(
"double"
));
37
this->
addSpecification
(
eNdf
, std::string(
"Ndf"
), std::string(
"unsigned char"
));
38
this->
addSpecification
(
eBlob
, std::string(
"Blob"
), std::string(
"blob"
));
39
this->
addSpecification
(
eBlobStrategy
,std::string(
"BlobStrategy"
),std::string(
"unsigned char"
));
40
this->
addSpecification
(
eErrorCode
, std::string(
"ErrorCode"
), std::string(
"unsigned int"
));
41
}
42
43
std::string
L1CaloEnergyScanResultsContainer::coolFolderKey
(
L1CaloEnergyScanResultsContainer::eCoolFolders
efolder)
const
{
44
45
std::map<L1CaloEnergyScanResultsContainer::eCoolFolders, std::string>::const_iterator it =
m_mCoolFoldersKeysMap
.find(efolder);
46
if
(it!=
m_mCoolFoldersKeysMap
.end()) {
47
return
it->second;
48
}
else
{
49
return
std::string(
""
);
50
}
51
}
52
53
std::vector<std::string>
L1CaloEnergyScanResultsContainer::coolInputKeys
()
const
{
54
std::vector<std::string> v;
55
v.push_back(this->
coolFolderKey
(
L1CaloEnergyScanResultsContainer::eEnergyScanResults
));
56
return
v;
57
}
58
59
std::string
L1CaloEnergyScanResultsContainer::coolOutputKey
()
const
{
60
return
this->
coolFolderKey
(
L1CaloEnergyScanResultsContainer::eEnergyScanResults
);
61
}
62
63
DataObject*
L1CaloEnergyScanResultsContainer::makePersistent
()
const
{
64
if
(
m_mEnergyScanResultsMap
.size()==0)
return
0;
65
66
// Create AttributeListSpecification according to the attributes to be recorded
67
// this is required to create the AttributeList objs
68
coral::AttributeListSpecification* attrSpecification = this->
createAttributeListSpecification
();
69
if
(!attrSpecification->size())
return
NULL;
70
71
CondAttrListCollection
* attrListCollection =
new
CondAttrListCollection
(
true
);
72
73
L1CaloEnergyScanResultsMap::const_iterator pos =
m_mEnergyScanResultsMap
.begin();
74
L1CaloEnergyScanResultsMap::const_iterator
end
=
m_mEnergyScanResultsMap
.end();
75
for
(; pos!=
end
; ++pos) {
76
const
unsigned
int
channelId = pos->first;
77
const
L1CaloEnergyScanResults
& p = pos->second;
78
79
AthenaAttributeList
attrList(*attrSpecification);
80
81
// Set value of each row for the current channel
82
attrList[ this->
specificationName
(
eOffset
) ].setValue(p.offset());
83
attrList[ this->
specificationName
(
eSlope
) ].setValue(p.slope());
84
attrList[ this->
specificationName
(
eChi2
) ].setValue(p.chi2());
85
attrList[ this->
specificationName
(
eNdf
) ].setValue(p.ndf());
86
attrList[ this->
specificationName
(
eBlob
) ].setValue(p.blob());
87
attrList[ this->
specificationName
(
eBlobStrategy
) ].setValue(p.blobStrategy());
88
attrList[ this->
specificationName
(
eErrorCode
) ].setValue(p.errorCode().errorCode());
89
90
attrListCollection->
add
(channelId, attrList);
91
}
92
93
return
attrListCollection;
94
}
95
96
void
L1CaloEnergyScanResultsContainer::makeTransient
(
const
std::map<std::string, const CondAttrListCollection*>& condAttrListCollectionMap) {
97
98
this->
clear
();
99
100
std::map<std::string, const CondAttrListCollection*>::const_iterator
101
it_map(condAttrListCollectionMap.find(this->coolFolderKey(
L1CaloEnergyScanResultsContainer::eEnergyScanResults
)));
102
103
if
(it_map!=condAttrListCollectionMap.end()) {
104
105
const
CondAttrListCollection
* attrListCollection = it_map->second;
106
107
//loop over CondAttrListCollection
108
CondAttrListCollection::const_iterator
pos = attrListCollection->
begin
();
109
CondAttrListCollection::const_iterator
end
= attrListCollection->
begin
();
110
for
(; pos!=
end
; ++pos) {
111
112
const
coral::AttributeList& attrList = pos->second;
113
114
// Get value of each row for the current channel
115
CondAttrListCollection::ChanNum
chanNum(pos->first);
116
117
double
offset = attrList[ this->
specificationName
(
eOffset
) ].data<
double
>();
118
double
slope = attrList[ this->
specificationName
(
eSlope
) ].data<
double
>();
119
double
chi2
= attrList[ this->
specificationName
(
eChi2
) ].data<
double
>();
120
unsigned
char
ndf = attrList[ this->
specificationName
(
eNdf
) ].data<
unsigned
char
>();
121
coral::Blob blob = attrList[ this->
specificationName
(
eBlob
) ].data<coral::Blob>();
122
unsigned
char
blobStrategy = attrList[ this->
specificationName
(
eBlobStrategy
) ].data<
unsigned
char
>();
123
ChanFitErrorCode
errorCode(attrList[ this->
specificationName
(
eErrorCode
) ].data<unsigned int>());
124
125
L1CaloEnergyScanResults
l1CaloEnergyScanResults(chanNum, offset, slope,
chi2
, ndf, blob, blobStrategy, errorCode);
126
m_mEnergyScanResultsMap
[chanNum] = l1CaloEnergyScanResults;
127
}
128
}
else
{
129
std::cout <<
"L1CaloEnergyScanResultsContainer : Could not find requested CondAttrListCollection "
130
<< this->
coolFolderKey
(
L1CaloEnergyScanResultsContainer::eEnergyScanResults
) << std::endl;
131
}
132
}
133
134
const
L1CaloEnergyScanResults
*
L1CaloEnergyScanResultsContainer::energyScanResults
(
unsigned
int
channelId)
const
{
135
L1CaloEnergyScanResultsMap::const_iterator pos =
m_mEnergyScanResultsMap
.find(channelId);
136
if
(pos==
m_mEnergyScanResultsMap
.end())
return
0;
137
else
return
&(pos->second);
138
}
139
140
const
L1CaloEnergyScanResults
*
L1CaloEnergyScanResultsContainer::energyScanResults
(
const
L1CaloCoolChannelId
& channelId)
const
{
141
return
this->
energyScanResults
(channelId.
id
());
142
}
143
144
void
L1CaloEnergyScanResultsContainer::addEnergyScanResults
(
unsigned
int
channelId,
const
L1CaloEnergyScanResults
&
energyScanResults
) {
145
m_mEnergyScanResultsMap
[channelId] =
energyScanResults
;
146
}
147
148
void
L1CaloEnergyScanResultsContainer::addEnergyScanResults
(
const
L1CaloCoolChannelId
& channelId,
const
L1CaloEnergyScanResults
&
energyScanResults
) {
149
return
this->
addEnergyScanResults
(channelId.
id
(),
energyScanResults
);
150
}
151
152
void
L1CaloEnergyScanResultsContainer::clear
() {
153
m_mEnergyScanResultsMap
.clear();
154
}
AthenaAttributeList.h
ChanFitErrorCode.h
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
L1CaloEnergyScanResultsContainer.h
AbstractL1CaloPersistentCondition::specificationName
std::string specificationName(int specId) const
Definition
AbstractL1CaloPersistentCondition.cxx:44
AbstractL1CaloPersistentCondition::AbstractL1CaloPersistentCondition
AbstractL1CaloPersistentCondition(const std::string &condType)
Definition
AbstractL1CaloPersistentCondition.h:45
AbstractL1CaloPersistentCondition::addSpecification
void addSpecification(int specId, const std::string &specName, const std::string &specType)
Definition
AbstractL1CaloPersistentCondition.cxx:26
AbstractL1CaloPersistentCondition::createAttributeListSpecification
coral::AttributeListSpecification * createAttributeListSpecification() const
Definition
AbstractL1CaloPersistentCondition.cxx:31
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table.
Definition
PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:46
ChanFitErrorCode
ChanFitErrorCode stores information about the calibration fit quality.
Definition
ChanFitErrorCode.h:17
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number.
Definition
CondAttrListCollection.h:51
CondAttrListCollection::add
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.
Definition
CondAttrListCollection.h:451
CondAttrListCollection::begin
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
Definition
CondAttrListCollection.h:308
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition
CondAttrListCollection.h:62
CondAttrListCollection::ChanNum
unsigned int ChanNum
Definition
CondAttrListCollection.h:54
L1CaloCoolChannelId
Encapsulates the ID of one channel of conditions data in COOL, ie the ID of a row in a table.
Definition
L1CaloCoolChannelId.h:10
L1CaloCoolChannelId::id
unsigned int id() const
Definition
L1CaloCoolChannelId.h:32
L1CaloEnergyScanResultsContainer::m_mCoolFoldersKeysMap
std::map< L1CaloEnergyScanResultsContainer::eCoolFolders, std::string > m_mCoolFoldersKeysMap
Definition
L1CaloEnergyScanResultsContainer.h:68
L1CaloEnergyScanResultsContainer::coolFolderKey
std::string coolFolderKey(L1CaloEnergyScanResultsContainer::eCoolFolders efolder) const
Definition
L1CaloEnergyScanResultsContainer.cxx:43
L1CaloEnergyScanResultsContainer::clear
virtual void clear()
Definition
L1CaloEnergyScanResultsContainer.cxx:152
L1CaloEnergyScanResultsContainer::makeTransient
virtual void makeTransient(const std::map< std::string, const CondAttrListCollection * > &condAttrListCollectionMap)
Definition
L1CaloEnergyScanResultsContainer.cxx:96
L1CaloEnergyScanResultsContainer::addEnergyScanResults
void addEnergyScanResults(unsigned int channelId, const L1CaloEnergyScanResults &energyScanResults)
Definition
L1CaloEnergyScanResultsContainer.cxx:144
L1CaloEnergyScanResultsContainer::L1CaloEnergyScanResultsContainer
L1CaloEnergyScanResultsContainer()
Definition
L1CaloEnergyScanResultsContainer.cxx:16
L1CaloEnergyScanResultsContainer::coolOutputKey
virtual std::string coolOutputKey() const
Definition
L1CaloEnergyScanResultsContainer.cxx:59
L1CaloEnergyScanResultsContainer::eChi2
@ eChi2
Definition
L1CaloEnergyScanResultsContainer.h:30
L1CaloEnergyScanResultsContainer::eNdf
@ eNdf
Definition
L1CaloEnergyScanResultsContainer.h:30
L1CaloEnergyScanResultsContainer::eOffset
@ eOffset
Definition
L1CaloEnergyScanResultsContainer.h:30
L1CaloEnergyScanResultsContainer::eBlobStrategy
@ eBlobStrategy
Definition
L1CaloEnergyScanResultsContainer.h:30
L1CaloEnergyScanResultsContainer::eSlope
@ eSlope
Definition
L1CaloEnergyScanResultsContainer.h:30
L1CaloEnergyScanResultsContainer::eBlob
@ eBlob
Definition
L1CaloEnergyScanResultsContainer.h:30
L1CaloEnergyScanResultsContainer::eErrorCode
@ eErrorCode
Definition
L1CaloEnergyScanResultsContainer.h:30
L1CaloEnergyScanResultsContainer::energyScanResults
const L1CaloEnergyScanResults * energyScanResults(unsigned int channelId) const
Definition
L1CaloEnergyScanResultsContainer.cxx:134
L1CaloEnergyScanResultsContainer::end
const_iterator end() const
Definition
L1CaloEnergyScanResultsContainer.h:57
L1CaloEnergyScanResultsContainer::coolInputKeys
virtual std::vector< std::string > coolInputKeys() const
Definition
L1CaloEnergyScanResultsContainer.cxx:53
L1CaloEnergyScanResultsContainer::m_mEnergyScanResultsMap
L1CaloEnergyScanResultsMap m_mEnergyScanResultsMap
Definition
L1CaloEnergyScanResultsContainer.h:67
L1CaloEnergyScanResultsContainer::makePersistent
virtual DataObject * makePersistent() const
Definition
L1CaloEnergyScanResultsContainer.cxx:63
L1CaloEnergyScanResultsContainer::eCoolFolders
eCoolFolders
Definition
L1CaloEnergyScanResultsContainer.h:37
L1CaloEnergyScanResultsContainer::eEnergyScanResults
@ eEnergyScanResults
Definition
L1CaloEnergyScanResultsContainer.h:37
L1CaloEnergyScanResults
Class that holds transient information about the calibration for trigger towers.
Definition
L1CaloEnergyScanResults.h:19
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition
comparitor.cxx:525
Generated on
for ATLAS Offline Software by
1.17.0