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

This is a tool to reconstruct the L1 JEM and CMX-Jet hits from RoIs. More...

#include <L1JetCMXTools.h>

Inheritance diagram for LVL1::L1JetCMXTools:
Collaboration diagram for LVL1::L1JetCMXTools:

Public Member Functions

 L1JetCMXTools (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor.
virtual ~L1JetCMXTools ()
 default destructor
virtual StatusCode initialize ()
 standard Athena-Algorithm method
virtual void formCMXJetTob (const xAOD::JEMTobRoIContainer *jemRoiVec, xAOD::CMXJetTobContainer *cmxTobVec) const
 form CMX-Jet TOBs from RoIs - single slice
virtual void formCMXJetTob (const std::vector< const xAOD::JEMTobRoIContainer * > &jemRoiColls, xAOD::CMXJetTobContainer *cmxTobVec, int peak) const
 form CMX-Jet TOBs from RoIs - multiple slices
virtual void formCMXJetHits (const xAOD::CMXJetTobContainer *cmxTobVec, xAOD::CMXJetHitsContainer *cmxHitsVec) const
 form complete CMX-Jet hits from CMX-Jet TOBs
virtual void formCMXJetHitsCrate (const xAOD::CMXJetTobContainer *cmxTobVec, xAOD::CMXJetHitsContainer *cmxHitsCrate) const
 form partial CMX-Jet hits (crate) from CMX-Jet TOBs
virtual void formCMXJetHitsSystem (const xAOD::CMXJetHitsContainer *cmxHitsCrate, xAOD::CMXJetHitsContainer *cmxHitsSys) const
 form partial CMX-Jet hits (system) from crate CMX-Jet hits
virtual void formCMXJetHitsTopo (const xAOD::CMXJetTobContainer *cmxTobVec, xAOD::CMXJetHitsContainer *cmxHitsTopo) const
 form partial CMX-Jet hits (topo) from system CMX-Jet TOBs
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

enum  HitsType { MAIN_HITS , FORWARD_HITS }
typedef std::vector< uint32_t > HitsVector
typedef std::vector< uint32_t > ErrorVector
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

void getHits (const xAOD::CMXJetTob *tob, HitsVector &hit10, HitsVector &hit11, HitsVector &hit20, HitsVector &hit21) const
 Get hit map.
void addOverflow (ErrorVector &hitErr, const ErrorVector &tobErr) const
 Add overflow bit.
void addCMXJetHits (HitsVector &vec1, const HitsVector &vec2, HitsType type) const
 Add hits from second vector to first.
unsigned int addHits (unsigned int hitMult, unsigned int hitVec, int multBits, int vecBits, int nthresh) const
 Increment JEM/CMX hit word.
void mergeCMXJetHits (xAOD::CMXJetHitsContainer *cmxHitsVec1, xAOD::CMXJetHitsContainer *cmxHitsVec2) const
 Merge CMX-Jet hits vectors.
void saveCMXJetHits (xAOD::CMXJetHitsContainer *cmxHitsVec, const HitsVector &hits0, const HitsVector &hits1, const ErrorVector &err0, const ErrorVector &err1, int crate, int source, int peak) const
 Save non-zero CMX-Jet hits.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< TrigConf::L1Menum_L1MenuKey { this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu", "L1 Menu" }
int m_crates
 Number of crates.
int m_modules
 Number of JEM modules per crate.
int m_maxTobs
 Maximum number of TOBs per module to CMXs.
int m_sysCrate
 System crate number.
bool m_debug
 Debug flag.
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

Detailed Description

This is a tool to reconstruct the L1 JEM and CMX-Jet hits from RoIs.

Used for offline monitoring and trigger reconstruction.

Useage: L1JetCMXTools->formJEMTobRoI() // convert to JEMTobRoI from other RoI classes L1JetCMXTools->formCMXJetTob() // form CMX-Jet TOBs from JEMTobRoIs L1JetCMXTools->formCMXJetHits() // form CMX-Jet hits from CMXJetTobs

@author  Peter Faulkner

Definition at line 36 of file L1JetCMXTools.h.

Member Typedef Documentation

◆ ErrorVector

typedef std::vector<uint32_t> LVL1::L1JetCMXTools::ErrorVector
private

Definition at line 77 of file L1JetCMXTools.h.

◆ HitsVector

typedef std::vector<uint32_t> LVL1::L1JetCMXTools::HitsVector
private

Definition at line 76 of file L1JetCMXTools.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ HitsType

Enumerator
MAIN_HITS 
FORWARD_HITS 

Definition at line 74 of file L1JetCMXTools.h.

Constructor & Destructor Documentation

◆ L1JetCMXTools()

LVL1::L1JetCMXTools::L1JetCMXTools ( const std::string & type,
const std::string & name,
const IInterface * parent )

Constructor.

Definition at line 34 of file L1JetCMXTools.cxx.

36 : AthAlgTool(type, name, parent),
37 m_crates(2),
38 m_modules(16), m_maxTobs(4), m_sysCrate(1), m_debug(false) {
39 declareInterface<IL1JetCMXTools>(this);
40}
AthAlgTool()
Default constructor:
int m_crates
Number of crates.
int m_sysCrate
System crate number.
int m_modules
Number of JEM modules per crate.
bool m_debug
Debug flag.
int m_maxTobs
Maximum number of TOBs per module to CMXs.

◆ ~L1JetCMXTools()

LVL1::L1JetCMXTools::~L1JetCMXTools ( )
virtual

default destructor

Destructor.

Definition at line 44 of file L1JetCMXTools.cxx.

44{}

Member Function Documentation

◆ addCMXJetHits()

void LVL1::L1JetCMXTools::addCMXJetHits ( HitsVector & vec1,
const HitsVector & vec2,
HitsType type ) const
private

Add hits from second vector to first.

Definition at line 409 of file L1JetCMXTools.cxx.

410 {
411 int size1 = vec1.size();
412 int size2 = vec2.size();
413 if (size1 < size2)
414 vec1.resize(size2);
415 HitsVector::iterator pos1 = vec1.begin();
416 HitsVector::iterator pose1 = vec1.end();
417 HitsVector::const_iterator pos2 = vec2.begin();
418 HitsVector::const_iterator pose2 = vec2.end();
419 for (; pos1 != pose1 && pos2 != pose2; ++pos1, ++pos2) {
420 if (type == MAIN_HITS)
421 *pos1 = addHits(*pos1, *pos2, 15, 15, 5);
422 else
423 *pos1 = addHits(*pos1, *pos2, 16, 16, 8);
424 }
425}
unsigned int addHits(unsigned int hitMult, unsigned int hitVec, int multBits, int vecBits, int nthresh) const
Increment JEM/CMX hit word.
std::vector< D3PDTest::MyVec2 > vec2

◆ addHits()

unsigned int LVL1::L1JetCMXTools::addHits ( unsigned int hitMult,
unsigned int hitVec,
int multBits,
int vecBits,
int nthresh ) const
private

Increment JEM/CMX hit word.

Definition at line 429 of file L1JetCMXTools.cxx.

431 {
432 if (m_debug)
433 msg(MSG::DEBUG) << "addHits: Original hitMult = " << std::hex << hitMult
434 << ". Add hitWord = " << hitVec << std::dec << endmsg;
435
436 int nbitsOut = multBits / nthresh;
437 int nbitsIn = vecBits / nthresh;
438
439 if (m_debug)
440 msg(MSG::DEBUG) << " Bits per threshold = " << nbitsOut << endmsg;
441
442 int max = (1 << nbitsOut) - 1;
443 unsigned int multMask = max;
444 unsigned int hitMask = (1 << nbitsIn) - 1;
445 unsigned int shift = 0;
446
447 unsigned int hits = 0;
448
449 for (int i = 0; i < nthresh; i++) {
450 int mult = (hitMult & multMask) + (hitVec & hitMask);
451 mult = ((mult <= max) ? mult : max);
452 hits += (mult << shift);
453
454 hitMult >>= nbitsOut;
455 hitVec >>= nbitsIn;
456 shift += nbitsOut;
457 }
458
459 if (m_debug)
460 msg(MSG::DEBUG) << "addHits returning hitMult = " << std::hex << hits
461 << std::dec << endmsg;
462
463 return hits;
464}
#define endmsg
#define max(a, b)
Definition cfImp.cxx:41
MsgStream & msg() const

◆ addOverflow()

void LVL1::L1JetCMXTools::addOverflow ( ErrorVector & hitErr,
const ErrorVector & tobErr ) const
private

Add overflow bit.

Definition at line 391 of file L1JetCMXTools.cxx.

392 {
393 const int timeslices = tobErr.size();
394 hitErr.resize(timeslices);
395 for (int slice = 0; slice < timeslices; ++slice) {
396 int error = tobErr[slice];
397 if (error) {
398 LVL1::DataError err(error);
399 int overflow = err.get(LVL1::DataError::Overflow);
400 LVL1::DataError err2;
401 err2.set(LVL1::DataError::Overflow, overflow);
402 hitErr[slice] |= err2.error();
403 }
404 }
405}
int error() const
Return the full error word.
Definition DataError.h:78
void set(ErrorBit bit, int value=1)
Set an error bit or data.
Definition DataError.cxx:28

◆ 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

◆ formCMXJetHits()

void LVL1::L1JetCMXTools::formCMXJetHits ( const xAOD::CMXJetTobContainer * cmxTobVec,
xAOD::CMXJetHitsContainer * cmxHitsVec ) const
virtual

form complete CMX-Jet hits from CMX-Jet TOBs

Implements LVL1::IL1JetCMXTools.

Definition at line 144 of file L1JetCMXTools.cxx.

146 {
150
151 formCMXJetHitsCrate(cmxTobVec, cmxHitsCrate);
152 formCMXJetHitsSystem(cmxHitsCrate, cmxHitsSys);
153 formCMXJetHitsTopo(cmxTobVec, cmxHitsTopo);
154
155 mergeCMXJetHits(cmxHitsVec, cmxHitsCrate);
156 mergeCMXJetHits(cmxHitsVec, cmxHitsSys);
157 mergeCMXJetHits(cmxHitsVec, cmxHitsTopo);
158
159 delete cmxHitsCrate;
160 delete cmxHitsSys;
161 delete cmxHitsTopo;
162}
virtual void formCMXJetHitsTopo(const xAOD::CMXJetTobContainer *cmxTobVec, xAOD::CMXJetHitsContainer *cmxHitsTopo) const
form partial CMX-Jet hits (topo) from system CMX-Jet TOBs
virtual void formCMXJetHitsSystem(const xAOD::CMXJetHitsContainer *cmxHitsCrate, xAOD::CMXJetHitsContainer *cmxHitsSys) const
form partial CMX-Jet hits (system) from crate CMX-Jet hits
void mergeCMXJetHits(xAOD::CMXJetHitsContainer *cmxHitsVec1, xAOD::CMXJetHitsContainer *cmxHitsVec2) const
Merge CMX-Jet hits vectors.
virtual void formCMXJetHitsCrate(const xAOD::CMXJetTobContainer *cmxTobVec, xAOD::CMXJetHitsContainer *cmxHitsCrate) const
form partial CMX-Jet hits (crate) from CMX-Jet TOBs
CMXJetHitsContainer_v1 CMXJetHitsContainer
Define the latest version of the CMXJetHits class.

◆ formCMXJetHitsCrate()

void LVL1::L1JetCMXTools::formCMXJetHitsCrate ( const xAOD::CMXJetTobContainer * cmxTobVec,
xAOD::CMXJetHitsContainer * cmxHitsCrate ) const
virtual

form partial CMX-Jet hits (crate) from CMX-Jet TOBs

Implements LVL1::IL1JetCMXTools.

Definition at line 164 of file L1JetCMXTools.cxx.

166 {
167 int peakm = 0;
168 std::vector<HitsVector> hitVecM(2 * m_crates);
169 std::vector<HitsVector> hitVecF(2 * m_crates);
170 std::vector<ErrorVector> errVecM(2 * m_crates); // Need overflow
171 std::vector<ErrorVector> errVecF(2 * m_crates);
172 HitsVector hit10, hit20;
173 HitsVector hit11, hit21;
176 for (; pos != pose; ++pos) {
177 const xAOD::CMXJetTob *tob = *pos;
178 const int index = 2 * tob->crate();
179 const std::vector<uint32_t> error(tob->errorVec());
180 hit10.clear();
181 hit11.clear();
182 hit20.clear();
183 hit21.clear();
184 getHits(tob, hit10, hit11, hit20, hit21);
185
186 addCMXJetHits(hitVecM[index], hit10, MAIN_HITS);
187 addCMXJetHits(hitVecM[index + 1], hit11, MAIN_HITS);
188 addCMXJetHits(hitVecF[index], hit20, FORWARD_HITS);
189 addCMXJetHits(hitVecF[index + 1], hit21, FORWARD_HITS);
190
191 addOverflow(errVecF[index], error);
192 addOverflow(errVecF[index + 1], error);
193 addOverflow(errVecM[index], error);
194 addOverflow(errVecM[index + 1], error);
195 const int peak = tob->peak();
196 if (peak > peakm)
197 peakm = peak;
198 }
199 // Save non-zero crate totals
200 for (int crate = 0; crate < m_crates; ++crate) {
201 const int index = crate * 2;
202 saveCMXJetHits(cmxHitsCrate, hitVecM[index], hitVecM[index + 1],
203 errVecM[index], errVecM[index + 1], crate,
205 saveCMXJetHits(cmxHitsCrate, hitVecF[index], hitVecF[index + 1],
206 errVecF[index], errVecF[index + 1], crate,
208 if (crate != m_sysCrate) { // REMOTE totals
209 saveCMXJetHits(cmxHitsCrate, hitVecM[index], hitVecM[index + 1],
210 errVecM[index], errVecM[index + 1], m_sysCrate,
212 saveCMXJetHits(cmxHitsCrate, hitVecF[index], hitVecF[index + 1],
213 errVecF[index], errVecF[index + 1], m_sysCrate,
215 }
216 }
217}
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
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 getHits(const xAOD::CMXJetTob *tob, HitsVector &hit10, HitsVector &hit11, HitsVector &hit20, HitsVector &hit21) const
Get hit map.
void saveCMXJetHits(xAOD::CMXJetHitsContainer *cmxHitsVec, const HitsVector &hits0, const HitsVector &hits1, const ErrorVector &err0, const ErrorVector &err1, int crate, int source, int peak) const
Save non-zero CMX-Jet hits.
void addOverflow(ErrorVector &hitErr, const ErrorVector &tobErr) const
Add overflow bit.
std::vector< uint32_t > HitsVector
void addCMXJetHits(HitsVector &vec1, const HitsVector &vec2, HitsType type) const
Add hits from second vector to first.
uint8_t peak() const
get peak
const std::vector< uint32_t > & errorVec() const
get errorVec
uint8_t crate() const
get crate
str index
Definition DeMoScan.py:362
CMXJetTob_v1 CMXJetTob
Define the latest version of the CMXJetTob class.

◆ formCMXJetHitsSystem()

void LVL1::L1JetCMXTools::formCMXJetHitsSystem ( const xAOD::CMXJetHitsContainer * cmxHitsCrate,
xAOD::CMXJetHitsContainer * cmxHitsSys ) const
virtual

form partial CMX-Jet hits (system) from crate CMX-Jet hits

Implements LVL1::IL1JetCMXTools.

Definition at line 219 of file L1JetCMXTools.cxx.

221 {
222 int peakm = 0;
223 HitsVector systemMain0(1);
224 HitsVector systemMain1(1);
225 HitsVector systemFwd0(1);
226 HitsVector systemFwd1(1);
227 ErrorVector errVec(1);
229 xAOD::CMXJetHitsContainer::const_iterator pose = cmxHitsCrate->end();
230 for (; pos != pose; ++pos) {
231 const xAOD::CMXJetHits *hits = *pos;
232 if (hits->crate() != m_sysCrate)
233 continue;
234 int source = hits->sourceComponent();
235 if (source != xAOD::CMXJetHits::LOCAL_MAIN &&
239 continue;
240 int peak = hits->peak();
241 if (peak > peakm)
242 peakm = peak;
243 HitsVector hitsVec0(hits->hitsVec0());
244 HitsVector hitsVec1(hits->hitsVec1());
245 if (source == xAOD::CMXJetHits::LOCAL_MAIN ||
247 addCMXJetHits(systemMain0, hitsVec0, MAIN_HITS);
248 addCMXJetHits(systemMain1, hitsVec1, MAIN_HITS);
249 } else {
250 addCMXJetHits(systemFwd0, hitsVec0, FORWARD_HITS);
251 addCMXJetHits(systemFwd1, hitsVec1, FORWARD_HITS);
252 }
253 ErrorVector error(hits->errorVec0()); // all have same error so redundant?
254 addOverflow(errVec, error);
255 }
256 // Save non-zero system totals
257 saveCMXJetHits(cmxHitsSys, systemMain0, systemMain1, errVec, errVec,
259 saveCMXJetHits(cmxHitsSys, systemFwd0, systemFwd1, errVec, errVec, m_sysCrate,
261}
std::vector< uint32_t > ErrorVector
CMXJetHits_v1 CMXJetHits
Define the latest version of the CMXJetHits class.

◆ formCMXJetHitsTopo()

void LVL1::L1JetCMXTools::formCMXJetHitsTopo ( const xAOD::CMXJetTobContainer * cmxTobVec,
xAOD::CMXJetHitsContainer * cmxHitsTopo ) const
virtual

form partial CMX-Jet hits (topo) from system CMX-Jet TOBs

Implements LVL1::IL1JetCMXTools.

Definition at line 263 of file L1JetCMXTools.cxx.

265 {
266 int peakm = 0;
267 int timeslices = 0;
268 std::vector<HitsVector> hitVec(4 * m_crates);
271 for (; pos != pose; ++pos) {
272 const xAOD::CMXJetTob *tob = *pos;
273 const int crate = tob->crate();
274 const int jem = tob->jem();
275 const int frame = tob->frame();
276 const int loc = tob->location();
277 const int index = crate * 4;
278 const std::vector<int> energyLg(tob->energyLargeVec().begin(),
279 tob->energyLargeVec().end());
280 const std::vector<int> energySm(tob->energySmallVec().begin(),
281 tob->energySmallVec().end());
282 // const std::vector<int>& error(tob->errorVec());
283 timeslices = energyLg.size();
284 HitsVector &checksum(hitVec[index]);
285 HitsVector &map(hitVec[index + 1]);
286 HitsVector &countsLow(hitVec[index + 2]);
287 HitsVector &countsHigh(hitVec[index + 3]);
288 checksum.resize(timeslices);
289 map.resize(timeslices);
290 countsLow.resize(timeslices);
291 countsHigh.resize(timeslices);
292 for (int slice = 0; slice < timeslices; ++slice) {
293 if (energyLg[slice] == 0 && energySm[slice] == 0)
294 continue;
295 // checksum
296 // LVL1::DataError err(error[slice]);
297 // const int overflow = err.get(LVL1::DataError::Overflow);
298 const int overflow = 0; // don't include overflow as not in slink data
299 checksum[slice] +=
300 jem + frame + loc + energyLg[slice] + energySm[slice] + overflow;
301 checksum[slice] &= 0xffff;
302 // occupancy map
303 map[slice] |= (1 << jem);
304 // occupancy counts
305 if (jem < 8) {
306 countsLow[slice] += (1 << (3 * jem)); // can't saturate
307 } else {
308 countsHigh[slice] += (1 << (3 * (jem - 8)));
309 }
310 }
311 const int peak = tob->peak();
312 if (peak > peakm)
313 peakm = peak;
314 }
315 // Save non-zero crate totals
316 HitsVector dummy(timeslices);
317 ErrorVector dummyE(timeslices);
318 for (int crate = 0; crate < m_crates; ++crate) {
319 const int index = crate * 4;
320 saveCMXJetHits(cmxHitsTopo, hitVec[index], dummy, dummyE, dummyE, crate,
322 saveCMXJetHits(cmxHitsTopo, hitVec[index + 1], dummy, dummyE, dummyE, crate,
324 saveCMXJetHits(cmxHitsTopo, hitVec[index + 2], hitVec[index + 3], dummyE,
326 peakm);
327 }
328}
uint8_t location() const
get location
const std::vector< uint16_t > & energySmallVec() const
get energySmallVec
const std::vector< uint16_t > & energyLargeVec() const
get energyLargeVec
uint8_t frame() const
get frame
uint8_t jem() const
get jem

◆ formCMXJetTob() [1/2]

void LVL1::L1JetCMXTools::formCMXJetTob ( const std::vector< const xAOD::JEMTobRoIContainer * > & jemRoiColls,
xAOD::CMXJetTobContainer * cmxTobVec,
int peak ) const
virtual

form CMX-Jet TOBs from RoIs - multiple slices

Implements LVL1::IL1JetCMXTools.

Definition at line 64 of file L1JetCMXTools.cxx.

66 {
67 std::map<uint32_t, const xAOD::JEMTobRoI *> jemRoiMap;
68 std::map<int, xAOD::CMXJetTob *> cmxTobMap;
70 int timeslices = jemRoiColls.size();
71 for (int slice = 0; slice < timeslices; ++slice) {
72 const xAOD::JEMTobRoIContainer *jemRoiVec = jemRoiColls[slice];
73 jemRoiMap.clear();
74 std::vector<unsigned int> presenceMaps(m_crates * m_modules);
75 std::vector<int> tobCount(m_crates * m_modules);
78 for (; it != itE; ++it) { // get sorted list
79 const xAOD::JEMTobRoI *roi = *it;
80 const int crate = roi->crate();
81 const int jem = roi->jem();
82 const int index = crate * m_modules + jem;
83 const int presenceBit = roi->frame(); // <<== CHECK
84 presenceMaps[index] |= (1 << presenceBit);
85 tobCount[index]++;
86 uint32_t key = roi->roiWord();
87 jemRoiMap.insert(std::make_pair(key, roi));
88 }
89 std::map<uint32_t, const xAOD::JEMTobRoI *>::const_iterator mit =
90 jemRoiMap.begin();
91 std::map<uint32_t, const xAOD::JEMTobRoI *>::const_iterator mitE =
92 jemRoiMap.end();
93 for (; mit != mitE; ++mit) {
94 const xAOD::JEMTobRoI *roi = mit->second;
95 const int crate = roi->crate();
96 const int jem = roi->jem();
97 const int frame = roi->frame();
98 const int loc = roi->location();
99 const int index = crate * m_modules + jem;
100 const int energyLg = roi->energyLarge();
101 const int energySm = roi->energySmall();
102 const unsigned int presence = presenceMaps[index];
103 int error = 0;
104 if (tobCount[index] > m_maxTobs) { // overflow
105 int count = 0;
106 for (int bit = 0; bit <= frame; ++bit)
107 count += (presence >> bit) & 0x1;
108 if (count > m_maxTobs)
109 continue;
110 LVL1::DataError err;
112 error = err.error();
113 }
114 const int key = (((((crate << 4) | jem) << 3) | frame) << 2) | loc;
115 xAOD::CMXJetTob *tob = 0;
116 std::map<int, xAOD::CMXJetTob *>::iterator xit = cmxTobMap.find(key);
117 if (xit == cmxTobMap.end()) {
118 tob = new xAOD::CMXJetTob;
119 tob->makePrivateStore();
120 tob->initialize(crate, jem, frame, loc);
121 if (timeslices > 0) { // TODO(amazurov): need to check >1 or >0
122 std::vector<uint16_t> vecU16(timeslices);
123 std::vector<uint32_t> vecU32(timeslices);
124 tob->addTob(vecU16, vecU16, vecU32, vecU16);
125 tob->setPeak(peak);
126 }
127 cmxTobMap.insert(std::make_pair(key, tob));
128 cmxTobVec->push_back(tob);
129 } else
130 tob = xit->second;
131 std::vector<uint16_t> energyLgVec(tob->energyLargeVec());
132 std::vector<uint16_t> energySmVec(tob->energySmallVec());
133 std::vector<uint32_t> errorVec(tob->errorVec());
134 std::vector<uint16_t> presenceMapVec(tob->presenceMapVec());
135 energyLgVec[slice] = energyLg;
136 energySmVec[slice] = energySm;
137 errorVec[slice] = error;
138 presenceMapVec[slice] = presence;
139 tob->addTob(energyLgVec, energySmVec, errorVec, presenceMapVec);
140 }
141 }
142}
value_type push_back(value_type pElem)
Add an element to the end of the collection.
void makePrivateStore()
Create a new (empty) private store for this object.
virtual void initialize(const uint8_t crate, const uint8_t jem, const uint8_t frame, const uint8_t loc)
initialize
void setPeak(uint8_t)
set peak
const std::vector< uint16_t > & presenceMapVec() const
get presenceMapVec
void addTob(const std::vector< uint16_t > &energyLargeVec, const std::vector< uint16_t > &energySmallVec, const std::vector< uint32_t > &errorVec, const std::vector< uint16_t > &presenceMapVec)
add data to existing object
uint32_t roiWord() const
get roiWord
int frame() const
Return RoI frame number (0-7)
int energyLarge() const
Return energy large window size.
int crate() const
Return crate number (0-1)
int energySmall() const
Return energy small window size.
int jem() const
Return JEM number (0-15)
int location() const
Return location (RoI local coords) (0-3)
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
JEMTobRoI_v1 JEMTobRoI
Define the latest version of the JEMTobRoI class.
JEMTobRoIContainer_v1 JEMTobRoIContainer
Define the latest version of the JEMTobRoI class.
setEventNumber uint32_t

◆ formCMXJetTob() [2/2]

void LVL1::L1JetCMXTools::formCMXJetTob ( const xAOD::JEMTobRoIContainer * jemRoiVec,
xAOD::CMXJetTobContainer * cmxTobVec ) const
virtual

form CMX-Jet TOBs from RoIs - single slice

Implements LVL1::IL1JetCMXTools.

Definition at line 58 of file L1JetCMXTools.cxx.

59 {
60 std::vector<const xAOD::JEMTobRoIContainer *> jemRoiColls(1, jemRoiVec);
61 formCMXJetTob(jemRoiColls, cmxTobVec, 0);
62}
virtual void formCMXJetTob(const xAOD::JEMTobRoIContainer *jemRoiVec, xAOD::CMXJetTobContainer *cmxTobVec) const
form CMX-Jet TOBs from RoIs - single slice

◆ getHits()

void LVL1::L1JetCMXTools::getHits ( const xAOD::CMXJetTob * tob,
HitsVector & hit10,
HitsVector & hit11,
HitsVector & hit20,
HitsVector & hit21 ) const
private

Get hit map.

Definition at line 330 of file L1JetCMXTools.cxx.

332 {
333 using namespace TrigConf;
334 const std::vector<uint16_t> &energyLg(tob->energyLargeVec());
335 const std::vector<uint16_t> &energySm(tob->energySmallVec());
336 const int timeslices = energyLg.size();
337 auto err = LVL1::DataError(tob->error());
338
339 hit10.assign(timeslices, 0);
340 hit11.assign(timeslices, 0);
341 hit20.assign(timeslices, 0);
342 hit21.assign(timeslices, 0);
343
344 for (int slice = 0; slice < timeslices; ++slice) {
346 hit10[slice] = 0x7fff;
347 hit11[slice] = 0x7fff;
348 hit20[slice] = 0xffff;
349 hit21[slice] = 0x3fff;
350 continue;
351 }
352
353 if (energyLg[slice] == 0 && energySm[slice] == 0)
354 continue;
355
356 xAOD::JEMTobRoI tobRoi;
357 tobRoi.makePrivateStore();
358 tobRoi.initialize(tob->crate(), tob->jem(), tob->frame(), tob->location(),
359 energyLg[slice], energySm[slice]);
360
361 auto l1Menu = SG::makeHandle( m_L1MenuKey );
362 LVL1::RecJetRoI roi(tobRoi.roiWord(), &(*l1Menu));
363
364 unsigned int numThresholdsHalf = 5;
365 unsigned int numBitsPerCounter = 3;
366
367 for (unsigned int i = 0; i < numThresholdsHalf * 2; ++i) {
368 if (roi.passedThreshold(i)) {
369 HitsVector &hit = i < numThresholdsHalf ? hit10 : hit11;
370 unsigned int ibit = i < numThresholdsHalf ? i : i - numThresholdsHalf;
371 hit[slice] |= (1 << (ibit * numBitsPerCounter));
372 }
373 }
374
375 numThresholdsHalf = 8;
376 numBitsPerCounter = 2;
377
378 for (unsigned int i = 0; i < numThresholdsHalf * 2; ++i) {
379 if (roi.passedThreshold(10 + i)) {
380 HitsVector &hit = i < numThresholdsHalf ? hit20 : hit21;
381 unsigned int ibit = i < numThresholdsHalf ? i : i - numThresholdsHalf;
382 hit[slice] |= (1 << (ibit * numBitsPerCounter));
383 }
384 }
385
386 } // end slice for-loop
387}
SG::ReadHandleKey< TrigConf::L1Menu > m_L1MenuKey
uint32_t error() const
get errorVec at peak bunch crossing
virtual void initialize(const int crate, const int jem, const int frame, const int location, const int energyLarge, const int energySmall)
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())

◆ initialize()

StatusCode LVL1::L1JetCMXTools::initialize ( )
virtual

standard Athena-Algorithm method

Initialisation.

Definition at line 48 of file L1JetCMXTools.cxx.

48 {
49 m_debug = msgLvl(MSG::DEBUG);
50
51 ATH_CHECK( m_L1MenuKey.initialize() );
52
53 return StatusCode::SUCCESS;
54}
#define ATH_CHECK
Evaluate an expression and check for errors.
bool msgLvl(const MSG::Level lvl) const

◆ 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::IL1JetCMXTools::interfaceID ( )
inlinestaticinherited

Definition at line 55 of file IL1JetCMXTools.h.

56 {
57 return IID_IL1JetCMXTools;
58 }
static const InterfaceID IID_IL1JetCMXTools("LVL1::IL1JetCMXTools", 1, 0)
Interface definition for L1JetCMXTools.

◆ mergeCMXJetHits()

void LVL1::L1JetCMXTools::mergeCMXJetHits ( xAOD::CMXJetHitsContainer * cmxHitsVec1,
xAOD::CMXJetHitsContainer * cmxHitsVec2 ) const
private

Merge CMX-Jet hits vectors.

Definition at line 468 of file L1JetCMXTools.cxx.

470 {
471 int size = cmxHitsVec2->size();
472 for (int index = 0; index < size; ++index) {
473 xAOD::CMXJetHits *hitsIn = 0;
474 xAOD::CMXJetHits *hitsOut = 0;
475 cmxHitsVec2->swapElement(index, hitsIn, hitsOut);
476 cmxHitsVec1->push_back(hitsOut);
477 }
478 cmxHitsVec2->clear();
479}
void swapElement(size_type index, value_type newElem, reference oldElem)
Swap one element out of the container.
size_type size() const noexcept
Returns the number of elements in the collection.
void clear()
Erase all the elements in the collection.

◆ 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 }

◆ saveCMXJetHits()

void LVL1::L1JetCMXTools::saveCMXJetHits ( xAOD::CMXJetHitsContainer * cmxHitsVec,
const HitsVector & hits0,
const HitsVector & hits1,
const ErrorVector & err0,
const ErrorVector & err1,
int crate,
int source,
int peak ) const
private

Save non-zero CMX-Jet hits.

Definition at line 483 of file L1JetCMXTools.cxx.

488 {
489 if (std::accumulate(hits0.begin(), hits0.end(), 0) ||
490 std::accumulate(hits1.begin(), hits1.end(), 0)) {
492 item->makePrivateStore();
493 item->initialize(crate, source, hits0, hits1, err0, err1, peak);
494 cmxHitsVec->push_back(item);
495 }
496}

◆ 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_crates

int LVL1::L1JetCMXTools::m_crates
private

Number of crates.

Definition at line 103 of file L1JetCMXTools.h.

◆ m_debug

bool LVL1::L1JetCMXTools::m_debug
private

Debug flag.

Definition at line 111 of file L1JetCMXTools.h.

◆ 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_L1MenuKey

SG::ReadHandleKey<TrigConf::L1Menu> LVL1::L1JetCMXTools::m_L1MenuKey { this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu", "L1 Menu" }
private

Definition at line 101 of file L1JetCMXTools.h.

101{ this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu", "L1 Menu" };

◆ m_maxTobs

int LVL1::L1JetCMXTools::m_maxTobs
private

Maximum number of TOBs per module to CMXs.

Definition at line 107 of file L1JetCMXTools.h.

◆ m_modules

int LVL1::L1JetCMXTools::m_modules
private

Number of JEM modules per crate.

Definition at line 105 of file L1JetCMXTools.h.

◆ m_sysCrate

int LVL1::L1JetCMXTools::m_sysCrate
private

System crate number.

Definition at line 109 of file L1JetCMXTools.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: