ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
LVL1::L1CPHitsTools Class Reference

#include <L1CPHitsTools.h>

Inheritance diagram for LVL1::L1CPHitsTools:
Collaboration diagram for LVL1::L1CPHitsTools:

Public Member Functions

 L1CPHitsTools (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor. More...
 
virtual ~L1CPHitsTools ()
 default destructor More...
 
virtual StatusCode initialize ()
 standard Athena-Algorithm method More...
 
virtual StatusCode finalize ()
 standard Athena-Algorithm method More...
 
virtual void formCPMRoI (const DataVector< EmTauROI > *emTauRoiVec, DataVector< CPMRoI > *cpmRoiVec) const
 EmTauROI to CPMRoI conversion. More...
 
virtual void formCPMHits (const DataVector< CPMRoI > *cpmRoiVec, DataVector< CPMHits > *cpmHitsVec) const
 form CPM hits from RoIs - single slice More...
 
virtual void formCPMHits (const std::vector< const DataVector< CPMRoI > * > &cpmRoiColls, DataVector< CPMHits > *cpmHitsVec, int peak) const
 form CPM hits from RoIs - multiple slices More...
 
virtual void formCMMCPHits (const DataVector< CPMHits > *cpmHitsVec, DataVector< CMMCPHits > *cmmHitsVec) const
 form complete CMM-CP hits from CPM hits More...
 
virtual void formCMMCPHitsModule (const DataVector< CPMHits > *cpmHitsVec, DataVector< CMMCPHits > *cmmHitsMod) const
 form partial CMM-CP hits (module) from CPM hits More...
 
virtual void formCMMCPHitsCrate (const DataVector< CMMCPHits > *cmmHitsMod, DataVector< CMMCPHits > *cmmHitsCrate) const
 form partial CMM-CP hits (crate) from module CMM-CP hits More...
 
virtual void formCMMCPHitsSystem (const DataVector< CMMCPHits > *cmmHitsCrate, DataVector< CMMCPHits > *cmmHitsSys) const
 form partial CMM-CP hits (system) from crate CMM-CP hits More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) 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 More...
 
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. More...
 

Private Types

typedef std::vector< unsigned int > HitsVector
 
typedef std::vector< int > ErrorVector
 
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

void addCMMCPHits (HitsVector &vec1, const HitsVector &vec2) const
 Add hits from second vector to first. More...
 
unsigned int addHits (unsigned int hitMult, unsigned int hitVec, int multBits, int vecBits) const
 Increment CPM/CMM hit word. More...
 
void mergeCMMCPHits (DataVector< CMMCPHits > *cmmHitsVec1, DataVector< CMMCPHits > *cmmHitsVec2) const
 Merge CMM-CP hits vectors. More...
 
void saveCMMCPHits (DataVector< CMMCPHits > *cmmHitsVec, const HitsVector &hits0, const HitsVector &hits1, int crate, int dataId, int peak) const
 Save non-zero CMM-CP hits. More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

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

Detailed Description

This is a tool to reconstruct the L1 CPM and CMM-CP hits from RoIs. Used for offline monitoring and trigger reconstruction.

Useage: L1CPHitsTools->formCPMRoI() // convert to CPMRoI from other RoI classes L1CPHitsTools->formCPMHits() // form CPM hits from RoIs L1CPHitsTools->formCMMCPHits() // form CMM-CP hits from CPM hits

Author
Alan Watson / Peter Faulkner

Definition at line 48 of file L1CPHitsTools.h.

Member Typedef Documentation

◆ ErrorVector

typedef std::vector<int> LVL1::L1CPHitsTools::ErrorVector
private

Definition at line 89 of file L1CPHitsTools.h.

◆ HitsVector

typedef std::vector<unsigned int> LVL1::L1CPHitsTools::HitsVector
private

Definition at line 88 of file L1CPHitsTools.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ L1CPHitsTools()

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

Constructor.

Definition at line 25 of file L1CPHitsTools.cxx.

28  :
30 {
31  declareInterface<IL1CPHitsTools>(this);
32 }

◆ ~L1CPHitsTools()

LVL1::L1CPHitsTools::~L1CPHitsTools ( )
virtual

default destructor

Destructor.

Definition at line 36 of file L1CPHitsTools.cxx.

37 {
38 }

Member Function Documentation

◆ addCMMCPHits()

