12 : m_rctInputLabel(iConfig.getParameter<
edm::
InputTag>(
"RctInputLabel")),
13 m_textFileName(iConfig.getParameter<
std::
string>(
"TextFileName")),
14 m_hexUpperCase(iConfig.getParameter<
bool>(
"HexUpperCase")) {
17 std::stringstream fileStream;
18 fileStream <<
m_textFileName << std::setw(2) << std::setfill(
'0') <<
i <<
".txt";
24 <<
"RctDigiToRctText::RctDigiToRctText : "
25 <<
" couldn't create the file " <<
fileName << std::endl;
53 bool debug_NOTEMPTY[18] = {
false};
54 for (
int i = 0;
i < 18;
i++)
55 debug_NOTEMPTY[
i] =
false;
56 std::stringstream dstrm;
60 unsigned long int CAND[18][8];
66 for (L1CaloEmCollection::const_iterator iem = em->begin(); iem != em->end(); iem++) {
67 int crate = iem->rctCrate();
68 iso = iem->isolated();
69 unsigned data = iem->raw();
71 id = iso ? n_iso[crate]++ : 4 + n_niso[crate]++;
76 if (crate > 17 ||
id > 7)
78 <<
"out of bounds indices crate:" << crate <<
"id:" <<
id << std::endl;
79 if (ldebug &&
data != 0)
80 debug_NOTEMPTY[crate] =
true;
83 <<
" bx:" <<
nevt <<
" crate:" << crate <<
" iso:" << iso <<
" raw:" <<
data <<
" \t cand:" << *iem;
84 if (debug_NOTEMPTY[crate])
85 fdebug << dstrm.str() << std::endl;
90 unsigned short MIPbits[18][7][2] = {{{0}}};
91 unsigned short QIEbits[18][7][2] = {{{0}}};
92 unsigned short RC[18][7][2] = {{{0}}};
93 unsigned short RCof[18][7][2] = {{{0}}};
94 unsigned short RCtau[18][7][2] = {{{0}}};
95 unsigned short HF[18][4][2] = {{{0}}};
97 for (L1CaloRegionCollection::const_iterator irgn = rgn->begin(); irgn != rgn->end(); irgn++) {
98 int crate = irgn->rctCrate();
99 int card = irgn->rctCard();
100 int rgnidx = irgn->rctRegionIndex();
103 if (!irgn->id().isHf()) {
104 RC[crate][card][rgnidx] = irgn->et();
105 RCof[crate][card][rgnidx] = irgn->overFlow();
106 RCtau[crate][card][rgnidx] = irgn->tauVeto();
107 MIPbits[crate][card][rgnidx] = irgn->mip();
108 QIEbits[crate][card][rgnidx] = irgn->quiet();
110 dstrm << hex <<
"Et=" << irgn->et() <<
" OverFlow=" << irgn->overFlow() <<
" tauVeto=" << irgn->tauVeto()
111 <<
" mip=" << irgn->mip() <<
" quiet=" << irgn->quiet() <<
" Card=" << irgn->rctCard()
112 <<
" Region=" << irgn->rctRegionIndex() <<
" Crate=" << irgn->rctCrate() <<
dec;
116 HF[crate][irgn->id().rctEta() - 7][irgn->id().rctPhi()] = irgn->et();
118 dstrm << hex <<
"Et=" << irgn->et() <<
" FGrain=" << irgn->fineGrain() <<
" Eta=" << irgn->id().rctEta()
119 <<
" Phi=" << irgn->id().rctPhi() <<
" Crate=" << irgn->rctCrate() <<
dec;
121 LogDebug(
"HFRegions") << dstrm.str();
124 if (ldebug && irgn->et() != 0)
125 debug_NOTEMPTY[crate] =
true;
126 if (debug_NOTEMPTY[crate]) {
128 <<
" bx:" <<
nevt <<
" crate:" << crate <<
"\t";
129 fdebug << dstrm.str() << std::endl;
133 std::stringstream sstrm;
135 sstrm << std::uppercase;
137 sstrm.unsetf(std::ios::uppercase);
143 sstrm <<
"Crossing " <<
nevt << std::endl;
145 for (
int j = 0;
j < 8;
j++) {
146 sstrm << setw(3) << setfill(
'0') << hex << (CAND[crate][
j] & 0x3ff);
150 sstrm << setfill(
' ') <<
dec;
151 m_file[crate] << sstrm.str() << std::endl;
154 if (debug_NOTEMPTY[crate])
155 fdebug << sstrm.str() << std::endl;
157 LogDebug(
"Electrons") << sstrm.str() << std::endl;
165 for (
int card = 0; card < 7; card++) {
166 for (
int j = 0;
j < 2;
j++) {
167 sstrm <<
" " << MIPbits[crate][card][
j];
170 m_file[crate] << sstrm.str() << std::endl;
171 if (debug_NOTEMPTY[crate])
172 fdebug << sstrm.str() << std::endl;
176 for (
int card = 0; card < 7; card++) {
177 for (
int j = 0;
j < 2;
j++) {
178 sstrm <<
" " << QIEbits[crate][card][
j];
181 m_file[crate] << sstrm.str() << std::endl;
182 if (debug_NOTEMPTY[crate])
183 fdebug << sstrm.str() << std::endl;
187 for (
int card = 0; card < 7; card++) {
188 for (
int j = 0;
j < 2;
j++) {
189 unsigned long int tmp;
190 unsigned et = RC[crate][card][
j];
191 unsigned ovf = RCof[crate][card][
j];
192 unsigned tau = RCtau[crate][card][
j];
194 tmp = ((
tau & 0x1) << 11) | ((ovf & 0x1) << 10) | ((
et & 0x3ff));
195 sstrm <<
" " << setw(3) << setfill(
'0') << hex <<
tmp;
198 m_file[crate] << sstrm.str() << std::endl;
199 if (debug_NOTEMPTY[crate])
200 fdebug << sstrm.str() << std::endl << std::endl;
204 for (
int ip = 0; ip < 2; ip++) {
205 for (
int ie = 0; ie < 4; ie++) {
206 unsigned et =
HF[crate][ie][ip] & 0xff;
207 sstrm <<
" " << setw(2) << setfill(
'0') << hex <<
et;
210 m_file[crate] << sstrm.str() << std::endl;
211 if (debug_NOTEMPTY[crate])
212 fdebug << sstrm.str() << std::endl;
213 sstrm << setfill(
' ') <<
dec;