ATLAS Offline Software
L1CaloTriggerTowerSelector.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 
8 
9 L1CaloTriggerTowerSelector::L1CaloTriggerTowerSelector(const std::string& name, ISvcLocator* pSvcLocator): AthAlgorithm(name, pSvcLocator), m_towerKey(0)
10 {
11  //setting selection range to the whole TTs by default
12  m_vEtaSelectionRange.push_back(-5.);
13  m_vEtaSelectionRange.push_back(5.);
14 
15  m_vPhiSelectionRange.push_back(0.);
16  m_vPhiSelectionRange.push_back(7.);
17 
18  declareProperty("OutputTriggerTowerLocation", m_inputTriggerTowerLocation = "LVL1TriggerTowers");
19  declareProperty("InputTriggerTowerLocation", m_outputTriggerTowerLocation = "SelectedLVL1TriggerTowers");
20 
21  declareProperty("EtaSelectionRange", m_vEtaSelectionRange);
22  declareProperty("PhiSelectionRange", m_vPhiSelectionRange);
23 }
24 
26 {
27  delete m_towerKey;
28 }
29 
30 //-------------------------------------------
31 // Initialize
32 //-------------------------------------------
34 {
35  ATH_MSG_INFO("From Initialize...");
36 
38 
39  return StatusCode::SUCCESS;
40 }
41 
42 //----------------------------------------
43 // Execute
44 //----------------------------------------
46 {
47  StatusCode sc;
48 
49  // retrieve triggertowers container from storegate
50  const TriggerTowerCollection* ttCollection = 0;
51  sc = evtStore()->retrieve(ttCollection, m_inputTriggerTowerLocation);
52  if (sc.isFailure() || !ttCollection) {
53  ATH_MSG_ERROR( "No Trigger Towers found" );
54  return StatusCode::SUCCESS;
55  } else ATH_MSG_DEBUG("TriggerTowerCollection retrieved from StoreGate, size: "<< ttCollection->size() );
56 
57  // create TriggerTowerCollection that will hold the selected TT
58  TriggerTowerCollection* outputTTCollection = new TriggerTowerCollection();
59 
60  //---
61  //loop on trigger towers
63  TriggerTowerCollection::const_iterator pos_end = ttCollection->end();
64 
65  for(;pos!=pos_end;++pos) {
66  const LVL1::TriggerTower* ptt = (*pos);
67 
68  // Compute TowerTrigger Key out of its coordinates
69  double eta = ptt->eta();
70  double phi = ptt->phi();
71 
72  if (this->isSelected(eta, phi)) {
73  LVL1::TriggerTower* selectedTriggerTower = new LVL1::TriggerTower(*ptt);
74  outputTTCollection->push_back(selectedTriggerTower);
75  }
76 
77  } // -- End of trigger tower loop --
78 
79  sc = evtStore()->record(outputTTCollection, m_outputTriggerTowerLocation);
80  if (sc.isFailure()) {
81  ATH_MSG_ERROR( "Failed to record output TriggerTowerCollection to TDS with key: "<< m_outputTriggerTowerLocation );
82  return StatusCode::SUCCESS;
83  } else ATH_MSG_DEBUG("TriggerTowerCollection recorded to TDS with key: "<< m_outputTriggerTowerLocation<<", size: "<< outputTTCollection->size() );
84 
85  return StatusCode::SUCCESS;
86 }
87 
88 //-----------------------------------------
89 // Finalize
90 //-----------------------------------------
92 {
93  return StatusCode::SUCCESS;
94 }
95 
98 }
LVL1::TriggerTower::phi
double phi() const
returns phi coord of tower
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/TriggerTower.h:97
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
L1CaloTriggerTowerSelector.h
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
L1CaloTriggerTowerSelector::~L1CaloTriggerTowerSelector
virtual ~L1CaloTriggerTowerSelector()
Definition: L1CaloTriggerTowerSelector.cxx:25
L1CaloTriggerTowerSelector::m_towerKey
LVL1::TriggerTowerKey * m_towerKey
Definition: L1CaloTriggerTowerSelector.h:41
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
L1CaloTriggerTowerSelector::m_vPhiSelectionRange
std::vector< double > m_vPhiSelectionRange
Definition: L1CaloTriggerTowerSelector.h:44
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
L1CaloTriggerTowerSelector::execute
virtual StatusCode execute()
Definition: L1CaloTriggerTowerSelector.cxx:45
L1CaloTriggerTowerSelector::m_vEtaSelectionRange
std::vector< double > m_vEtaSelectionRange
Definition: L1CaloTriggerTowerSelector.h:43
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
L1CaloTriggerTowerSelector::L1CaloTriggerTowerSelector
L1CaloTriggerTowerSelector(const std::string &name, ISvcLocator *pSvcLocator)
Definition: L1CaloTriggerTowerSelector.cxx:9
L1CaloTriggerTowerSelector::initialize
virtual StatusCode initialize()
Definition: L1CaloTriggerTowerSelector.cxx:33
L1CaloTriggerTowerSelector::finalize
virtual StatusCode finalize()
Definition: L1CaloTriggerTowerSelector.cxx:91
DataVector< LVL1::TriggerTower >
AthAlgorithm
Definition: AthAlgorithm.h:47
L1CaloTriggerTowerSelector::m_outputTriggerTowerLocation
std::string m_outputTriggerTowerLocation
Definition: L1CaloTriggerTowerSelector.h:38
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
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
L1CaloTriggerTowerSelector::m_inputTriggerTowerLocation
std::string m_inputTriggerTowerLocation
Definition: L1CaloTriggerTowerSelector.h:37
L1CaloTriggerTowerSelector::isSelected
bool isSelected(double eta, double phi)
Definition: L1CaloTriggerTowerSelector.cxx:96
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
TriggerTowerCollection
DataVector< LVL1::TriggerTower > TriggerTowerCollection
Definition: TriggerTowerCollection.h:10
TriggerTowerCollection.h
LVL1::TriggerTower::eta
double eta() const
returns eta coord
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/TriggerTower.h:94
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
LVL1::TriggerTowerKey
The TriggerTowerKey object provides the key for each trigger tower depending on its eta-phi coords.
Definition: TriggerTowerKey.h:56
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
xAOD::TriggerTower
TriggerTower_v2 TriggerTower
Define the latest version of the TriggerTower class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/TriggerTower.h:16