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)
51 int flag_for_zeroes = 0;
52 int flag_for_inconsistent_events = 0;
53 unsigned int flag_for_consistency = 0;
54 int flag_for_consistent_events = 0;
56 for (L1GctFibreCollection::const_iterator
f=fibre->begin();
f!=fibre->end();
f++){
62 if(
f==fibre->begin()) {flag_for_consistency =
f->data();}
63 else if(flag_for_consistency ==
f->data()){flag_for_consistent_events++;}
68 edm::LogInfo(
"GCT fibre data error") <<
"Missing phase bit (clock) in fibre data " << (*f);
79 edm::LogInfo(
"GCT fibre data error") <<
"BC0 mismatch in fibre data " << (*f);
95 if(flag_for_zeroes == 1) {flag_for_inconsistent_events++;}
108 if (fibre.
data() & 0x8000){
118 if (fibre.
data() & 0x80000000){
128 int cycle0Data, cycle1Data;
130 cycle0Data = fibre.
data() & 0x7FFF;
131 cycle1Data = (fibre.
data() >> 16) & 0x7FFF;
134 if ((cycle0Data+1)!=cycle1Data){
135 edm::LogInfo(
"GCT fibre data error") <<
"Fibre data not incrementing in cycles 0 and 1 " 136 <<
" Cycle 0 data=" << cycle0Data
137 <<
" Cycle 1 data=" << cycle1Data
142 edm::LogInfo(
"GCT fibre counter data") <<
" Fibre data: cycle0=" << cycle0Data
143 <<
" cycle1=" << cycle1Data
151 unsigned ref_jf_link[] = {1,2,3,4,1,2,3,4};
155 unsigned ref_eta0_link[] = {3,4,3,4,3,4};
158 unsigned ref_jf_type[] = {2,2,3,3,1,1,1,1};
161 unsigned ref_eta0_type[] = {2,2,2,2,2,2};
164 int eta_region, rct_phi_region, leaf_phi_region, jf_type, elec_type, local_source_card_id, source_card_id_read, 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 )
182 if(((fibre.
block() >> 8) & 0x7) == 0 || ((fibre.
block() >> 8) & 0x7) == 4)
185 if((fibre.
block() & 0xFF)==0x04) elec_type=1;
186 else if((fibre.
block() & 0xFF)==0x84) elec_type=0;
189 rct_phi_region = (fibre.
index() / 3) + (4*elec_type);
191 local_source_card_id = (4*eta_region);
193 source_card_id_expected = (8 * rct_phi_region) + local_source_card_id;
195 source_card_id_read = (fibre.
data() >> 8) & 0x7F;
197 if(source_card_id_expected != source_card_id_read )
199 edm::LogInfo(
"GCT fibre data error") <<
"Electron Source Card IDs do not match " 200 <<
"Expected ID = " << source_card_id_expected
201 <<
" ID read from data = " << source_card_id_read
205 if( (fibre.
data() & 0xFF) != (
unsigned int)(2 + fibre.
index()%3))
207 edm::LogInfo(
"GCT fibre data error") <<
"Electron Fibres do not match " 208 <<
"Expected Fibre = " << (2 + fibre.
index()%3)
209 <<
" Fibre read from data = " << (fibre.
data() & 0xFF)
222 if((fibre.
block() & 0xFF)==0x04) jf_type=1;
223 else if((fibre.
block() & 0xFF)==0x0C) jf_type=2;
224 else if((fibre.
block() & 0xFF)==0x84) jf_type=-1;
225 else if((fibre.
block() & 0xFF)==0x8C) jf_type=0;
230 leaf_phi_region = ((fibre.
block() >> 8) & 0x7)-1;
231 if(eta_region == 0) leaf_phi_region--;
232 if(leaf_phi_region <0 || leaf_phi_region >5)
throw cms::Exception(
"Unknown Leaf Card ") << fibre.
block();
242 if(fibre.
index() <=5 )
244 rct_phi_region = ( (8 + ((leaf_phi_region%3)*3) + (fibre.
index() / 2) ) % 9);
252 local_source_card_id = ref_eta0_type[ fibre.
index() ] + (4 + (eta_region * -4));
255 source_card_id_expected = (8 * rct_phi_region) + local_source_card_id;
258 source_card_id_read = (fibre.
data() >> 8) & 0x7F;
260 if(source_card_id_expected != source_card_id_read )
262 edm::LogInfo(
"GCT fibre data error") <<
"ETA0 Source Card IDs do not match " 263 <<
"Expected ID = " << source_card_id_expected
264 <<
" ID read from data = " << source_card_id_read
268 if( (fibre.
data() & 0xFF) != ref_eta0_link[fibre.
index()])
270 edm::LogInfo(
"GCT fibre data error") <<
"ETA0 Fibres do not match " 271 <<
"Expected Fibre = " << ref_eta0_link[fibre.
index()]
272 <<
" Fibre read from data = " << (fibre.
data() & 0xFF)
276 else edm::LogInfo(
"GCT fibre data error") <<
"ETA0 Fibre index out of bounds " << fibre;
283 if(fibre.
index() <=7 )
285 rct_phi_region = ( (8 + ((leaf_phi_region%3)*3) + jf_type ) % 9);
307 local_source_card_id = ref_jf_type[ fibre.
index() ] + (4 * eta_region);
310 if(local_source_card_id == 7) local_source_card_id = 3;
313 source_card_id_expected = (8 * rct_phi_region) + local_source_card_id;
315 source_card_id_read = (fibre.
data() >> 8) & 0x7F;
317 if(source_card_id_expected != source_card_id_read )
319 edm::LogInfo(
"GCT fibre data error") <<
"Source Card IDs do not match " 320 <<
"Expected ID = " << source_card_id_expected
321 <<
" ID read from data = " << source_card_id_read
325 if( (fibre.
data() & 0xFF) != ref_jf_link[fibre.
index()])
327 edm::LogInfo(
"GCT fibre data error") <<
"Fibres do not match " 328 <<
"Expected Fibre = " << ref_jf_link[fibre.
index()]
329 <<
" Fibre read from data = " << (fibre.
data() & 0xFF)
333 else edm::LogInfo(
"GCT fibre data error") <<
"Fibre index out of bounds " << fibre;
Global Calorimeter Trigger SC -> CC fibre data word.
virtual void analyze(const edm::Event &, const edm::EventSetup &)
unsigned int m_numConsistentEvents
bool CheckFibreWord(const L1GctFibreWord fibre)
unsigned int m_numZeroEvents
void CheckLogicalID(const L1GctFibreWord fibre)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
edm::InputTag m_fibreSource
bool CheckForBC0(const L1GctFibreWord fibre)
GctFibreAnalyzer(const edm::ParameterSet &)
void CheckCounter(const L1GctFibreWord fibre)
unsigned int m_numInconsistentPayloadEvents