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  SaveFile = ps.getUntrackedParameter<bool>("SaveFile", false);
29  NameFile = ps.getUntrackedParameter<std::string>("NameFile","RPCEfficiency.root");
30  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
31 }
32 
33 
35 
37 
39 
41 }
42 
44 
45  if(dbe_ == 0) return;
46 
48  EffBarrelRoll = dbe_->book1D("EffBarrelRoll", "Barrel Efficiency",101,-0.5, 100.5);
49  EffEndcapPlusRoll = dbe_->book1D("EffEndcapPlusRoll", "Endcap + Efficiency",101,-0.5, 100.5);
50  EffEndcapMinusRoll = dbe_->book1D("EffEndcapMinusRoll", "Endcap - Efficiency",101,-0.5, 100.5);
51  RollPercentage = dbe_->book2D("RollPercentage", "RollPercentage",1,0.,1.,3,0.,3.);
52 
53  RollPercentage->setBinLabel(1,"%",1);
54  RollPercentage->setBinLabel(1,"E+",2);
55  RollPercentage->setBinLabel(2,"B",2);
56  RollPercentage->setBinLabel(3,"E-",2);
57 }
58 
60 
61  std::stringstream meName;
62  MonitorElement * myMe;
63 
64  meName.str("");
65  meName<<globalFolder_;
66 
67  //Barrel
68 
69  int entriesBarrel = 0;
70  int entriesBarrelBeyondEff = 0;
71  float percBarrel = 0;
72 
73  for(int w = -2 ; w<3; w++){
74 
75  meName.str("");
76  if(w <= 0) meName<<globalFolder_<<"Efficiency_Roll_vs_Sector_Wheel_"<<w;
77  else meName<<globalFolder_<<"Efficiency_Roll_vs_Sector_Wheel_+"<<w;
78 
79  myMe = dbe_->get(meName.str());
80 
81  if(myMe){
82  for(int s = 1; s <= myMe->getNbinsX(); s++){
83  for(int r = 1;r <= myMe->getNbinsY(); r++){
84 
85  double effBarrel = myMe->getBinContent(s,r);
86 
87  if(effBarrel >= 0){//5
88 
89  if (EffBarrelRoll) EffBarrelRoll->Fill(effBarrel);
90  entriesBarrel++;
91 
92  if(effBarrel >= effCut_) entriesBarrelBeyondEff++;
93  }
94  }
95  }
96  }
97  }
98 
99  if(entriesBarrel != 0){
100  percBarrel = 100*entriesBarrelBeyondEff/entriesBarrel;
101  if(RollPercentage)RollPercentage->setBinContent(1,2,percBarrel);}
102 
103 
104  //EndcapMinus
105 
106  int entriesEndcapMinus = 0;
107  int entriesEndcapMinusBeyondEff = 0;
108  float percEndcapMinus = 0;
109  int entriesEndcapPlus = 0;
110  int entriesEndcapPlusBeyondEff = 0;
111  float percEndcapPlus = 0;
112  for(int d = -numberOfDisks_ ; d <= numberOfDisks_; d++){
113 
114  if(d == 0) continue;
115 
116  meName.str("");
117  meName<<globalFolder_<<"Efficiency_Roll_vs_Segment_Disk_"<<d;
118  myMe = dbe_->get(meName.str());
119 
120 
121  if(myMe){
122 
123  for (int x = 1 ;x <= myMe->getNbinsX();x++){
124  for(int y = 1;y<=myMe->getNbinsY(); y++){
125 
126  double effEndcap = myMe->getBinContent(x,y);
127 
128  if(d<0 ){
129  entriesEndcapMinus++;
131  if(effEndcap >= effCut_) entriesEndcapMinusBeyondEff++;
132  }else {
133  entriesEndcapPlus++;
135  if(effEndcap >= effCut_) entriesEndcapPlusBeyondEff++;
136  }
137  }
138  }
139  }
140  }
141 
142 
143  if(entriesEndcapMinus != 0){
144  percEndcapMinus = 100*entriesEndcapMinusBeyondEff/entriesEndcapMinus;
145  if( RollPercentage) RollPercentage->setBinContent(1,3,percEndcapMinus);}
146 
147 
148  if(entriesEndcapPlus != 0){
149  percEndcapPlus = 100*entriesEndcapPlusBeyondEff/entriesEndcapPlus;
150  if(RollPercentage) RollPercentage->setBinContent(1,1,percEndcapPlus);
151  }
152 
153  if(SaveFile) dbe_->save(NameFile);
154 
155 }
156 
157 
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:942
void endRun(const edm::Run &r, const edm::EventSetup &c)
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:230
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:1696
RPCEfficiencyShiftHisto(const edm::ParameterSet &iConfig)
Constructor.
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:2490
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:1070
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup)
Analyze.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
Definition: Run.h:41