23 resetMe_(
true), currentRun_(-99)
25 LogDebug(
"HLTMonSimpleBTag") <<
"constructor...." ;
29 LogWarning(
"Status") <<
"unable to get DQMStore service?";
54 std::vector<edm::ParameterSet>
filters =
55 iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"filters");
56 for(std::vector<edm::ParameterSet>::iterator
57 filterconf = filters.begin() ; filterconf != filters.end();
59 std::string me = filterconf->getParameter<std::string>(
"name");
60 std::string denom = filterconf->getParameter<std::string>(
"refname");
69 std::pair<std::string,std::string> trigpair(me,denom);
101 using namespace trigger;
107 if(!triggerObj.isValid()) {
108 edm::LogInfo(
"Status") <<
"Summary HLT object (TriggerEvent) not found, "
115 for (
size_t ia = 0; ia < triggerObj->sizeFilters(); ++ ia) {
116 std::string fullname = triggerObj->filterTag(ia).encode();
120 size_t p = fullname.find_first_of(
':');
121 if ( p != std::string::npos) {
122 name = fullname.substr(0, p);
128 LogDebug(
"Parameter") <<
"filter " << ia <<
", full name = " << fullname
130 <<
", abbreviated = " <<
name ;
140 for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
141 LogDebug(
"Parameters") << name <<
"(" << ki-k.begin() <<
"): pt, eta, phi = "
142 << toc[*ki].pt() <<
", "
143 << toc[*ki].eta() <<
", "
144 << toc[*ki].phi() <<
","
146 pic->getEtHisto()->Fill(toc[*ki].pt());
147 pic->getEtaHisto()->Fill(toc[*ki].
eta());
148 pic->getPhiHisto()->Fill(toc[*ki].
phi());
149 pic->getEtaVsPhiHisto()->Fill(toc[*ki].
eta(), toc[*ki].
phi());
153 for(std::vector<std::pair<std::string, std::string> >::iterator matchIter =
triggerMap_.begin(); matchIter!=
triggerMap_.end(); ++matchIter){
155 if(matchIter->second!=name)
157 LogDebug(
"HLTMonSimpleBTag") <<
"found match! " <<
" " << matchIter->first <<
" " << matchIter->second ;
159 for(
size_t ib = 0; ib < triggerObj->sizeFilters(); ++ ib) {
162 std::string fullname_b = triggerObj->filterTag(ib).encode();
166 size_t p_b = fullname_b.find_first_of(
':');
167 if ( p_b != std::string::npos) {
168 name_b = fullname_b.substr(0, p_b);
174 if(name_b!=matchIter->first)
188 for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
189 for (trigger::Keys::const_iterator ki_b = k_b.begin(); ki_b !=k_b.end(); ++ki_b ) {
194 LogDebug(
"Parameters") <<
"matched pt, eta, phi = "
195 << toc[*ki].pt() <<
", "
196 << toc[*ki].eta() <<
", "
197 << toc[*ki].phi() <<
" to "
198 << toc[*ki_b].pt() <<
", "
199 << toc[*ki_b].eta() <<
", "
200 << toc[*ki_b].phi() <<
" (using the first to fill histo to avoid division problems...)";
202 pic_b->getEtHisto()->Fill(toc[*ki].pt());
203 pic_b->getEtaHisto()->Fill(toc[*ki].
eta());
204 pic_b->getPhiHisto()->Fill(toc[*ki].
phi());
205 pic_b->getEtaVsPhiHisto()->Fill(toc[*ki].
eta(), toc[*ki].
phi());
237 for(PathInfoCollection::iterator
v =
hltPaths_.begin();
240 std::string histoname(
v->getName()+
"_et");
241 std::string
title(
v->getName()+
" E_t");
242 et = dbe->
book1D(histoname.c_str(),
247 histoname =
v->getName()+
"_eta";
248 title =
v->getName()+
" #eta";
249 eta = dbe->
book1D(histoname.c_str(),
252 histoname =
v->getName()+
"_phi";
253 title =
v->getName()+
" #phi";
254 phi = dbe->
book1D(histoname.c_str(),
255 histoname.c_str(),
nBins_/2,-3.14,3.14);
258 histoname =
v->getName()+
"_etaphi";
259 title =
v->getName()+
" #eta vs #phi";
260 etavsphi = dbe->
book2D(histoname.c_str(),
265 v->setHistos( et, eta, phi, etavsphi);
271 std::string histoname(
v->getName()+
"_et");
272 std::string
title(
v->getName()+
" E_t");
273 et = dbe->
book1D(histoname.c_str(),
278 histoname =
v->getName()+
"_eta";
279 title =
v->getName()+
" #eta";
280 eta = dbe->
book1D(histoname.c_str(),
283 histoname =
v->getName()+
"_phi";
284 title =
v->getName()+
" #phi";
285 phi = dbe->
book1D(histoname.c_str(),
286 histoname.c_str(),
nBins_/2,-3.14,3.14);
289 histoname =
v->getName()+
"_etaphi";
290 title =
v->getName()+
" #eta vs #phi";
291 etavsphi = dbe->
book2D(histoname.c_str(),
296 v->setHistos( et, eta, phi, etavsphi);
305 LogInfo(
"Status") <<
"endJob: analyzed " <<
nev_ <<
" events";
313 LogDebug(
"Status") <<
"beginRun, run " << run.
id();
319 LogDebug(
"Status") <<
"final re-calculation efficiencies!" ;
321 LogDebug(
"Status") <<
"endRun, run " << run.
id();
331 for( std::vector<std::pair<std::string,std::string> >::iterator iter =
triggerMap_.begin(); iter!=
triggerMap_.end(); iter++){
337 std::string effname =
makeEffName(iter->first,iter->second);
339 LogDebug(
"HLTMonBTagSlim::calcEff") <<
"calculating efficiencies for histogram with effname=" << effname <<
" using also histogram " << numeratorname ;
346 LogDebug(
"HLTMonBTagSlim::calcEff") <<
"found histo with name " << effname <<
" and " << numeratorname <<
"!" ;
352 doEffCalc(effHists->getEtaVsPhiHisto(),numerHists->getEtaVsPhiHisto(),
hltPaths_.
find(iter->second)->getEtaVsPhiHisto());
356 LogDebug(
"HLTMonBTagSlim::calcEff") <<
"done with efficiencies!" ;
362 double x,
y,errx,erry;
382 if(fabs(y)<0.00001 || fabs(x)<0.0001){
388 LogDebug(
"HLTMonSimpleBTag::calcEff()") << eff->
getName() <<
" (" << ibin <<
") " << x <<
" " <<
y;
390 eff->
setBinError(ibin,
sqrt((errx*errx)/(x*x)+(erry*erry)/(y*y))* (x/y)*(1-(x/y)));
393 for(
int jbin=0; jbin<=num->
getNbinsY(); jbin++){
398 if(fabs(y)<0.0001 || fabs(x)<0.0001){
403 LogDebug(
"HLTMonSimpleBTag::calcEff()") << eff->
getName() <<
" (" << ibin<<
"," << jbin <<
") " << x <<
" " <<
y ;
406 eff->
setBinError(ibin,jbin,
sqrt((errx*errx)/(x*x)+(erry*erry)/(y*y))* (x/y)*(1-(x/y)));
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
void setBinContent(int binx, double content)
set content of bin (1-D)
static const uint32_t DQM_PROP_TYPE_TH1S
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
void rmdir(const std::string &fullpath)
static const uint32_t DQM_PROP_TYPE_TH2D
std::vector< PathInfo >::iterator find(std::string pathName)
std::vector< std::pair< std::string, std::string > > triggerMap_
void beginRun(const edm::Run &run, const edm::EventSetup &c)
static const uint32_t DQM_PROP_TYPE_TH1F
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< TPRegexp > filters
edm::InputTag triggerSummaryLabel_
int getNbinsY(void) const
get # of bins in Y-axis
double deltaR(double eta1, double phi1, double eta2, double phi2)
PathInfoCollection hltEfficiencies_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
void setVerbose(unsigned level)
Kind kind(void) const
Get the type of the monitor element.
static const uint32_t DQM_PROP_TYPE_TH1D
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
HLTMonSimpleBTag(const edm::ParameterSet &)
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
std::vector< size_type > Keys
std::string makeEffNumeratorName(std::string trig1, std::string trig2)
PathInfoCollection hltPaths_
double getBinContent(int binx) const
get content of bin (1-D)
static const uint32_t DQM_PROP_TYPE_TH2S
int getNbinsX(void) const
get # of bins in X-axis
void doEffCalc(MonitorElement *eff, MonitorElement *num, MonitorElement *denom)
void endRun(const edm::Run &run, const edm::EventSetup &c)
EndRun.
void calcEff(void)
calcEff: calculates efficiency using histograms booked in std::map<std::string,std::string> triggerMa...
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
void setCurrentFolder(const std::string &fullpath)
std::string makeEffName(std::string trig1, std::string trig2)
static const uint32_t DQM_PROP_TYPE_TH2F