#include <HLTMuonOverlap.h>
Public Member Functions | |
void | analyze (const edm::Event &event) |
void | begin () |
void | finish () |
HLTMuonOverlap (const edm::ParameterSet &) | |
Private Types | |
typedef std::map< std::string, unsigned int > | trigPath |
Private Attributes | |
std::map< std::string, bool > | fired |
bool | init_ |
unsigned int | Nall_trig |
std::map< std::string, trigPath > | Ncross |
unsigned int | Nevents |
unsigned int | Ntp |
trigPath | Ntrig |
unsigned int | size |
double | theCrossSection |
double | theLuminosity |
edm::InputTag | TrigResLabel_ |
bool | TrigResultsIn |
Definition at line 21 of file HLTMuonOverlap.h.
typedef std::map<std::string, unsigned int> HLTMuonOverlap::trigPath [private] |
Definition at line 36 of file HLTMuonOverlap.h.
HLTMuonOverlap::HLTMuonOverlap | ( | const edm::ParameterSet & | pset | ) |
Definition at line 23 of file HLTMuonOverlap.cc.
References ExpressReco_HICollisions_FallBack::e, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), init_, Nall_trig, Nevents, Ntp, size, theCrossSection, theLuminosity, TrigResLabel_, and TrigResultsIn.
{ TrigResultsIn=true; Ntp = 0; Nall_trig = Nevents = 0; theCrossSection = pset.getParameter<double>("CrossSection"); // Convert it already into /nb/s) theLuminosity = pset.getUntrackedParameter<double>("Luminosity",1.e+32)*1.e-33; TrigResLabel_=pset.getParameter<edm::InputTag>("TriggerResultLabel"); init_=false; size=0; }
void HLTMuonOverlap::analyze | ( | const edm::Event & | event | ) |
Definition at line 43 of file HLTMuonOverlap.cc.
References fired, i, edm::InputTag::instance(), j, edm::InputTag::label(), LogTrace, Nall_trig, AlCaRecoCosmics_cfg::name, Ncross, Nevents, Ntp, Ntrig, size, edm::TriggerNames::triggerNames(), TrigResLabel_, and TrigResultsIn.
{ using namespace edm; if (!TrigResultsIn)return; ++Nevents; Handle<TriggerResults> trigRes; event.getByLabel(TrigResLabel_, trigRes); if (!trigRes.isValid()){ edm::InputTag triggerResultsLabelFU(TrigResLabel_.label(),TrigResLabel_.instance(), "FU"); event.getByLabel(triggerResultsLabelFU,trigRes); if(!trigRes.isValid()) { LogWarning("HLTMuonVal")<< "No trigger Results"; TrigResultsIn=false; // Do nothing return; } } size=trigRes->size(); LogTrace("HLTMuonVal")<< "Ntp="<<Ntp<<" Size of trigger results="<<size; const edm::TriggerNames & triggerNames = event.triggerNames(*trigRes); if(Ntp) assert(Ntp == size); else Ntp = size; // has any trigger fired this event? if(trigRes->accept())++Nall_trig; else return; LogTrace("HLTMuonVal")<<" This event has fired "; // loop over all paths, get trigger decision for(unsigned i = 0; i != size; ++i) { std::string name = triggerNames.triggerName(i); LogTrace("HLTMuonVal") << name << " has decision "<<trigRes->accept(i); fired[name] = trigRes->accept(i); if(fired[name]) ++(Ntrig[name]); } // NOTE: WE SHOULD MAKE THIS A SYMMETRIC MATRIX... // double-loop over all paths, get trigger overlaps for(unsigned i = 0; i != size; ++i) { std::string name = triggerNames.triggerName(i); if(!fired[name])continue; bool correlation = false; for(unsigned j = 0; j != size; ++j) { // skip the same name; // this entry correponds to events triggered by single trigger if(i == j) continue; std::string name2 = triggerNames.triggerName(j); if(fired[name2]) { correlation = true; ++(Ncross[name][name2]); } } // loop over j-trigger paths if(!correlation) // events triggered by single trigger ++(Ncross[name][name]); } // // loop over i-trigger paths }
void HLTMuonOverlap::begin | ( | void | ) |
Definition at line 38 of file HLTMuonOverlap.cc.
{ }
void HLTMuonOverlap::finish | ( | ) |
Definition at line 113 of file HLTMuonOverlap.cc.
References cross(), Nall_trig, Ncross, Nevents, Ntrig, theCrossSection, theLuminosity, and TrigResultsIn.
{ using namespace edm; if (!TrigResultsIn || Nevents == 0 )return; LogVerbatim("HLTMuonVal") << " Total trigger fraction: " << Nall_trig << "/" << Nevents << " events (" << 100*Nall_trig/Nevents<<"%), the Rate="<< Nall_trig*theLuminosity*theCrossSection/Nevents << "Hz "; LogVerbatim("HLTMuonVal") << " Individual path rates: " ; typedef trigPath::iterator It; int ix = 1; for(It it = Ntrig.begin(); it != Ntrig.end(); ++it, ++ix) { LogVerbatim("HLTMuonVal") << " Trigger path \"" << it->first << "\": " << it->second << "/" << Nevents << " events, Rate=" << (it->second)*theLuminosity*theCrossSection/Nevents << "Hz " ; } LogVerbatim("HLTMuonVal") << " Trigger path correlations: " ; typedef std::map<std::string, trigPath>::iterator IIt; ix = 1; for(IIt it = Ncross.begin(); it != Ncross.end(); ++it, ++ix) { // loop over first trigger of pair trigPath & cross = it->second; int iy = 1; for(It it2 = cross.begin(); it2 != cross.end(); ++it2, ++iy) { // loop over second trigger of pair // skip symmetric pairs: 1st pass does "path1", "path2"; // 2nd pass should skip "path2", "path1" if(it->first > it2->first)continue; // if second trigger = first trigger, // this corresponds to unique rate (ie. no correlation) if(it->first == it2->first) LogVerbatim("HLTMuonVal") << " \"" << it->first << "\"" << " (unique rate): "<< it2->second << "/" << Nevents << " events, Rate=" << (it2->second)*theLuminosity*theCrossSection/Nevents << "Hz "; else LogVerbatim("HLTMuonVal") << " \"" << it->first << "\""<< " x \"" << it2->first << "\": "<< it2->second << "/"<< Nevents << " events, Rate=" << (it2->second)*theLuminosity*theCrossSection/Nevents << "Hz "; } } }
std::map<std::string, bool> HLTMuonOverlap::fired [private] |
Definition at line 47 of file HLTMuonOverlap.h.
Referenced by analyze().
bool HLTMuonOverlap::init_ [private] |
Definition at line 38 of file HLTMuonOverlap.h.
Referenced by HLTMuonOverlap().
unsigned int HLTMuonOverlap::Nall_trig [private] |
Definition at line 34 of file HLTMuonOverlap.h.
Referenced by analyze(), finish(), and HLTMuonOverlap().
std::map<std::string, trigPath> HLTMuonOverlap::Ncross [private] |
Definition at line 43 of file HLTMuonOverlap.h.
unsigned int HLTMuonOverlap::Nevents [private] |
Definition at line 35 of file HLTMuonOverlap.h.
Referenced by analyze(), finish(), and HLTMuonOverlap().
unsigned int HLTMuonOverlap::Ntp [private] |
Definition at line 33 of file HLTMuonOverlap.h.
Referenced by analyze(), and HLTMuonOverlap().
trigPath HLTMuonOverlap::Ntrig [private] |
Definition at line 39 of file HLTMuonOverlap.h.
unsigned int HLTMuonOverlap::size [private] |
Definition at line 32 of file HLTMuonOverlap.h.
Referenced by analyze(), and HLTMuonOverlap().
double HLTMuonOverlap::theCrossSection [private] |
Definition at line 37 of file HLTMuonOverlap.h.
Referenced by finish(), and HLTMuonOverlap().
double HLTMuonOverlap::theLuminosity [private] |
Definition at line 37 of file HLTMuonOverlap.h.
Referenced by finish(), and HLTMuonOverlap().
edm::InputTag HLTMuonOverlap::TrigResLabel_ [private] |
Definition at line 31 of file HLTMuonOverlap.h.
Referenced by analyze(), and HLTMuonOverlap().
bool HLTMuonOverlap::TrigResultsIn [private] |
Definition at line 30 of file HLTMuonOverlap.h.
Referenced by analyze(), finish(), and HLTMuonOverlap().