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 edm::EDConsumerBase

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Public Attributes

MonitorElementEfficiencyPerLayer
 
MonitorElementEfficiencyPerRing
 

Private Attributes

DQMStoredbe_
 
std::string globalFolder_
 
int innermostRings_
 
std::string NameFile
 
int numberOfDisks_
 
bool SaveFile
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 29 of file RPCEfficiencyPerRingLayer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 13 of file RPCEfficiencyPerRingLayer.cc.

References edm::ParameterSet::getUntrackedParameter(), globalFolder_, innermostRings_, NameFile, numberOfDisks_, SaveFile, and AlCaHLTBitMon_QueryRunRegistry::string.

13  {
14 
15  globalFolder_ = ps.getUntrackedParameter<std::string>("GlobalFolder", "RPC/RPCEfficiency/");
16  SaveFile = ps.getUntrackedParameter<bool>("SaveFile", false);
17  NameFile = ps.getUntrackedParameter<std::string>("NameFile","RPCEfficiency.root");
18 
19  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
20  innermostRings_ = ps.getUntrackedParameter<int>("NumberOfInnermostEndcapRings", 2);
21 
22 }
RPCEfficiencyPerRingLayer::~RPCEfficiencyPerRingLayer ( )
virtual

Destructor.

Definition at line 25 of file RPCEfficiencyPerRingLayer.cc.

25 { }

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 27 of file RPCEfficiencyPerRingLayer.cc.

27 {}
void RPCEfficiencyPerRingLayer::beginJob ( void  )
virtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 29 of file RPCEfficiencyPerRingLayer.cc.

References dbe_, and cppFunctionSkipper::operator.

void RPCEfficiencyPerRingLayer::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 34 of file RPCEfficiencyPerRingLayer.cc.

References DQMStore::book1D(), dbe_, EfficiencyPerLayer, EfficiencyPerRing, globalFolder_, and DQMStore::setCurrentFolder().

