CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/HLTrigger/HLTanalyzers/src/EventHeader.cc

Go to the documentation of this file.
00001 #include <iostream>
00002 #include <sstream>
00003 #include <istream>
00004 #include <fstream>
00005 #include <iomanip>
00006 #include <stdlib.h>
00007 #include <string.h>
00008 
00009 #include "HLTrigger/HLTanalyzers/interface/EventHeader.h"
00010 
00011 EventHeader::EventHeader() {
00012 
00013   //set parameter defaults 
00014   _Debug=false;
00015 }
00016 
00017 EventHeader::~EventHeader() {
00018 
00019 }
00020 
00021 /*  Setup the analysis to put the branch-variables into the tree. */
00022 void EventHeader::setup(TTree* HltTree) {
00023 
00024   fRun = -1;
00025   fEvent = -1;
00026   fLumiBlock=-1;
00027   fBx = -1;
00028   fOrbit = -1;
00029 
00030   HltTree->Branch("Run",       &fRun,         "Run/I");
00031   HltTree->Branch("Event",     &fEvent,       "Event/I");
00032   HltTree->Branch("LumiBlock", &fLumiBlock,   "LumiBlock/I"); 
00033   HltTree->Branch("Bx",        &fBx,          "Bx/I"); 
00034   HltTree->Branch("Orbit",     &fOrbit,       "Orbit/I"); 
00035 }
00036 
00037 /* **Analyze the event** */
00038 void EventHeader::analyze(edm::Event const& iEvent, TTree* HltTree) {
00039                                         
00040   fRun          = iEvent.id().run();
00041   fEvent        = iEvent.id().event();
00042   fLumiBlock    = iEvent.luminosityBlock();
00043   fBx           = iEvent.bunchCrossing();
00044   fOrbit        = iEvent.orbitNumber();
00045   
00046   if (_Debug) { 
00047     std::cout << "EventHeader -- run   = "          << fRun       << std::endl;
00048     std::cout << "EventHeader -- event = "          << fEvent     << std::endl;
00049     std::cout << "EventHeader -- lumisection = "    << fLumiBlock << std::endl; 
00050     std::cout << "EventHeader -- bunch crossing = " << fBx        << std::endl; 
00051     std::cout << "EventHeader -- orbit number = "   << fOrbit     << std::endl; 
00052   }
00053 
00054 }