CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Attributes
RPCEfficiencyPerRingLayer Class Reference

#include <RPCEfficiencyPerRingLayer.h>

Inheritance diagram for RPCEfficiencyPerRingLayer:
edm::EDAnalyzer

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 Analyze. More...
 
void beginJob ()
 BeginJob. More...
 
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. More...
 
virtual ~RPCEfficiencyPerRingLayer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Public Attributes

MonitorElementEfficiencyPerLayer
 
MonitorElementEfficiencyPerRing
 

Private Attributes

DQMStoredbe_
 
std::string globalFolder_
 
std::string NameFile
 
bool SaveFile
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 31 of file RPCEfficiencyPerRingLayer.h.

Constructor & Destructor Documentation

RPCEfficiencyPerRingLayer::RPCEfficiencyPerRingLayer ( const edm::ParameterSet iConfig)

Constructor.

Definition at line 22 of file RPCEfficiencyPerRingLayer.cc.

References edm::ParameterSet::getUntrackedParameter(), globalFolder_, NameFile, and SaveFile.

22  {
23 
24  globalFolder_ = ps.getUntrackedParameter<std::string>("GlobalFolder", "RPC/RPCEfficiency/");
25  SaveFile = ps.getUntrackedParameter<bool>("SaveFile", false);
26  NameFile = ps.getUntrackedParameter<std::string>("NameFile","RPCEfficiency.root");
27 }
RPCEfficiencyPerRingLayer::~RPCEfficiencyPerRingLayer ( )
virtual

Destructor.

Definition at line 30 of file RPCEfficiencyPerRingLayer.cc.

30 { }

Member Function Documentation

void RPCEfficiencyPerRingLayer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 32 of file RPCEfficiencyPerRingLayer.cc.

32 {}
void RPCEfficiencyPerRingLayer::beginJob ( void  )
virtual
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().

39  {
40 
41  if(dbe_ == 0) return;
42 
44  EfficiencyPerRing = dbe_->book1D("EfficiencyPerRing","Efficiency per Ring",12,0.5,12.5);
45  EfficiencyPerLayer = dbe_->book1D("EfficiencyPerLayer","Efficiency per Layer",6,0.5,6.5);
46 
47 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:514
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232
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().

49  {
50 
51  std::stringstream meName1;
52  MonitorElement * myMe1;
53 
54  std::stringstream meName2;
55  MonitorElement * myMe2;
56 
57  std::stringstream binName;
58  binName.str("");
59 
60  meName1.str("");
61  meName1<<globalFolder_;
62 
63  meName2.str("");
64  meName2<<globalFolder_;
65 
66  int k = 0;
67 
68  //EfficiencyPerRing
69 
70  for(int i=-3; i<=3; i++){
71  if(i == 0) continue;
72  for(int j=2; j<=3; j++){
73  meName1.str("");
74  meName2.str("");
75  if(i < 0){
76  meName1<<globalFolder_<<"Azimutal/ExGregDistroDm"<<abs(i)<<"R"<<j;
77  meName2<<globalFolder_<<"Azimutal/OcGregDistroDm"<<abs(i)<<"R"<<j;
78  //std::cout<<meName1.str()<<std::endl;
79  //std::cout<<meName2.str()<<std::endl;
80  binName.str("");
81  binName<<"RE-"<<i<<"/"<<j;
82  k++;}
83  else if(i >0){
84  meName1<<globalFolder_<<"Azimutal/ExGregDistroD"<<abs(i)<<"R"<<j;
85  meName2<<globalFolder_<<"Azimutal/OcGregDistroD"<<abs(i)<<"R"<<j;
86  //std::cout<<meName1.str()<<std::endl;
87  //std::cout<<meName2.str()<<std::endl;
88  binName.str("");
89  binName<<"RE+"<<abs(i)<<"/"<<j;
90  k++;}
91 
92  myMe1 = dbe_->get(meName1.str());
93  myMe2 = dbe_->get(meName2.str());
94  TH1 * histo1 = myMe1->getTH1();
95  TH1 * histo2 = myMe2->getTH1();
96  if(myMe1 && myMe2){
97 
98  int exg = histo1->Integral();
99  int obg = histo2->Integral();
100  double eff = 0;
101  double err = 0;
102  if(exg != 0){
103  eff = (double)obg/(double)exg;
104  err = sqrt(eff*(1-eff)/(double)exg);}
105  //std::cout<<exg<<" "<<obg<<" "<<eff<<" "<<err<<" "<<k<<std::endl;
106  if(k%2 != 0 && k < 7){
107  EfficiencyPerRing->setBinContent(k+1, eff);
108  EfficiencyPerRing->setBinError(k+1, err);
109  EfficiencyPerRing->setBinLabel(k+1, binName.str());}
110  else if(k%2 == 0 && k < 7){
111  EfficiencyPerRing->setBinContent(k-1, eff);
112  EfficiencyPerRing->setBinError(k-1, err);
113  EfficiencyPerRing->setBinLabel(k-1, binName.str());}
114  else if(k >= 7){
117  EfficiencyPerRing->setBinLabel(k, binName.str());}
118  }
119  }
120  }
121 
122  //EfficiencyPerLayer
123 
124  for(int i=1; i<=6; i++){
125 
126  int Exp = 0;
127  int Obs = 0;
128  double eff = 0;
129  double err = 0;
130 
131  for(int j=-2; j<=2; j++){
132  meName1.str("");
133  meName2.str("");
134  if(j < 0){
135  meName1<<globalFolder_<<"BarrelPerLayer/ExpLayerWm"<<abs(j);
136  meName2<<globalFolder_<<"BarrelPerLayer/ObsLayerWm"<<abs(j);}
137  else{
138  meName1<<globalFolder_<<"BarrelPerLayer/ExpLayerW"<<j;
139  meName2<<globalFolder_<<"BarrelPerLayer/ObsLayerW"<<j;}
140  //std::cout<<meName1.str()<<std::endl;
141  //std::cout<<meName2.str()<<std::endl;
142  myMe1 = dbe_->get(meName1.str());
143  myMe2 = dbe_->get(meName2.str());
144  if(myMe1 && myMe2){
145  Exp += myMe1->getBinContent(i);
146  Obs += myMe2->getBinContent(i);
147  }
148  }
149 
150  if(Exp != 0){
151  eff = (double)Obs/(double)Exp;
152  err = sqrt(eff*(1-eff)/(double)Exp);}
155  binName.str("");
156  binName<<"Layer "<<i;
157  EfficiencyPerLayer->setBinLabel(i, binName.str());
158  //std::cout<<Exp<<" "<<Obs<<" "<<eff<<" "<<err<<std::endl;
159  }
160 
161  if(SaveFile) dbe_->save(NameFile);
162 
163 }
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:1898
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
#define abs(x)
Definition: mlp_lapack.h:159
T sqrt(T t)
Definition: SSEVec.h:28
int j
Definition: DBlmapReader.cc:9
TH1 * getTH1(void) const
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1265
int k[5][pyjets_maxn]
double getBinContent(int binx) const
get content of bin (1-D)

Member Data Documentation

DQMStore* RPCEfficiencyPerRingLayer::dbe_
private

Definition at line 61 of file RPCEfficiencyPerRingLayer.h.

Referenced by beginJob(), beginRun(), and endRun().

MonitorElement* RPCEfficiencyPerRingLayer::EfficiencyPerLayer

Definition at line 53 of file RPCEfficiencyPerRingLayer.h.

Referenced by beginRun(), and endRun().

MonitorElement* RPCEfficiencyPerRingLayer::EfficiencyPerRing

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().