28 m_fibreSource(iConfig.getUntrackedParameter<edm::InputTag>(
"FibreSource")),
29 m_doLogicalID(iConfig.getUntrackedParameter<bool>(
"doLogicalID")),
30 m_doCounter(iConfig.getUntrackedParameter<bool>(
"doCounter")),
32 m_numInconsistentPayloadEvents(0),
33 m_numConsistentEvents(0)
52 int flag_for_zeroes = 0;
53 int flag_for_inconsistent_events = 0;
54 unsigned int flag_for_consistency = 0;
55 int flag_for_consistent_events = 0;
57 for (L1GctFibreCollection::const_iterator
f=fibre->begin();
f!=fibre->end();
f++){
63 if(
f==fibre->begin()) {flag_for_consistency =
f->data();}
64 else if(flag_for_consistency ==
f->data()){flag_for_consistent_events++;}
69 edm::LogInfo(
"GCT fibre data error") <<
"Missing phase bit (clock) in fibre data " << (*f);
80 edm::LogInfo(
"GCT fibre data error") <<
"BC0 mismatch in fibre data " << (*f);
96 if(flag_for_zeroes == 1) {flag_for_inconsistent_events++;}
109 if (fibre.
data() & 0x8000){
119 if (fibre.
data() & 0x80000000){
129 int cycle0Data, cycle1Data;
131 cycle0Data = fibre.
data() & 0x7FFF;
132 cycle1Data = (fibre.
data() >> 16) & 0x7FFF;
135 if ((cycle0Data+1)!=cycle1Data){
136 edm::LogInfo(
"GCT fibre data error") <<
"Fibre data not incrementing in cycles 0 and 1 "
137 <<
" Cycle 0 data=" << cycle0Data
138 <<
" Cycle 1 data=" << cycle1Data
143 edm::LogInfo(
"GCT fibre counter data") <<
" Fibre data: cycle0=" << cycle0Data
144 <<
" cycle1=" << cycle1Data
152 unsigned ref_jf_link[] = {1,2,3,4,1,2,3,4};
156 unsigned ref_eta0_link[] = {3,4,3,4,3,4};
159 unsigned ref_jf_type[] = {2,2,3,3,1,1,1,1};
162 unsigned ref_eta0_type[] = {2,2,2,2,2,2};
165 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;
168 if ((fibre.
data()&0x7FFF)!=((fibre.
data()&0x7FFF0000)>>16)){
169 edm::LogInfo(
"GCT fibre data error") <<
"Fibre data different on cycles 0 and 1 " << fibre;
175 if((fibre.
block() >> 10) & 0x1 )
183 if(((fibre.
block() >> 8) & 0x7) == 0 || ((fibre.
block() >> 8) & 0x7) == 4)
186 if((fibre.
block() & 0xFF)==0x04) elec_type=1;
187 else if((fibre.
block() & 0xFF)==0x84) elec_type=0;
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 edm::LogInfo(
"GCT fibre data error") <<
"Electron Source Card IDs do not match "
201 <<
"Expected ID = " << source_card_id_expected
202 <<
" ID read from data = " << source_card_id_read
206 if( (fibre.
data() & 0xFF) != (
unsigned int)(2 + fibre.
index()%3))
208 edm::LogInfo(
"GCT fibre data error") <<
"Electron Fibres do not match "
209 <<
"Expected Fibre = " << (2 + fibre.
index()%3)
210 <<
" Fibre read from data = " << (fibre.
data() & 0xFF)
223 if((fibre.
block() & 0xFF)==0x04) jf_type=1;
224 else if((fibre.
block() & 0xFF)==0x0C) jf_type=2;
225 else if((fibre.
block() & 0xFF)==0x84) jf_type=-1;
226 else if((fibre.
block() & 0xFF)==0x8C) jf_type=0;
231 leaf_phi_region = ((fibre.
block() >> 8) & 0x7)-1;
232 if(eta_region == 0) leaf_phi_region--;
233 if(leaf_phi_region <0 || leaf_phi_region >5)
throw cms::Exception(
"Unknown Leaf Card ") << fibre.
block();
243 if(fibre.
index() <=5 )
245 rct_phi_region = ( (8 + ((leaf_phi_region%3)*3) + (fibre.
index() / 2) ) % 9);
253 local_source_card_id = ref_eta0_type[ fibre.
index() ] + (4 + (eta_region * -4));
256 source_card_id_expected = (8 * rct_phi_region) + local_source_card_id;
259 source_card_id_read = (fibre.
data() >> 8) & 0x7F;
261 if(source_card_id_expected != source_card_id_read )
263 edm::LogInfo(
"GCT fibre data error") <<
"ETA0 Source Card IDs do not match "
264 <<
"Expected ID = " << source_card_id_expected
265 <<
" ID read from data = " << source_card_id_read
269 if( (fibre.
data() & 0xFF) != ref_eta0_link[fibre.
index()])
271 edm::LogInfo(
"GCT fibre data error") <<
"ETA0 Fibres do not match "
272 <<
"Expected Fibre = " << ref_eta0_link[fibre.
index()]
273 <<
" Fibre read from data = " << (fibre.
data() & 0xFF)
277 else edm::LogInfo(
"GCT fibre data error") <<
"ETA0 Fibre index out of bounds " << fibre;
284 if(fibre.
index() <=7 )
286 rct_phi_region = ( (8 + ((leaf_phi_region%3)*3) + jf_type ) % 9);
308 local_source_card_id = ref_jf_type[ fibre.
index() ] + (4 * eta_region);
311 if(local_source_card_id == 7) local_source_card_id = 3;
314 source_card_id_expected = (8 * rct_phi_region) + local_source_card_id;
316 source_card_id_read = (fibre.
data() >> 8) & 0x7F;
318 if(source_card_id_expected != source_card_id_read )
320 edm::LogInfo(
"GCT fibre data error") <<
"Source Card IDs do not match "
321 <<
"Expected ID = " << source_card_id_expected
322 <<
" ID read from data = " << source_card_id_read
326 if( (fibre.
data() & 0xFF) != ref_jf_link[fibre.
index()])
328 edm::LogInfo(
"GCT fibre data error") <<
"Fibres do not match "
329 <<
"Expected Fibre = " << ref_jf_link[fibre.
index()]
330 <<
" Fibre read from data = " << (fibre.
data() & 0xFF)
334 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