CMS 3D CMS Logo

Public Member Functions | Public Attributes | Static Private Member Functions | Private Attributes

HLTBitAnalyzer Class Reference

#include <HLTBitAnalyzer.h>

Inheritance diagram for HLTBitAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (edm::Event const &e, edm::EventSetup const &iSetup)
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
virtual void endJob ()
 HLTBitAnalyzer (edm::ParameterSet const &conf)

Public Attributes

TTree * HltTree

Static Private Member Functions

static int errMax ()

Private Attributes

double _EtaMax
double _EtaMin
std::string _HistName
bool _UseTFileService
int errCnt
EventHeader evt_header_
 Default analyses.
edm::InputTag gctBitCounts_
edm::InputTag gctRingSums_
edm::InputTag genEventInfo_
edm::InputTag gtObjectMap_
edm::InputTag gtReadoutRecord_
HLTInfo hlt_analysis_
edm::InputTag hltresults_
std::string l1extramc_
std::string l1extramu_
TFile * m_file
edm::InputTag m_l1extraemi
edm::InputTag m_l1extraemn
edm::InputTag m_l1extrajetc
edm::InputTag m_l1extrajetf
edm::InputTag m_l1extramet
edm::InputTag m_l1extramht
edm::InputTag m_l1extramu
edm::InputTag m_l1extrataujet

Detailed Description

$Date: November 2006 $Revision:

Author:
P. Bargassa - Rice U.

Definition at line 32 of file HLTBitAnalyzer.h.


Constructor & Destructor Documentation

HLTBitAnalyzer::HLTBitAnalyzer ( edm::ParameterSet const &  conf) [explicit]

Definition at line 28 of file HLTBitAnalyzer.cc.

References _HistName, _UseTFileService, gather_cfg::cout, errCnt, evt_header_, gctBitCounts_, gctRingSums_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), gtObjectMap_, gtReadoutRecord_, hlt_analysis_, hltresults_, HltTree, l1extramc_, l1extramu_, edm::InputTag::label(), m_file, m_l1extraemi, m_l1extraemn, m_l1extrajetc, m_l1extrajetf, m_l1extramet, m_l1extramht, m_l1extramu, m_l1extrataujet, environment_file_cff::runParameters, EventHeader::setup(), and HLTInfo::setup().

                                                          {

  // If your module takes parameters, here is where you would define
  // their names and types, and access them to initialize internal
  // variables. Example as follows:
  std::cout << " Beginning HLTBitAnalyzer Analysis " << std::endl;

  l1extramu_        = conf.getParameter<std::string>   ("l1extramu");
  m_l1extramu       = edm::InputTag(l1extramu_, "");

  // read the L1Extra collection name, and add the instance names as needed
  l1extramc_        = conf.getParameter<std::string>   ("l1extramc");
  m_l1extraemi      = edm::InputTag(l1extramc_, "Isolated");
  m_l1extraemn      = edm::InputTag(l1extramc_, "NonIsolated");
  m_l1extrajetc     = edm::InputTag(l1extramc_, "Central");
  m_l1extrajetf     = edm::InputTag(l1extramc_, "Forward");
  m_l1extrataujet   = edm::InputTag(l1extramc_, "Tau");
  m_l1extramet      = edm::InputTag(l1extramc_, "MET");
  m_l1extramht      = edm::InputTag(l1extramc_, "MHT");

  hltresults_       = conf.getParameter<edm::InputTag> ("hltresults");
  gtReadoutRecord_  = conf.getParameter<edm::InputTag> ("l1GtReadoutRecord");
  gtObjectMap_      = conf.getParameter<edm::InputTag> ("l1GtObjectMapRecord");

  gctBitCounts_        = edm::InputTag( conf.getParameter<edm::InputTag>("l1GctHFBitCounts").label(), "" );
  gctRingSums_         = edm::InputTag( conf.getParameter<edm::InputTag>("l1GctHFRingSums").label(), "" );

        _UseTFileService = conf.getUntrackedParameter<bool>("UseTFileService",false);
        
  m_file = 0;   // set to null
  errCnt = 0;

  // read run parameters with a default value
  edm::ParameterSet runParameters = conf.getParameter<edm::ParameterSet>("RunParameters");
  _HistName = runParameters.getUntrackedParameter<std::string>("HistogramFile", "test.root");

  // open the tree file and initialize the tree
  if(_UseTFileService){
    edm::Service<TFileService> fs;
    HltTree = fs->make<TTree>("HltTree", "");
  }else{
    m_file = new TFile(_HistName.c_str(), "RECREATE");
    if (m_file)
      m_file->cd();
    HltTree = new TTree("HltTree", "");
  }

  // Setup the different analysis
  hlt_analysis_.setup(conf, HltTree);
  evt_header_.setup(HltTree);
}

