Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef EventFilter_L1GlobalTriggerRawToDigi_L1GlobalTriggerEvmRawToDigi_h
0002 #define EventFilter_L1GlobalTriggerRawToDigi_L1GlobalTriggerEvmRawToDigi_h
0003 
0004 /**
0005  * \class L1GlobalTriggerEvmRawToDigi
0006  *
0007  *
0008  * Description: unpack EVM raw data into digitized data.
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 #include <iostream>
0021 
0022 // user include files
0023 #include "FWCore/Framework/interface/Frameworkfwd.h"
0024 #include "FWCore/Framework/interface/stream/EDProducer.h"
0025 
0026 #include "FWCore/Framework/interface/Event.h"
0027 #include "FWCore/Framework/interface/MakerMacros.h"
0028 
0029 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0030 #include "FWCore/Utilities/interface/InputTag.h"
0031 #include "FWCore/Utilities/interface/typedefs.h"
0032 #include "FWCore/Utilities/interface/ESGetToken.h"
0033 
0034 #include "CondFormats/L1TObjects/interface/L1GtBoardMaps.h"
0035 #include "CondFormats/DataRecord/interface/L1GtBoardMapsRcd.h"
0036 #include "CondFormats/L1TObjects/interface/L1GtParameters.h"
0037 #include "CondFormats/DataRecord/interface/L1GtParametersRcd.h"
0038 
0039 // forward declarations
0040 class L1GtfeWord;
0041 class L1GtfeExtWord;
0042 class L1TcsWord;
0043 class L1GtFdlWord;
0044 
0045 class FEDHeader;
0046 class FEDTrailer;
0047 
0048 // class declaration
0049 class L1GlobalTriggerEvmRawToDigi : public edm::stream::EDProducer<> {
0050 public:
0051   /// constructor(s)
0052   explicit L1GlobalTriggerEvmRawToDigi(const edm::ParameterSet&);
0053 
0054   /// destructor
0055   ~L1GlobalTriggerEvmRawToDigi() override;
0056 
0057 private:
0058   void produce(edm::Event&, const edm::EventSetup&) override;
0059 
0060   /// block unpackers
0061 
0062   /// unpack header
0063   void unpackHeader(const unsigned char*, FEDHeader&);
0064 
0065   /// unpack trailer word
0066   void unpackTrailer(const unsigned char*, FEDTrailer&);
0067 
0068   /// produce empty products in case of problems
0069   void produceEmptyProducts(edm::Event&);
0070 
0071   /// dump FED raw data
0072   void dumpFedRawData(const unsigned char*, int, std::ostream&);
0073 
0074 private:
0075   L1GtfeExtWord* m_gtfeWord;
0076   L1TcsWord* m_tcsWord;
0077   L1GtFdlWord* m_gtFdlWord;
0078 
0079   /// input tags for GT EVM record
0080   edm::InputTag m_evmGtInputTag;
0081 
0082   /// FED Id for GT EVM record
0083   /// default value defined in DataFormats/FEDRawData/src/FEDNumbering.cc
0084   int m_evmGtFedId;
0085 
0086   /// EventSetup Token for L1GtBoardMaps
0087   const edm::ESGetToken<L1GtBoardMaps, L1GtBoardMapsRcd> m_l1GtBMToken;
0088 
0089   /// EventSetup Token for L1GtParameters
0090   edm::ESGetToken<L1GtParameters, L1GtParametersRcd> m_l1GtParamToken;
0091 
0092   /// mask for active boards
0093   cms_uint16_t m_activeBoardsMaskGt;
0094 
0095   // number of bunch crossing to be unpacked
0096   int m_unpackBxInEvent;
0097 
0098   /// lowest bxInEvent to be unpacked in the event
0099   /// assume symmetrical number of BX around L1Accept
0100   int m_lowSkipBxInEvent;
0101 
0102   /// upper bxInEvent to be unpacked in the event
0103   /// assume symmetrical number of BX around L1Accept
0104   int m_uppSkipBxInEvent;
0105 
0106   /// total Bx's in the event, obtained from GTFE block
0107   //
0108   /// corresponding to alternative 0 in altNrBxBoard()
0109   int m_recordLength0;
0110 
0111   /// corresponding to alternative 1 in altNrBxBoard()
0112   int m_recordLength1;
0113 
0114   /// number of Bx for a board, obtained from GTFE block (record length & alternative)
0115   int m_totalBxInEvent;
0116 
0117   /// length of BST record (in bytes)
0118   int m_bstLengthBytes;
0119 
0120 private:
0121   /// verbosity level
0122   int m_verbosity;
0123   bool m_isDebugEnabled;
0124 };
0125 
0126 #endif  // EventFilter_L1GlobalTriggerRawToDigi_L1GlobalTriggerEvmRawToDigi_h