CMS 3D CMS Logo

GctFibreAnalyzer Class Reference

Description: Analyzer individual fibre channels from the source card. More...

#include <L1Trigger/L1GctAnalzyer/src/GctFibreAnalyzer.cc>

Inheritance diagram for GctFibreAnalyzer:

edm::EDAnalyzer

List of all members.

Public Member Functions

 GctFibreAnalyzer (const edm::ParameterSet &)
 ~GctFibreAnalyzer ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
void CheckCounter (const L1GctFibreWord fibre)
bool CheckFibreWord (const L1GctFibreWord fibre)
bool CheckForBC0 (const L1GctFibreWord fibre)
void CheckLogicalID (const L1GctFibreWord fibre)

Private Attributes

bool m_doCounter
bool m_doLogicalID
edm::InputTag m_fibreSource


Detailed Description

Description: Analyzer individual fibre channels from the source card.

Definition at line 33 of file GctFibreAnalyzer.h.


Constructor & Destructor Documentation

GctFibreAnalyzer::GctFibreAnalyzer ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 27 of file GctFibreAnalyzer.cc.

00027                                                                 :
00028   m_fibreSource(iConfig.getUntrackedParameter<edm::InputTag>("FibreSource")),
00029   m_doLogicalID(iConfig.getUntrackedParameter<bool>("doLogicalID")),
00030   m_doCounter(iConfig.getUntrackedParameter<bool>("doCounter"))
00031 {
00032 }

GctFibreAnalyzer::~GctFibreAnalyzer (  ) 

Definition at line 34 of file GctFibreAnalyzer.cc.

00035 {
00036 }


Member Function Documentation

void GctFibreAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 38 of file GctFibreAnalyzer.cc.

References CheckCounter(), CheckFibreWord(), CheckForBC0(), CheckLogicalID(), f, edm::Event::getByLabel(), m_doCounter, m_doLogicalID, and m_fibreSource.

00039 {
00040   using namespace edm;
00041   
00042   Handle<L1GctFibreCollection> fibre;
00043   iEvent.getByLabel(m_fibreSource,fibre);
00044 
00045   bool bc0= false;
00046 
00047   for (L1GctFibreCollection::const_iterator f=fibre->begin(); f!=fibre->end(); f++){
00048 
00049     // Check for corrupt fibre data
00050     if (!CheckFibreWord(*f)){
00051       edm::LogInfo("GCT fibre data error") << "Missing phase bit (clock) in fibre data " << (*f);
00052     }
00053     
00054     // Check for BC0
00055     if (CheckForBC0(*f) && (f==fibre->begin())) {
00056       bc0=true;
00057     }
00058 
00059     // Check for mismatch between fibres
00060     if ((bc0 && !CheckForBC0(*f)) ||
00061         (!bc0 && CheckForBC0(*f))){
00062       edm::LogInfo("GCT fibre data error") << "BC0 mismatch in fibre data " << (*f);
00063     }
00064 
00065     // Check logical ID pattern
00066     if (m_doLogicalID) CheckLogicalID(*f);
00067 
00068     // Check counter pattern
00069     if (m_doCounter) CheckCounter(*f);
00070 
00071   }   
00072 }

void GctFibreAnalyzer::CheckCounter ( const L1GctFibreWord  fibre  )  [private]

Definition at line 164 of file GctFibreAnalyzer.cc.

References L1GctFibreWord::data().

Referenced by analyze().

00165 {
00166   // Remove MSB from both cycles
00167   int cycle0Data, cycle1Data;
00168   
00169   cycle0Data = fibre.data() & 0x20007FFF;
00170   cycle1Data = (fibre.data() >> 16) & 0x20007FFF;
00171 
00172   // Check to see if fibre numbers are consistent
00173   if ((cycle0Data+1)!=cycle1Data){
00174     edm::LogInfo("GCT fibre data error") << "Fibre data not incrementing in cycles 0 and 1 "
00175                                          << " Cycle 0 data=" << cycle0Data
00176                                          << " Cycle 1 data=" << cycle1Data
00177                                          << " " << fibre;      
00178   }  
00179   
00180   // For now just write out the data
00181   edm::LogInfo("GCT fibre counter data") << " Fibre data: cycle0=" << cycle0Data 
00182                                          << " cycle1=" << cycle1Data
00183                                          << " " << fibre;
00184 }