void LVL1::L1CPHitsTools::addCMMCPHits ( HitsVector vec1,
const HitsVector vec2 
) const
private

Add hits from second vector to first.

Definition at line 275 of file L1CPHitsTools.cxx.

276 {
277  int size1 = vec1.size();
278  int size2 = vec2.size();
279  if (size1 < size2) vec1.resize(size2);
280  HitsVector::iterator pos1 = vec1.begin();
281  HitsVector::iterator pose1 = vec1.end();
282  HitsVector::const_iterator pos2 = vec2.begin();
283  HitsVector::const_iterator pose2 = vec2.end();
284  for (; pos1 != pose1 && pos2 != pose2; ++pos1, ++pos2) {
285  *pos1 = addHits(*pos1, *pos2, 24, 24);
286  }
287 }

◆ addHits()

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

Increment CPM/CMM hit word.

Definition at line 291 of file L1CPHitsTools.cxx.

294 {
295  ATH_MSG_DEBUG("addHits: Original hitMult = " << std::hex << hitMult
296  << ". Add hitWord = " << hitVec << std::dec);
297 
298  // Results transmitted in 2 words, each reporting half of the CP thresholds
299  int nthresh = TrigT1CaloDefs::numOfCPThresholds/2;
300 
301  int nbitsOut = multBits/nthresh;
302  int nbitsIn = vecBits/nthresh;
303 
304  ATH_MSG_DEBUG(" Bits per threshold = " << nbitsOut);
305 
306  int max = (1<<nbitsOut) - 1;
307  unsigned int multMask = max;
308  unsigned int hitMask = (1<<nbitsIn) - 1;
309  unsigned int shift = 0;
310 
311  unsigned int hits = 0;
312 
313  for (int i = 0; i < nthresh; i++) {
314  int mult = (hitMult&multMask) + (hitVec&hitMask);
315  mult = ( (mult<=max) ? mult : max);
316  hits += (mult<<shift);
317 
318  hitMult >>= nbitsOut;
319  hitVec >>= nbitsIn;
320  shift += nbitsOut;
321  }
322 
323  ATH_MSG_DEBUG("addHits returning hitMult = "
324  << std::hex << hits << std::dec );
325 
326  return hits;
327 }

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

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

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

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

95 { return m_detStore; }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ 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::L1CPHitsTools::finalize ( )
virtual

standard Athena-Algorithm method

Finalisation.

Definition at line 54 of file L1CPHitsTools.cxx.

55 {
56  return StatusCode::SUCCESS;
57 }

◆ formCMMCPHits()

void LVL1::L1CPHitsTools::formCMMCPHits ( const DataVector< CPMHits > *  cpmHitsVec,
DataVector< CMMCPHits > *  cmmHitsVec 
) const
virtual

form complete CMM-CP hits from CPM hits

Implements LVL1::IL1CPHitsTools.

Definition at line 152 of file L1CPHitsTools.cxx.

154 {
155  DataVector<CMMCPHits>* cmmHitsCrate = new DataVector<CMMCPHits>;
157  formCMMCPHitsModule(cpmHitsVec, cmmHitsVec);
158  formCMMCPHitsCrate(cmmHitsVec, cmmHitsCrate);
159  formCMMCPHitsSystem(cmmHitsCrate, cmmHitsSys);
160  mergeCMMCPHits(cmmHitsVec, cmmHitsCrate);
161  mergeCMMCPHits(cmmHitsVec, cmmHitsSys);
162  delete cmmHitsCrate;
163  delete cmmHitsSys;
164 }

◆ formCMMCPHitsCrate()

void LVL1::L1CPHitsTools::formCMMCPHitsCrate ( const DataVector< CMMCPHits > *  cmmHitsMod,
DataVector< CMMCPHits > *  cmmHitsCrate 
) const
virtual

form partial CMM-CP hits (crate) from module CMM-CP hits

Implements LVL1::IL1CPHitsTools.

Definition at line 189 of file L1CPHitsTools.cxx.

