CMS 3D CMS Logo

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

#include <RPCOccupancyTest.h>

Inheritance diagram for RPCOccupancyTest:
RPCClient

Public Member Functions

void beginJob (std::string &)
 
void clientOperation ()
 
void getMonitorElements (std::vector< MonitorElement * > &, std::vector< RPCDetId > &, std::string &)
 
void myBooker (DQMStore::IBooker &)
 
 RPCOccupancyTest (const edm::ParameterSet &ps)
 
virtual ~RPCOccupancyTest ()
 
- Public Member Functions inherited from RPCClient
virtual ~RPCClient (void)
 

Protected Member Functions

void fillGlobalME (RPCDetId &, MonitorElement *)
 

Private Attributes

MonitorElementAsyMeDisk [10]
 
MonitorElementAsyMeWheel [5]
 
MonitorElementBarrel_OccBySt
 
MonitorElementEndCap_OccByDisk
 
MonitorElementEndCap_OccByRng
 
std::string globalFolder_
 
std::vector< RPCDetIdmyDetIds_
 
std::vector< MonitorElement * > myOccupancyMe_
 
MonitorElementNormOccupDDisk [10]
 
MonitorElementNormOccupDisk [10]
 
MonitorElementNormOccupDWheel [5]
 
MonitorElementNormOccupWheel [5]
 
int numberOfDisks_
 
int numberOfRings_
 
std::string prefixDir_
 
int prescaleFactor_
 
float rpcevents_
 
bool useNormalization_
 
bool useRollInfo_
 

Detailed Description

Definition at line 15 of file RPCOccupancyTest.h.

Constructor & Destructor Documentation

RPCOccupancyTest::RPCOccupancyTest ( const edm::ParameterSet ps)

Definition at line 12 of file RPCOccupancyTest.cc.

References edm::ParameterSet::getUntrackedParameter(), numberOfDisks_, numberOfRings_, prefixDir_, prescaleFactor_, AlCaHLTBitMon_QueryRunRegistry::string, useNormalization_, and useRollInfo_.

12  {
13  edm::LogVerbatim ("rpceventsummary") << "[RPCOccupancyTest]: Constructor";
14 
15  prescaleFactor_ = ps.getUntrackedParameter<int>("DiagnosticPrescale", 1);
16  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
17  numberOfRings_ = ps.getUntrackedParameter<int>("NumberOfEndcapRings", 2);
18  useNormalization_ = ps.getUntrackedParameter<bool>("testMode", true);
19  useRollInfo_ = ps.getUntrackedParameter<bool>("useRollInfo_", false);
20 
21  std::string subsystemFolder = ps.getUntrackedParameter<std::string>("RPCFolder", "RPC");
22  std::string recHitTypeFolder= ps.getUntrackedParameter<std::string>("RecHitTypeFolder", "AllHits");
23 
24  prefixDir_ = subsystemFolder+ "/"+ recHitTypeFolder;
25 
26 }
T getUntrackedParameter(std::string const &, T const &) const
std::string prefixDir_
RPCOccupancyTest::~RPCOccupancyTest ( )
virtual

Definition at line 28 of file RPCOccupancyTest.cc.

28 {}

Member Function Documentation

void RPCOccupancyTest::beginJob ( std::string &  workingFolder)
virtual

Implements RPCClient.

Definition at line 30 of file RPCOccupancyTest.cc.

References globalFolder_.

30  {
31  edm::LogVerbatim ("rpceventsummary") << "[RPCOccupancyTest]: Begin job ";
32  globalFolder_ = workingFolder;
33 }
std::string globalFolder_
void RPCOccupancyTest::clientOperation ( )
virtual

Implements RPCClient.

Definition at line 49 of file RPCOccupancyTest.cc.

References fillGlobalME(), i, myDetIds_, and myOccupancyMe_.