34  {
35 
36  if(dbe_ == 0) return;
37 
39  EfficiencyPerRing = dbe_->book1D("EfficiencyPerRing","Efficiency per Ring",12,0.5,12.5);
40  EfficiencyPerLayer = dbe_->book1D("EfficiencyPerLayer","Efficiency per Layer",6,0.5,6.5);
41 
42 
43 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
void RPCEfficiencyPerRingLayer::endRun ( const edm::Run r,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 45 of file RPCEfficiencyPerRingLayer.cc.

References funct::abs(), dbe_, EfficiencyPerLayer, EfficiencyPerRing, DQMStore::get(), MonitorElement::getBinContent(), MonitorElement::getTH1(), globalFolder_, i, innermostRings_, j, gen::k, NameFile, NULL, numberOfDisks_, DQMStore::save(), SaveFile, MonitorElement::setBinContent(), MonitorElement::setBinError(), MonitorElement::setBinLabel(), and mathSSE::sqrt().

45  {
46 
47  std::stringstream meName1;
48  MonitorElement * myMe1;
49 
50  std::stringstream meName2;
51  MonitorElement * myMe2;
52 
53  std::stringstream binName;
54  binName.str("");
55 
56  meName1.str("");
57  meName1<<globalFolder_;
58 
59  meName2.str("");
60  meName2<<globalFolder_;
61 
62  int k = 0;
63 
64  //EfficiencyPerRing
65 
66  for(int i=(-1*numberOfDisks_ ); i<=numberOfDisks_ ; i++){
67  if(i == 0) continue;
68  for(int j=innermostRings_; j<=3; j++){
69  meName1.str("");
70  meName2.str("");
71  if(i < 0){
72  meName1<<globalFolder_<<"Azimutal/ExGregDistroDm"<<abs(i)<<"R"<<j;
73  meName2<<globalFolder_<<"Azimutal/OcGregDistroDm"<<abs(i)<<"R"<<j;
74  //std::cout<<meName1.str()<<std::endl;
75  //std::cout<<meName2.str()<<std::endl;
76  binName.str("");
77  binName<<"RE-"<<i<<"/"<<j;
78  k++;}
79  else if(i >0){
80  meName1<<globalFolder_<<"Azimutal/ExGregDistroD"<<abs(i)<<"R"<<j;
81  meName2<<globalFolder_<<"Azimutal/OcGregDistroD"<<abs(i)<<"R"<<j;
82  //std::cout<<meName1.str()<<std::endl;
83  //std::cout<<meName2.str()<<std::endl;
84  binName.str("");
85  binName<<"RE+"<<abs(i)<<"/"<<j;
86  k++;}
87 
88  myMe1 = NULL; myMe1 = NULL;
89  myMe1 = dbe_->get(meName1.str());
90  myMe2 = dbe_->get(meName2.str());
91 
92  if(myMe1 && myMe2){
93  TH1 * histo1 = myMe1->getTH1();
94  TH1 * histo2 = myMe2->getTH1();
95 
96  int exg = histo1->Integral();
97  int obg = histo2->Integral();
98  double eff = 0;
99  double err = 0;
100  if(exg != 0){
101  eff = (double)obg/(double)exg;
102  err = sqrt(eff*(1-eff)/(double)exg);}
103 
104  if(k%2 != 0 && k < 7){
105  EfficiencyPerRing->setBinContent(k+1, eff);
106  EfficiencyPerRing->setBinError(k+1, err);
107  EfficiencyPerRing->setBinLabel(k+1, binName.str());}
108  else if(k%2 == 0 && k < 7){
109  EfficiencyPerRing->setBinContent(k-1, eff);
110  EfficiencyPerRing->setBinError(k-1, err);
111  EfficiencyPerRing->setBinLabel(k-1, binName.str());}
112  else if(k >= 7){
115  EfficiencyPerRing->setBinLabel(k, binName.str());}
116  }
117  }
118  }
119 
120  //EfficiencyPerLayer
121 
122  for(int i=1; i<=6; i++){
123 
124  int Exp = 0;
125  int Obs = 0;
126  double eff = 0;
127  double err = 0;
128 
129  for(int j=-2; j<=2; j++){
130  meName1.str("");
131  meName2.str("");
132  if(j < 0){
133  meName1<<globalFolder_<<"BarrelPerLayer/ExpLayerWm"<<abs(j);
134  meName2<<globalFolder_<<"BarrelPerLayer/ObsLayerWm"<<abs(j);}
135  else{
136  meName1<<globalFolder_<<"BarrelPerLayer/ExpLayerW"<<j;
137  meName2<<globalFolder_<<"BarrelPerLayer/ObsLayerW"<<j;}
138  myMe1 = NULL; myMe1 = NULL;
139  myMe1 = dbe_->get(meName1.str());
140  myMe2 = dbe_->get(meName2.str());
141  if(myMe1 && myMe2){
142  Exp += myMe1->getBinContent(i);
143  Obs += myMe2->getBinContent(i);
144  }
145  }
146 
147  if(Exp != 0){
148  eff = (double)Obs/(double)Exp;
149  err = sqrt(eff*(1-eff)/(double)Exp);}
152  binName.str("");
153  binName<<"Layer "<<i;
154  EfficiencyPerLayer->setBinLabel(i, binName.str());
155 
156  }
157 
158  if(SaveFile) dbe_->save(NameFile);
159 
160 }
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
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 NULL
Definition: scimark2.h:8
T sqrt(T t)
Definition: SSEVec.h:48
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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:1708
int k[5][pyjets_maxn]
double getBinContent(int binx) const
get content of bin (1-D)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2540

Member Data Documentation

DQMStore* RPCEfficiencyPerRingLayer::dbe_
private

Definition at line 62 of file RPCEfficiencyPerRingLayer.h.

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

MonitorElement* RPCEfficiencyPerRingLayer::EfficiencyPerLayer

Definition at line 51 of file RPCEfficiencyPerRingLayer.h.

Referenced by beginRun(), and endRun().

MonitorElement* RPCEfficiencyPerRingLayer::EfficiencyPerRing

Definition at line 50 of file RPCEfficiencyPerRingLayer.h.

Referenced by beginRun(), and endRun().

std::string RPCEfficiencyPerRingLayer::globalFolder_
private

Definition at line 64 of file RPCEfficiencyPerRingLayer.h.

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

int RPCEfficiencyPerRingLayer::innermostRings_
private

Definition at line 57 of file RPCEfficiencyPerRingLayer.h.

Referenced by endRun(), and RPCEfficiencyPerRingLayer().

std::string RPCEfficiencyPerRingLayer::NameFile
private

Definition at line 60 of file RPCEfficiencyPerRingLayer.h.

Referenced by endRun(), and RPCEfficiencyPerRingLayer().

int RPCEfficiencyPerRingLayer::numberOfDisks_
private

Definition at line 56 of file RPCEfficiencyPerRingLayer.h.

Referenced by endRun(), and RPCEfficiencyPerRingLayer().

bool RPCEfficiencyPerRingLayer::SaveFile
private

Definition at line 58 of file RPCEfficiencyPerRingLayer.h.

Referenced by endRun(), and RPCEfficiencyPerRingLayer().