ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
HLT::TriggerElement::ObjectIndex Class Reference

Helper class for conversion from/to int stored in TE and pair of ints used in Navigation Object pointer in Navigation is pair of ints. More...

#include <TriggerElement.h>

Collaboration diagram for HLT::TriggerElement::ObjectIndex:

Public Member Functions

 ObjectIndex ()
 
 ObjectIndex (sub_index_type subType, index_type begin, index_type end)
 constructor used to create index used in TE More...
 
sub_index_type subTypeIndex () const
 to get collection index More...
 
index_type objectsBegin () const
 to get object number in th ecollection More...
 
index_type objectsEnd () const
 to get object number in th ecollection More...
 
bool isSameOrWithin (const ObjectIndex *idx) const
 check if idx is the same as this or is within this index More...
 
void updateBeginAndEnd (index_type begin, index_type end)
 
bool operator< (const ObjectIndex &obj) const
 
void serialize (std::vector< uint32_t > &output) const
 
void deserialize (std::vector< uint32_t >::const_iterator &inputIt)
 
void setSubTypeIndex (sub_index_type idx)
 
bool valid () const
 
bool operator== (const ObjectIndex &rhs) const
 
bool operator!= (const ObjectIndex &rhs) const
 

Private Attributes

sub_index_type m_subTypeIndex
 actual index storage More...
 
index_type m_objIndexBegin
 auxiliary index word for big features More...
 
index_type m_objIndexEnd
 auxiliary index word for big features More...
 

Detailed Description

Helper class for conversion from/to int stored in TE and pair of ints used in Navigation Object pointer in Navigation is pair of ints.

One is pointing so collection of givent type. Second int points to object in this sub collection. In TE fro historical reason (and space saving) this 2 ints need to colapse into one 32bit int.

Warning
Therefore limitation ... we can have up to 65000 distinct collections of given type
Therefore limitation ... we can have up to 65000 objects in each subcollection.

Definition at line 75 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

Constructor & Destructor Documentation

◆ ObjectIndex() [1/2]

TriggerElement::ObjectIndex::ObjectIndex ( )

Definition at line 234 of file TrigNavStructure/Root/TriggerElement.cxx.

235  : m_subTypeIndex(invalid_sub_index), m_objIndexBegin(invalid_index), m_objIndexEnd(invalid_index) {}

◆ ObjectIndex() [2/2]

TriggerElement::ObjectIndex::ObjectIndex ( sub_index_type  subType,
index_type  begin,
index_type  end 
)

constructor used to create index used in TE

Definition at line 238 of file TrigNavStructure/Root/TriggerElement.cxx.

240 {
241  if (subType >= invalid_sub_index)
242  throw std::runtime_error("To many collections of one type: " + std::to_string(subType)+" >= 0xffff" );
243 }

Member Function Documentation

◆ deserialize()

void TriggerElement::ObjectIndex::deserialize ( std::vector< uint32_t >::const_iterator &  inputIt)

Definition at line 306 of file TrigNavStructure/Root/TriggerElement.cxx.

306  {
307  // check if compressed reference
308  uint32_t w = *inputIt++; // pickup and advance
309  if ( w & 0x80000000 ) {
310  // small numbers (compressed to one word)
311  m_subTypeIndex = w & 0xf;
312  m_objIndexBegin = ( (w>>18) & 0x1fff );
313  m_objIndexEnd = (w>>4) & 0x3fff;
314  // std::cerr << "feature idx deser: " << std::hex << w << std::dec << " " << std::endl;
315  } else if ( (w & 0x40000000) == 0 ) {
316  // medium numbers (compressed to 2 words)
317  m_subTypeIndex = w & 0xffff;
318  uint32_t w2 = *inputIt++;
319  m_objIndexBegin = w2 >> 16;
320  m_objIndexEnd = w2 & 0xffff;
321  // std::cerr << "feature idx2: " << std::hex << m_subTypeIndex << " " << m_objIndex << std::dec << std::endl;
322  } else {
323  // huge numbers (3 word involved)
324  m_subTypeIndex = w & 0xffff;
325  m_objIndexBegin = *inputIt++;
326  m_objIndexEnd = *inputIt++;
327 
328  }
329  // at the end the inputIt is pointing outside the ObjectIndex
330 }

◆ isSameOrWithin()

bool TriggerElement::ObjectIndex::isSameOrWithin ( const ObjectIndex idx) const

check if idx is the same as this or is within this index

Definition at line 332 of file TrigNavStructure/Root/TriggerElement.cxx.

332  {
333  if ( this->subTypeIndex() != idx->subTypeIndex() )
334  return false;
335  if ( this->objectsBegin() > idx->objectsBegin() )
336  return false;
337  if ( this->objectsEnd() < idx->objectsEnd() )
338  return false;
339  return true;
340 }

◆ objectsBegin()

uint32_t TriggerElement::ObjectIndex::objectsBegin ( ) const

to get object number in th ecollection

Definition at line 256 of file TrigNavStructure/Root/TriggerElement.cxx.

256  {
257  return m_objIndexBegin;
258 }

◆ objectsEnd()

uint32_t TriggerElement::ObjectIndex::objectsEnd ( ) const

to get object number in th ecollection

Definition at line 260 of file TrigNavStructure/Root/TriggerElement.cxx.

260  {
261  return m_objIndexEnd;
262 }

◆ operator!=()

Definition at line 99 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

99  {
100  return ! (*this == rhs);
101  }

◆ operator<()

bool TriggerElement::ObjectIndex::operator< ( const ObjectIndex obj) const

