Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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"
,
"slinkOutput.txt"
)),
19
nevt_(0) {
20
edm::LogInfo
(
"TextToDigi"
) <<
"Creating ASCII dump "
<<
filename_
<< std::endl;
21
}
22
23
RawToText::~RawToText
() {}
24
25
void
RawToText::analyze
(
const
edm::Event
&
iEvent
,
const
edm::EventSetup
&iSetup) {
26
nevt_
++;
27
28
// get raw data collection
29
edm::Handle<FEDRawDataCollection>
feds
;
30
iEvent.
getByLabel
(
inputLabel_
, feds);
31
const
FEDRawData
&gctRcd = feds->FEDData(
fedId_
);
32
33
edm::LogInfo
(
"GCT"
) <<
"Upacking FEDRawData of size "
<<
std::dec
<< gctRcd.
size
() << std::endl;
34
35
// do a simple check of the raw data
36
if
(gctRcd.
size
() < 16) {
37
edm::LogWarning
(
"Invalid Data"
) <<
"Empty/invalid GCT raw data, size = "
<< gctRcd.
size
() << std::endl;
38
return
;
39
}
40
41
const
unsigned
char
*
data
= gctRcd.
data
();
42
43
int
eventSize = gctRcd.
size
() / 4;
44
45
unsigned
long
d
= 0;
46
for
(
int
i
= 0;
i
< eventSize;
i
++) {
47
d = 0;
48
// d = data[i*4+0] + (data[i*4+1]<<8) + (data[i*4+2]<<16) +
49
// (data[i*4+3]<<24);
50
for
(
int
j
= 0;
j
< 4;
j
++) {
51
d += ((data[
i
* 4 +
j
] & 0xff) << (8 *
j
));
52
}
53
file_
<< std::setw(8) << std::setfill(
'0'
) << std::hex << d << std::endl;
54
}
55
file_
<< std::flush << std::endl;
56
}
57
58
void
RawToText::beginJob
() {
59
// open VME file
60
file_
.open(
filename_
.c_str(),
std::ios::out
);
61
62
if
(!
file_
.good()) {
63
edm::LogInfo
(
"RawToText"
) <<
"Failed to open ASCII file "
<<
filename_
<< std::endl;
64
}
65
}
66
67
void
RawToText::endJob
() {
file_
.close(); }
RawToText.h
RawToText::~RawToText
~RawToText() override
Definition:
RawToText.cc:23
RawToText::fedId_
int fedId_
Definition:
RawToText.h:39
dqmiolumiharvest.j
tuple j
Definition:
dqmiolumiharvest.py:66
mps_fire.i
i
Definition:
mps_fire.py:428
RawToText::beginJob
void beginJob() override
Definition:
RawToText.cc:58
MessageLogger.h
edm::Handle< FEDRawDataCollection >
FEDRawDataCollection.h
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:45
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
unpackBuffers-CaloStage1.feds
tuple feds
Definition:
unpackBuffers-CaloStage1.py:139
ztail.d
tuple d
Definition:
ztail.py:151
RawToText::filename_
std::string filename_
Definition:
RawToText.h:42
iEvent
int iEvent
Definition:
GenABIO.cc:224
FEDRawData
Definition:
FEDRawData.h:19
edm::EventSetup
Definition:
EventSetup.h:59
edm::Event::getByLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition:
Event.h:500
edm::LogInfo
Log< level::Info, false > LogInfo
Definition:
MessageLogger.h:125
RawToText::inputLabel_
edm::InputTag inputLabel_
Definition:
RawToText.h:36
Exception.h
RawToText::nevt_
int nevt_
Definition:
RawToText.h:45
HLT_FULL_cff.InputTag
tuple InputTag
Definition:
HLT_FULL_cff.py:72505
data
char data[epos_bytes_allocation]
Definition:
EPOS_Wrapper.h:79
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition:
FEDRawData.cc:24
RawToText::endJob
void endJob() override
Definition:
RawToText.cc:67
edm::ParameterSet
Definition:
ParameterSet.h:47
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition:
MessageLogger.h:122
edm::Event
Definition:
Event.h:73
iConfig
iConfig
Definition:
TSGFromPropagation.cc:56
RawToText::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
RawToText.cc:25
TauDecayModes.dec
tuple dec
Definition:
TauDecayModes.py:142
submitPVResolutionJobs.out
string out
Definition:
submitPVResolutionJobs.py:118
Generated for CMSSW Reference Manual by
1.8.5