#include <RPCEfficiencyPerRingLayer.h>
Public Member Functions | |
void | analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) |
Analyze. | |
void | beginJob () |
BeginJob. | |
void | beginRun (const edm::Run &r, const edm::EventSetup &c) |
void | endRun (const edm::Run &r, const edm::EventSetup &c) |
RPCEfficiencyPerRingLayer (const edm::ParameterSet &iConfig) | |
Constructor. | |
virtual | ~RPCEfficiencyPerRingLayer () |
Destructor. | |
Public Attributes | |
MonitorElement * | EfficiencyPerLayer |
MonitorElement * | EfficiencyPerRing |
Private Attributes | |
DQMStore * | dbe_ |
std::string | globalFolder_ |
std::string | NameFile |
bool | SaveFile |
RPCEfficiencyPerRingLayer::RPCEfficiencyPerRingLayer | ( | const edm::ParameterSet & | iConfig | ) |
Constructor.
Definition at line 22 of file RPCEfficiencyPerRingLayer.cc.
References edm::ParameterSet::getUntrackedParameter(), globalFolder_, NameFile, SaveFile, and AlCaHLTBitMon_QueryRunRegistry::string.
{ globalFolder_ = ps.getUntrackedParameter<std::string>("GlobalFolder", "RPC/RPCEfficiency/"); SaveFile = ps.getUntrackedParameter<bool>("SaveFile", false); NameFile = ps.getUntrackedParameter<std::string>("NameFile","RPCEfficiency.root"); }
RPCEfficiencyPerRingLayer::~RPCEfficiencyPerRingLayer | ( | ) | [virtual] |
void RPCEfficiencyPerRingLayer::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
void RPCEfficiencyPerRingLayer::beginJob | ( | void | ) | [virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 34 of file RPCEfficiencyPerRingLayer.cc.
References dbe_, and cppFunctionSkipper::operator.
{ dbe_ = edm::Service<DQMStore>().operator->(); }
void RPCEfficiencyPerRingLayer::beginRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 39 of file RPCEfficiencyPerRingLayer.cc.
References DQMStore::book1D(), dbe_, EfficiencyPerLayer, EfficiencyPerRing, globalFolder_, and DQMStore::setCurrentFolder().
{ if(dbe_ == 0) return; dbe_->setCurrentFolder(globalFolder_); EfficiencyPerRing = dbe_->book1D("EfficiencyPerRing","Efficiency per Ring",12,0.5,12.5); EfficiencyPerLayer = dbe_->book1D("EfficiencyPerLayer","Efficiency per Layer",6,0.5,6.5); }
void RPCEfficiencyPerRingLayer::endRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 49 of file RPCEfficiencyPerRingLayer.cc.
References abs, dbe_, EfficiencyPerLayer, EfficiencyPerRing, DQMStore::get(), MonitorElement::getBinContent(), MonitorElement::getTH1(), globalFolder_, i, j, gen::k, NameFile, DQMStore::save(), SaveFile, MonitorElement::setBinContent(), MonitorElement::setBinError(), MonitorElement::setBinLabel(), and mathSSE::sqrt().
{ std::stringstream meName1; MonitorElement * myMe1; std::stringstream meName2; MonitorElement * myMe2; std::stringstream binName; binName.str(""); meName1.str(""); meName1<<globalFolder_; meName2.str(""); meName2<<globalFolder_; int k = 0; //EfficiencyPerRing for(int i=-3; i<=3; i++){ if(i == 0) continue; for(int j=2; j<=3; j++){ meName1.str(""); meName2.str(""); if(i < 0){ meName1<<globalFolder_<<"Azimutal/ExGregDistroDm"<<abs(i)<<"R"<<j; meName2<<globalFolder_<<"Azimutal/OcGregDistroDm"<<abs(i)<<"R"<<j; //std::cout<<meName1.str()<<std::endl; //std::cout<<meName2.str()<<std::endl; binName.str(""); binName<<"RE-"<<i<<"/"<<j; k++;} else if(i >0){ meName1<<globalFolder_<<"Azimutal/ExGregDistroD"<<abs(i)<<"R"<<j; meName2<<globalFolder_<<"Azimutal/OcGregDistroD"<<abs(i)<<"R"<<j; //std::cout<<meName1.str()<<std::endl; //std::cout<<meName2.str()<<std::endl; binName.str(""); binName<<"RE+"<<abs(i)<<"/"<<j; k++;} myMe1 = dbe_->get(meName1.str()); myMe2 = dbe_->get(meName2.str()); TH1 * histo1 = myMe1->getTH1(); TH1 * histo2 = myMe2->getTH1(); if(myMe1 && myMe2){ int exg = histo1->Integral(); int obg = histo2->Integral(); double eff = 0; double err = 0; if(exg != 0){ eff = (double)obg/(double)exg; err = sqrt(eff*(1-eff)/(double)exg);} //std::cout<<exg<<" "<<obg<<" "<<eff<<" "<<err<<" "<<k<<std::endl; if(k%2 != 0 && k < 7){ EfficiencyPerRing->setBinContent(k+1, eff); EfficiencyPerRing->setBinError(k+1, err); EfficiencyPerRing->setBinLabel(k+1, binName.str());} else if(k%2 == 0 && k < 7){ EfficiencyPerRing->setBinContent(k-1, eff); EfficiencyPerRing->setBinError(k-1, err); EfficiencyPerRing->setBinLabel(k-1, binName.str());} else if(k >= 7){ EfficiencyPerRing->setBinContent(k, eff); EfficiencyPerRing->setBinError(k, err); EfficiencyPerRing->setBinLabel(k, binName.str());} } } } //EfficiencyPerLayer for(int i=1; i<=6; i++){ int Exp = 0; int Obs = 0; double eff = 0; double err = 0; for(int j=-2; j<=2; j++){ meName1.str(""); meName2.str(""); if(j < 0){ meName1<<globalFolder_<<"BarrelPerLayer/ExpLayerWm"<<abs(j); meName2<<globalFolder_<<"BarrelPerLayer/ObsLayerWm"<<abs(j);} else{ meName1<<globalFolder_<<"BarrelPerLayer/ExpLayerW"<<j; meName2<<globalFolder_<<"BarrelPerLayer/ObsLayerW"<<j;} //std::cout<<meName1.str()<<std::endl; //std::cout<<meName2.str()<<std::endl; myMe1 = dbe_->get(meName1.str()); myMe2 = dbe_->get(meName2.str()); if(myMe1 && myMe2){ Exp += myMe1->getBinContent(i); Obs += myMe2->getBinContent(i); } } if(Exp != 0){ eff = (double)Obs/(double)Exp; err = sqrt(eff*(1-eff)/(double)Exp);} EfficiencyPerLayer->setBinContent(i, eff); EfficiencyPerLayer->setBinError(i, err); binName.str(""); binName<<"Layer "<<i; EfficiencyPerLayer->setBinLabel(i, binName.str()); //std::cout<<Exp<<" "<<Obs<<" "<<eff<<" "<<err<<std::endl; } if(SaveFile) dbe_->save(NameFile); }
DQMStore* RPCEfficiencyPerRingLayer::dbe_ [private] |
Definition at line 61 of file RPCEfficiencyPerRingLayer.h.
Referenced by beginJob(), beginRun(), and endRun().
Definition at line 53 of file RPCEfficiencyPerRingLayer.h.
Referenced by beginRun(), and endRun().
Definition at line 52 of file RPCEfficiencyPerRingLayer.h.
Referenced by beginRun(), and endRun().
std::string RPCEfficiencyPerRingLayer::globalFolder_ [private] |
Definition at line 63 of file RPCEfficiencyPerRingLayer.h.
Referenced by beginRun(), endRun(), and RPCEfficiencyPerRingLayer().
std::string RPCEfficiencyPerRingLayer::NameFile [private] |
Definition at line 59 of file RPCEfficiencyPerRingLayer.h.
Referenced by endRun(), and RPCEfficiencyPerRingLayer().
bool RPCEfficiencyPerRingLayer::SaveFile [private] |
Definition at line 57 of file RPCEfficiencyPerRingLayer.h.
Referenced by endRun(), and RPCEfficiencyPerRingLayer().