Definition at line 269 of file TrigNavStructure/Root/TriggerElement.cxx.

269  {
270  if ( m_subTypeIndex != obj.m_subTypeIndex )
271  return m_subTypeIndex < obj.m_subTypeIndex;
272  if ( m_objIndexBegin != obj.m_objIndexBegin )
273  return m_objIndexBegin < obj.m_objIndexBegin;
274 
275  return m_objIndexEnd < obj.m_objIndexEnd;
276 }

◆ operator==()

bool HLT::TriggerElement::ObjectIndex::operator== ( const ObjectIndex rhs) const
inline

Definition at line 93 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

93  {
94  if (m_subTypeIndex != rhs.m_subTypeIndex || m_objIndexBegin != rhs.m_objIndexBegin
95  || m_objIndexEnd != rhs.m_objIndexEnd)
96  return false;
97  return true;
98  }

◆ serialize()

void TriggerElement::ObjectIndex::serialize ( std::vector< uint32_t > &  output) const

Definition at line 278 of file TrigNavStructure/Root/TriggerElement.cxx.

278  {
279  // here comec the compression
280  // check if we can fit into one int
281  // ie. subtypeIndex fits into the 4 bits (0-8)
282  // if the begin indexes fit into the 13 bits (0-8192 )
283  // if the end indexes fit into the 14 bits (0-16383 )
284 
285  if ( (0 == (m_subTypeIndex & ~0xf)) && (0 == (objectsBegin() & ~0x1fff)) && ( 0 == (objectsEnd() & ~0x3fff)) ) {
286  output.push_back(0x80000000 | m_subTypeIndex | objectsEnd()<< 4 | objectsBegin() << 18);
287  // std::cerr << "feature idx ser: " << std::hex << output.back() << std::dec << std::endl;
288 
289  } else if ( (0 == (objectsBegin() & ~0xffff)) && (0 == (objectsEnd() & ~0xffff)) ) {
290  // check if we can fit into two ints
291  // ie. subtypeIndex fits into the 16 bits
292  // if the begin indexes fit into the 16 bits (0-65536 )
293  // if the end indexes fit into the 16 bits (0-65536)
294 
295  // std::cerr << "feature idx2: " << std::hex << m_subTypeIndex << " " << m_objIndex << std::dec << std::endl;
296  output.push_back(m_subTypeIndex);
297  output.push_back((objectsBegin() << 16) | (objectsEnd()) );
298  } else {
299  // we have to use 3 words
300  output.push_back(m_subTypeIndex | 0x40000000); // second most significant bit marks that
301  output.push_back(objectsBegin());
302  output.push_back(objectsEnd());
303  }
304 }

◆ setSubTypeIndex()

void HLT::TriggerElement::ObjectIndex::setSubTypeIndex ( sub_index_type  idx)
inline

◆ subTypeIndex()

uint16_t TriggerElement::ObjectIndex::subTypeIndex ( ) const

to get collection index

Definition at line 247 of file TrigNavStructure/Root/TriggerElement.cxx.

247  {
248  return m_subTypeIndex;
249 }

◆ updateBeginAndEnd()

void TriggerElement::ObjectIndex::updateBeginAndEnd ( index_type  begin,
index_type  end 
)

Definition at line 264 of file TrigNavStructure/Root/TriggerElement.cxx.

264  {
266  m_objIndexEnd = end;
267 }

◆ valid()

bool TriggerElement::ObjectIndex::valid ( ) const

Definition at line 342 of file TrigNavStructure/Root/TriggerElement.cxx.

342  {
343  if ( m_subTypeIndex == invalid_sub_index && m_objIndexBegin == invalid_index && m_objIndexEnd == invalid_index )
344  return false;
345  return true;
346 }

Member Data Documentation

◆ m_objIndexBegin

index_type HLT::TriggerElement::ObjectIndex::m_objIndexBegin
private

auxiliary index word for big features

Definition at line 105 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

◆ m_objIndexEnd

index_type HLT::TriggerElement::ObjectIndex::m_objIndexEnd
private

auxiliary index word for big features

Definition at line 106 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.

◆ m_subTypeIndex

sub_index_type HLT::TriggerElement::ObjectIndex::m_subTypeIndex
private

actual index storage

Definition at line 104 of file TrigNavStructure/TrigNavStructure/TriggerElement.h.


The documentation for this class was generated from the following files:
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
HLT::TriggerElement::ObjectIndex::m_objIndexEnd
index_type m_objIndexEnd
auxiliary index word for big features
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:106
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
HLT::TriggerElement::ObjectIndex::subTypeIndex
sub_index_type subTypeIndex() const
to get collection index
Definition: TrigNavStructure/Root/TriggerElement.cxx:247
HLT::TriggerElement::ObjectIndex::objectsBegin
index_type objectsBegin() const
to get object number in th ecollection
Definition: TrigNavStructure/Root/TriggerElement.cxx:256
HLT::TriggerElement::ObjectIndex::m_subTypeIndex
sub_index_type m_subTypeIndex
actual index storage
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:104
merge.output
output
Definition: merge.py:17
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
HLT::TriggerElement::ObjectIndex::m_objIndexBegin
index_type m_objIndexBegin
auxiliary index word for big features
Definition: TrigNavStructure/TrigNavStructure/TriggerElement.h:105
HLT::TriggerElement::ObjectIndex::objectsEnd
index_type objectsEnd() const
to get object number in th ecollection
Definition: TrigNavStructure/Root/TriggerElement.cxx:260
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
python.PyAthena.obj
obj
Definition: PyAthena.py:132