ATLAS Offline Software
Loading...
Searching...
No Matches
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
9L1CaloTriggerTowerSelector::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
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
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
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)
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
std::vector< double > m_vEtaSelectionRange
bool isSelected(double eta, double phi)
std::vector< double > m_vPhiSelectionRange
L1CaloTriggerTowerSelector(const std::string &name, ISvcLocator *pSvcLocator)
The TriggerTowerKey object provides the key for each trigger tower depending on its eta-phi coords.
Trigger towers are the inputs to all other parts of the calorimeter trigger.