Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "FWCore/Framework/interface/Frameworkfwd.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 #include "FWCore/Framework/interface/stream/EDProducer.h"
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/Framework/interface/MakerMacros.h"
0006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0007 #include "FWCore/Utilities/interface/StreamID.h"
0008 
0009 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
0010 #include "DataFormats/L1ScoutingRawData/interface/SDSNumbering.h"
0011 #include "DataFormats/L1ScoutingRawData/interface/SDSRawDataCollection.h"
0012 #include "DataFormats/L1Scouting/interface/OrbitCollection.h"
0013 
0014 #include "DataFormats/L1Scouting/interface/L1ScoutingCalo.h"
0015 
0016 #include "EventFilter/L1ScoutingRawToDigi/interface/shifts.h"
0017 #include "EventFilter/L1ScoutingRawToDigi/interface/masks.h"
0018 #include "EventFilter/L1ScoutingRawToDigi/interface/blocks.h"
0019 #include "L1TriggerScouting/Utilities/interface/printScObjects.h"
0020 
0021 #include <iostream>
0022 #include <memory>
0023 #include <string>
0024 
0025 class ScCaloRawToDigi : public edm::stream::EDProducer<> {
0026 public:
0027   explicit ScCaloRawToDigi(const edm::ParameterSet&);
0028   ~ScCaloRawToDigi() override;
0029 
0030   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0031 
0032 private:
0033   void produce(edm::Event&, const edm::EventSetup&) override;
0034 
0035   enum class CaloObjectType { Jet, EGamma, Tau, EtSum };
0036 
0037   void unpackOrbitFromDMA(edm::Handle<SDSRawDataCollection>& ScoutingRawDataCollection, int sourceId);
0038   void unpackTcpData(edm::Handle<SDSRawDataCollection>& ScoutingRawDataCollection,
0039                      std::vector<int> sourceList,
0040                      CaloObjectType dataType);
0041   void unpackOrbitFromTCP(const unsigned char* buf, size_t len, CaloObjectType dataType);
0042 
0043   void unpackJets(uint32_t* dataBlock, int bx, int nObjets);
0044   void unpackEGammas(uint32_t* dataBlock, int bx, int nObjets);
0045   void unpackTaus(uint32_t* dataBlock, int bx, int nObjets);
0046   void unpackEtSums(uint32_t* dataBlock, int bx);
0047 
0048   int nJetsOrbit_, nEGammasOrbit_, nTausOrbit_, nEtSumsOrbit_;
0049   // vectors holding data for every bunch crossing
0050   // before  filling the orbit collection
0051   std::vector<std::vector<l1ScoutingRun3::Jet>> orbitBufferJets_;
0052   std::vector<std::vector<l1ScoutingRun3::EGamma>> orbitBufferEGammas_;
0053   std::vector<std::vector<l1ScoutingRun3::Tau>> orbitBufferTaus_;
0054   std::vector<std::vector<l1ScoutingRun3::BxSums>> orbitBufferEtSums_;
0055 
0056   bool debug_ = false;
0057   bool enableAllSums_ = false;  // write the full sert of ET sums
0058   edm::InputTag srcInputTag_;
0059   edm::EDGetToken rawToken_;
0060   std::string dataSourceMode_;  // data from TCP / DMA
0061   edm::ParameterSet dataSourceConfig_;
0062   std::vector<int> jetSourceIdList_;
0063   std::vector<int> eGammaSourceIdList_;
0064   std::vector<int> tauSourceIdList_;
0065   std::vector<int> etSumSourceIdList_;
0066 };