HerdSoftware  0.4.0
CaloPDEventChannelInfo.h
Go to the documentation of this file.
1 /*
2  * CaloPDEventChannelInfo.h
3  *
4  * Created on: 06 Aug. 2020
5  * Author: Lorenzo Pacini
6  */
7 
10 #ifndef HERD_CALOPDEVENTCHANNELINFO_H_
11 #define HERD_CALOPDEVENTCHANNELINFO_H_
12 
16 
17 #include <vector>
18 
19 #ifdef HS_USE_ROOT
20 #include "Rtypes.h"
21 #endif
22 
23 namespace Herd {
24 
30 
31 #ifdef HS_USE_ROOT
32  friend void CaloPDEventChannelInfoStreamer(TBuffer &buf, void *voidPtr);
33 #endif
34 
45  enum class Flag : unsigned short { NONE = 0, HIGHGAIN = 1, SATURATED = 1 << 1, INFOVALID = 1 << 15 };
46 
52 
58  CaloPDEventChannelInfo(unsigned int nChannels) { SetNChannels(nChannels); };
59 
61  virtual ~CaloPDEventChannelInfo() = default;
62 
67  void SetNChannels(size_t nChannels) { _channelInfoStatusFlags.resize(nChannels); };
68 
74  [[nodiscard]] Flag StatusFlags(unsigned int volID) const { return _channelInfoStatusFlags[volID]; };
75 
82  void SetStatusFlags(unsigned int volID, Flag channelInfoStatusFlags);
83 
84 private:
88  std::vector<Flag> _channelInfoStatusFlags;
89 
90 // This calss has a custom streamer, please check teh custom streamer if you change teh calss def.
91 #ifdef HS_USE_ROOT
92  ClassDef(CaloPDEventChannelInfo, 1)
93 #endif
94 };
95 
96 } // namespace Herd
97 
98 // Enable bitmask operations on Flag
100 
101 #endif /* HERD_CALOPDEVENTCHANNELINFO_H_ */
Point.h
Herd::CaloPDEventChannelInfo::SetStatusFlags
void SetStatusFlags(unsigned int volID, Flag channelInfoStatusFlags)
Set the entire binary corresponding to this ID.
Definition: CaloPDEventChannelInfo.cpp:13
AxesArray.h
Herd
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:22
Herd::CaloPDEventChannelInfo::StatusFlags
Flag StatusFlags(unsigned int volID) const
Return the binary code which contains all the flags corresponding to the ID.
Definition: CaloPDEventChannelInfo.h:74
BitMask.h
Herd::CaloPDEventChannelInfo::Flag::INFOVALID
@ INFOVALID
Herd::CaloPDEventChannelInfo
Data structure for information regarding a channel connected to a Calo photodiode.
Definition: CaloPDEventChannelInfo.h:29
Herd::CaloPDEventChannelInfo::~CaloPDEventChannelInfo
virtual ~CaloPDEventChannelInfo()=default
Virtual destructor
Herd::CaloPDEventChannelInfo::Flag::SATURATED
@ SATURATED
Herd::CaloPDEventChannelInfo::Flag::HIGHGAIN
@ HIGHGAIN
Herd::CaloPDEventChannelInfo::Flag
Flag
Enum used as index for the bitset member LSB rappresents the Gain: 1 -> high gain; 0 -> low gain....
Definition: CaloPDEventChannelInfo.h:45
Herd::CaloPDEventChannelInfo::CaloPDEventChannelInfo
CaloPDEventChannelInfo()
Default constructor with the number of channels = 0.
Definition: CaloPDEventChannelInfo.h:51
Herd::CaloPDEventChannelInfo::_channelInfoStatusFlags
std::vector< Flag > _channelInfoStatusFlags
binary code use to store some information
Definition: CaloPDEventChannelInfo.h:88
ENABLE_BITMASK_OPERATORS
#define ENABLE_BITMASK_OPERATORS(x)
Type safe implementation of a bitmask enum.
Definition: BitMask.h:21
Herd::CaloPDEventChannelInfo::Flag::NONE
@ NONE
Herd::CaloPDEventChannelInfo::SetNChannels
void SetNChannels(size_t nChannels)
Setup the total number of channels and initialize the values.
Definition: CaloPDEventChannelInfo.h:67
Herd::CaloPDEventChannelInfo::CaloPDEventChannelInfo
CaloPDEventChannelInfo(unsigned int nChannels)
Constructor.
Definition: CaloPDEventChannelInfo.h:58