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 
7 
8 // user include files
10 #include <sstream>
11 
12 //CondFormats
15 // Framework
21 //DQM Services
23 
25 
26  globalFolder_ = ps.getUntrackedParameter<std::string>("GlobalFolder", "RPC/RPCEfficiency/");
27  effCut_= ps.getUntrackedParameter<int>("EffCut", 90);
28  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
29 }
30 
31 
33 
35 
37 
39 
41  EffBarrelRoll = ibooker.book1D("EffBarrelRoll", "Barrel Efficiency",101,-0.5, 100.5);
42  EffEndcapPlusRoll = ibooker.book1D("EffEndcapPlusRoll", "Endcap + Efficiency",101,-0.5, 100.5);
43  EffEndcapMinusRoll = ibooker.book1D("EffEndcapMinusRoll", "Endcap - Efficiency",101,-0.5, 100.5);
44  RollPercentage = ibooker.book2D("RollPercentage", "RollPercentage",1,0.,1.,3,0.,3.);
45 
46  RollPercentage->setBinLabel(1,"%",1);
47  RollPercentage->setBinLabel(1,"E+",2);
48  RollPercentage->setBinLabel(2,"B",2);
49  RollPercentage->setBinLabel(3,"E-",2);
50 
51 
52  std::stringstream meName;
53  MonitorElement * myMe;
54 
55  meName.str("");
56  meName<<globalFolder_;
57 
58  //Barrel
59 
60  int entriesBarrel = 0;
61  int entriesBarrelBeyondEff = 0;
62  float percBarrel = 0;
63 
64  for(int w = -2 ; w<3; w++){
65 
66  meName.str("");
67  if(w <= 0) meName<<globalFolder_<<"Efficiency_Roll_vs_Sector_Wheel_"<<w;
68  else meName<<globalFolder_<<"Efficiency_Roll_vs_Sector_Wheel_+"<<w;
69 
70  myMe = igetter.get(meName.str());
71 
72  if(myMe){
73  for(int s = 1; s <= myMe->getNbinsX(); s++){
74  for(int r = 1;r <= myMe->getNbinsY(); r++){
75 
76  double effBarrel = myMe->getBinContent(s,r);
77 
78  if(effBarrel >= 0){//5
79 
80  if (EffBarrelRoll) EffBarrelRoll->Fill(effBarrel);
81  entriesBarrel++;
82 
83  if(effBarrel >= effCut_) entriesBarrelBeyondEff++;
84  }
85  }
86  }
87  }
88  }
89 
90  if(entriesBarrel != 0){
91  percBarrel = 100*entriesBarrelBeyondEff/entriesBarrel;
92  if(RollPercentage)RollPercentage->setBinContent(1,2,percBarrel);}
93 
94 
95  //EndcapMinus
96 
97  int entriesEndcapMinus = 0;
98  int entriesEndcapMinusBeyondEff = 0;
99  float percEndcapMinus = 0;
100  int entriesEndcapPlus = 0;
101  int entriesEndcapPlusBeyondEff = 0;
102  float percEndcapPlus = 0;
103  for(int d = -numberOfDisks_ ; d <= numberOfDisks_; d++){
104 
105  if(d == 0) continue;
106 
107  meName.str("");
108  meName<<globalFolder_<<"Efficiency_Roll_vs_Segment_Disk_"<<d;
109  myMe = igetter.get(meName.str());
110 
111 
112  if(myMe){
113 
114  for (int x = 1 ;x <= myMe->getNbinsX();x++){
115  for(int y = 1;y<=myMe->getNbinsY(); y++){
116 
117  double effEndcap = myMe->getBinContent(x,y);
118 
119  if(d<0 ){
120  entriesEndcapMinus++;
122  if(effEndcap >= effCut_) entriesEndcapMinusBeyondEff++;
123  }else {
124  entriesEndcapPlus++;
126  if(effEndcap >= effCut_) entriesEndcapPlusBeyondEff++;
127  }
128  }
129  }
130  }
131  }
132 
133 
134  if(entriesEndcapMinus != 0){
135  percEndcapMinus = 100*entriesEndcapMinusBeyondEff/entriesEndcapMinus;
136  if( RollPercentage) RollPercentage->setBinContent(1,3,percEndcapMinus);}
137 
138 
139  if(entriesEndcapPlus != 0){
140  percEndcapPlus = 100*entriesEndcapPlusBeyondEff/entriesEndcapPlus;
141  if(RollPercentage) RollPercentage->setBinContent(1,1,percEndcapPlus);
142  }
143 
144 
145 }
146 
147 
T getUntrackedParameter(std::string const &, T const &) const
void setBinContent(int binx, double content)
set content of bin (1-D)
virtual ~RPCEfficiencyShiftHisto()
Destructor.
const double w
Definition: UKUtility.cc:23
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:298
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)
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
int getNbinsY(void) const
get # of bins in Y-axis
void Fill(long long x)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
RPCEfficiencyShiftHisto(const edm::ParameterSet &iConfig)
Constructor.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX(void) const
get # of bins in X-axis
Definition: DDAxes.h:10