ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloCalibUtils
src
L1CaloHVDummyContainers.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigT1CaloCalibUtils/L1CaloHVDummyContainers.h
"
6
7
#include "GaudiKernel/MsgStream.h"
8
9
#include "
TrigT1CaloEvent/TriggerTowerCollection.h
"
10
#include "Identifier/Identifier.h"
11
#include "
Identifier/IdentifierHash.h
"
12
#include "
CaloEvent/CaloCellContainer.h
"
13
#include "
CaloDetDescr/CaloDetDescriptor.h
"
14
#include "CaloDetDescr/CaloDetDescrElement.h"
15
#include "
CaloIdentifier/CaloCell_ID.h
"
16
#include "
CaloIdentifier/CaloIdManager.h
"
17
18
L1CaloHVDummyContainers::L1CaloHVDummyContainers
(
const
std::string& name, ISvcLocator *pSvcLocator)
19
:
AthAlgorithm
(name, pSvcLocator),
20
m_triggerTowerCollectionName
(
"TriggerTowers"
),
21
m_caloCellContainerName
(
"AllCalo"
),
22
m_caloMgr
(nullptr),
23
m_caloCellHelper
(nullptr),
24
m_firstEvent
(true)
25
{
26
declareProperty
(
"TriggerTowerCollectionName"
,
m_triggerTowerCollectionName
);
27
declareProperty
(
"CaloCellContainerName"
,
m_caloCellContainerName
);
28
}
29
30
L1CaloHVDummyContainers::~L1CaloHVDummyContainers
()
31
{
32
}
33
34
StatusCode
L1CaloHVDummyContainers::initialize
()
35
{
36
ATH_CHECK
(
detStore
()->retrieve(
m_caloMgr
));
37
m_caloCellHelper
=
m_caloMgr
->getCaloCell_ID();
38
if
( !
m_caloCellHelper
) {
39
ATH_MSG_ERROR
(
"Cannot retrieve CaloCell_ID"
);
40
return
StatusCode::FAILURE;
41
}
42
ATH_CHECK
(
m_caloMgrKey
.initialize());
43
44
return
StatusCode::SUCCESS;
45
}
46
47
StatusCode
L1CaloHVDummyContainers::execute
(
const
EventContext& ctx)
48
{
49
if
(
m_firstEvent
) {
50
51
SG::ReadCondHandle<CaloDetDescrManager>
caloMgrHandle{
m_caloMgrKey
, ctx};
52
ATH_CHECK
(caloMgrHandle.
isValid
());
53
const
CaloDetDescrManager
* caloDetDescrMgr = *caloMgrHandle;
54
55
// Create dummy TriggerTower collection
56
TriggerTowerCollection
* ttCol =
new
TriggerTowerCollection
();
57
58
// Fill with dummy TriggerTowers
59
const
int
etaBins[4] = { 25, 3, 1, 4 };
60
const
int
phiBins[4] = { 64, 32, 32, 16 };
61
const
double
etaOffsets[4] = { 0., 2.5, 3.1, 3.2 };
62
const
double
etaGrans[4] = { 0.1, 0.2, 0.1, 0.425 };
63
const
double
phiGrans[4] = {
M_PI
/32.,
M_PI
/16.,
M_PI
/16.,
M_PI
/8. };
64
for
(
int
side = -1; side <= 1; side+=2) {
65
for
(
int
region = 0; region < 4; ++region) {
66
for
(
int
ieta = 0; ieta < etaBins[region]; ++ieta) {
67
double
eta
= side*(etaOffsets[region] + (ieta+0.5)*etaGrans[region]);
68
for
(
int
iphi = 0; iphi < phiBins[region]; ++iphi) {
69
double
phi
= (iphi+0.5)*phiGrans[region];
70
LVL1::TriggerTower
* tt =
new
LVL1::TriggerTower
(
phi
,
eta
, 0);
71
ttCol->
push_back
(tt);
72
}
73
}
74
}
75
}
76
ATH_MSG_INFO
(
"Size of TriggerTowerCollection is "
<< ttCol->
size
());
77
78
// Create dummy CaloCellCollection
79
CaloCellContainer
* ccCol =
new
CaloCellContainer
();
80
81
// Fill with dummy CaloCells
82
std::vector<Identifier>::const_iterator cellItr(
m_caloCellHelper
->cell_begin(
CaloCell_ID::LAREM
));
83
std::vector<Identifier>::const_iterator cellEnd(
m_caloCellHelper
->cell_end(
CaloCell_ID::LAREM
));
84
for
(; cellItr != cellEnd; ++cellItr) {
85
CaloCell
* cell =
new
CaloCell
();
86
cell->set(caloDetDescrMgr->
get_element
(*cellItr), *cellItr);
87
ccCol->
push_back
(cell);
88
}
89
cellItr =
m_caloCellHelper
->cell_begin(
CaloCell_ID::LARHEC
);
90
cellEnd =
m_caloCellHelper
->cell_end(
CaloCell_ID::LARHEC
);
91
for
(; cellItr != cellEnd; ++cellItr) {
92
CaloCell
* cell =
new
CaloCell
();
93
cell->set(caloDetDescrMgr->
get_element
(*cellItr), *cellItr);
94
ccCol->
push_back
(cell);
95
}
96
cellItr =
m_caloCellHelper
->cell_begin(
CaloCell_ID::LARFCAL
);
97
cellEnd =
m_caloCellHelper
->cell_end(
CaloCell_ID::LARFCAL
);
98
for
(; cellItr != cellEnd; ++cellItr) {
99
CaloCell
* cell =
new
CaloCell
();
100
cell->set(caloDetDescrMgr->
get_element
(*cellItr), *cellItr);
101
ccCol->
push_back
(cell);
102
}
103
ATH_MSG_INFO
(
"Size of CaloCellContainer is "
<< ccCol->
size
());
104
105
// Save in StoreGate
106
StatusCode
sc
=
evtStore
()->record(ttCol,
m_triggerTowerCollectionName
);
107
if
(
sc
.isFailure()) {
108
ATH_MSG_ERROR
(
"Failed to store TriggerTowerCollection in StoreGate"
);
109
return
sc
;
110
}
111
sc
=
evtStore
()->record(ccCol,
m_caloCellContainerName
);
112
if
(
sc
.isFailure()) {
113
ATH_MSG_ERROR
(
"Failed to store CaloCellContainer in StoreGate"
);
114
return
sc
;
115
}
116
117
m_firstEvent
=
false
;
118
119
}
120
121
return
StatusCode::SUCCESS;
122
}
123
124
StatusCode
L1CaloHVDummyContainers::finalize
()
125
{
126
return
StatusCode::SUCCESS;
127
}
M_PI
#define M_PI
Definition
ActiveFraction.h:14
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
CaloCellContainer.h
CaloCell_ID.h
CaloDetDescriptor.h
Definition of CaloDetDescriptor.
CaloIdManager.h
IdentifierHash.h
L1CaloHVDummyContainers.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
TriggerTowerCollection.h
TriggerTowerCollection
DataVector< LVL1::TriggerTower > TriggerTowerCollection
Definition
TriggerTowerCollection.h:10
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
CaloCellContainer
Container class for CaloCell.
Definition
CaloCellContainer.h:55
CaloCellContainer::push_back
void push_back(CaloCell *)
reimplementation of const push_back
Definition
CaloCellContainer.cxx:74
CaloCell_Base_ID::LAREM
@ LAREM
Definition
CaloCell_Base_ID.h:45
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition
CaloCell_Base_ID.h:45
CaloCell_Base_ID::LARHEC
@ LARHEC
Definition
CaloCell_Base_ID.h:45
CaloCell
Data object for each calorimeter readout cell.
Definition
CaloCell.h:57
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition
CaloDetDescrManager.cxx:159
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition
CaloDetDescrManager.h:469
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
L1CaloHVDummyContainers::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
L1CaloHVDummyContainers.cxx:47
L1CaloHVDummyContainers::finalize
virtual StatusCode finalize() override
Definition
L1CaloHVDummyContainers.cxx:124
L1CaloHVDummyContainers::m_caloCellContainerName
std::string m_caloCellContainerName
Definition
L1CaloHVDummyContainers.h:38
L1CaloHVDummyContainers::m_firstEvent
bool m_firstEvent
Definition
L1CaloHVDummyContainers.h:48
L1CaloHVDummyContainers::~L1CaloHVDummyContainers
virtual ~L1CaloHVDummyContainers()
Definition
L1CaloHVDummyContainers.cxx:30
L1CaloHVDummyContainers::m_caloCellHelper
const CaloCell_ID * m_caloCellHelper
Definition
L1CaloHVDummyContainers.h:41
L1CaloHVDummyContainers::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition
L1CaloHVDummyContainers.h:42
L1CaloHVDummyContainers::initialize
virtual StatusCode initialize() override
Definition
L1CaloHVDummyContainers.cxx:34
L1CaloHVDummyContainers::L1CaloHVDummyContainers
L1CaloHVDummyContainers(const std::string &name, ISvcLocator *pSvcLocator)
Definition
L1CaloHVDummyContainers.cxx:18
L1CaloHVDummyContainers::m_triggerTowerCollectionName
std::string m_triggerTowerCollectionName
Definition
L1CaloHVDummyContainers.h:37
L1CaloHVDummyContainers::m_caloMgr
const CaloIdManager * m_caloMgr
Definition
L1CaloHVDummyContainers.h:40
LVL1::TriggerTower
Trigger towers are the inputs to all other parts of the calorimeter trigger.
Definition
Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/TriggerTower.h:45
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:205
Generated on
for ATLAS Offline Software by
1.17.0