ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1::L1JetElementTools Class Reference

This is a tool to reconstruct the L1 Jet trigger sums for a particular RoI location from the stored JetInputs. More...

#include <L1JetElementTools.h>

Inheritance diagram for LVL1::L1JetElementTools:
Collaboration diagram for LVL1::L1JetElementTools:

Public Member Functions

 L1JetElementTools (const std::string &, const std::string &, const IInterface *)
 Constructor.
virtual ~L1JetElementTools ()
 default destructor
virtual StatusCode initialize ()
 standard Athena-Algorithm method
virtual StatusCode finalize ()
 standard Athena-Algorithm method
virtual void makeJetElements (const xAOD::TriggerTowerContainer *tts, xAOD::JetElementContainer *jetElements) const
 Fill DataVector of JetElements from user-supplied TriggerTowers.
virtual void mapJetElements (const xAOD::JetElementContainer *jetElements, xAOD::JetElementMap_t *map) const
 Fill map of JetElements from user-supplied vector of TriggerTowers.
virtual void makeJetElements (const DataVector< TriggerTower > *tts, DataVector< JetElement > *jetElements) const
 Fill DataVector of JetElements from user-supplied vector of TriggerTowers.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Static Private Attributes

static const int m_ttSat = 0xFF
 Trigger Tower and Jet Element properties.
static const int m_layerSat = 0x1FF

Detailed Description

This is a tool to reconstruct the L1 Jet trigger sums for a particular RoI location from the stored JetInputs.

Used for offline monitoring and trigger reconstruction.

Useage: L1JetElementTools->mapTowers() // set up event for analysis L1JetElementTools->formSums(eta, phi) // for each RoI L1JetElementTools->ET8x8() // etc. Return values

Author
Alan Watson Alan..nosp@m.Wats.nosp@m.on@ce.nosp@m.rn.c.nosp@m.h

Definition at line 38 of file L1JetElementTools.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ L1JetElementTools()

LVL1::L1JetElementTools::L1JetElementTools ( const std::string & t,
const std::string & n,
const IInterface * p )

Constructor.

Definition at line 24 of file L1JetElementTools.cxx.

27 :
28 AthAlgTool(t,n,p)
29{
30 declareInterface<IL1JetElementTools>(this);
31
32}
AthAlgTool()
Default constructor:

◆ ~L1JetElementTools()

LVL1::L1JetElementTools::~L1JetElementTools ( )
virtual

default destructor

Destructor.

Definition at line 36 of file L1JetElementTools.cxx.

37{
38}

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode LVL1::L1JetElementTools::finalize ( )
virtual

standard Athena-Algorithm method

Finalisation.

Definition at line 50 of file L1JetElementTools.cxx.

51{
52 return StatusCode::SUCCESS;
53}

◆ initialize()

StatusCode LVL1::L1JetElementTools::initialize ( )
virtual

standard Athena-Algorithm method

Initialisation.

Definition at line 43 of file L1JetElementTools.cxx.

44{
45 return StatusCode::SUCCESS;
46}

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & LVL1::IL1JetElementTools::interfaceID ( )
inlinestaticinherited

Definition at line 50 of file IL1JetElementTools.h.

51 {
53 }
static const InterfaceID IID_IL1JetElementTools("LVL1::IL1JetElementTools", 1, 0)
Interface definition for L1JetTools.

◆ makeJetElements() [1/2]

void LVL1::L1JetElementTools::makeJetElements ( const DataVector< TriggerTower > * tts,
DataVector< JetElement > * jetElements ) const
virtual

Fill DataVector of JetElements from user-supplied vector of TriggerTowers.

Need to get pointers to the TriggerTowers corresponding to each JetElement
Store these in a vector for each JetElement
Keep vectors of pointers in a std::map so can easily locate and add more
towers to correct element

Each entry in the "Sums" map should now be a std::vector of pointers
to all of the towers in the collection making up each JetElement.
Now we need to go through them, add their energies, and form the
actual JetElement objects.
The complication is that the EM and Had vectors may not always have
the same lengths. In this case, we need to be careful how we combine
them.

At this point we have 2 vectors of ET. If their lengths and peak
positions are equal the rest is easy

If not, we align peaks, then create vectors using only those
slices before and after peaks where both layers present

Implements LVL1::IL1JetElementTools.

Definition at line 154 of file L1JetElementTools.cxx.

