CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

GctTimingAnalyzer Class Reference

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

Inheritance diagram for GctTimingAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)

Private Attributes

edm::InputTag m_cenJetsSource
bool m_doElectrons
bool m_doESums
bool m_doHFRings
bool m_doInternal
bool m_doJets
unsigned m_evtNum
edm::InputTag m_forJetsSource
edm::InputTag m_gctSource
edm::InputTag m_isoEmSource
edm::InputTag m_nonIsoEmSource
std::ofstream m_outputFile
std::string m_outputFileName
edm::InputTag m_tauJetsSource

Detailed Description

Description: Analyse the timing of all of the GCT pipelines

Definition at line 37 of file GctTimingAnalyzer.h.


Constructor & Destructor Documentation

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

Definition at line 21 of file GctTimingAnalyzer.cc.

References m_outputFile, and m_outputFileName.

                                                                  :
  m_outputFileName(iConfig.getUntrackedParameter<std::string>("outFile", "gctTiming.txt")),
  m_gctSource(iConfig.getUntrackedParameter<edm::InputTag>("gctSource")),
  m_isoEmSource(iConfig.getUntrackedParameter<edm::InputTag>("isoEmSource")),
  m_nonIsoEmSource(iConfig.getUntrackedParameter<edm::InputTag>("nonIsoEmSource")),
  m_cenJetsSource(iConfig.getUntrackedParameter<edm::InputTag>("cenJetsSource")),
  m_forJetsSource(iConfig.getUntrackedParameter<edm::InputTag>("forJetsSource")),
  m_tauJetsSource(iConfig.getUntrackedParameter<edm::InputTag>("tauJetsSource")),
  m_doInternal(iConfig.getUntrackedParameter<bool>("doInternal")),
  m_doElectrons(iConfig.getUntrackedParameter<bool>("doElectrons")),
  m_doJets(iConfig.getUntrackedParameter<bool>("doJets")),
  m_doHFRings(iConfig.getUntrackedParameter<bool>("doHFRings")),
  m_doESums(iConfig.getUntrackedParameter<bool>("doESums")),
  m_evtNum(0)
{
  m_outputFile.open(m_outputFileName.c_str());
}
GctTimingAnalyzer::~GctTimingAnalyzer ( )

Definition at line 39 of file GctTimingAnalyzer.cc.

References m_outputFile.

{
  m_outputFile.close();
}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 44 of file GctTimingAnalyzer.cc.

References alignCSCRings::e, edm::Event::getByLabel(), edm::HandleBase::isValid(), j, m_cenJetsSource, m_doElectrons, m_doESums, m_doHFRings, m_doInternal, m_doJets, m_evtNum, m_forJetsSource, m_gctSource, m_isoEmSource, m_nonIsoEmSource, m_outputFile, m_tauJetsSource, and CaloMET_cfi::met.

