27 : m_fibreSource(iConfig.getUntrackedParameter<
edm::
InputTag>(
"FibreSource")),
28 m_doLogicalID(iConfig.getUntrackedParameter<
bool>(
"doLogicalID")),
29 m_doCounter(iConfig.getUntrackedParameter<
bool>(
"doCounter")),
31 m_numInconsistentPayloadEvents(0),
32 m_numConsistentEvents(0) {}
50 int flag_for_zeroes = 0;
51 int flag_for_inconsistent_events = 0;
52 unsigned int flag_for_consistency = 0;
53 int flag_for_consistent_events = 0;
55 for (L1GctFibreCollection::const_iterator
f = fibre->begin();
f != fibre->end();
f++) {
58 if (
f == fibre->begin()) {
59 flag_for_consistency =
f->data();
60 }
else if (flag_for_consistency ==
f->data()) {
61 flag_for_consistent_events++;
67 edm::LogInfo(
"GCT fibre data error") <<
"Missing phase bit (clock) in fibre data " << (*f);
77 edm::LogInfo(
"GCT fibre data error") <<
"BC0 mismatch in fibre data " << (*f);
91 if (flag_for_zeroes == 0 &&
f == (fibre->end() - 1)) {
95 if (flag_for_zeroes == 1) {
96 flag_for_inconsistent_events++;
101 if (flag_for_inconsistent_events != 0) {
105 if (
m_doCounter && flag_for_consistent_events != 0) {
112 if (fibre.
data() & 0x8000) {
121 if (fibre.
data() & 0x80000000) {
130 int cycle0Data, cycle1Data;
132 cycle0Data = fibre.
data() & 0x7FFF;
133 cycle1Data = (fibre.
data() >> 16) & 0x7FFF;
136 if ((cycle0Data + 1) != cycle1Data) {
137 edm::LogInfo(
"GCT fibre data error") <<
"Fibre data not incrementing in cycles 0 and 1 " 138 <<
" Cycle 0 data=" << cycle0Data <<
" Cycle 1 data=" << cycle1Data <<
" " 143 edm::LogInfo(
"GCT fibre counter data") <<
" Fibre data: cycle0=" << cycle0Data <<
" cycle1=" << cycle1Data <<
" " 150 unsigned ref_jf_link[] = {1, 2, 3, 4, 1, 2, 3, 4};
154 unsigned ref_eta0_link[] = {3, 4, 3, 4, 3, 4};
157 unsigned ref_jf_type[] = {2, 2, 3, 3, 1, 1, 1, 1};
160 unsigned ref_eta0_type[] = {2, 2, 2, 2, 2, 2};
163 int eta_region, rct_phi_region, leaf_phi_region, jf_type, elec_type, local_source_card_id, source_card_id_read,
164 source_card_id_expected;
167 if ((fibre.
data() & 0x7FFF) != ((fibre.
data() & 0x7FFF0000) >> 16)) {
168 edm::LogInfo(
"GCT fibre data error") <<
"Fibre data different on cycles 0 and 1 " << fibre;
174 if ((fibre.
block() >> 10) & 0
x1) {
181 if (((fibre.
block() >> 8) & 0x7) == 0 || ((fibre.
block() >> 8) & 0x7) == 4)
183 if ((fibre.
block() & 0xFF) == 0x04)
185 else if ((fibre.
block() & 0xFF) == 0x84)
190 rct_phi_region = (fibre.
index() / 3) + (4 * elec_type);
192 local_source_card_id = (4 * eta_region);
194 source_card_id_expected = (8 * rct_phi_region) + local_source_card_id;
196 source_card_id_read = (fibre.
data() >> 8) & 0x7F;
198 if (source_card_id_expected != source_card_id_read) {
200 <<
"Electron Source Card IDs do not match " 201 <<
"Expected ID = " << source_card_id_expected <<
" ID read from data = " << source_card_id_read <<
" " 205 if ((fibre.
data() & 0xFF) != (
unsigned int)(2 + fibre.
index() % 3)) {
207 <<
"Electron Fibres do not match " 208 <<
"Expected Fibre = " << (2 + fibre.
index() % 3) <<
" Fibre read from data = " << (fibre.
data() & 0xFF)
219 if ((fibre.
block() & 0xFF) == 0x04)
221 else if ((fibre.
block() & 0xFF) == 0x0C)
223 else if ((fibre.
block() & 0xFF) == 0x84)
225 else if ((fibre.
block() & 0xFF) == 0x8C)
232 leaf_phi_region = ((fibre.
block() >> 8) & 0x7) - 1;
235 if (leaf_phi_region < 0 || leaf_phi_region > 5)
245 if (fibre.
index() <= 5)
247 rct_phi_region = ((8 + ((leaf_phi_region % 3) * 3) + (fibre.
index() / 2)) % 9);
255 local_source_card_id = ref_eta0_type[fibre.
index()] + (4 + (eta_region * -4));
258 source_card_id_expected = (8 * rct_phi_region) + local_source_card_id;
261 source_card_id_read = (fibre.
data() >> 8) & 0x7F;
263 if (source_card_id_expected != source_card_id_read) {
265 <<
"ETA0 Source Card IDs do not match " 266 <<
"Expected ID = " << source_card_id_expected <<
" ID read from data = " << source_card_id_read <<
" " 270 if ((fibre.
data() & 0xFF) != ref_eta0_link[fibre.
index()]) {
272 <<
"ETA0 Fibres do not match " 273 <<
"Expected Fibre = " << ref_eta0_link[fibre.
index()]
274 <<
" Fibre read from data = " << (fibre.
data() & 0xFF) <<
" " << fibre;
277 edm::LogInfo(
"GCT fibre data error") <<
"ETA0 Fibre index out of bounds " << fibre;
282 if (fibre.
index() <= 7) {
283 rct_phi_region = ((8 + ((leaf_phi_region % 3) * 3) + jf_type) % 9);
305 local_source_card_id = ref_jf_type[fibre.
index()] + (4 * eta_region);
308 if (local_source_card_id == 7)
309 local_source_card_id = 3;
312 source_card_id_expected = (8 * rct_phi_region) + local_source_card_id;
314 source_card_id_read = (fibre.
data() >> 8) & 0x7F;
316 if (source_card_id_expected != source_card_id_read) {
318 <<
"Source Card IDs do not match " 319 <<
"Expected ID = " << source_card_id_expected <<
" ID read from data = " << source_card_id_read <<
" " 323 if ((fibre.
data() & 0xFF) != ref_jf_link[fibre.
index()]) {
325 <<
"Fibres do not match " 326 <<
"Expected Fibre = " << ref_jf_link[fibre.
index()]
327 <<
" Fibre read from data = " << (fibre.
data() & 0xFF) <<
" " << fibre;
330 edm::LogInfo(
"GCT fibre data error") <<
"Fibre index out of bounds " << fibre;
Global Calorimeter Trigger SC -> CC fibre data word.
~GctFibreAnalyzer() override
unsigned int m_numConsistentEvents
bool CheckFibreWord(const L1GctFibreWord fibre)
void analyze(const edm::Event &, const edm::EventSetup &) override
unsigned int m_numZeroEvents
void CheckLogicalID(const L1GctFibreWord fibre)
Log< level::Info, false > LogInfo
edm::InputTag m_fibreSource
bool CheckForBC0(const L1GctFibreWord fibre)
GctFibreAnalyzer(const edm::ParameterSet &)
void CheckCounter(const L1GctFibreWord fibre)
unsigned int m_numInconsistentPayloadEvents