ATLAS Offline Software
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 
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 
31 {
32 }
33 
35 {
38  if ( !m_caloCellHelper ) {
39  ATH_MSG_ERROR("Cannot retrieve CaloCell_ID");
40  return StatusCode::FAILURE;
41  }
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
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  }
91  for (; cellItr != cellEnd; ++cellItr) {
92  CaloCell* cell = new CaloCell();
93  cell->set(caloDetDescrMgr->get_element(*cellItr), *cellItr);
94  ccCol->push_back(cell);
95  }
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
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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
L1CaloHVDummyContainers::~L1CaloHVDummyContainers
virtual ~L1CaloHVDummyContainers()
Definition: L1CaloHVDummyContainers.cxx:30
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition: CaloCell_Base_ID.h:46
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
ConvertOldUJHistosToNewHistos.etaBins
list etaBins
Definition: ConvertOldUJHistosToNewHistos.py:145
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition: CaloDetDescrManager.cxx:159
M_PI
#define M_PI
Definition: ActiveFraction.h:11
L1CaloHVDummyContainers::m_caloCellContainerName
std::string m_caloCellContainerName
Definition: L1CaloHVDummyContainers.h:38
CaloCell_Base_ID::cell_end
id_iterator cell_end(void) const
end iterator over full set of Identifiers (LAr + Tiles)
CaloCell_Base_ID::LARHEC
@ LARHEC
Definition: CaloCell_Base_ID.h:46
L1CaloHVDummyContainers::finalize
virtual StatusCode finalize() override
Definition: L1CaloHVDummyContainers.cxx:124
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
CaloCell_ID.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
RunTileCalibRec.CaloCellContainer
CaloCellContainer
Definition: RunTileCalibRec.py:403
TRT::Hit::side
@ side
Definition: HitInfo.h:83
CaloDetDescriptor.h
Definition of CaloDetDescriptor.
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
L1CaloHVDummyContainers::initialize
virtual StatusCode initialize() override
Definition: L1CaloHVDummyContainers.cxx:34
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
L1CaloHVDummyContainers::execute
virtual StatusCode execute() override
Definition: L1CaloHVDummyContainers.cxx:47
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
L1CaloHVDummyContainers::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition: L1CaloHVDummyContainers.h:42
L1CaloHVDummyContainers::m_caloCellHelper
const CaloCell_ID * m_caloCellHelper
Definition: L1CaloHVDummyContainers.h:41
DataVector< LVL1::TriggerTower >
CaloCell_Base_ID::cell_begin
id_iterator cell_begin(void) const
begin iterator over full set of Identifiers (LAr + Tiles)
AthAlgorithm
Definition: AthAlgorithm.h:47
LVL1::TriggerTower
Trigger towers are the inputs to all other parts of the calorimeter trigger.
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/TriggerTower.h:45
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
CaloIdManager::getCaloCell_ID
const CaloCell_ID * getCaloCell_ID(void) const
Access to IdHelper.
Definition: CaloIdManager.cxx:63
IdentifierHash.h
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
L1CaloHVDummyContainers::m_triggerTowerCollectionName
std::string m_triggerTowerCollectionName
Definition: L1CaloHVDummyContainers.h:37
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CaloCellContainer.h
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
L1CaloHVDummyContainers::m_caloMgr
const CaloIdManager * m_caloMgr
Definition: L1CaloHVDummyContainers.h:40
L1CaloHVDummyContainers.h
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloCellContainer::push_back
void push_back(CaloCell *)
reimplementation of const push_back
Definition: CaloCellContainer.cxx:74
TriggerTowerCollection
DataVector< LVL1::TriggerTower > TriggerTowerCollection
Definition: TriggerTowerCollection.h:10
TriggerTowerCollection.h
L1CaloHVDummyContainers::m_firstEvent
bool m_firstEvent
Definition: L1CaloHVDummyContainers.h:48
CaloIdManager.h
L1CaloHVDummyContainers::L1CaloHVDummyContainers
L1CaloHVDummyContainers(const std::string &name, ISvcLocator *pSvcLocator)
Definition: L1CaloHVDummyContainers.cxx:18
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:46
TileDCSDataPlotter.tt
tt
Definition: TileDCSDataPlotter.py:874
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
xAOD::TriggerTower
TriggerTower_v2 TriggerTower
Define the latest version of the TriggerTower class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/TriggerTower.h:16