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;
52 bool debug_NOTEMPTY[18] = {
false};
53 for (
int i = 0;
i < 18;
i++)
54 debug_NOTEMPTY[
i] =
false;
55 std::stringstream dstrm;
59 unsigned long int CAND[18][8];
65 for (L1CaloEmCollection::const_iterator iem = em->begin(); iem != em->end(); iem++) {
66 int crate = iem->rctCrate();
67 iso = iem->isolated();
68 unsigned data = iem->raw();
70 id = iso ? n_iso[crate]++ : 4 + n_niso[crate]++;
75 if (crate > 17 ||
id > 7)
77 <<
"out of bounds indices crate:" << crate <<
"id:" <<
id << std::endl;
78 if (ldebug &&
data != 0)
79 debug_NOTEMPTY[crate] =
true;
82 <<
" bx:" <<
nevt <<
" crate:" << crate <<
" iso:" << iso <<
" raw:" <<
data <<
" \t cand:" << *iem;
83 if (debug_NOTEMPTY[crate])
84 fdebug << dstrm.str() << std::endl;
89 unsigned short MIPbits[18][7][2] = {{{0}}};
90 unsigned short QIEbits[18][7][2] = {{{0}}};
91 unsigned short RC[18][7][2] = {{{0}}};
92 unsigned short RCof[18][7][2] = {{{0}}};
93 unsigned short RCtau[18][7][2] = {{{0}}};
94 unsigned short HF[18][4][2] = {{{0}}};
96 for (L1CaloRegionCollection::const_iterator irgn = rgn->begin(); irgn != rgn->end(); irgn++) {
97 int crate = irgn->rctCrate();
98 int card = irgn->rctCard();
99 int rgnidx = irgn->rctRegionIndex();
102 if (!irgn->id().isHf()) {
103 RC[crate][card][rgnidx] = irgn->et();
104 RCof[crate][card][rgnidx] = irgn->overFlow();
105 RCtau[crate][card][rgnidx] = irgn->tauVeto();
106 MIPbits[crate][card][rgnidx] = irgn->mip();
107 QIEbits[crate][card][rgnidx] = irgn->quiet();
109 dstrm << hex <<
"Et=" << irgn->et() <<
" OverFlow=" << irgn->overFlow() <<
" tauVeto=" << irgn->tauVeto()
110 <<
" mip=" << irgn->mip() <<
" quiet=" << irgn->quiet() <<
" Card=" << irgn->rctCard()
111 <<
" Region=" << irgn->rctRegionIndex() <<
" Crate=" << irgn->rctCrate() <<
dec;
115 HF[crate][irgn->id().rctEta() - 7][irgn->id().rctPhi()] = irgn->et();
117 dstrm << hex <<
"Et=" << irgn->et() <<
" FGrain=" << irgn->fineGrain() <<
" Eta=" << irgn->id().rctEta()
118 <<
" Phi=" << irgn->id().rctPhi() <<
" Crate=" << irgn->rctCrate() <<
dec;
120 LogDebug(
"HFRegions") << dstrm.str();
123 if (ldebug && irgn->et() != 0)
124 debug_NOTEMPTY[crate] =
true;
125 if (debug_NOTEMPTY[crate]) {
127 <<
" bx:" <<
nevt <<
" crate:" << crate <<
"\t";
128 fdebug << dstrm.str() << std::endl;
132 std::stringstream sstrm;
134 sstrm << std::uppercase;
136 sstrm.unsetf(std::ios::uppercase);
142 sstrm <<
"Crossing " <<
nevt << std::endl;
144 for (
int j = 0;
j < 8;
j++) {
145 sstrm << setw(3) << setfill(
'0') << hex << (CAND[crate][
j] & 0x3ff);
149 sstrm << setfill(
' ') <<
dec;
150 m_file[crate] << sstrm.str() << std::endl;
153 if (debug_NOTEMPTY[crate])
154 fdebug << sstrm.str() << std::endl;
156 LogDebug(
"Electrons") << sstrm.str() << std::endl;
164 for (
int card = 0; card < 7; card++) {
165 for (
int j = 0;
j < 2;
j++) {
166 sstrm <<
" " << MIPbits[crate][card][
j];
169 m_file[crate] << sstrm.str() << std::endl;
170 if (debug_NOTEMPTY[crate])
171 fdebug << sstrm.str() << std::endl;
175 for (
int card = 0; card < 7; card++) {
176 for (
int j = 0;
j < 2;
j++) {
177 sstrm <<
" " << QIEbits[crate][card][
j];
180 m_file[crate] << sstrm.str() << std::endl;
181 if (debug_NOTEMPTY[crate])
182 fdebug << sstrm.str() << std::endl;
186 for (
int card = 0; card < 7; card++) {
187 for (
int j = 0;
j < 2;
j++) {
188 unsigned long int tmp;
189 unsigned et = RC[crate][card][
j];
190 unsigned ovf = RCof[crate][card][
j];
191 unsigned tau = RCtau[crate][card][
j];
193 tmp = ((
tau & 0x1) << 11) | ((ovf & 0x1) << 10) | ((
et & 0x3ff));
194 sstrm <<
" " << setw(3) << setfill(
'0') << hex <<
tmp;
197 m_file[crate] << sstrm.str() << std::endl;
198 if (debug_NOTEMPTY[crate])
199 fdebug << sstrm.str() << std::endl << std::endl;
203 for (
int ip = 0; ip < 2; ip++) {
204 for (
int ie = 0; ie < 4; ie++) {
205 unsigned et =
HF[crate][ie][ip] & 0xff;
206 sstrm <<
" " << setw(2) << setfill(
'0') << hex <<
et;
209 m_file[crate] << sstrm.str() << std::endl;
210 if (debug_NOTEMPTY[crate])
211 fdebug << sstrm.str() << std::endl;
212 sstrm << setfill(
' ') <<
dec;
static const unsigned NUM_RCT_CRATES
bool m_hexUpperCase
write upper case hex words
edm::InputTag m_rctInputLabel
label for RCT digis
void analyze(const edm::Event &, const edm::EventSetup &) override
std::ofstream m_file[NUM_RCT_CRATES]
handles for output files
~RctDigiToRctText() override
RctDigiToRctText(const edm::ParameterSet &)
auto const good
min quality of good
std::string m_textFileName
basename for output files
char data[epos_bytes_allocation]
std::ofstream fdebug
handle for debug file