191 {
192  int peakm = 0;
193  HitsVector crate0Hit0(1);
194  HitsVector crate0Hit1(1);
195  HitsVector crate1Hit0(1);
196  HitsVector crate1Hit1(1);
197  HitsVector crate2Hit0(1);
198  HitsVector crate2Hit1(1);
199  HitsVector crate3Hit0(1);
200  HitsVector crate3Hit1(1);
202  DataVector<CMMCPHits>::const_iterator pose = cmmHitsMod->end();
203  for (; pos != pose; ++pos) {
204  const CMMCPHits* hits = *pos;
205  int dataId = hits->dataID();
206  if (dataId > 14) continue;
207  int crate = hits->crate();
208  int peak = hits->peak();
209  if (peak > peakm) peakm = peak;
210  HitsVector hits0(hits->HitsVec0());
211  HitsVector hits1(hits->HitsVec1());
212  if (crate == 0) {
213  addCMMCPHits(crate0Hit0, hits0);
214  addCMMCPHits(crate0Hit1, hits1);
215  } else if (crate == 1) {
216  addCMMCPHits(crate1Hit0, hits0);
217  addCMMCPHits(crate1Hit1, hits1);
218  } else if (crate == 2) {
219  addCMMCPHits(crate2Hit0, hits0);
220  addCMMCPHits(crate2Hit1, hits1);
221  } else if (crate == 3) {
222  addCMMCPHits(crate3Hit0, hits0);
223  addCMMCPHits(crate3Hit1, hits1);
224  }
225  }
226  // Save non-zero crate totals
227  saveCMMCPHits(cmmHitsCrate, crate0Hit0, crate0Hit1, 0, CMMCPHits::LOCAL,
228  peakm);
229  saveCMMCPHits(cmmHitsCrate, crate1Hit0, crate1Hit1, 1, CMMCPHits::LOCAL,
230  peakm);
231  saveCMMCPHits(cmmHitsCrate, crate2Hit0, crate2Hit1, 2, CMMCPHits::LOCAL,
232  peakm);
233  saveCMMCPHits(cmmHitsCrate, crate3Hit0, crate3Hit1, 3, CMMCPHits::LOCAL,
234  peakm);
235  saveCMMCPHits(cmmHitsCrate, crate0Hit0, crate0Hit1, 3, CMMCPHits::REMOTE_0,
236  peakm);
237  saveCMMCPHits(cmmHitsCrate, crate1Hit0, crate1Hit1, 3, CMMCPHits::REMOTE_1,
238  peakm);
239  saveCMMCPHits(cmmHitsCrate, crate2Hit0, crate2Hit1, 3, CMMCPHits::REMOTE_2,
240  peakm);
241 }

◆ formCMMCPHitsModule()

void LVL1::L1CPHitsTools::formCMMCPHitsModule ( const DataVector< CPMHits > *  cpmHitsVec,
DataVector< CMMCPHits > *  cmmHitsMod 
) const
virtual

form partial CMM-CP hits (module) from CPM hits

Implements LVL1::IL1CPHitsTools.

Definition at line 168 of file L1CPHitsTools.cxx.

170 {
172  DataVector<CPMHits>::const_iterator pose = cpmHitsVec->end();
173  for (; pos != pose; ++pos) {
174  const CPMHits* hits = *pos;
175  int crate = hits->crate();
176  int cpm = hits->module();
177  int peak = hits->peak();
178  HitsVector hits0(hits->HitsVec0());
179  HitsVector hits1(hits->HitsVec1());
180  ErrorVector err0(hits0.size());
181  ErrorVector err1(hits1.size());
182  cmmHitsMod->push_back(new CMMCPHits(crate, cpm, hits0, hits1,
183  err0, err1, peak));
184  }
185 }

◆ formCMMCPHitsSystem()

void LVL1::L1CPHitsTools::formCMMCPHitsSystem ( const DataVector< CMMCPHits > *  cmmHitsCrate,
DataVector< CMMCPHits > *  cmmHitsSys 
) const
virtual

form partial CMM-CP hits (system) from crate CMM-CP hits

Implements LVL1::IL1CPHitsTools.

Definition at line 245 of file L1CPHitsTools.cxx.