49  {
50 
51  edm::LogVerbatim ("rpceventsummary") <<"[RPCOccupancyTest]: Client Operation";
52 
53  //Loop on MEs
54  for (unsigned int i = 0 ; i<myOccupancyMe_.size();i++){
56  }//End loop on MEs
57 }
int i
Definition: DBlmapReader.cc:9
std::vector< RPCDetId > myDetIds_
void fillGlobalME(RPCDetId &, MonitorElement *)
std::vector< MonitorElement * > myOccupancyMe_
void RPCOccupancyTest::fillGlobalME ( RPCDetId detId,
MonitorElement myMe 
)
protected

Definition at line 145 of file RPCOccupancyTest.cc.

References AsyMeDisk, AsyMeWheel, Barrel_OccBySt, rpcdqm::utils::detId2RollNr(), EndCap_OccByRng, MonitorElement::Fill(), HcalObjRepresent::Fill(), MonitorElement::getBinContent(), MonitorElement::getEntries(), MonitorElement::getNbinsX(), NormOccupDDisk, NormOccupDisk, NormOccupDWheel, NormOccupWheel, NULL, numberOfDisks_, numberOfRings_, RPCDetId::region(), RPCDetId::ring(), RPCDetId::roll(), rpcevents_, RPCDetId::sector(), RPCGeomServ::segment(), MonitorElement::setBinContent(), RPCDetId::station(), useNormalization_, and cuy::yBin.

Referenced by clientOperation().

145  {
146 
147 
148 if (!myMe) return;
149 
150  MonitorElement * AsyMe=NULL; //Left Right Asymetry
151  MonitorElement * NormOccup=NULL;
152  MonitorElement * NormOccupD=NULL;
153 
154  if(detId.region() ==0){
155  AsyMe= AsyMeWheel[detId.ring()+2];
156  if(useNormalization_){
157  NormOccup=NormOccupWheel[detId.ring()+2];
158  NormOccupD=NormOccupDWheel[detId.ring()+2];
159  }
160 
161  }else{
162 
163  if( -detId.station() + numberOfDisks_ >= 0 ){
164 
165  if(detId.region()<0){
166  AsyMe= AsyMeDisk[-detId.station() + numberOfDisks_];
167  if(useNormalization_){
168  NormOccup=NormOccupDisk[-detId.station() + numberOfDisks_];
169  NormOccupD=NormOccupDDisk[-detId.station() + numberOfDisks_];
170  }
171  }else{
172  AsyMe= AsyMeDisk[detId.station() + numberOfDisks_-1];
173  if(useNormalization_){
174  NormOccup=NormOccupDisk[detId.station() + numberOfDisks_-1];
175  NormOccupD=NormOccupDDisk[detId.station() + numberOfDisks_-1];
176  }
177  }
178  }
179  }
180 
181 
182  int xBin,yBin;
183  if(detId.region()==0){//Barrel
184  xBin= detId.sector();
185  rpcdqm::utils rollNumber;
186  yBin = rollNumber.detId2RollNr(detId);
187  }else{//Endcap
188  //get segment number
189  RPCGeomServ RPCServ(detId);
190  xBin = RPCServ.segment();
191  (numberOfRings_ == 3 ? yBin= detId.ring()*3-detId.roll()+1 : yBin= (detId.ring()-1)*3-detId.roll()+1);
192  }
193 
194 
195  int stripInRoll=myMe->getNbinsX();
196  float FOccupancy=0;
197  float BOccupancy=0;
198 
199  float totEnt = myMe->getEntries();
200  for(int strip = 1 ; strip<=stripInRoll; strip++){
201  if(strip<=stripInRoll/2) FOccupancy+=myMe->getBinContent(strip);
202  else BOccupancy+=myMe->getBinContent(strip);
203  }
204 
205 
206  float asym = 0;
207  if(totEnt != 0 ) asym = fabs((FOccupancy - BOccupancy )/totEnt);
208 
209  if(AsyMe) AsyMe->setBinContent(xBin,yBin,asym);
210 
211 
212 
213  float normoccup = 1;
214  if(rpcevents_ != 0) normoccup = (totEnt/rpcevents_);
215 
216  if(useNormalization_){
217  if(NormOccup) NormOccup->setBinContent(xBin,yBin, normoccup);
218  if(NormOccupD) NormOccupD->Fill(normoccup);
219  }
220 
221 
222  if(detId.region()==0) {
223  if(Barrel_OccBySt)Barrel_OccBySt -> Fill(detId.station(), normoccup);
224  }else if(detId.region()==1) {
225  if(detId.ring()==3) {
226  EndCap_OccByRng -> Fill(1, normoccup);
227  } else {
228  EndCap_OccByRng -> Fill(2, normoccup);
229  }
230  } else {
231  if(detId.ring()==3) {
232  EndCap_OccByRng -> Fill(4, normoccup);
233  }else {
234  EndCap_OccByRng -> Fill(3, normoccup);
235  }
236  }
237 
238 }
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * AsyMeWheel[5]
tuple yBin
Definition: cuy.py:891
MonitorElement * NormOccupDDisk[10]
MonitorElement * EndCap_OccByRng
#define NULL
Definition: scimark2.h:8
double getEntries(void) const
get # of entries
void Fill(long long x)
MonitorElement * NormOccupDWheel[5]
MonitorElement * Barrel_OccBySt
int roll() const
Definition: RPCDetId.h:120
MonitorElement * NormOccupWheel[5]
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int ring() const
Definition: RPCDetId.h:72
MonitorElement * AsyMeDisk[10]
int detId2RollNr(const RPCDetId &_id)
Definition: utils.h:18
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:102
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX(void) const
get # of bins in X-axis
MonitorElement * NormOccupDisk[10]
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
int station() const
Definition: RPCDetId.h:96
void RPCOccupancyTest::getMonitorElements ( std::vector< MonitorElement * > &  meVector,
std::vector< RPCDetId > &  detIdVector,
std::string &  clientHistoName 
)
virtual