{
  using namespace edm;
  using namespace std;
  
  // Electrons
  if(m_doElectrons){

    // Isolated EM cands in GCT output
    Handle<L1GctEmCandCollection> isoEm; 
    iEvent.getByLabel(m_isoEmSource,isoEm);    

    for (L1GctEmCandCollection::const_iterator em=isoEm->begin(); em!=isoEm->end(); em++){
      if (em->rank()>0) {
        m_outputFile << "BX = " << dec << m_evtNum << " " << (*em) << std::endl; 
      }
    }
  
    // Non-Isolated EM cands in GCT output
    Handle<L1GctEmCandCollection> nonIsoEm; 
    iEvent.getByLabel(m_nonIsoEmSource,nonIsoEm);    
    
    for (L1GctEmCandCollection::const_iterator em=nonIsoEm->begin(); em!=nonIsoEm->end(); em++){
      if (em->rank()>0) {
        m_outputFile << "BX = " << dec << m_evtNum << " " << (*em) << std::endl; 
      }
    }

    if (m_doInternal){
      // Internal GCT EM cands
      Handle<L1GctInternEmCandCollection> internEm; 
      iEvent.getByLabel(m_gctSource,internEm);    

      if (internEm.isValid()) {
        for (L1GctInternEmCandCollection::const_iterator em=internEm->begin(); em!=internEm->end(); em++){
          if (em->rank()>0) {
            m_outputFile << "BX = " << dec << m_evtNum << " " << (*em) << std::endl; 
          }
        }
      }
    }

    // RCT EM cands
    Handle<L1CaloEmCollection> rctEm; 
    iEvent.getByLabel(m_gctSource,rctEm);    
    
    for (L1CaloEmCollection::const_iterator em=rctEm->begin(); em!=rctEm->end(); em++){
      if (em->rank()>0) {
        m_outputFile << "BX = " << dec << m_evtNum << " " << (*em) << std::endl; 
      }
    }
  }     
  
  // Jets
  if (m_doJets){

    // Central jet cands in GCT output
    Handle<L1GctJetCandCollection> cenJets; 
    iEvent.getByLabel(m_cenJetsSource,cenJets);    

    for (L1GctJetCandCollection::const_iterator cj=cenJets->begin(); cj!=cenJets->end(); cj++){
      if (cj->rank()>0) {
        m_outputFile << "BX = " << dec << m_evtNum << " " << (*cj) << std::endl; 
      }
    }
    
    // Forward jet cands in GCT output
    Handle<L1GctJetCandCollection> forJets; 
    iEvent.getByLabel(m_forJetsSource,forJets);    
    
    for (L1GctJetCandCollection::const_iterator fj=forJets->begin(); fj!=forJets->end(); fj++){
      if (fj->rank()>0) {
        m_outputFile << "BX = " << dec << m_evtNum << " " << (*fj) << std::endl; 
      }
    }
    
    // Tau jet cands in GCT output
    Handle<L1GctJetCandCollection> tauJets; 
    iEvent.getByLabel(m_tauJetsSource,tauJets);    
    
    for (L1GctJetCandCollection::const_iterator tj=tauJets->begin(); tj!=tauJets->end(); tj++){
      if (tj->rank()>0) {
        m_outputFile << "BX = " << dec << m_evtNum << " " << (*tj) << std::endl; 
      }
    }
  
    if (m_doInternal){

      // Internal GCT jet cands
      Handle<L1GctInternJetDataCollection> internJets; 
      iEvent.getByLabel(m_gctSource,internJets);    
    
      if (internJets.isValid()){
        for (L1GctInternJetDataCollection::const_iterator j=internJets->begin(); j!=internJets->end(); j++){
          if ((j->et()>0) || (j->rank()>0)) {
            m_outputFile << "BX = " << dec << m_evtNum << " " << (*j) << std::endl; 
          }
        }
      }
    }
  }
  
  // RCT regions
  Handle<L1CaloRegionCollection> rctRn; 
  iEvent.getByLabel(m_gctSource,rctRn);    
    
  for (L1CaloRegionCollection::const_iterator rn=rctRn->begin(); rn!=rctRn->end(); rn++){
    if (rn->et()>0) {
      m_outputFile << "BX = " << dec << m_evtNum << " " << (*rn) << std::endl; 
    }
  }

  // HF Rings
  if (m_doHFRings){

    // HFRing counts
    Handle<L1GctHFBitCountsCollection> hfBitCnt;
    iEvent.getByLabel(m_gctSource,hfBitCnt);

    for (L1GctHFBitCountsCollection::const_iterator jc=hfBitCnt->begin(); jc!=hfBitCnt->end(); jc++){
      if (jc->bitCount(0) || jc->bitCount(1) || jc->bitCount(2) || jc->bitCount(3)){
        m_outputFile << "BX = " << dec << m_evtNum << " " << (*jc) << std::endl; 
      }
    }

    // HFRing Et sums
    Handle<L1GctHFRingEtSumsCollection> hfEtSums;
    iEvent.getByLabel(m_gctSource,hfEtSums);

    for (L1GctHFRingEtSumsCollection::const_iterator js=hfEtSums->begin(); js!=hfEtSums->end(); js++){
      if (js->etSum(0) || js->etSum(1) || js->etSum(2) || js->etSum(3)){
        m_outputFile << "BX = " << dec << m_evtNum << " " << (*js) << std::endl; 
      }
    }

    if (m_doInternal){
      // Internal HF data
      Handle<L1GctInternHFDataCollection> internHF;
      iEvent.getByLabel(m_gctSource,internHF);
      
      if (internHF.isValid()){
        for (L1GctInternHFDataCollection::const_iterator hf=internHF->begin(); hf!=internHF->end(); hf++){
          if (hf->value(0) || hf->value(1) || hf->value(2) || hf->value(3)){
            m_outputFile << "BX = " << dec << m_evtNum << " " << (*hf) << std::endl; 
          }
        }
      }
    }    
  }

  // HT, MET and ET
  if (m_doESums){

    // MET
    Handle<L1GctEtMissCollection> missEt;
    iEvent.getByLabel(m_gctSource,missEt);

    for (L1GctEtMissCollection::const_iterator met=missEt->begin(); met!=missEt->end(); met++){
      if (met->et()>0){
        m_outputFile << "BX = " << dec << m_evtNum << " " << (*met) << std::endl; 
      }
    }

    // Total Et
    Handle<L1GctEtTotalCollection> totEt;
    iEvent.getByLabel(m_gctSource,totEt);
    
    for (L1GctEtTotalCollection::const_iterator tet=totEt->begin(); tet!=totEt->end(); tet++){
      if (tet->et()>0){
        m_outputFile << "BX = " << dec << m_evtNum << " " << (*tet) << std::endl; 
      }
    }
    
    // Ht
    Handle<L1GctEtHadCollection> hadEt;
    iEvent.getByLabel(m_gctSource,hadEt);

    for (L1GctEtHadCollection::const_iterator ht=hadEt->begin(); ht!=hadEt->end(); ht++){
      if (ht->et()>0){
        m_outputFile << "BX = " << dec << m_evtNum << " " << (*ht) << std::endl; 
      }
    }

    if (m_doInternal){
      // Internal GCT Et sums
      Handle<L1GctInternEtSumCollection> Et;
      iEvent.getByLabel(m_gctSource,Et);
      
      if (Et.isValid()){
        for (L1GctInternEtSumCollection::const_iterator e=Et->begin(); e!=Et->end(); e++){
          if (e->et()>0){
            m_outputFile << "BX = " << dec << m_evtNum << " " << (*e) << std::endl;
          }
        }
      }
    }    
  }

  m_evtNum++;

}

