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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

int dduID
 
bool debug
 
edm::EDGetTokenT< DTDigiCollectiondigicoll
 
int maxFEDid_
 
int minFEDid_
 
DTDigiToRawpacker
 
bool useStandardFEDid_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 10 of file DTDigiToRawModule.h.

Constructor & Destructor Documentation

◆ DTDigiToRawModule()

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

Constructor.

Definition at line 20 of file DTDigiToRawModule.cc.

20  {
21  produces<FEDRawDataCollection>();
22 
23  dduID = ps.getUntrackedParameter<int>("dduID", 770);
24  debug = ps.getUntrackedParameter<bool>("debugMode", false);
25  digicoll = consumes<DTDigiCollection>(ps.getParameter<edm::InputTag>("digiColl"));
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 }

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

◆ ~DTDigiToRawModule()

DTDigiToRawModule::~DTDigiToRawModule ( )
override

Destructor.

Definition at line 36 of file DTDigiToRawModule.cc.

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

References gather_cfg::cout, and debug.

Member Function Documentation

◆ produce()

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

Definition at line 42 of file DTDigiToRawModule.cc.

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  iSetup.get<DTReadOutMappingRcd>().get(map);
52 
53  // Create the packed data
54  int FEDIDmin = 0, FEDIDMax = 0;
55  if (useStandardFEDid_) {
56  FEDIDmin = FEDNumbering::MINDTFEDID;
57  FEDIDMax = FEDNumbering::MAXDTFEDID;
58  } else {
59  FEDIDmin = minFEDid_;
60  FEDIDMax = maxFEDid_;
61  }
62 
63  for (int id = FEDIDmin; id <= FEDIDMax; ++id) {
64  packer->SetdduID(id);
66 
67  FEDRawData& fedRawData = fed_buffers->FEDData(id);
69  delete rawData;
70 
71  FEDHeader dtFEDHeader(fedRawData.data());
72  dtFEDHeader.set(fedRawData.data(), 0, e.id().event(), 0, id);
73 
74  FEDTrailer dtFEDTrailer(fedRawData.data() + (fedRawData.size() - 8));
75  dtFEDTrailer.set(fedRawData.data() + (fedRawData.size() - 8),
76  fedRawData.size() / 8,
77  evf::compute_crc(fedRawData.data(), fedRawData.size()),
78  0,
79  0);
80  }
81  // Put the raw data to the event
82  e.put(std::move(fed_buffers));
83 }

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

Member Data Documentation

◆ dduID

int DTDigiToRawModule::dduID
private

Definition at line 24 of file DTDigiToRawModule.h.

◆ debug

bool DTDigiToRawModule::debug
private

◆ digicoll

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

Definition at line 26 of file DTDigiToRawModule.h.

◆ maxFEDid_

int DTDigiToRawModule::maxFEDid_
private

Definition at line 30 of file DTDigiToRawModule.h.

◆ minFEDid_

int DTDigiToRawModule::minFEDid_
private

Definition at line 29 of file DTDigiToRawModule.h.

◆ packer

DTDigiToRaw* DTDigiToRawModule::packer
private

Definition at line 22 of file DTDigiToRawModule.h.

◆ useStandardFEDid_

bool DTDigiToRawModule::useStandardFEDid_
private

Definition at line 28 of file DTDigiToRawModule.h.

DTDigiToRaw::SetdduID
void SetdduID(int dduid)
Definition: DTDigiToRaw.cc:182
DTDigiToRawModule::digicoll
edm::EDGetTokenT< DTDigiCollection > digicoll
Definition: DTDigiToRawModule.h:26
DTReadOutMappingRcd
Definition: DTReadOutMappingRcd.h:5
DTDigiToRawModule::dduID
int dduID
Definition: DTDigiToRawModule.h:24
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DTDigiToRawModule::packer
DTDigiToRaw * packer
Definition: DTDigiToRawModule.h:22
l1tstage2_dqm_sourceclient-live_cfg.rawData
rawData
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:156
edm::Handle< DTDigiCollection >
FEDRawData
Definition: FEDRawData.h:19
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
l1t_dqm_sourceclient-live_cfg.fedRawData
fedRawData
Definition: l1t_dqm_sourceclient-live_cfg.py:182
DTDigiToRaw::createFedBuffers
FEDRawData * createFedBuffers(const DTDigiCollection &digis, edm::ESHandle< DTReadOutMapping > &mapping)
Take a vector of digis and fill the FEDRawDataCollection.
Definition: DTDigiToRaw.cc:21
edm::ESHandle< DTReadOutMapping >
evf::compute_crc
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
Definition: CRC16.h:46
FEDNumbering::MAXDTFEDID
Definition: FEDNumbering.h:56
FEDTrailer
Definition: FEDTrailer.h:14
DTDigiToRaw
Definition: DTDigiToRaw.h:15
FEDNumbering::MINDTFEDID
Definition: FEDNumbering.h:55
get
#define get
DTDigiToRawModule::maxFEDid_
int maxFEDid_
Definition: DTDigiToRawModule.h:30
DTDigiToRawModule::useStandardFEDid_
bool useStandardFEDid_
Definition: DTDigiToRawModule.h:28
eostools.move
def move(src, dest)
Definition: eostools.py:511
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
FEDHeader::set
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
genParticles_cff.map
map
Definition: genParticles_cff.py:11
DTDigiToRawModule::debug
bool debug
Definition: DTDigiToRawModule.h:25
FEDHeader
Definition: FEDHeader.h:14
DTDigiToRawModule::minFEDid_
int minFEDid_
Definition: DTDigiToRawModule.h:29
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37