Implements RPCClient.

Definition at line 36 of file RPCOccupancyTest.cc.

References i, myDetIds_, myOccupancyMe_, and AlCaHLTBitMon_QueryRunRegistry::string.

36  {
37  //Get NumberOfDigi ME for each roll
38  for(unsigned int i = 0 ; i<meVector.size(); i++){
39 
40  std::string meName = meVector[i]->getName();
41 
42  if(meName.find(clientHistoName) != std::string::npos){
43  myOccupancyMe_.push_back(meVector[i]);
44  myDetIds_.push_back(detIdVector[i]);
45  }
46  }
47 }
int i
Definition: DBlmapReader.cc:9
std::vector< RPCDetId > myDetIds_
std::vector< MonitorElement * > myOccupancyMe_
void RPCOccupancyTest::myBooker ( DQMStore::IBooker ibooker)
virtual

Implements RPCClient.

Definition at line 60 of file RPCOccupancyTest.cc.

References AsyMeDisk, AsyMeWheel, Barrel_OccBySt, DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), ztail::d, EndCap_OccByRng, globalFolder_, rpcdqm::utils::labelXAxisSector(), rpcdqm::utils::labelXAxisSegment(), rpcdqm::utils::labelYAxisRing(), rpcdqm::utils::labelYAxisRoll(), NormOccupDDisk, NormOccupDisk, NormOccupDWheel, NormOccupWheel, numberOfDisks_, numberOfRings_, hltrates_dqm_sourceclient-live_cfg::offset, DQMStore::IBooker::setCurrentFolder(), useNormalization_, useRollInfo_, and w.