154 {
155
156 // Clear collection before filling
157 jetElements->clear();
158
163 std::map< int, TriggerTowerVector_t> Sums;
164
165 // Step over all TriggerTowers, and put into map
167 JetElementKey testKey(0.0, 0.0);
168
169 for( it = tts->begin(); it != tts->end(); ++it ) {
170 // Find JetElementKey for this TriggerTower
171 int key = testKey.jeKey((*it)->phi(),(*it)->eta());
172 // Does the map already contain an entry for this JetElement?
173 std::map< int, TriggerTowerVector_t>::iterator mapIt=Sums.find(key);
174 if (mapIt != Sums.end()) {
175 // Add pointer to this tower to the list
176 (mapIt->second).push_back((*it));
177 }
178 else {
179 // New entry in map.
181 vec.push_back((*it));
182 Sums.insert(std::map< int, TriggerTowerVector_t >::value_type(key,vec));
183 }
184 } // end of loop over towers
185
193
194 for (std::map< int, TriggerTowerVector_t >::iterator mapIt = Sums.begin();
195 mapIt != Sums.end(); ++mapIt) {
196
197 // Get first TT for this JE
198 TriggerTowerVector_t::iterator it = (mapIt->second).begin();
199 if (it != (mapIt->second).end()) {
200 // Get JE eta, phi using first tower in vector (any tower in JE should do)
201 unsigned int key = testKey.jeKey((*it)->phi(),(*it)->eta());
202 double phi = testKey.phi();
203 double eta = testKey.eta();
204 // get peak positions in ET vectors
205 int emPeak = (*it)->emPeak();
206 int hadPeak = (*it)->hadPeak();
207 // create empty ET vectors
208 std::vector<int> emET;
209 std::vector<int> hadET;
210 // now loop through all TT present and add their ET values
211 // if tower saturated, saturate corresponding sum also
212 for (; it != (mapIt->second).end(); ++it) {
213 std::vector<int> tempEM = (*it)->emLUT();
214 if (tempEM.size() > emET.size()) emET.resize(tempEM.size(),0);
215 for (size_t iem = 0; iem < tempEM.size(); ++iem)
216 emET[iem] += (tempEM[iem] < m_ttSat ? tempEM[iem] : m_layerSat);
217 std::vector<int> tempHad = (*it)->hadLUT();
218 if (tempHad.size() > hadET.size()) hadET.resize(tempHad.size(),0);
219 for (size_t ihd = 0; ihd < tempHad.size(); ++ihd)
220 hadET[ihd] += (tempHad[ihd] < m_ttSat ? tempHad[ihd] : m_layerSat);
221 }
224 if (emET.size() == hadET.size() && emPeak == hadPeak) {
225 std::vector<int> Dummy(emET.size());
226 JetElement* jetElement = new JetElement(phi, eta, emET, hadET, key, Dummy, Dummy, Dummy, emPeak);
227 jetElements->push_back(jetElement);
228 }
231 else {
232 std::vector<int> emSums;
233 std::vector<int> hadSums;
234 int Peak = (emPeak < hadPeak ? emPeak : hadPeak);
235 int Tail = (emET.size() - emPeak < hadET.size() - hadPeak ?
236 emET.size() - emPeak : hadET.size() - hadPeak) - 1;
237 for (int j = emPeak - Peak; j <= emPeak + Tail; ++j) emSums.push_back(emET[j]);
238 for (int j = hadPeak - Peak; j <= hadPeak + Tail; ++j) hadSums.push_back(hadET[j]);
239
240 std::vector<int> Dummy(emSums.size());
241 JetElement* jetElement = new JetElement(phi, eta, emSums, hadSums, key, Dummy, Dummy, Dummy, Peak);
242 jetElements->push_back(jetElement);
243 } // unequal EM and Had readout
244
245 } // end of check that first element of vector present
246
247 } // end of loop through Sums map
248
249 return;
250}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
std::vector< size_t > vec
DataModel_detail::const_iterator< DataVector > const_iterator
Standard 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.
void clear()
Erase all the elements in the collection.
static const int m_layerSat
static const int m_ttSat
Trigger Tower and Jet Element properties.
std::vector< TriggerTowerMap_t::mapped_type > TriggerTowerVector_t
JetElement_v2 JetElement
Define the latest version of the JetElement class.

◆ makeJetElements() [2/2]

void LVL1::L1JetElementTools::makeJetElements ( const xAOD::TriggerTowerContainer * tts,
xAOD::JetElementContainer * jetElements ) const
virtual

Fill DataVector of JetElements from user-supplied TriggerTowers.

Fill DataVector of JetElements from user-supplied vector of TriggerTowers.

Need to get pointers to the TriggerTowers corresponding to each JetElement
Store these in a vector for each JetElement
Keep vectors of pointers in a std::map so can easily locate and add more
towers to correct element

