CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCEfficiencyShiftHisto.cc
Go to the documentation of this file.
1 //
2 // Original Author: Cesare Calabria,161 R-006,
3 // Created: Tue Jul 20 12:58:43 CEST 2010
4 
5 // Reviewed : Anna Cimmino Tue Aug 16 10:20 2010
6 // $Id: RPCEfficiencyShiftHisto.cc,v 1.2 2011/07/06 09:09:59 cimmino Exp $
7 
8 
9 // user include files
11 #include <sstream>
12 
13 //CondFormats
16 // Framework
22 //DQM Services
24 
26 
27  globalFolder_ = ps.getUntrackedParameter<std::string>("GlobalFolder", "RPC/RPCEfficiency/");
28  effCut_= ps.getUntrackedParameter<int>("EffCut", 90);
29  SaveFile = ps.getUntrackedParameter<bool>("SaveFile", false);
30  NameFile = ps.getUntrackedParameter<std::string>("NameFile","RPCEfficiency.root");
31  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 3);
32 }
33 
34 
36 
38 
40 
42 }
43 
45 
46  if(dbe_ == 0) return;
47 
49  EffBarrelRoll = dbe_->book1D("EffBarrelRoll", "Barrel Efficiency",101,-0.5, 100.5);
50  EffEndcapPlusRoll = dbe_->book1D("EffEndcapPlusRoll", "Endcap + Efficiency",101,-0.5, 100.5);
51  EffEndcapMinusRoll = dbe_->book1D("EffEndcapMinusRoll", "Endcap - Efficiency",101,-0.5, 100.5);
52  RollPercentage = dbe_->book2D("RollPercentage", "RollPercentage",1,0.,1.,3,0.,3.);
53 
54  RollPercentage->setBinLabel(1,"%",1);
55  RollPercentage->setBinLabel(1,"E+",2);
56  RollPercentage->setBinLabel(2,"B",2);
57  RollPercentage->setBinLabel(3,"E-",2);
58 }
59 
61 
62  std::stringstream meName;
63  MonitorElement * myMe;
64 
65  meName.str("");
66  meName<<globalFolder_;
67 
68  //Barrel
69 
70  int entriesBarrel = 0;
71  int entriesBarrelBeyondEff = 0;
72  float percBarrel = 0;
73 
74  for(int w = -2 ; w<3; w++){
75 
76  meName.str("");
77  if(w <= 0) meName<<globalFolder_<<"Efficiency_Roll_vs_Sector_Wheel_"<<w;
78  else meName<<globalFolder_<<"Efficiency_Roll_vs_Sector_Wheel_+"<<w;
79 
80  myMe = dbe_->get(meName.str());
81 
82  if(myMe){
83  for(int s = 1; s <= myMe->getNbinsX(); s++){
84  for(int r = 1;r <= myMe->getNbinsY(); r++){
85 
86  double effBarrel = myMe->getBinContent(s,r);
87 
88  if(effBarrel >= 0){//5
89 
90  if (EffBarrelRoll) EffBarrelRoll->Fill(effBarrel);
91  entriesBarrel++;
92 
93  if(effBarrel >= effCut_) entriesBarrelBeyondEff++;
94  }
95  }
96  }
97  }
98  }
99 
100  if(entriesBarrel != 0){
101  percBarrel = 100*entriesBarrelBeyondEff/entriesBarrel;
102  if(RollPercentage)RollPercentage->setBinContent(1,2,percBarrel);}
103 
104 
105  //EndcapMinus
106 
107  int entriesEndcapMinus = 0;
108  int entriesEndcapMinusBeyondEff = 0;
109  float percEndcapMinus = 0;
110  int entriesEndcapPlus = 0;
111  int entriesEndcapPlusBeyondEff = 0;
112  float percEndcapPlus = 0;
113  for(int d = -numberOfDisks_ ; d <= numberOfDisks_; d++){
114 
115  if(d == 0) continue;
116 
117  meName.str("");
118  meName<<globalFolder_<<"Efficiency_Roll_vs_Segment_Disk_"<<d;
119  myMe = dbe_->get(meName.str());
120 
121 
122  if(myMe){
123 
124  for (int x = 1 ;x <= myMe->getNbinsX();x++){
125  for(int y = 1;y<=myMe->getNbinsY(); y++){
126 
127  double effEndcap = myMe->getBinContent(x,y);
128 
129  if(d<0 ){
130  entriesEndcapMinus++;
132  if(effEndcap >= effCut_) entriesEndcapMinusBeyondEff++;
133  }else {
134  entriesEndcapPlus++;
136  if(effEndcap >= effCut_) entriesEndcapPlusBeyondEff++;
137  }
138  }
139  }
140  }
141  }
142 
143 
144  if(entriesEndcapMinus != 0){
145  percEndcapMinus = 100*entriesEndcapMinusBeyondEff/entriesEndcapMinus;
146  if( RollPercentage) RollPercentage->setBinContent(1,3,percEndcapMinus);}
147 
148 
149  if(entriesEndcapPlus != 0){
150  percEndcapPlus = 100*entriesEndcapPlusBeyondEff/entriesEndcapPlus;
151  if(RollPercentage) RollPercentage->setBinContent(1,1,percEndcapPlus);
152  }
153 
154  if(SaveFile) dbe_->save(NameFile);
155 
156 }
157 
158 
T getUntrackedParameter(std::string const &, T const &) const
void setBinContent(int binx, double content)
set content of bin (1-D)
virtual ~RPCEfficiencyShiftHisto()
Destructor.
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
void endRun(const edm::Run &r, const edm::EventSetup &c)
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:2118
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)
int getNbinsY(void) const
get # of bins in Y-axis
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:243
void beginRun(const edm::Run &r, const edm::EventSetup &c)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
RPCEfficiencyShiftHisto(const edm::ParameterSet &iConfig)
Constructor.
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX(void) const
get # of bins in X-axis
T w() const
Definition: DDAxes.h:10
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:850
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup)
Analyze.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
Definition: Run.h:36