60  {
61 
63 
64  std::stringstream histoName;
65  rpcdqm::utils rpcUtils;
66 
67  histoName.str("");
68  histoName<<"Barrel_OccupancyByStations_Normalized";
69 
70  Barrel_OccBySt = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 4, 0.5, 4.5);
71  Barrel_OccBySt -> setBinLabel(1, "St1", 1);
72  Barrel_OccBySt -> setBinLabel(2, "St2", 1);
73  Barrel_OccBySt -> setBinLabel(3, "St3", 1);
74  Barrel_OccBySt -> setBinLabel(4, "St4", 1);
75 
76 
77  histoName.str("");
78  histoName<<"EndCap_OccupancyByRings_Normalized";
79  EndCap_OccByRng = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 4, 0.5, 4.5);
80  EndCap_OccByRng -> setBinLabel(1, "E+/R3", 1);
81  EndCap_OccByRng -> setBinLabel(2, "E+/R2", 1);
82  EndCap_OccByRng -> setBinLabel(3, "E-/R2", 1);
83  EndCap_OccByRng -> setBinLabel(4, "E-/R3", 1);
84 
85  for (int w = -2; w<=2; w++ ){//loop on wheels
86 
87  histoName.str("");
88  histoName<<"AsymmetryLeftRight_Roll_vs_Sector_Wheel"<<w;
89 
90  AsyMeWheel[w+2] = ibooker.book2D(histoName.str().c_str(), histoName.str().c_str(), 12, 0.5, 12.5, 21, 0.5, 21.5);
91 
92  rpcUtils.labelXAxisSector(AsyMeWheel[w+2]);
93  rpcUtils.labelYAxisRoll(AsyMeWheel[w+2], 0, w, useRollInfo_);
94 
95 
97 
98  histoName.str("");
99  histoName<<"OccupancyNormByEvents_Wheel"<<w;
100  NormOccupWheel[w+2] = ibooker.book2D(histoName.str().c_str(), histoName.str().c_str(), 12, 0.5, 12.5, 21, 0.5, 21.5);
101 
102  rpcUtils.labelXAxisSector( NormOccupWheel[w+2]);
103  rpcUtils.labelYAxisRoll( NormOccupWheel[w+2], 0, w, useRollInfo_);
104 
105  histoName.str("");
106  histoName<<"OccupancyNormByEvents_Distribution_Wheel"<<w;
107 
108  NormOccupDWheel[w+2] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 100, 0.0, 0.205);
109  }
110  }//end Barrel
111 
112  for(int d = -numberOfDisks_; d<=numberOfDisks_; d++ ){
113 
114  if (d == 0)continue;
115 
116  int offset = numberOfDisks_;
117  if (d>0) offset --; //used to skip case equale to zero
118 
119  histoName.str("");
120  histoName<<"AsymmetryLeftRight_Ring_vs_Segment_Disk"<<d;
121  AsyMeDisk[d+offset] = ibooker.book2D(histoName.str().c_str(), histoName.str().c_str(), 36, 0.5, 36.5, 3*numberOfRings_, 0.5,3*numberOfRings_+ 0.5);
122 
123  rpcUtils.labelXAxisSegment(AsyMeDisk[d+offset]);
124  rpcUtils.labelYAxisRing(AsyMeDisk[d+offset], numberOfRings_, useRollInfo_);
125 
126 
127 
128  if(useNormalization_){
129 
130  histoName.str("");
131  histoName<<"OccupancyNormByEvents_Disk"<<d;
132  NormOccupDisk[d+offset] = ibooker.book2D(histoName.str().c_str(), histoName.str().c_str(), 36, 0.5, 36.5, 3*numberOfRings_, 0.5,3*numberOfRings_+ 0.5);
133 
134  rpcUtils.labelXAxisSegment(NormOccupDisk[d+offset]);
136 
137  histoName.str("");
138  histoName<<"OccupancyNormByEvents_Distribution_Disk"<<d;
139  NormOccupDDisk[d+offset] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 100, 0.0, 0.205);
140  }
141  }//End loop on Endcap
142 }
MonitorElement * AsyMeWheel[5]
const double w
Definition: UKUtility.cc:23
MonitorElement * NormOccupDDisk[10]
void labelXAxisSegment(MonitorElement *myMe)
Definition: utils.h:250
MonitorElement * EndCap_OccByRng
void labelYAxisRoll(MonitorElement *myMe, int region, int ring, bool useRollInfo)
Definition: utils.h:268
tuple d
Definition: ztail.py:151
MonitorElement * NormOccupDWheel[5]
MonitorElement * Barrel_OccBySt
void labelYAxisRing(MonitorElement *myMe, int numberOfRings, bool useRollInfo)
Definition: utils.h:295
MonitorElement * NormOccupWheel[5]
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
MonitorElement * AsyMeDisk[10]
std::string globalFolder_
void labelXAxisSector(MonitorElement *myMe)
Definition: utils.h:236
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:273
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
MonitorElement * NormOccupDisk[10]

