Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:45

0001 #ifndef EventFilter_L1GlobalTriggerRawToDigi_L1GTEvmDigiToRaw_h
0002 #define EventFilter_L1GlobalTriggerRawToDigi_L1GTEvmDigiToRaw_h
0003 
0004 /**
0005  * \class L1GTEvmDigiToRaw
0006  *
0007  *
0008  * Description: generate raw data from digis.
0009  *
0010  * Implementation:
0011  *    <TODO: enter implementation details>
0012  *
0013  * \author: Vasile Mihai Ghete - HEPHY Vienna
0014  *
0015  *
0016  */
0017 
0018 // system include files
0019 #include <memory>
0020 
0021 // user include files
0022 #include "FWCore/Framework/interface/Frameworkfwd.h"
0023 #include "FWCore/Framework/interface/stream/EDProducer.h"
0024 
0025 #include "FWCore/Framework/interface/Event.h"
0026 #include "FWCore/Framework/interface/MakerMacros.h"
0027 
0028 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0029 #include "FWCore/Utilities/interface/InputTag.h"
0030 #include "FWCore/Utilities/interface/typedefs.h"
0031 #include "FWCore/Utilities/interface/ESGetToken.h"
0032 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h"
0033 #include "CondFormats/L1TObjects/interface/L1GtBoardMaps.h"
0034 #include "CondFormats/DataRecord/interface/L1GtBoardMapsRcd.h"
0035 
0036 // forward declarations
0037 class FEDRawDataCollection;
0038 
0039 class L1GtfeWord;
0040 class L1GtfeExtWord;
0041 class L1TcsWord;
0042 class L1GtFdlWord;
0043 
0044 // class declaration
0045 class L1GTEvmDigiToRaw : public edm::stream::EDProducer<> {
0046 public:
0047   /// constructor(s)
0048   explicit L1GTEvmDigiToRaw(const edm::ParameterSet&);
0049 
0050 private:
0051   /// loop over events
0052   void produce(edm::Event&, const edm::EventSetup&) override;
0053 
0054   /// block packers -------------
0055 
0056   /// pack header
0057   void packHeader(unsigned char*, edm::Event&);
0058 
0059   /// pack the GTFE block
0060   /// gives the number of bunch crosses in the event, as well as the active boards
0061   /// records for inactive boards are not written in the GT EVM record
0062   void packGTFE(const edm::EventSetup&, unsigned char*, L1GtfeExtWord&, cms_uint16_t activeBoardsGtValue);
0063 
0064   /// pack the TCS block
0065   void packTCS(const edm::EventSetup& evSetup, unsigned char* ptrGt, L1TcsWord& tcsBlock);
0066 
0067   /// pack FDL blocks for various bunch crosses
0068   void packFDL(const edm::EventSetup&, unsigned char*, L1GtFdlWord&);
0069 
0070   /// pack trailer word
0071   void packTrailer(unsigned char*, unsigned char*, int);
0072 
0073 private:
0074   /// FED Id for GT EVM record
0075   /// default value defined in DataFormats/FEDRawData/src/FEDNumbering.cc
0076   int m_evmGtFedId;
0077 
0078   /// input tag for GT EVM record
0079   const edm::EDGetTokenT<L1GlobalTriggerEvmReadoutRecord> m_evmGtInputToken;
0080   const edm::InputTag m_evmGtInputTag;
0081 
0082   /// EventSetup Token for L1GtBoardMaps
0083   const edm::ESGetToken<L1GtBoardMaps, L1GtBoardMapsRcd> m_l1GtBMToken;
0084 
0085   /// mask for active boards
0086   cms_uint16_t m_activeBoardsMaskGt;
0087 
0088   /// total Bx's in the event, obtained from GTFE block
0089   int m_totalBxInEvent;
0090 
0091   /// min Bx's in the event, computed after m_totalBxInEvent is obtained from GTFE block
0092   /// assume symmetrical number of BX around L1Accept
0093   int m_minBxInEvent;
0094 
0095   /// max Bx's in the event, computed after m_totalBxInEvent is obtained from GTFE block
0096   /// assume symmetrical number of BX around L1Accept
0097   int m_maxBxInEvent;
0098 
0099   /// length of BST record (in bytes)
0100   int m_bstLengthBytes;
0101 
0102 private:
0103   /// verbosity level
0104   const int m_verbosity;
0105   const bool m_isDebugEnabled;
0106 };
0107 
0108 #endif  // EventFilter_L1GlobalTriggerRawToDigi_L1GTEvmDigiToRaw_h