Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:15:06

0001 #ifndef EventFilter_L1GlobalTriggerRawToDigi_L1GlobalTriggerRawToDigi_h
0002 #define EventFilter_L1GlobalTriggerRawToDigi_L1GlobalTriggerRawToDigi_h
0003 
0004 /**
0005  * \class L1GlobalTriggerRawToDigi
0006  *
0007  *
0008  * Description: unpack raw data into digitized data.
0009  *
0010  * Implementation:
0011  *    <TODO: enter implementation details>
0012  *
0013  * \author: Vasile Mihai Ghete - HEPHY Vienna -  GT
0014  * \author: Ivan Mikulec       - HEPHY Vienna - GMT
0015  *
0016  *
0017  */
0018 
0019 // system include files
0020 #include <memory>
0021 #include <iostream>
0022 
0023 // user include files
0024 #include "FWCore/Framework/interface/Frameworkfwd.h"
0025 #include "FWCore/Framework/interface/stream/EDProducer.h"
0026 
0027 #include "FWCore/Framework/interface/Event.h"
0028 #include "FWCore/Framework/interface/MakerMacros.h"
0029 
0030 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0031 #include "FWCore/Utilities/interface/InputTag.h"
0032 #include "FWCore/Utilities/interface/typedefs.h"
0033 #include "FWCore/Utilities/interface/ESGetToken.h"
0034 
0035 #include "CondFormats/L1TObjects/interface/L1MuTriggerScales.h"
0036 #include "CondFormats/DataRecord/interface/L1MuTriggerScalesRcd.h"
0037 #include "CondFormats/L1TObjects/interface/L1MuTriggerPtScale.h"
0038 #include "CondFormats/DataRecord/interface/L1MuTriggerPtScaleRcd.h"
0039 #include "CondFormats/L1TObjects/interface/L1GtBoardMaps.h"
0040 #include "CondFormats/DataRecord/interface/L1GtBoardMapsRcd.h"
0041 
0042 // forward declarations
0043 class L1GtfeWord;
0044 class L1GtFdlWord;
0045 class L1GtPsbWord;
0046 
0047 class L1MuGMTReadoutCollection;
0048 
0049 class FEDHeader;
0050 class FEDTrailer;
0051 
0052 class L1MuTriggerScales;
0053 class L1MuTriggerPtScale;
0054 
0055 // class declaration
0056 class L1GlobalTriggerRawToDigi : public edm::stream::EDProducer<> {
0057 public:
0058   /// constructor(s)
0059   explicit L1GlobalTriggerRawToDigi(const edm::ParameterSet&);
0060 
0061   /// destructor
0062   ~L1GlobalTriggerRawToDigi() override;
0063 
0064   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0065 
0066 private:
0067   void produce(edm::Event&, const edm::EventSetup&) override;
0068 
0069   /// block unpackers
0070 
0071   /// unpack header
0072   void unpackHeader(const unsigned char*, FEDHeader&);
0073 
0074   /// unpack PSB blocks
0075   /// unpacking is done in PSB class format
0076   /// methods are given later to translate from the PSB format
0077   /// to the physical input of the PSB
0078   void unpackPSB(const edm::EventSetup&, const unsigned char*, L1GtPsbWord&);
0079 
0080   /// unpack the GMT record
0081   void unpackGMT(const unsigned char*, std::unique_ptr<L1MuGMTReadoutCollection>&, edm::Event&);
0082 
0083   /// unpack trailer word
0084   void unpackTrailer(const unsigned char*, FEDTrailer&);
0085 
0086   /// produce empty products in case of problems
0087   void produceEmptyProducts(edm::Event&);
0088 
0089   /// dump FED raw data
0090   void dumpFedRawData(const unsigned char*, int, std::ostream&);
0091 
0092 private:
0093   L1GtfeWord* m_gtfeWord;
0094   L1GtPsbWord* m_gtPsbWord;
0095   L1GtFdlWord* m_gtFdlWord;
0096 
0097   /// input tags for GT DAQ record
0098   edm::InputTag m_daqGtInputTag;
0099 
0100   /// FED Id for GT DAQ record
0101   /// default value defined in DataFormats/FEDRawData/src/FEDNumbering.cc
0102   int m_daqGtFedId;
0103 
0104   /// mask for active boards
0105   cms_uint16_t m_activeBoardsMaskGt;
0106 
0107   /// EventSetup Token for L1MuTriggerScales
0108   const edm::ESGetToken<L1MuTriggerScales, L1MuTriggerScalesRcd> m_trigScalesToken;
0109 
0110   /// EventSetup Token for L1MuTriggerPtScale
0111   const edm::ESGetToken<L1MuTriggerPtScale, L1MuTriggerPtScaleRcd> m_trigPtScaleToken;
0112 
0113   /// EventSetup Token for L1GtBoardMaps
0114   const edm::ESGetToken<L1GtBoardMaps, L1GtBoardMapsRcd> m_l1GtBMToken;
0115 
0116   // number of bunch crossing to be unpacked
0117   int m_unpackBxInEvent;
0118 
0119   /// lowest bxInEvent to be unpacked in the event
0120   /// assume symmetrical number of BX around L1Accept
0121   int m_lowSkipBxInEvent;
0122 
0123   /// upper bxInEvent to be unpacked in the event
0124   /// assume symmetrical number of BX around L1Accept
0125   int m_uppSkipBxInEvent;
0126 
0127   /// total Bx's in the event, obtained from GTFE block
0128   //
0129   /// corresponding to alternative 0 in altNrBxBoard()
0130   int m_recordLength0;
0131 
0132   /// corresponding to alternative 1 in altNrBxBoard()
0133   int m_recordLength1;
0134 
0135   /// number of Bx for a board, obtained from GTFE block (record length & alternative)
0136   int m_totalBxInEvent;
0137 
0138   /// muon trigger scales to convert unpacked data into physical quantities
0139   const L1MuTriggerScales* m_TriggerScales;
0140   const L1MuTriggerPtScale* m_TriggerPtScale;
0141 
0142 private:
0143   /// verbosity level
0144   int m_verbosity;
0145   bool m_isDebugEnabled;
0146 };
0147 
0148 #endif  // EventFilter_L1GlobalTriggerRawToDigi_L1GlobalTriggerRawToDigi_h