Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-01-08 03:36:08

0001 //-------------------------------------------------
0002 //
0003 /**  \class DTuROSRawToDigi
0004  *
0005  *   L1 DT uROS Raw-to-Digi
0006  *
0007  *
0008  *
0009  *   C. Heidemann - RWTH Aachen
0010  *   J. Troconiz  - UAM Madrid
0011  */
0012 //
0013 //--------------------------------------------------
0014 #ifndef DTRawToDigi_DTuROSRawToDigi_h
0015 #define DTRawToDigi_DTuROSRawToDigi_h
0016 
0017 #include "CondFormats/DTObjects/interface/DTReadOutMapping.h"
0018 #include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h"
0019 #include "DataFormats/Common/interface/Handle.h"
0020 #include "DataFormats/DTDigi/interface/DTDigiCollection.h"
0021 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
0022 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
0023 #include "DataFormats/MuonDetId/interface/DTLayerId.h"
0024 #include "FWCore/Framework/interface/ConsumesCollector.h"
0025 #include "FWCore/Framework/interface/ESHandle.h"
0026 #include "FWCore/Framework/interface/Event.h"
0027 #include "FWCore/Framework/interface/EventSetup.h"
0028 #include "FWCore/Framework/interface/stream/EDProducer.h"
0029 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0030 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0031 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0032 #include "FWCore/Utilities/interface/ESGetToken.h"
0033 #include "FWCore/Utilities/interface/InputTag.h"
0034 
0035 #include <string>
0036 
0037 class DTReadOutMapping;
0038 class DTuROSFEDData;
0039 
0040 class DTuROSRawToDigi : public edm::stream::EDProducer<> {
0041 public:
0042   /// Constructor
0043   DTuROSRawToDigi(const edm::ParameterSet& pset);
0044 
0045   /// Destructor
0046   ~DTuROSRawToDigi() override = default;
0047 
0048   /// Produce digis out of raw data
0049   void produce(edm::Event& e, const edm::EventSetup& c) override;
0050 
0051   /// Generate and fill FED raw data for a full event
0052   bool fillRawData(edm::Event& e, const edm::EventSetup& c, DTDigiCollection& digis, std::vector<DTuROSFEDData>& words);
0053 
0054   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0055 
0056 private:
0057   edm::InputTag DTuROSInputTag_;
0058 
0059   bool debug_;
0060 
0061   int nfeds_;
0062 
0063   std::vector<int> feds_;
0064 
0065   unsigned char* lineFED;
0066 
0067   // Operations
0068 
0069   //process data
0070 
0071   void process(int DTuROSFED,
0072                edm::Handle<FEDRawDataCollection> data,
0073                edm::ESHandle<DTReadOutMapping> mapping,
0074                DTDigiCollection& digis,
0075                DTuROSFEDData& fwords);
0076 
0077   // utilities
0078   inline void readline(int& lines, long& dataWord) {
0079     dataWord = *((long*)lineFED);
0080     lineFED += 8;
0081     ++lines;
0082   }
0083 
0084   int theDDU(int crate, int slot, int link, bool tenDDU);
0085 
0086   int theROS(int slot, int link);
0087 
0088   int theROB(int slot, int link);
0089 
0090   edm::InputTag getDTuROSInputTag() { return DTuROSInputTag_; }
0091 
0092   edm::EDGetTokenT<FEDRawDataCollection> Raw_token;
0093   edm::ESGetToken<DTReadOutMapping, DTReadOutMappingRcd> mapping_token_;
0094 };
0095 #endif