EventFilter
DTRawToDigi
plugins
DTDigiToRawModule.cc
Go to the documentation of this file.
1
#include "
EventFilter/DTRawToDigi/plugins/DTDigiToRawModule.h
"
2
#include "
EventFilter/DTRawToDigi/plugins/DTDigiToRaw.h
"
3
#include "
DataFormats/FEDRawData/interface/FEDRawDataCollection.h
"
4
#include "
DataFormats/FEDRawData/interface/FEDNumbering.h
"
5
#include "
DataFormats/Common/interface/Handle.h
"
6
#include "
FWCore/Framework/interface/Event.h
"
7
8
#include "
DataFormats/FEDRawData/interface/FEDHeader.h
"
9
#include "
DataFormats/FEDRawData/interface/FEDTrailer.h
"
10
#include "
FWCore/Utilities/interface/CRC16.h
"
11
12
#include "
CondFormats/DataRecord/interface/DTReadOutMappingRcd.h
"
13
#include "
FWCore/Framework/interface/EventSetup.h
"
14
15
#include <iostream>
16
17
using namespace
edm
;
18
using namespace
std
;
19
20
DTDigiToRawModule::DTDigiToRawModule
(
const
edm::ParameterSet
& ps) {
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
}
35
36
DTDigiToRawModule::~DTDigiToRawModule
() {
37
delete
packer;
38
if
(
debug
)
39
cout
<<
"[DTDigiToRawModule]: destructor"
<< endl;
40
}
41
42
void
DTDigiToRawModule::produce
(
Event
&
e
,
const
EventSetup
& iSetup) {
43
auto
fed_buffers = std::make_unique<FEDRawDataCollection>();
44
45
// Take digis from the event
46
Handle<DTDigiCollection>
digis;
47
e
.getByToken(digicoll, digis);
48
49
// Load DTMap
50
edm::ESHandle<DTReadOutMapping>
map
;
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
);
65
FEDRawData
*
rawData
= packer->createFedBuffers(*digis,
map
);
66
67
FEDRawData
&
fedRawData
= fed_buffers->FEDData(
id
);
68
fedRawData
= *
rawData
;
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
}
FEDNumbering.h
Handle.h
DTDigiToRawModule::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
DTDigiToRawModule.cc:42
DTReadOutMappingRcd
Definition:
DTReadOutMappingRcd.h:5
edm
HLT enums.
Definition:
AlignableModifier.h:19
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
l1tstage2_dqm_sourceclient-live_cfg.rawData
rawData
Definition:
l1tstage2_dqm_sourceclient-live_cfg.py:162
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DTDigiToRaw.h
edm::Handle< DTDigiCollection >
FEDRawData
Definition:
FEDRawData.h:19
debug
#define debug
Definition:
HDRShower.cc:19
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:73
DTDigiToRawModule.h
l1t_dqm_sourceclient-live_cfg.fedRawData
fedRawData
Definition:
l1t_dqm_sourceclient-live_cfg.py:188
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
DTReadOutMappingRcd.h
DTDigiToRawModule::~DTDigiToRawModule
~DTDigiToRawModule() override
Destructor.
Definition:
DTDigiToRawModule.cc:36
edm::ParameterSet
Definition:
ParameterSet.h:36
FEDTrailer
Definition:
FEDTrailer.h:14
DTDigiToRaw
Definition:
DTDigiToRaw.h:15
Event.h
edm::get
T const & get(Event const &event, InputTag const &tag) noexcept(false)
Definition:
Event.h:669
FEDRawDataCollection.h
edm::EventSetup
Definition:
EventSetup.h:57
FEDNumbering::MINDTFEDID
Definition:
FEDNumbering.h:55
FEDTrailer::set
static void set(unsigned char *trailer, uint32_t lenght, uint16_t crc, uint8_t evt_stat, uint8_t tts, bool moreTrailers=false)
Set all fields in the trailer.
Definition:
FEDTrailer.cc:31
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
DTDigiToRawModule::DTDigiToRawModule
DTDigiToRawModule(const edm::ParameterSet &pset)
Constructor.
Definition:
DTDigiToRawModule.cc:20
eostools.move
def move(src, dest)
Definition:
eostools.py:511
std
Definition:
JetResolutionObject.h:76
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
EventSetup.h
genParticles_cff.map
map
Definition:
genParticles_cff.py:11
FEDHeader
Definition:
FEDHeader.h:14
edm::Event
Definition:
Event.h:73
FEDHeader.h
edm::InputTag
Definition:
InputTag.h:15
CRC16.h
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
FEDTrailer.h
Generated for CMSSW Reference Manual by
1.8.16