Main Page
Namespaces
Classes
Package Documentation
L1Trigger
TextToDigi
plugins
RawToText.cc
Go to the documentation of this file.
1
2
#include "
L1Trigger/TextToDigi/plugins/RawToText.h
"
3
4
// system
5
#include <fstream>
6
#include <iomanip>
7
#include <iostream>
8
#include <string>
9
// framework
10
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
11
#include "
FWCore/Utilities/interface/Exception.h
"
12
// raw data collection
13
#include "
DataFormats/FEDRawData/interface/FEDRawDataCollection.h
"
14
15
RawToText::RawToText
(
const
edm::ParameterSet
&iConfig)
16
: inputLabel_(iConfig.getParameter<
edm
::InputTag>(
"inputLabel"
)),
17
fedId_(iConfig.getUntrackedParameter<
int
>(
"fedId"
, 745)),
18
filename_(iConfig.getUntrackedParameter<
std
::
string
>(
"filename"
,
19
"slinkOutput.txt"
)),
20
nevt_(0) {
21
edm::LogInfo
(
"TextToDigi"
)
22
<<
"Creating ASCII dump "
<<
filename_
<< std::endl;
23
}
24
25
RawToText::~RawToText
() {}
26
27
void
RawToText::analyze
(
const
edm::Event
&
iEvent
,
28
const
edm::EventSetup
&iSetup) {
29
30
nevt_
++;
31
32
// get raw data collection
33
edm::Handle<FEDRawDataCollection>
feds;
34
iEvent.
getByLabel
(
inputLabel_
, feds);
35
const
FEDRawData
&gctRcd = feds->
FEDData
(
fedId_
);
36
37
edm::LogInfo
(
"GCT"
) <<
"Upacking FEDRawData of size "
<<
std::dec
38
<< gctRcd.
size
() << std::endl;
39
40
// do a simple check of the raw data
41
if
(gctRcd.
size
() < 16) {
42
edm::LogWarning
(
"Invalid Data"
)
43
<<
"Empty/invalid GCT raw data, size = "
<< gctRcd.
size
() << std::endl;
44
return
;
45
}
46
47
const
unsigned
char
*
data
= gctRcd.
data
();
48
49
int
eventSize = gctRcd.
size
() / 4;
50
51
unsigned
long
d
= 0;
52
for
(
int
i
= 0;
i
< eventSize;
i
++) {
53
d = 0;
54
// d = data[i*4+0] + (data[i*4+1]<<8) + (data[i*4+2]<<16) +
55
// (data[i*4+3]<<24);
56
for
(
int
j = 0; j < 4; j++) {
57
d += ((data[
i
* 4 + j] & 0xff) << (8 * j));
58
}
59
file_
<< std::setw(8) << std::setfill(
'0'
) << std::hex << d << std::endl;
60
}
61
file_
<< std::flush << std::endl;
62
}
63
64
void
RawToText::beginJob
() {
65
66
// open VME file
67
file_
.open(
filename_
.c_str(),
std::ios::out
);
68
69
if
(!
file_
.good()) {
70
edm::LogInfo
(
"RawToText"
)
71
<<
"Failed to open ASCII file "
<<
filename_
<< std::endl;
72
}
73
}
74
75
void
RawToText::endJob
() {
file_
.close(); }
RawToText.h
RawToText::~RawToText
~RawToText() override
Definition:
RawToText.cc:25
RawToText::fedId_
int fedId_
Definition:
RawToText.h:39
MessageLogger.h
mps_fire.i
i
Definition:
mps_fire.py:330
RawToText::beginJob
void beginJob() override
Definition:
RawToText.cc:64
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Handle
Definition:
AssociativeIterator.h:47
edm::LogWarning
Definition:
MessageLogger.h:141
FEDRawDataCollection.h
std
Definition:
JetResolutionObject.h:80
RawToText::RawToText
RawToText(const edm::ParameterSet &)
Definition:
RawToText.cc:15
RawToText::file_
std::ofstream file_
Definition:
RawToText.h:43
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition:
FEDRawData.h:47
RawToText::filename_
std::string filename_
Definition:
RawToText.h:42
iEvent
int iEvent
Definition:
GenABIO.cc:224
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition:
FEDRawDataCollection.cc:28
createfilelist.int
int
Definition:
createfilelist.py:10
FEDRawData
Definition:
FEDRawData.h:20
edm::EventSetup
Definition:
EventSetup.h:57
edm::Event::getByLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition:
Event.h:480
edmIntegrityCheck.d
d
Definition:
edmIntegrityCheck.py:66
edm::LogInfo
Definition:
MessageLogger.h:254
RawToText::inputLabel_
edm::InputTag inputLabel_
Definition:
RawToText.h:36
Exception.h
MillePedeFileConverter_cfg.out
out
Definition:
MillePedeFileConverter_cfg.py:31
RawToText::nevt_
int nevt_
Definition:
RawToText.h:45
TauDecayModes.dec
dec
Definition:
TauDecayModes.py:143
edm
HLT enums.
Definition:
AlignableModifier.h:17
data
char data[epos_bytes_allocation]
Definition:
EPOS_Wrapper.h:82
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition:
FEDRawData.cc:28
RawToText::endJob
void endJob() override
Definition:
RawToText.cc:75
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::Event
Definition:
Event.h:71
RawToText::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
RawToText.cc:27
Generated for CMSSW Reference Manual by
1.8.11