248 {
249  int peakm = 0;
250  HitsVector systemHit0(1);
251  HitsVector systemHit1(1);
253  DataVector<CMMCPHits>::const_iterator pose = cmmHitsCrate->end();
254  for (; pos != pose; ++pos) {
255  const CMMCPHits* hits = *pos;
256  if (hits->crate() != 3) continue;
257  int dataId = hits->dataID();
258  if (dataId != CMMCPHits::LOCAL &&
259  dataId != CMMCPHits::REMOTE_0 &&
260  dataId != CMMCPHits::REMOTE_1 &&
261  dataId != CMMCPHits::REMOTE_2) continue;
262  int peak = hits->peak();
263  if (peak > peakm) peakm = peak;
264  HitsVector hits0(hits->HitsVec0());
265  HitsVector hits1(hits->HitsVec1());
266  addCMMCPHits(systemHit0, hits0);
267  addCMMCPHits(systemHit1, hits1);
268  }
269  // Save non-zero system totals
270  saveCMMCPHits(cmmHitsSys, systemHit0, systemHit1, 3, CMMCPHits::TOTAL, peakm);
271 }

◆ formCPMHits() [1/2]

void LVL1::L1CPHitsTools::formCPMHits ( const DataVector< CPMRoI > *  cpmRoiVec,
DataVector< CPMHits > *  cpmHitsVec 
) const
virtual

form CPM hits from RoIs - single slice

Implements LVL1::IL1CPHitsTools.

Definition at line 74 of file L1CPHitsTools.cxx.

76 {
77  std::vector<const DataVector<CPMRoI>*> cpmRoiColls(1, cpmRoiVec);
78  formCPMHits(cpmRoiColls, cpmHitsVec, 0);
79 }

◆ formCPMHits() [2/2]

void LVL1::L1CPHitsTools::formCPMHits ( const std::vector< const DataVector< CPMRoI > * > &  cpmRoiColls,
DataVector< CPMHits > *  cpmHitsVec,
int  peak 
) const
virtual

form CPM hits from RoIs - multiple slices

Implements LVL1::IL1CPHitsTools.

Definition at line 83 of file L1CPHitsTools.cxx.

86 {
87  ClusterProcessorModuleKey testKey;
88  std::map<unsigned int, CPMHits*> cpmHitsMap;
90  int timeslices = cpmRoiColls.size();
91 
92  for (int slice = 0; slice < timeslices; ++slice) {
93  const DataVector<CPMRoI>* cpmRoiVec = cpmRoiColls[slice];
94 
95  for (it=cpmRoiVec->begin(); it!=cpmRoiVec->end(); ++it){
96  const CPMRoI* roi = *it;
97  unsigned int crate = roi->crate();
98  unsigned int module = roi->cpm();
99  unsigned int key = testKey.cpmKey(crate, module);
100  if (m_debug) {
101  CPRoIDecoder decoder;
102  CoordinateRange coord = decoder.coordinate(roi->roiWord());
103  if (timeslices > 1) ATH_MSG_DEBUG( "Slice " << slice << ", ");
104  ATH_MSG_DEBUG( "Found RoI with (eta, phi) = ("
105  << coord.eta() << ", " << coord.phi() << ") " << ", RoIWord = "
106  << std::hex << roi->roiWord() << std::dec );
107  ATH_MSG_DEBUG( "Crate = " << crate << ", Module = " << module
108  << ", CPM key = " << key );
109  }
110  CPMHits* cpmHits=0;
111  // find whether corresponding CPMHits already exists
113  // if not, create it
114  if ( test==cpmHitsMap.end()){
115  ATH_MSG_DEBUG( "New key. CPM has crate = "
116  << crate << ", Module = " << module );
117  ATH_MSG_DEBUG( "Create new CPMHits" );
118  cpmHits = new CPMHits(crate, module);
119  if (timeslices > 1) {
120  HitsVector hitVec(timeslices);
121  cpmHits->addHits(hitVec, hitVec);
122  cpmHits->setPeak(peak);
123  }
124 
125  ATH_MSG_DEBUG( "and insert into map" );
126  cpmHitsMap.insert(
127  std::map<unsigned int,CPMHits*>::value_type(key,cpmHits));
128  cpmHitsVec->push_back(cpmHits);
129  }
130  else {
131  ATH_MSG_DEBUG( "Existing CPMHits" );
132  cpmHits = test->second; // Already exists, so set pointer
133  }
134  // increment hit multiplicity.
135  ATH_MSG_DEBUG( "Update CPM hits" );
136  HitsVector hitvec0(cpmHits->HitsVec0());
137  HitsVector hitvec1(cpmHits->HitsVec1());
138  unsigned int hits0 = hitvec0[slice];
139  unsigned int hits1 = hitvec1[slice];
140  hits0 = addHits(hits0, roi->roiWord()&0xFF, 24, 8);
141  hits1 = addHits(hits1,(roi->roiWord()&0xFF00)>>8, 24, 8);
142  hitvec0[slice] = hits0;
143  hitvec1[slice] = hits1;
144  cpmHits->addHits(hitvec0, hitvec1);
145  ATH_MSG_DEBUG( "All done for this one" );
146  }
147  }
148 }