Member Data Documentation

MonitorElement* RPCOccupancyTest::AsyMeDisk[10]
private

Definition at line 48 of file RPCOccupancyTest.h.

Referenced by fillGlobalME(), and myBooker().

MonitorElement* RPCOccupancyTest::AsyMeWheel[5]
private

Definition at line 44 of file RPCOccupancyTest.h.

Referenced by fillGlobalME(), and myBooker().

MonitorElement* RPCOccupancyTest::Barrel_OccBySt
private

Definition at line 52 of file RPCOccupancyTest.h.

Referenced by fillGlobalME(), and myBooker().

MonitorElement* RPCOccupancyTest::EndCap_OccByDisk
private

Definition at line 54 of file RPCOccupancyTest.h.

MonitorElement* RPCOccupancyTest::EndCap_OccByRng
private

Definition at line 53 of file RPCOccupancyTest.h.

Referenced by fillGlobalME(), and myBooker().

std::string RPCOccupancyTest::globalFolder_
private

Definition at line 33 of file RPCOccupancyTest.h.

Referenced by beginJob(), and myBooker().

std::vector<RPCDetId> RPCOccupancyTest::myDetIds_
private

Definition at line 37 of file RPCOccupancyTest.h.

Referenced by clientOperation(), and getMonitorElements().

std::vector<MonitorElement *> RPCOccupancyTest::myOccupancyMe_
private

Definition at line 36 of file RPCOccupancyTest.h.

Referenced by clientOperation(), and getMonitorElements().

MonitorElement* RPCOccupancyTest::NormOccupDDisk[10]
private

Definition at line 50 of file RPCOccupancyTest.h.

Referenced by fillGlobalME(), and myBooker().

MonitorElement* RPCOccupancyTest::NormOccupDisk[10]
private

Definition at line 49 of file RPCOccupancyTest.h.

Referenced by fillGlobalME(), and myBooker().

MonitorElement* RPCOccupancyTest::NormOccupDWheel[5]
private

Definition at line 46 of file RPCOccupancyTest.h.

Referenced by fillGlobalME(), and myBooker().

MonitorElement* RPCOccupancyTest::NormOccupWheel[5]
private

Definition at line 45 of file RPCOccupancyTest.h.

Referenced by fillGlobalME(), and myBooker().

int RPCOccupancyTest::numberOfDisks_
private

Definition at line 40 of file RPCOccupancyTest.h.

Referenced by fillGlobalME(), myBooker(), and RPCOccupancyTest().

int RPCOccupancyTest::numberOfRings_
private

Definition at line 40 of file RPCOccupancyTest.h.

Referenced by fillGlobalME(), myBooker(), and RPCOccupancyTest().

std::string RPCOccupancyTest::prefixDir_
private

Definition at line 33 of file RPCOccupancyTest.h.

Referenced by RPCOccupancyTest().

int RPCOccupancyTest::prescaleFactor_
private

Definition at line 38 of file RPCOccupancyTest.h.

Referenced by RPCOccupancyTest().

float RPCOccupancyTest::rpcevents_
private

Definition at line 42 of file RPCOccupancyTest.h.

Referenced by fillGlobalME().

bool RPCOccupancyTest::useNormalization_
private

Definition at line 34 of file RPCOccupancyTest.h.

Referenced by fillGlobalME(), myBooker(), and RPCOccupancyTest().

bool RPCOccupancyTest::useRollInfo_
private

Definition at line 35 of file RPCOccupancyTest.h.

Referenced by myBooker(), and RPCOccupancyTest().