Member Data Documentation

Definition at line 54 of file GctTimingAnalyzer.h.

Referenced by analyze().

Definition at line 59 of file GctTimingAnalyzer.h.

Referenced by analyze().

Definition at line 62 of file GctTimingAnalyzer.h.

Referenced by analyze().

Definition at line 61 of file GctTimingAnalyzer.h.

Referenced by analyze().

Definition at line 58 of file GctTimingAnalyzer.h.

Referenced by analyze().

Definition at line 60 of file GctTimingAnalyzer.h.

Referenced by analyze().

unsigned GctTimingAnalyzer::m_evtNum [private]

Definition at line 64 of file GctTimingAnalyzer.h.

Referenced by analyze().

Definition at line 55 of file GctTimingAnalyzer.h.

Referenced by analyze().

Definition at line 51 of file GctTimingAnalyzer.h.

Referenced by analyze().

Definition at line 52 of file GctTimingAnalyzer.h.

Referenced by analyze().

Definition at line 53 of file GctTimingAnalyzer.h.

Referenced by analyze().

std::ofstream GctTimingAnalyzer::m_outputFile [private]

Definition at line 49 of file GctTimingAnalyzer.h.

Referenced by analyze(), GctTimingAnalyzer(), and ~GctTimingAnalyzer().

std::string GctTimingAnalyzer::m_outputFileName [private]

Definition at line 48 of file GctTimingAnalyzer.h.

Referenced by GctTimingAnalyzer().

Definition at line 56 of file GctTimingAnalyzer.h.

Referenced by analyze().