ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
7#include "GaudiKernel/MsgStream.h"
8
10#include "Identifier/Identifier.h"
14#include "CaloDetDescr/CaloDetDescrElement.h"
17
18L1CaloHVDummyContainers::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
33
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
48{
49 if (m_firstEvent) {
50
52 ATH_CHECK(caloMgrHandle.isValid());
53 const CaloDetDescrManager* caloDetDescrMgr = *caloMgrHandle;
54
55 // Create dummy TriggerTower collection
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];
71 ttCol->push_back(tt);
72 }
73 }
74 }
75 }
76 ATH_MSG_INFO("Size of TriggerTowerCollection is " << ttCol->size());
77
78 // Create dummy CaloCellCollection
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
125{
126 return StatusCode::SUCCESS;
127}
#define M_PI
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
Definition of CaloDetDescriptor.
static Double_t sc
DataVector< LVL1::TriggerTower > TriggerTowerCollection
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
Container class for CaloCell.
void push_back(CaloCell *)
reimplementation of const push_back
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
This class provides the client interface for accessing the detector description information common to...
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual StatusCode finalize() override
const CaloCell_ID * m_caloCellHelper
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
virtual StatusCode execute() override
virtual StatusCode initialize() override
L1CaloHVDummyContainers(const std::string &name, ISvcLocator *pSvcLocator)
const CaloIdManager * m_caloMgr
Trigger towers are the inputs to all other parts of the calorimeter trigger.