◆ formCPMRoI()

void LVL1::L1CPHitsTools::formCPMRoI ( const DataVector< EmTauROI > *  emTauRoiVec,
DataVector< CPMRoI > *  cpmRoiVec 
) const
virtual

EmTauROI to CPMRoI conversion.

Implements LVL1::IL1CPHitsTools.

Definition at line 61 of file L1CPHitsTools.cxx.

63 {
65  DataVector<EmTauROI>::const_iterator pose = emTauRoiVec->end();
66  for (; pos != pose; ++pos) {
67  CPMRoI* roi = new CPMRoI((*pos)->roiWord());
68  cpmRoiVec->push_back(roi);
69  }
70 }

◆ initialize()

StatusCode LVL1::L1CPHitsTools::initialize ( )
virtual

standard Athena-Algorithm method

Initialisation.

Definition at line 43 of file L1CPHitsTools.cxx.

44 {
46 
47  ATH_MSG_INFO( "Initialization completed" );
48 
49  return StatusCode::SUCCESS;
50 }

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

Definition at line 48 of file IL1CPHitsTools.h.

49  {
50  return IID_IL1CPHitsTools;
51  }

◆ mergeCMMCPHits()

void LVL1::L1CPHitsTools::mergeCMMCPHits ( DataVector< CMMCPHits > *  cmmHitsVec1,
DataVector< CMMCPHits > *  cmmHitsVec2 
) const
private

Merge CMM-CP hits vectors.

Definition at line 331 of file L1CPHitsTools.cxx.

333 {
334  int size = cmmHitsVec2->size();
335  for (int index = 0; index < size; ++index) {
336  CMMCPHits* hitsIn = 0;
337  CMMCPHits* hitsOut = 0;
338  cmmHitsVec2->swapElement(index, hitsIn, hitsOut);
339  cmmHitsVec1->push_back(hitsOut);
340  }
341  cmmHitsVec2->clear();
342 }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
366  }

◆ saveCMMCPHits()

void LVL1::L1CPHitsTools::saveCMMCPHits ( DataVector< CMMCPHits > *  cmmHitsVec,
const HitsVector hits0,
const HitsVector hits1,
int  crate,
int  dataId,
int  peak 
) const
private

Save non-zero CMM-CP hits.

Definition at line 346 of file L1CPHitsTools.cxx.

350 {
351  if (std::accumulate(hits0.begin(), hits0.end(), 0) ||
352  std::accumulate(hits1.begin(), hits1.end(), 0)) {
353  ErrorVector err0(hits0.size());
354  ErrorVector err1(hits1.size());
355  cmmHitsVec->push_back(new CMMCPHits(crate, dataId, hits0, hits1,
356  err0, err1, peak));
357  }
358 }

◆ 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 DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_debug

bool LVL1::L1CPHitsTools::m_debug = false
private

