Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:20

0001 /****************************************************************************
0002  *
0003  * This is a part of HGCAL offline software.
0004  * Authors:
0005  *   Laurent Forthomme, CERN
0006  *   Pedro Silva, CERN
0007  *
0008  ****************************************************************************/
0009 
0010 #ifndef DataFormats_HGCalDigi_HGCalRawDataEmulatorInfo_h
0011 #define DataFormats_HGCalDigi_HGCalRawDataEmulatorInfo_h
0012 
0013 #include <bitset>
0014 #include <unordered_map>
0015 #include <vector>
0016 
0017 /// Short summary of the truth information when an ECON-D data frame is generated
0018 /// \note It can be used to check that the unpacking outputs match the main fields.
0019 ///   For the moment it stores information on the error bits and channel status
0020 class HGCalECONDEmulatorInfo {
0021 public:
0022   HGCalECONDEmulatorInfo() = default;
0023   explicit HGCalECONDEmulatorInfo(bool, bool, bool, bool, bool, bool, const std::vector<std::vector<bool> >& = {});
0024 
0025   void clear();
0026 
0027   void addERxChannelsEnable(const std::vector<bool>&);
0028   std::vector<bool> channelsEnabled(size_t) const;
0029 
0030   enum HGCROCEventRecoStatus { PerfectReco = 0, GoodReco = 1, FailedReco = 2, AmbiguousReco = 3 };
0031   HGCROCEventRecoStatus eventRecoStatus() const;
0032 
0033   bool bitO() const { return header_bits_.test(StatusBits::O); }
0034   bool bitB() const { return header_bits_.test(StatusBits::B); }
0035   bool bitE() const { return header_bits_.test(StatusBits::E); }
0036   bool bitT() const { return header_bits_.test(StatusBits::T); }
0037   bool bitH() const { return header_bits_.test(StatusBits::H); }
0038   bool bitS() const { return header_bits_.test(StatusBits::S); }
0039 
0040 private:
0041   enum StatusBits { O = 0, B, E, T, H, S };
0042   std::bitset<6> header_bits_;
0043   std::vector<std::vector<bool> > erx_pois_;
0044 };
0045 
0046 /// Map of ECON-D emulator truth information within a capture block
0047 class HGCalCaptureBlockEmulatorInfo {
0048 public:
0049   HGCalCaptureBlockEmulatorInfo() = default;
0050 
0051   inline void clear() { econd_info_.clear(); }
0052 
0053   void addECONDEmulatedInfo(unsigned int, const HGCalECONDEmulatorInfo&);
0054 
0055 private:
0056   std::unordered_map<unsigned int, HGCalECONDEmulatorInfo> econd_info_;
0057 };
0058 
0059 /// Map of capture block emulator truth information within a S-link payload
0060 class HGCalSlinkEmulatorInfo {
0061 public:
0062   HGCalSlinkEmulatorInfo() = default;
0063 
0064   inline void clear() { cb_info_.clear(); }
0065 
0066   void addCaptureBlockEmulatedInfo(unsigned int, const HGCalCaptureBlockEmulatorInfo&);
0067   HGCalCaptureBlockEmulatorInfo& captureBlockEmulatedInfo(unsigned int);
0068 
0069 private:
0070   std::unordered_map<unsigned int, HGCalCaptureBlockEmulatorInfo> cb_info_;
0071 };
0072 
0073 #endif