ATLAS Offline Software
Global/GlobalSimulation/src/IO/Count.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 // Count.h
5 // TopoCore
6 // Created by Carlos Moreno on 15/01/21.
7 // Adapted for GlobalL1TopoSim
8 
9 #ifndef GLOBALSIM_COUNT_H
10 #define GLOBALSIM_COUNT_H
11 
12 #include "GaudiKernel/StatusCode.h"
13 
14 #include "AthenaKernel/CLASS_DEF.h"
15 
16 
17 #include <ostream>
18 #include <vector>
19 #include <bitset>
20 
21 namespace GlobalSim {
22 
23  class Count {
24  public:
25 
26  Count(unsigned int firstBit = 0,
27  unsigned int nBits = 1,
28  unsigned int sizeCount = 1 ) :
30  m_nBits(nBits),
32  {};
33 
34  // Destructor
35  ~Count(){};
36 
37  // setters
38  StatusCode reset() { m_count = 0; return StatusCode::SUCCESS; }
39 
40  void setFirstBit(unsigned int startBit) { m_firstBit = startBit; }
41  void setNBits(unsigned int nBits) { m_nBits = nBits; }
42  void setSizeCount(unsigned int sizeCount);// { m_sizeCount = sizeCount; }
43 
44  // getters
45  // TO-DO add function to get count bits for a determined position
46  // TO-DO make ready for executing multiple algorithms in one instance
47 
48  std::bitset<128> getCountBits() const { return m_count; }
49  unsigned int firstBit() const { return m_firstBit; }
50  unsigned int lastBit() const { return m_firstBit + m_nBits - 1; }
51  unsigned int nBits() const { return m_nBits; }
52  unsigned int sizeCount() const { return m_sizeCount; }
53 
54  private:
55  std::bitset<128> m_count {0};
56  unsigned int m_firstBit {0};
57  unsigned int m_nBits {1};
58  unsigned int m_sizeCount {1};
59 
60  };
61 
62 }
63 CLASS_DEF( GlobalSim::Count , 165533003 , 1 )
64 std::ostream & operator<<(std::ostream&, const GlobalSim::Count&);
65 
66 #endif
GlobalSim::Count::nBits
unsigned int nBits() const
Definition: Global/GlobalSimulation/src/IO/Count.h:51
GlobalSim::Count::Count
Count(unsigned int firstBit=0, unsigned int nBits=1, unsigned int sizeCount=1)
Definition: Global/GlobalSimulation/src/IO/Count.h:26
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
GlobalSim::Count::m_firstBit
unsigned int m_firstBit
Definition: Global/GlobalSimulation/src/IO/Count.h:56
GlobalSim::Count::firstBit
unsigned int firstBit() const
Definition: Global/GlobalSimulation/src/IO/Count.h:49
GlobalSim::Count
Definition: Global/GlobalSimulation/src/IO/Count.h:23
GlobalSim::Count::setSizeCount
void setSizeCount(unsigned int sizeCount)
Definition: Global/GlobalSimulation/src/IO/Count.cxx:13
GlobalSim::Count::getCountBits
std::bitset< 128 > getCountBits() const
Definition: Global/GlobalSimulation/src/IO/Count.h:48
GlobalSim
AlgTool to obtain a selection of eFex RoIs read in from the event store.
Definition: dump.h:8
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
GlobalSim::Count::setNBits
void setNBits(unsigned int nBits)
Definition: Global/GlobalSimulation/src/IO/Count.h:41
GlobalSim::Count::sizeCount
unsigned int sizeCount() const
Definition: Global/GlobalSimulation/src/IO/Count.h:52
GlobalSim::Count::lastBit
unsigned int lastBit() const
Definition: Global/GlobalSimulation/src/IO/Count.h:50
GlobalSim::Count::setFirstBit
void setFirstBit(unsigned int startBit)
Definition: Global/GlobalSimulation/src/IO/Count.h:40
GlobalSim::Count::~Count
~Count()
Definition: Global/GlobalSimulation/src/IO/Count.h:35
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
GlobalSim::Count::m_count
std::bitset< 128 > m_count
Definition: Global/GlobalSimulation/src/IO/Count.h:55
GlobalSim::Count::m_sizeCount
unsigned int m_sizeCount
Definition: Global/GlobalSimulation/src/IO/Count.h:58
GlobalSim::Count::reset
StatusCode reset()
Definition: Global/GlobalSimulation/src/IO/Count.h:38
GlobalSim::Count::m_nBits
unsigned int m_nBits
Definition: Global/GlobalSimulation/src/IO/Count.h:57
CLASS_DEF.h
macros to associate a CLID to a type