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 <string>
6
#include <fstream>
7
#include <iostream>
8
#include <iomanip>
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
16
RawToText::RawToText
(
const
edm::ParameterSet
& iConfig) :
17
inputLabel_(iConfig.getParameter<
edm
::InputTag>(
"inputLabel"
)),
18
fedId_(iConfig.getUntrackedParameter<
int
>(
"fedId"
, 745)),
19
filename_(iConfig.getUntrackedParameter<
std
::
string
>(
"filename"
,
"slinkOutput.txt"
)),
20
nevt_(0) {
21
edm::LogInfo
(
"TextToDigi"
) <<
"Creating ASCII dump "
<<
filename_
<< std::endl;
22
}
23
24
25
RawToText::~RawToText
() {}
26
27
28
void
RawToText::analyze
(
const
edm::Event
&
iEvent
,
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 "
38
<<
std::dec
<< gctRcd.
size
()
39
<< std::endl;
40
41
// do a simple check of the raw data
42
if
(gctRcd.
size
()<16) {
43
edm::LogWarning
(
"Invalid Data"
)
44
<<
"Empty/invalid GCT raw data, size = "
<< gctRcd.
size
()
45
<< std::endl;
46
return
;
47
}
48
49
const
unsigned
char
*
data
= gctRcd.
data
();
50
51
int
eventSize = gctRcd.
size
() / 4;
52
53
unsigned
long
d
= 0;
54
for
(
int
i
=0;
i
<eventSize;
i
++) {
55
d = 0;
56
//d = data[i*4+0] + (data[i*4+1]<<8) + (data[i*4+2]<<16) + (data[i*4+3]<<24);
57
for
(
int
j=0; j<4; j++) {
58
d += ((data[
i
*4+j]&0xff)<<(8*j));
59
}
60
file_
<< std::setw(8) << std::setfill(
'0'
) << std::hex << d << std::endl;
61
}
62
file_
<< std::flush << std::endl;
63
64
}
65
66
67
void
RawToText::beginJob
() {
68
69
// open VME file
70
file_
.open(
filename_
.c_str(),
std::ios::out
);
71
72
if
(!
file_
.good()) {
73
edm::LogInfo
(
"RawToText"
) <<
"Failed to open ASCII file "
<<
filename_
74
<< std::endl;
75
}
76
}
77
78
79
void
RawToText::endJob
() {
80
file_
.close();
81
}
RawToText.h
RawToText::~RawToText
~RawToText() override
Definition:
RawToText.cc:25
RawToText::fedId_
int fedId_
Definition:
RawToText.h:41
MessageLogger.h
mps_fire.i
i
Definition:
mps_fire.py:269
RawToText::beginJob
void beginJob() override
Definition:
RawToText.cc:67
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
edm::Handle
Definition:
AssociativeIterator.h:48
edm::LogWarning
Definition:
MessageLogger.h:142
FEDRawDataCollection.h
std
Definition:
JetResolutionObject.h:80
RawToText::RawToText
RawToText(const edm::ParameterSet &)
Definition:
RawToText.cc:16
RawToText::file_
std::ofstream file_
Definition:
RawToText.h:45
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:44
iEvent
int iEvent
Definition:
GenABIO.cc:230
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:52
edm::Event::getByLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition:
Event.h:535
edmIntegrityCheck.d
d
Definition:
edmIntegrityCheck.py:65
edm::LogInfo
Definition:
MessageLogger.h:238
RawToText::inputLabel_
edm::InputTag inputLabel_
Definition:
RawToText.h:38
Exception.h
MillePedeFileConverter_cfg.out
out
Definition:
MillePedeFileConverter_cfg.py:31
RawToText::nevt_
int nevt_
Definition:
RawToText.h:47
TauDecayModes.dec
dec
Definition:
TauDecayModes.py:142
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:79
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::Event
Definition:
Event.h:70
RawToText::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
RawToText.cc:28
Generated for CMSSW Reference Manual by
1.8.11