bool GctFibreAnalyzer::CheckFibreWord ( const L1GctFibreWord  fibre  )  [private]

Definition at line 84 of file GctFibreAnalyzer.cc.

References L1GctFibreWord::data().

Referenced by analyze().

00085 {
00086   // Check that the phase or clock bit (MSB bit on cycle 1) is set as it should be
00087   if (fibre.data() & 0x80000000){
00088     return true;
00089   } else {
00090     return false;
00091   }
00092 }

bool GctFibreAnalyzer::CheckForBC0 ( const L1GctFibreWord  fibre  )  [private]

Definition at line 74 of file GctFibreAnalyzer.cc.

References L1GctFibreWord::data().

Referenced by analyze().

00075 {
00076   // Check for BC0 on this event
00077   if (fibre.data() & 0x8000){
00078     return true;
00079   } else {
00080     return false;
00081   }
00082 }

void GctFibreAnalyzer::CheckLogicalID ( const L1GctFibreWord  fibre  )  [private]

Definition at line 94 of file GctFibreAnalyzer.cc.

References L1GctFibreWord::block(), L1GctFibreWord::data(), Exception, and L1GctFibreWord::index().

Referenced by analyze().

00095 {
00096 
00097   // Check that data data in cycle 0 and cycle 1 are equal
00098   if ((fibre.data()&0x7FFF)!=((fibre.data()&0x7FFF0000)>>16)){
00099     edm::LogInfo("GCT fibre data error") << "Fibre data different on cycles 0 and 1 " << fibre;
00100   }
00101 
00102   // Decode the fibre data
00103   int sourceFibreNumber, sourceLogicalID;
00104     
00105   sourceFibreNumber = (fibre.data() & 0x7)-1; 
00106   sourceLogicalID   = (fibre.data() & 0x7F00) >> 8;
00107     
00108   // Calculate logical ID and fibre number from block and index
00109   int concFibreNumber, concRctCrate;
00110 
00111   switch (fibre.block()){
00112     
00113   case 0x89:
00114     concRctCrate = fibre.index()/3;
00115     concFibreNumber = 1+(fibre.index()%3);
00116     break;
00117 
00118   case 0x81:
00119     concRctCrate = 4+(fibre.index()/3);
00120     concFibreNumber = 1+(fibre.index()%3);
00121     break;
00122       
00123   case 0xc9:
00124     concRctCrate = 9+(fibre.index()/3);
00125     concFibreNumber = 1+(fibre.index()%3);
00126     break;
00127       
00128   case 0xc1:
00129     concRctCrate = 13+(fibre.index()/3);
00130     concFibreNumber = 1+(fibre.index()%3);
00131     break;
00132 
00133   default:
00134     throw cms::Exception("Unknown GCT fibre data block ") << fibre.block();    
00135   }
00136     
00137   // Calculate logical ID from crate and fibre number
00138   int concLogicalID;
00139     
00140   if (concRctCrate>=9){
00141     concLogicalID=8*(concRctCrate-9)+4;
00142   } else {
00143     concLogicalID=8*(concRctCrate);
00144   }
00145 
00146   // Check to see if logical IDs are consistent
00147   if (concLogicalID!=sourceLogicalID){
00148     edm::LogInfo("GCT fibre data error") << "Logical IDs are different " 
00149                                          << "Source card logical ID=" << sourceLogicalID
00150                                          << " Conc card logical ID=" << concLogicalID
00151                                          << " " << fibre;      
00152   }
00153 
00154   // Check to see if fibre numbers are consistent
00155   if (concFibreNumber!=sourceFibreNumber){
00156     edm::LogInfo("GCT fibre data error") << "Fibre numbers are different " 
00157                                          << "Source card fibre number=" << sourceFibreNumber
00158                                          << " Conc card fibre number=" << concFibreNumber
00159                                          << " " << fibre;      
00160   }
00161     
00162 }


Member Data Documentation

bool GctFibreAnalyzer::m_doCounter [private]

Definition at line 51 of file GctFibreAnalyzer.h.

Referenced by analyze().

bool GctFibreAnalyzer::m_doLogicalID [private]

Definition at line 50 of file GctFibreAnalyzer.h.

Referenced by analyze().

edm::InputTag GctFibreAnalyzer::m_fibreSource [private]

Definition at line 49 of file GctFibreAnalyzer.h.

Referenced by analyze().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:21:10 2009 for CMSSW by  doxygen 1.5.4