Member Function Documentation

void HLTBitAnalyzer::analyze ( edm::Event const &  e,
edm::EventSetup const &  iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 81 of file HLTBitAnalyzer.cc.

References HLTInfo::analyze(), EventHeader::analyze(), errCnt, errMax(), evt_header_, gctBitCounts_, gctRingSums_, getCollection(), gtObjectMap_, gtReadoutRecord_, hlt_analysis_, hltresults_, HltTree, kHltresults, kL1extemi, kL1extemn, kL1extjetc, kL1extjetf, kL1extmet, kL1extmht, kL1extmu, kL1exttaujet, kL1GctBitCounts, kL1GctRingSums, kL1GtOMRec, kL1GtRR, m_file, m_l1extraemi, m_l1extraemn, m_l1extrajetc, m_l1extrajetf, m_l1extramet, m_l1extramht, m_l1extramu, m_l1extrataujet, combine::missing, and dbtoconf::out.

                                                                                {

  edm::Handle<edm::TriggerResults>                  hltresults;
  edm::Handle<l1extra::L1EmParticleCollection>      l1extemi, l1extemn;
  edm::Handle<l1extra::L1MuonParticleCollection>    l1extmu;
  edm::Handle<l1extra::L1JetParticleCollection>     l1extjetc, l1extjetf, l1exttaujet;
  edm::Handle<l1extra::L1EtMissParticleCollection>  l1extmet,l1extmht;
  edm::Handle<L1GlobalTriggerReadoutRecord>         l1GtRR;
  edm::Handle<L1GlobalTriggerObjectMapRecord>       l1GtOMRec;
  edm::Handle<L1GlobalTriggerObjectMap>             l1GtOM;
  edm::Handle< L1GctHFBitCountsCollection >         gctBitCounts ;
  edm::Handle< L1GctHFRingEtSumsCollection >        gctRingSums ;

  // extract the collections from the event, check their validity and log which are missing
  std::vector<MissingCollectionInfo> missing;

  getCollection( iEvent, missing, hltresults,      hltresults_,        kHltresults );
  getCollection( iEvent, missing, l1extemi,        m_l1extraemi,       kL1extemi );
  getCollection( iEvent, missing, l1extemn,        m_l1extraemn,       kL1extemn );
  getCollection( iEvent, missing, l1extmu,         m_l1extramu,        kL1extmu );
  getCollection( iEvent, missing, l1extjetc,       m_l1extrajetc,      kL1extjetc );
  getCollection( iEvent, missing, l1extjetf,       m_l1extrajetf,      kL1extjetf );
  getCollection( iEvent, missing, l1exttaujet,     m_l1extrataujet,    kL1exttaujet );
  getCollection( iEvent, missing, l1extmet,        m_l1extramet,       kL1extmet );
  getCollection( iEvent, missing, l1extmht,        m_l1extramht,       kL1extmht );
  getCollection( iEvent, missing, l1GtRR,          gtReadoutRecord_,   kL1GtRR );
  getCollection( iEvent, missing, l1GtOMRec,       gtObjectMap_,       kL1GtOMRec );
  getCollection( iEvent, missing, gctBitCounts,     gctBitCounts_,      kL1GctBitCounts );
  getCollection( iEvent, missing, gctRingSums,      gctRingSums_,       kL1GctRingSums );


  // print missing collections
  if (not missing.empty() and (errCnt < errMax())) {
    errCnt++;
    std::stringstream out;       
    out <<  "OpenHLT analyser - missing collections:";
    BOOST_FOREACH(const MissingCollectionInfo & entry, missing)
      out << "\n\t" << entry.first << ": " << entry.second->encode();
    edm::LogPrint("OpenHLT") << out.str() << std::endl; 
    if (errCnt == errMax())
      edm::LogWarning("OpenHLT") << "Maximum error count reached -- No more messages will be printed.";
  }

  // run the analysis, passing required event fragments
  hlt_analysis_.analyze(
    hltresults,
    l1extemi,
    l1extemn,
    l1extmu,
    l1extjetc,
    l1extjetf,
    l1exttaujet,
    l1extmet,
    l1extmht,
    l1GtRR,
    gctBitCounts,
    gctRingSums,
    iSetup,
    iEvent,
    HltTree);

  evt_header_.analyze(iEvent, HltTree);

  // std::cout << " Ending Event Analysis" << std::endl;
  // After analysis, fill the variables tree
  if (m_file)
    m_file->cd();
  HltTree->Fill();
}
void HLTBitAnalyzer::beginRun ( edm::Run const &  run,
edm::EventSetup const &  es 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 153 of file HLTBitAnalyzer.cc.

References HLTInfo::beginRun(), and hlt_analysis_.

void HLTBitAnalyzer::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 159 of file HLTBitAnalyzer.cc.

References _UseTFileService, HltTree, and m_file.

                            {
        
        if(!_UseTFileService){
                if (m_file)
                        m_file->cd();
                
                HltTree->Write();
                delete HltTree;
                HltTree = 0;
                
                if (m_file) {         // if there was a tree file...
                        m_file->Write();    // write out the branches
                        delete m_file;      // close and delete the file
                        m_file = 0;         // set to zero to clean up
                }
        }
}
static int HLTBitAnalyzer::errMax ( ) [inline, static, private]

Definition at line 67 of file HLTBitAnalyzer.h.

Referenced by analyze().

{ return 100; }

Member Data Documentation

double HLTBitAnalyzer::_EtaMax [private]

Definition at line 70 of file HLTBitAnalyzer.h.

double HLTBitAnalyzer::_EtaMin [private]

Definition at line 70 of file HLTBitAnalyzer.h.

std::string HLTBitAnalyzer::_HistName [private]

Definition at line 69 of file HLTBitAnalyzer.h.

Referenced by HLTBitAnalyzer().

Definition at line 72 of file HLTBitAnalyzer.h.

Referenced by endJob(), and HLTBitAnalyzer().

int HLTBitAnalyzer::errCnt [private]

Definition at line 66 of file HLTBitAnalyzer.h.

Referenced by analyze(), and HLTBitAnalyzer().

Default analyses.

Definition at line 49 of file HLTBitAnalyzer.h.

Referenced by analyze(), and HLTBitAnalyzer().

Definition at line 64 of file HLTBitAnalyzer.h.

Referenced by analyze(), and HLTBitAnalyzer().

Definition at line 64 of file HLTBitAnalyzer.h.

Referenced by analyze(), and HLTBitAnalyzer().

Definition at line 52 of file HLTBitAnalyzer.h.

Definition at line 63 of file HLTBitAnalyzer.h.

Referenced by analyze(), and HLTBitAnalyzer().

Definition at line 63 of file HLTBitAnalyzer.h.

Referenced by analyze(), and HLTBitAnalyzer().

Definition at line 50 of file HLTBitAnalyzer.h.

Referenced by analyze(), beginRun(), and HLTBitAnalyzer().

Definition at line 52 of file HLTBitAnalyzer.h.

Referenced by analyze(), and HLTBitAnalyzer().

Definition at line 42 of file HLTBitAnalyzer.h.

Referenced by analyze(), endJob(), and HLTBitAnalyzer().

std::string HLTBitAnalyzer::l1extramc_ [private]

Definition at line 53 of file HLTBitAnalyzer.h.

Referenced by HLTBitAnalyzer().

std::string HLTBitAnalyzer::l1extramu_ [private]

Definition at line 53 of file HLTBitAnalyzer.h.

Referenced by HLTBitAnalyzer().

TFile* HLTBitAnalyzer::m_file [private]

Definition at line 71 of file HLTBitAnalyzer.h.

Referenced by analyze(), endJob(), and HLTBitAnalyzer().

Definition at line 55 of file HLTBitAnalyzer.h.

Referenced by analyze(), and HLTBitAnalyzer().

Definition at line 56 of file HLTBitAnalyzer.h.

Referenced by analyze(), and HLTBitAnalyzer().

Definition at line 57 of file HLTBitAnalyzer.h.

Referenced by analyze(), and HLTBitAnalyzer().

Definition at line 58 of file HLTBitAnalyzer.h.

Referenced by analyze(), and HLTBitAnalyzer().

Definition at line 60 of file HLTBitAnalyzer.h.

Referenced by analyze(), and HLTBitAnalyzer().

Definition at line 61 of file HLTBitAnalyzer.h.

Referenced by analyze(), and HLTBitAnalyzer().

Definition at line 54 of file HLTBitAnalyzer.h.

Referenced by analyze(), and HLTBitAnalyzer().

Definition at line 59 of file HLTBitAnalyzer.h.

Referenced by analyze(), and HLTBitAnalyzer().