Definition at line 104 of file L1CPHitsTools.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_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:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
D3PDMakerTestInstan::vec2
std::vector< D3PDTest::MyVec2 > vec2
Definition: D3PDMakerTestDict.h:14
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
max
#define max(a, b)
Definition: cfImp.cxx:41
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
python.LArCondContChannels.decoder
decoder
def channelSelection(self, channelList, groupType): if groupType == self.SingleGroup: pass elif group...
Definition: LArCondContChannels.py:618
index
Definition: index.py:1
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
skel.it
it
Definition: skel.GENtoEVGEN.py:423
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:144
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
LVL1::L1CPHitsTools::addHits
unsigned int addHits(unsigned int hitMult, unsigned int hitVec, int multBits, int vecBits) const
Increment CPM/CMM hit word.
Definition: L1CPHitsTools.cxx:291
LVL1::L1CPHitsTools::formCMMCPHitsSystem
virtual void formCMMCPHitsSystem(const DataVector< CMMCPHits > *cmmHitsCrate, DataVector< CMMCPHits > *cmmHitsSys) const
form partial CMM-CP hits (system) from crate CMM-CP hits
Definition: L1CPHitsTools.cxx:245
LVL1::L1CPHitsTools::formCMMCPHitsModule
virtual void formCMMCPHitsModule(const DataVector< CPMHits > *cpmHitsVec, DataVector< CMMCPHits > *cmmHitsMod) const
form partial CMM-CP hits (module) from CPM hits
Definition: L1CPHitsTools.cxx:168
DataVector::swapElement
void swapElement(size_type index, value_type newElem, reference oldElem)
Swap one element out of the container.
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
LVL1::CMMCPHits::REMOTE_0
@ REMOTE_0
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMCPHits.h:33
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
python.PyAthena.module
module
Definition: PyAthena.py:134
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
perfmonmt-refit.slice
slice
Definition: perfmonmt-refit.py:52
lumiFormat.i
int i
Definition: lumiFormat.py:92
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArG4ShowerLibProcessing.hits
hits
Definition: LArG4ShowerLibProcessing.py:136
LVL1::CMMCPHits::LOCAL
@ LOCAL
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMCPHits.h:33
LVL1::L1CPHitsTools::mergeCMMCPHits
void mergeCMMCPHits(DataVector< CMMCPHits > *cmmHitsVec1, DataVector< CMMCPHits > *cmmHitsVec2) const
Merge CMM-CP hits vectors.
Definition: L1CPHitsTools.cxx:331
test_pyathena.parent
parent
Definition: test_pyathena.py:15
xAOD::CPMHits
CPMHits_v1 CPMHits
Define the latest version of the CPMHits class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/CPMHits.h:14
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
DataVector::clear
void clear()
Erase all the elements in the collection.
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
LVL1::CMMCPHits::TOTAL
@ TOTAL
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMCPHits.h:33
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
LVL1::L1CPHitsTools::m_debug
bool m_debug
Definition: L1CPHitsTools.h:104
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
LVL1::L1CPHitsTools::formCMMCPHitsCrate
virtual void formCMMCPHitsCrate(const DataVector< CMMCPHits > *cmmHitsMod, DataVector< CMMCPHits > *cmmHitsCrate) const
form partial CMM-CP hits (crate) from module CMM-CP hits
Definition: L1CPHitsTools.cxx:189
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
LVL1::L1CPHitsTools::ErrorVector
std::vector< int > ErrorVector
Definition: L1CPHitsTools.h:89
JetVoronoiDiagramHelpers::coord
double coord
Definition: JetVoronoiDiagramHelpers.h:45
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.
DeMoScan.index
string index
Definition: DeMoScan.py:362
a
TList * a
Definition: liststreamerinfos.cxx:10
h
LVL1::TrigT1CaloDefs::numOfCPThresholds
static const unsigned int numOfCPThresholds
Definition: TrigT1CaloDefs.h:124
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LVL1::CMMCPHits::REMOTE_2
@ REMOTE_2
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMCPHits.h:33
LVL1::L1CPHitsTools::HitsVector
std::vector< unsigned int > HitsVector
Definition: L1CPHitsTools.h:88
DEBUG
#define DEBUG
Definition: page_access.h:11
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
LVL1::CMMCPHits::REMOTE_1
@ REMOTE_1
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMCPHits.h:33
LVL1::L1CPHitsTools::formCPMHits
virtual void formCPMHits(const DataVector< CPMRoI > *cpmRoiVec, DataVector< CPMHits > *cpmHitsVec) const
form CPM hits from RoIs - single slice
Definition: L1CPHitsTools.cxx:74
LVL1::L1CPHitsTools::addCMMCPHits
void addCMMCPHits(HitsVector &vec1, const HitsVector &vec2) const
Add hits from second vector to first.
Definition: L1CPHitsTools.cxx:275
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
xAOD::CMMCPHits
CMMCPHits_v1 CMMCPHits
Define the latest version of the CMMCPHits class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/CMMCPHits.h:17
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
xAOD::CPMRoI
CPMRoI_v1 CPMRoI
Define the latest version of the CPMRoI class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/CPMRoI.h:14
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
fitman.k
k
Definition: fitman.py:528
LVL1::L1CPHitsTools::saveCMMCPHits
void saveCMMCPHits(DataVector< CMMCPHits > *cmmHitsVec, const HitsVector &hits0, const HitsVector &hits1, int crate, int dataId, int peak) const
Save non-zero CMM-CP hits.
Definition: L1CPHitsTools.cxx:346
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37