#include <HLTriggerOffline/Muon/interface/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 |
Vander Donckt (starting from Christos analyzeTrigegrResults)
Vander Donckt (copied from J. Alcaraz)
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 e, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), init_, Nall_trig, Nevents, Ntp, size, theCrossSection, theLuminosity, TrigResLabel_, and TrigResultsIn.
00024 { 00025 TrigResultsIn=true; 00026 Ntp = 0; 00027 Nall_trig = Nevents = 0; 00028 theCrossSection = pset.getParameter<double>("CrossSection"); 00029 // Convert it already into /nb/s) 00030 theLuminosity = pset.getUntrackedParameter<double>("Luminosity",1.e+32)*1.e-33; 00031 TrigResLabel_=pset.getParameter<edm::InputTag>("TriggerResultLabel"); 00032 init_=false; 00033 size=0; 00034 }
void HLTMuonOverlap::analyze | ( | const edm::Event & | event | ) |
Definition at line 43 of file HLTMuonOverlap.cc.
References fired, i, j, LogTrace, Nall_trig, name, Ncross, Nevents, Ntp, Ntrig, size, TrigResLabel_, and TrigResultsIn.
Referenced by MuonTriggerRateTimeAnalyzer::analyze().
00043 { 00044 using namespace edm; 00045 00046 if (!TrigResultsIn)return; 00047 ++Nevents; 00048 00049 Handle<TriggerResults> trigRes; 00050 try { 00051 event.getByLabel(TrigResLabel_, trigRes); 00052 } catch (...) { 00053 LogWarning("HLTMuonVal")<< "No trigger Results"; 00054 TrigResultsIn=false; 00055 // Do nothing 00056 return; 00057 } 00058 size=trigRes->size(); 00059 LogTrace("HLTMuonVal")<< "Ntp="<<Ntp<<" Size of trigger results="<<size; 00060 TriggerNames triggerNames(*trigRes); 00061 00062 if(Ntp) 00063 assert(Ntp == size); 00064 else 00065 Ntp = size; 00066 00067 // has any trigger fired this event? 00068 if(trigRes->accept())++Nall_trig; 00069 else return; 00070 LogTrace("HLTMuonVal")<<" This event has fired "; 00071 // loop over all paths, get trigger decision 00072 for(unsigned i = 0; i != size; ++i) 00073 { 00074 std::string name = triggerNames.triggerName(i); 00075 LogTrace("HLTMuonVal") << name << " has decision "<<trigRes->accept(i); 00076 fired[name] = trigRes->accept(i); 00077 if(fired[name]) ++(Ntrig[name]); 00078 } 00079 00080 // NOTE: WE SHOULD MAKE THIS A SYMMETRIC MATRIX... 00081 // double-loop over all paths, get trigger overlaps 00082 for(unsigned i = 0; i != size; ++i) 00083 { 00084 std::string name = triggerNames.triggerName(i); 00085 if(!fired[name])continue; 00086 00087 bool correlation = false; 00088 00089 for(unsigned j = 0; j != size; ++j) 00090 { 00091 // skip the same name; 00092 // this entry correponds to events triggered by single trigger 00093 if(i == j) continue; 00094 std::string name2 = triggerNames.triggerName(j); 00095 if(fired[name2]) 00096 { 00097 correlation = true; 00098 ++(Ncross[name][name2]); 00099 } 00100 } // loop over j-trigger paths 00101 00102 if(!correlation) // events triggered by single trigger 00103 ++(Ncross[name][name]); 00104 00105 } // // loop over i-trigger paths 00106 00107 }
void HLTMuonOverlap::begin | ( | ) |
Definition at line 38 of file HLTMuonOverlap.cc.
Referenced by MuonTriggerRateTimeAnalyzer::beginJob().
void HLTMuonOverlap::finish | ( | ) |
Definition at line 110 of file HLTMuonOverlap.cc.
References it, Nall_trig, Ncross, Nevents, Ntrig, theCrossSection, theLuminosity, and TrigResultsIn.
Referenced by MuonTriggerRateTimeAnalyzer::endJob().
00111 { 00112 using namespace edm; 00113 if (!TrigResultsIn || Nevents == 0 )return; 00114 LogVerbatim("HLTMuonVal") << " Total trigger fraction: " << Nall_trig << "/" << Nevents 00115 << " events (" << 100*Nall_trig/Nevents<<"%), the Rate="<< Nall_trig*theLuminosity*theCrossSection/Nevents << "Hz "; 00116 00117 LogVerbatim("HLTMuonVal") << " Individual path rates: " ; 00118 typedef trigPath::iterator It; 00119 int ix = 1; 00120 for(It it = Ntrig.begin(); 00121 it != Ntrig.end(); ++it, ++ix) 00122 { 00123 LogVerbatim("HLTMuonVal") << " Trigger path \"" << it->first << "\": " 00124 << it->second << "/" 00125 << Nevents << " events, Rate=" << (it->second)*theLuminosity*theCrossSection/Nevents 00126 << "Hz " ; 00127 } 00128 00129 LogVerbatim("HLTMuonVal") << " Trigger path correlations: " ; 00130 typedef std::map<std::string, trigPath>::iterator IIt; 00131 00132 ix = 1; 00133 for(IIt it = Ncross.begin(); 00134 it != Ncross.end(); ++it, ++ix) 00135 { // loop over first trigger of pair 00136 00137 trigPath & cross = it->second; 00138 int iy = 1; 00139 for(It it2 = cross.begin(); 00140 it2 != cross.end(); ++it2, ++iy) 00141 { // loop over second trigger of pair 00142 // skip symmetric pairs: 1st pass does "path1", "path2"; 00143 // 2nd pass should skip "path2", "path1" 00144 if(it->first > it2->first)continue; 00145 00146 // if second trigger = first trigger, 00147 // this corresponds to unique rate (ie. no correlation) 00148 if(it->first == it2->first) 00149 LogVerbatim("HLTMuonVal") << " \"" << it->first << "\"" 00150 << " (unique rate): "<< it2->second << "/" 00151 << Nevents << " events, Rate=" 00152 << (it2->second)*theLuminosity*theCrossSection/Nevents 00153 << "Hz "; 00154 else 00155 LogVerbatim("HLTMuonVal") << " \"" << it->first << "\""<< " x \"" 00156 << it2->first << "\": "<< it2->second 00157 << "/"<< Nevents << " events, Rate=" 00158 << (it2->second)*theLuminosity*theCrossSection/Nevents 00159 << "Hz "; 00160 00161 } 00162 } 00163 00164 }
std::map<std::string, bool> HLTMuonOverlap::fired [private] |
bool HLTMuonOverlap::init_ [private] |
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] |
unsigned int HLTMuonOverlap::Nevents [private] |
Definition at line 35 of file HLTMuonOverlap.h.
Referenced by analyze(), finish(), and HLTMuonOverlap().
unsigned int HLTMuonOverlap::Ntp [private] |
trigPath HLTMuonOverlap::Ntrig [private] |
unsigned int HLTMuonOverlap::size [private] |
double HLTMuonOverlap::theCrossSection [private] |
double HLTMuonOverlap::theLuminosity [private] |
edm::InputTag HLTMuonOverlap::TrigResLabel_ [private] |
bool HLTMuonOverlap::TrigResultsIn [private] |
Definition at line 30 of file HLTMuonOverlap.h.
Referenced by analyze(), finish(), and HLTMuonOverlap().