CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DTDigiToRawModule Class Reference

#include <DTDigiToRawModule.h>

Inheritance diagram for DTDigiToRawModule:
edm::stream::EDProducer<>

Public Member Functions

 DTDigiToRawModule (const edm::ParameterSet &pset)
 Constructor. More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~DTDigiToRawModule () override
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

int dduID
 
bool debug
 
edm::EDGetTokenT< DTDigiCollectiondigicoll
 
edm::ESGetToken< DTReadOutMapping, DTReadOutMappingRcdmapToken_
 
int maxFEDid_
 
int minFEDid_
 
DTDigiToRawpacker
 
bool useStandardFEDid_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 13 of file DTDigiToRawModule.h.

Constructor & Destructor Documentation

◆ DTDigiToRawModule()

DTDigiToRawModule::DTDigiToRawModule ( const edm::ParameterSet pset)

Constructor.

Definition at line 19 of file DTDigiToRawModule.cc.

References gather_cfg::cout, debug, edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

19  {
20  produces<FEDRawDataCollection>();
21 
22  dduID = ps.getUntrackedParameter<int>("dduID", 770);
23  debug = ps.getUntrackedParameter<bool>("debugMode", false);
24  digicoll = consumes<DTDigiCollection>(ps.getParameter<edm::InputTag>("digiColl"));
25  mapToken_ = esConsumes<DTReadOutMapping, DTReadOutMappingRcd>();
26 
27  useStandardFEDid_ = ps.getUntrackedParameter<bool>("useStandardFEDid", true);
28  minFEDid_ = ps.getUntrackedParameter<int>("minFEDid", 770);
29  maxFEDid_ = ps.getUntrackedParameter<int>("maxFEDid", 775);
30 
31  packer = new DTDigiToRaw(ps);
32  if (debug)
33  cout << "[DTDigiToRawModule]: constructor" << endl;
34 }
edm::ESGetToken< DTReadOutMapping, DTReadOutMappingRcd > mapToken_
edm::EDGetTokenT< DTDigiCollection > digicoll
DTDigiToRaw * packer

◆ ~DTDigiToRawModule()

DTDigiToRawModule::~DTDigiToRawModule ( )
override

Destructor.

Definition at line 36 of file DTDigiToRawModule.cc.

References gather_cfg::cout, and debug.

36  {
37  delete packer;
38  if (debug)
39  cout << "[DTDigiToRawModule]: destructor" << endl;
40 }
DTDigiToRaw * packer

Member Function Documentation

◆ produce()

void DTDigiToRawModule::produce ( edm::Event e,
const edm::EventSetup iSetup 
)
override

Definition at line 42 of file DTDigiToRawModule.cc.

References evf::compute_crc(), MillePedeFileConverter_cfg::e, l1t_dqm_sourceclient-live_cfg::fedRawData, edm::EventSetup::getHandle(), EcalPhiSymFlatTableProducers_cfi::id, genParticles_cff::map, FEDNumbering::MAXDTFEDID, FEDNumbering::MINDTFEDID, eostools::move(), l1tstage2_dqm_sourceclient-live_cfg::rawData, FEDHeader::set(), and FEDTrailer::set().

42  {
43  auto fed_buffers = std::make_unique<FEDRawDataCollection>();
44 
45  // Take digis from the event
47  e.getByToken(digicoll, digis);
48 
49  // Load DTMap
51 
52  // Create the packed data
53  int FEDIDmin = 0, FEDIDMax = 0;
54  if (useStandardFEDid_) {
55  FEDIDmin = FEDNumbering::MINDTFEDID;
56  FEDIDMax = FEDNumbering::MAXDTFEDID;
57  } else {
58  FEDIDmin = minFEDid_;
59  FEDIDMax = maxFEDid_;
60  }
61 
62  for (int id = FEDIDmin; id <= FEDIDMax; ++id) {
63  packer->SetdduID(id);
65 
66  FEDRawData& fedRawData = fed_buffers->FEDData(id);
68  delete rawData;
69 
70  FEDHeader dtFEDHeader(fedRawData.data());
71  dtFEDHeader.set(fedRawData.data(), 0, e.id().event(), 0, id);
72 
73  FEDTrailer dtFEDTrailer(fedRawData.data() + (fedRawData.size() - 8));
74  dtFEDTrailer.set(fedRawData.data() + (fedRawData.size() - 8),
75  fedRawData.size() / 8,
76  evf::compute_crc(fedRawData.data(), fedRawData.size()),
77  0,
78  0);
79  }
80  // Put the raw data to the event
81  e.put(std::move(fed_buffers));
82 }
edm::ESGetToken< DTReadOutMapping, DTReadOutMappingRcd > mapToken_
edm::EDGetTokenT< DTDigiCollection > digicoll
void SetdduID(int dduid)
Definition: DTDigiToRaw.cc:173
DTDigiToRaw * packer
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
Definition: CRC16.h:46
FEDRawData * createFedBuffers(const DTDigiCollection &digis, edm::ESHandle< DTReadOutMapping > &mapping)
Take a vector of digis and fill the FEDRawDataCollection.
Definition: DTDigiToRaw.cc:21
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
static void set(unsigned char *header, uint8_t triggerType, uint32_t lvl1ID, uint16_t bxID, uint16_t sourceID, uint8_t version=0, bool moreHeaders=false)
Set all fields in the header.
Definition: FEDHeader.cc:25
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ dduID

int DTDigiToRawModule::dduID
private

Definition at line 27 of file DTDigiToRawModule.h.

◆ debug

bool DTDigiToRawModule::debug
private

◆ digicoll

edm::EDGetTokenT<DTDigiCollection> DTDigiToRawModule::digicoll
private

Definition at line 29 of file DTDigiToRawModule.h.

◆ mapToken_

edm::ESGetToken<DTReadOutMapping, DTReadOutMappingRcd> DTDigiToRawModule::mapToken_
private

Definition at line 30 of file DTDigiToRawModule.h.

◆ maxFEDid_

int DTDigiToRawModule::maxFEDid_
private

Definition at line 34 of file DTDigiToRawModule.h.

◆ minFEDid_

int DTDigiToRawModule::minFEDid_
private

Definition at line 33 of file DTDigiToRawModule.h.

◆ packer

DTDigiToRaw* DTDigiToRawModule::packer
private

Definition at line 25 of file DTDigiToRawModule.h.

◆ useStandardFEDid_

bool DTDigiToRawModule::useStandardFEDid_
private

Definition at line 32 of file DTDigiToRawModule.h.