12 : m_rctInputLabel(iConfig.getParameter<
edm::InputTag>(
"RctInputLabel")),
13 m_textFileName(iConfig.getParameter<
std::
string>(
"TextFileName")),
14 m_hexUpperCase(iConfig.getParameter<
bool>(
"HexUpperCase")) {
18 std::stringstream fileStream;
26 <<
"RctDigiToRctText::RctDigiToRctText : " 27 <<
" couldn't create the file " <<
fileName << std::endl;
57 bool debug_NOTEMPTY[18] = {
false};
58 for (
int i = 0;
i < 18;
i++)
59 debug_NOTEMPTY[
i] =
false;
60 std::stringstream dstrm;
64 unsigned long int CAND[18][8];
70 for (L1CaloEmCollection::const_iterator iem = em->begin(); iem != em->end();
73 int crate = iem->rctCrate();
74 iso = iem->isolated();
75 unsigned data = iem->raw();
77 id = iso ? n_iso[crate]++ : 4 + n_niso[crate]++;
82 if (crate > 17 ||
id > 7)
84 <<
"out of bounds indices crate:" << crate <<
"id:" <<
id 86 if (ldebug && data != 0)
87 debug_NOTEMPTY[crate] =
true;
90 <<
" bx:" << nevt <<
" crate:" << crate <<
" iso:" << iso
91 <<
" raw:" << data <<
" \t cand:" << *iem;
92 if (debug_NOTEMPTY[crate])
93 fdebug << dstrm.str() << std::endl;
98 unsigned short MIPbits[18][7][2] = {{{0}}};
99 unsigned short QIEbits[18][7][2] = {{{0}}};
100 unsigned short RC[18][7][2] = {{{0}}};
101 unsigned short RCof[18][7][2] = {{{0}}};
102 unsigned short RCtau[18][7][2] = {{{0}}};
103 unsigned short HF[18][4][2] = {{{0}}};
105 for (L1CaloRegionCollection::const_iterator irgn = rgn->begin();
106 irgn != rgn->end(); irgn++) {
108 int crate = irgn->rctCrate();
109 int card = irgn->rctCard();
110 int rgnidx = irgn->rctRegionIndex();
113 if (!irgn->id().isHf()) {
114 RC[crate][card][rgnidx] = irgn->et();
115 RCof[crate][card][rgnidx] = irgn->overFlow();
116 RCtau[crate][card][rgnidx] = irgn->tauVeto();
117 MIPbits[crate][card][rgnidx] = irgn->mip();
118 QIEbits[crate][card][rgnidx] = irgn->quiet();
120 dstrm << hex <<
"Et=" << irgn->et() <<
" OverFlow=" << irgn->overFlow()
121 <<
" tauVeto=" << irgn->tauVeto() <<
" mip=" << irgn->mip()
122 <<
" quiet=" << irgn->quiet() <<
" Card=" << irgn->rctCard()
123 <<
" Region=" << irgn->rctRegionIndex()
124 <<
" Crate=" << irgn->rctCrate() <<
dec;
128 HF[crate][irgn->id().rctEta() - 7][irgn->id().rctPhi()] = irgn->et();
130 dstrm << hex <<
"Et=" << irgn->et() <<
" FGrain=" << irgn->fineGrain()
131 <<
" Eta=" << irgn->id().rctEta() <<
" Phi=" << irgn->id().rctPhi()
132 <<
" Crate=" << irgn->rctCrate() <<
dec;
134 LogDebug(
"HFRegions") << dstrm.str();
137 if (ldebug && irgn->et() != 0)
138 debug_NOTEMPTY[crate] =
true;
139 if (debug_NOTEMPTY[crate]) {
141 <<
" bx:" << nevt <<
" crate:" << crate <<
"\t";
142 fdebug << dstrm.str() << std::endl;
146 std::stringstream sstrm;
148 sstrm << std::uppercase;
150 sstrm.unsetf(std::ios::uppercase);
157 sstrm <<
"Crossing " << nevt << std::endl;
159 for (
int j = 0; j < 8; j++) {
160 sstrm << setw(3) << setfill(
'0') << hex << (CAND[crate][j] & 0x3ff);
164 sstrm << setfill(
' ') <<
dec;
165 m_file[crate] << sstrm.str() << std::endl;
168 if (debug_NOTEMPTY[crate])
169 fdebug << sstrm.str() << std::endl;
171 LogDebug(
"Electrons") << sstrm.str() << std::endl;
180 for (
int card = 0; card < 7; card++) {
181 for (
int j = 0; j < 2; j++) {
182 sstrm <<
" " << MIPbits[crate][card][j];
185 m_file[crate] << sstrm.str() << std::endl;
186 if (debug_NOTEMPTY[crate])
187 fdebug << sstrm.str() << std::endl;
191 for (
int card = 0; card < 7; card++) {
192 for (
int j = 0; j < 2; j++) {
193 sstrm <<
" " << QIEbits[crate][card][j];
196 m_file[crate] << sstrm.str() << std::endl;
197 if (debug_NOTEMPTY[crate])
198 fdebug << sstrm.str() << std::endl;
202 for (
int card = 0; card < 7; card++) {
203 for (
int j = 0; j < 2; j++) {
204 unsigned long int tmp;
205 unsigned et = RC[crate][card][j];
206 unsigned ovf = RCof[crate][card][j];
207 unsigned tau = RCtau[crate][card][j];
209 tmp = ((tau & 0x1) << 11) | ((ovf & 0x1) << 10) | ((et & 0x3ff));
210 sstrm <<
" " << setw(3) << setfill(
'0') << hex <<
tmp;
213 m_file[crate] << sstrm.str() << std::endl;
214 if (debug_NOTEMPTY[crate])
215 fdebug << sstrm.str() << std::endl << std::endl;
219 for (
int ip = 0; ip < 2; ip++) {
220 for (
int ie = 0; ie < 4; ie++) {
221 unsigned et = HF[crate][ie][ip] & 0xff;
222 sstrm <<
" " << setw(2) << setfill(
'0') << hex <<
et;
225 m_file[crate] << sstrm.str() << std::endl;
226 if (debug_NOTEMPTY[crate])
227 fdebug << sstrm.str() << std::endl;
228 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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
~RctDigiToRctText() override
RctDigiToRctText(const edm::ParameterSet &)
et
define resolution functions of each parameter
std::vector< std::vector< double > > tmp
std::string m_textFileName
basename for output files
char data[epos_bytes_allocation]
std::ofstream fdebug
handle for debug file