Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:39:10

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 #include "DataFormats/HGCalDigi/interface/HGCalRawDataEmulatorInfo.h"
0011 
0012 //-----------------------------------------------
0013 // ECON-D emulator info
0014 //-----------------------------------------------
0015 
0016 HGCalECONDEmulatorInfo::HGCalECONDEmulatorInfo(bool obit,
0017                                                bool bbit,
0018                                                bool ebit,
0019                                                bool tbit,
0020                                                bool hbit,
0021                                                bool sbit,
0022                                                const std::vector<std::vector<bool> >& enabled_channels) {
0023   header_bits_[StatusBits::O] = obit;
0024   header_bits_[StatusBits::B] = bbit;
0025   header_bits_[StatusBits::E] = ebit;
0026   header_bits_[StatusBits::T] = tbit;
0027   header_bits_[StatusBits::H] = hbit;
0028   header_bits_[StatusBits::S] = sbit;
0029   for (const auto& ch_en : enabled_channels)
0030     erx_pois_.emplace_back(ch_en);
0031 }
0032 
0033 void HGCalECONDEmulatorInfo::clear() {
0034   header_bits_.reset();
0035   erx_pois_.clear();
0036 }
0037 
0038 void HGCalECONDEmulatorInfo::addERxChannelsEnable(const std::vector<bool>& erx_channels_poi) {
0039   erx_pois_.emplace_back(erx_channels_poi);
0040 }
0041 
0042 std::vector<bool> HGCalECONDEmulatorInfo::channelsEnabled(size_t ch_id) const {
0043   std::vector<bool> ch_en;
0044   ch_en.reserve(erx_pois_.size());
0045   for (const auto& erx_channels_poi : erx_pois_)
0046     ch_en.emplace_back(erx_channels_poi.at(ch_id));
0047   return ch_en;
0048 }
0049 
0050 HGCalECONDEmulatorInfo::HGCROCEventRecoStatus HGCalECONDEmulatorInfo::eventRecoStatus() const {
0051   return static_cast<HGCROCEventRecoStatus>(bitH() << 1 | bitT());
0052 }
0053 
0054 //-----------------------------------------------
0055 // Capture block emulator info
0056 //-----------------------------------------------
0057 
0058 void HGCalCaptureBlockEmulatorInfo::addECONDEmulatedInfo(unsigned int econd_id,
0059                                                          const HGCalECONDEmulatorInfo& econd_info) {
0060   econd_info_[econd_id] = econd_info;
0061 }
0062 
0063 //-----------------------------------------------
0064 // S-link emulator info
0065 //-----------------------------------------------
0066 
0067 void HGCalSlinkEmulatorInfo::addCaptureBlockEmulatedInfo(unsigned int cb_id,
0068                                                          const HGCalCaptureBlockEmulatorInfo& cb_info) {
0069   cb_info_[cb_id] = cb_info;
0070 }
0071 
0072 HGCalCaptureBlockEmulatorInfo& HGCalSlinkEmulatorInfo::captureBlockEmulatedInfo(unsigned int cb_id) {
0073   return cb_info_[cb_id];
0074 }