Each entry in the "Sums" map should now be a std::vector of pointers
to all of the towers in the collection making up each JetElement.
Now we need to go through them, add their energies, and form the
actual JetElement objects.
The complication is that the EM and Had vectors may not always have
the same lengths. In this case, we need to be careful how we combine
them.

Create JetElement

Implements LVL1::IL1JetElementTools.

Definition at line 56 of file L1JetElementTools.cxx.

56 {
57
58 // Clear collection before filling
59 jetElements->clear();
60
65 std::map< int, std::vector<const xAOD::TriggerTower*> > Sums;
66
67 // Step over all TriggerTowers, and put into map
69 JetElementKey testKey(0.0, 0.0);
70
71 for ( it = tts->begin(); it != tts->end(); ++it ) {
72 // Find JetElementKey for this TriggerTower
73 int key = testKey.jeKey((*it)->phi(),(*it)->eta());
74 // Does the map already contain an entry for this JetElement?
75 std::map< int, std::vector<const xAOD::TriggerTower*> >::iterator mapIt=Sums.find(key);
76 if (mapIt != Sums.end()) {
77 // Add pointer to this tower to the list
78 (mapIt->second).push_back((*it));
79 }
80 else {
81 // New entry in map.
82 std::vector<const xAOD::TriggerTower*> vec;
83 vec.push_back((*it));
84 Sums.insert(std::map< int, std::vector<const xAOD::TriggerTower*> >::value_type(key,vec));
85 }
86 } // end of loop over towers
87
95
96 for (std::map< int, std::vector<const xAOD::TriggerTower*> >::iterator mapIt = Sums.begin();
97 mapIt != Sums.end(); ++mapIt) {
98
99 // Get first TT for this JE
100 std::vector<const xAOD::TriggerTower*>::iterator it = (mapIt->second).begin();
101 if (it != (mapIt->second).end()) {
102 // Get JE eta, phi using first tower in vector (any tower in JE should do)
103 unsigned int key = testKey.jeKey((*it)->phi(),(*it)->eta());
104 float phi = testKey.phi();
105 float eta = testKey.eta();
106 // peak position in ET vectors
107 int peak = 0;
108 // create empty ET vectors with 1 element each
109 std::vector<uint16_t> emET(1);
110 std::vector<uint16_t> hadET(1);
111 // now loop through all TT present and add their ET values
112 // if tower saturated, saturate corresponding sum also
113 // Note that this version will only create 1 time sample per JE
114 for (; it != (mapIt->second).end(); ++it) {
115 int layer = (*it)->layer();
116 int et = (*it)->jepET();
117 if (layer == 0) emET[peak] += ( et < m_ttSat ? et : m_layerSat );
118 else hadET[peak] += ( et < m_ttSat ? et : m_layerSat );
119 }
120
122 std::vector<uint32_t> Dummy(emET.size());
123 xAOD::JetElement* jetElement = new xAOD::JetElement();
124 jetElements->push_back(jetElement);
125 jetElement->initialize(eta, phi, key, emET, hadET, Dummy, Dummy, Dummy, peak);
126
127 } // end of check that first element of vector present
128
129 } // end of loop through Sums map
130
131 return;
132}
float et(const xAOD::jFexSRJetRoI *j)
virtual void initialize(const float eta, const float phi, const unsigned int key)
initialize
@ layer
Definition HitInfo.h:79

◆ mapJetElements()

void LVL1::L1JetElementTools::mapJetElements ( const xAOD::JetElementContainer * jetElements,
xAOD::JetElementMap_t * map ) const
virtual

Fill map of JetElements from user-supplied vector of TriggerTowers.

Implements LVL1::IL1JetElementTools.

Definition at line 136 of file L1JetElementTools.cxx.

136 {
137
138 // Clear map before filling
139 map->clear();
140
141 // Iterate through the DataVector and insert into the map
142
143 for (xAOD::JetElementContainer::const_iterator it = jetElements->begin();
144 it != jetElements->end(); ++it) {
145 // As long as JetElement contains the key value, lazy (& quick) option is to use it
146 int key = (*it)->key();
147 map->insert(std::make_pair(key,(*it)));
148 }
149
150 return;
151}

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_layerSat

const int LVL1::L1JetElementTools::m_layerSat = 0x1FF
staticprivate

Definition at line 63 of file L1JetElementTools.h.

◆ m_ttSat

const int LVL1::L1JetElementTools::m_ttSat = 0xFF
staticprivate

Trigger Tower and Jet Element properties.

Definition at line 62 of file L1JetElementTools.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: