CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCDeadChannelTest.cc
Go to the documentation of this file.
1 /* * \author Anna Cimmino*/
4 
5 // Framework
7 //#include <FWCore/Framework/interface/ESHandle.h>
8 
9 // Geometry
13 
14 #include <sstream>
15 
17 
18  edm::LogVerbatim ("rpcdeadchanneltest") << "[RPCDeadChannelTest]: Constructor";
19 
20  useRollInfo_ = ps.getUntrackedParameter<bool>("UseRollInfo", false);
21 
22  prescaleFactor_ = ps.getUntrackedParameter<int>("DiagnosticPrescale", 1);
23  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 3);
24  numberOfRings_ = ps.getUntrackedParameter<int>("NumberOfEndcapRings", 2);
25 }
26 
28 
29 void RPCDeadChannelTest::beginJob(DQMStore * dbe, std::string workingFolder ){
30  edm::LogVerbatim ("rpcdeadchanneltest") << "[RPCDeadChannelTest]: Begin Job";
31  globalFolder_ = workingFolder;
32  dbe_=dbe;
33 }
34 
36 
37  edm::LogVerbatim ("rpcdeadchanneltest") << "[RPCDeadChannelTest]: End run";
38 
39 }
40 
41 
42 void RPCDeadChannelTest::getMonitorElements(std::vector<MonitorElement *> & meVector, std::vector<RPCDetId> & detIdVector){
43 
44  //Get Occupancy ME for each roll
45 
46  for (unsigned int i = 0 ; i<meVector.size(); i++){
47 
48  bool flag= false;
49 
51  tagList = meVector[i]->getTags();
52  DQMNet::TagList::iterator tagItr = tagList.begin();
53 
54  while (tagItr != tagList.end() && !flag ) {
55  if((*tagItr) == rpcdqm::OCCUPANCY)
56  flag= true;
57 
58  tagItr++;
59  }
60 
61  if(flag){
62  myOccupancyMe_.push_back(meVector[i]);
63  myDetIds_.push_back(detIdVector[i]);
64  }
65  }
66 }
67 
69 
71 
73 
75 
76  edm::LogVerbatim ("rpcdeadchanneltest") <<"[RPCDeadChannelTest]:Client Operation";
77 
78 
79  MonitorElement * DEAD = NULL;
80 
81 
82  //Loop on chambers
83  for (unsigned int i = 0 ; i<myOccupancyMe_.size();i++){
84 
85  RPCDetId & detId = myDetIds_[i];
87 
88  if (! myMe ) continue;
89 
90  const QReport * theOccupancyQReport = myMe->getQReport("DeadChannel_0");
91 
92  float deadFraction = 0.0 ;
93 
94  if(theOccupancyQReport) {
95 
96  float qtresult = theOccupancyQReport->getQTresult();
97  // std::vector<dqm::me_util::Channel> badChannels = theOccupancyQReport->getBadChannels();
98  deadFraction = 1.0 - qtresult;
99 
100  }else{
101  int xBins = myMe->getNbinsX();
102  float emptyBins = 0.0;
103  for(int x = 1 ; x<= xBins ; x++){if(myMe->getBinContent(x) == 0 ) {emptyBins++;}}
104  if (xBins != 0){ deadFraction = emptyBins/xBins;}
105  }
106 
107  if (detId.region()==0) DEAD = DEADWheel[detId.ring() + 2] ;
108  else{
109  if(-detId.station()+ numberOfDisks_ >= 0 ){
110 
111  if(detId.region()<0){
112  DEAD = DEADDisk[-detId.station() + numberOfDisks_];
113  }else{
114  DEAD = DEADDisk[detId.station() + numberOfDisks_-1];
115  }
116  }
117  }
118 
119  if (DEAD){
120  int xBin,yBin;
121  if(detId.region()==0){//Barrel
122  xBin= detId.sector();
123  rpcdqm::utils rollNumber;
124  yBin = rollNumber.detId2RollNr(detId);
125  }else{//Endcap
126  //get segment number
127  RPCGeomServ RPCServ(detId);
128  xBin = RPCServ.segment();
129  (numberOfRings_ == 3 ? yBin= detId.ring()*3-detId.roll()+1 : yBin= (detId.ring()-1)*3-detId.roll()+1);
130  }
131  DEAD->setBinContent(xBin,yBin, deadFraction );
132 
133  }
134 
135  }//End loop on rolls in given chambers
136 
137 }
138 
140 
141  MonitorElement* me;
143 
144  std::stringstream histoName;
145 
146  rpcdqm::utils rpcUtils;
147 
148  int limit = numberOfDisks_;
149  if(numberOfDisks_ < 2) limit = 2;
150 
151  for (int i = -1 * limit; i<= limit;i++ ){//loop on wheels and disks
152  if (i>-3 && i<3){//wheels
153  histoName.str("");
154  histoName<<"DeadChannelFraction_Roll_vs_Sector_Wheel"<<i;
155  me = 0;
156  me = dbe_->get(globalFolder_ +"/"+ histoName.str());
157  if (0!=me ) {
158  dbe_->removeElement(me->getName());
159  }
160  DEADWheel[i+2] = dbe_->book2D(histoName.str().c_str(), histoName.str().c_str(), 12, 0.5, 12.5, 21, 0.5, 21.5);
161 
162  for (int x = 1; x<=12; x++)
163  for(int y=1; y<=21; y++)
164  DEADWheel[i+2]->setBinContent(x,y,-1);
165 
166  rpcUtils.labelXAxisSector( DEADWheel[i+2]);
167  rpcUtils.labelYAxisRoll( DEADWheel[i+2], 0, i, useRollInfo_);
168  }//end wheels
169 
170  if (i == 0 || i > numberOfDisks_ || i< (-1 * numberOfDisks_))continue;
171 
172  int offset = numberOfDisks_;
173  if (i>0) offset --; //used to skip case equale to zero
174 
175  histoName.str("");
176  histoName<<"DeadChannelFraction_Ring_vs_Segment_Disk"<<i;
177  me = 0;
178  me = dbe_->get(globalFolder_ +"/"+ histoName.str());
179  if (0!=me ) {
180  dbe_->removeElement(me->getName());
181  }
182 
183  DEADDisk[i+offset] = dbe_->book2D(histoName.str().c_str(), histoName.str().c_str(),36, 0.5, 36.5, 3*numberOfRings_, 0.5,3*numberOfRings_+ 0.5);
184 
185  rpcUtils.labelXAxisSegment(DEADDisk[i+offset]);
186  rpcUtils.labelYAxisRing(DEADDisk[i+offset], numberOfRings_ ,useRollInfo_);
187 
188 
189  }//end loop on wheels and disks
190 
191 
192 }
193 
195 
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
const QReport * getQReport(const std::string &qtname) const
get QReport corresponding to &lt;qtname&gt; (null pointer if QReport does not exist)
void setBinContent(int binx, double content)
set content of bin (1-D)
long int flag
Definition: mlp_lapack.h:47
void getMonitorElements(std::vector< MonitorElement * > &, std::vector< RPCDetId > &)
MonitorElement * DEADWheel[5]
void labelXAxisSegment(MonitorElement *myMe)
Definition: utils.h:251
void labelYAxisRoll(MonitorElement *myMe, int region, int ring, bool useRollInfo)
Definition: utils.h:269
#define NULL
Definition: scimark2.h:8
void endRun(const edm::Run &, const edm::EventSetup &)
virtual ~RPCDeadChannelTest()
Destructor.
int iEvent
Definition: GenABIO.cc:243
void labelYAxisRing(MonitorElement *myMe, int numberOfRings, bool useRollInfo)
Definition: utils.h:296
int roll() const
Definition: RPCDetId.h:124
int ring() const
Definition: RPCDetId.h:76
void removeElement(const std::string &name)
Definition: DQMStore.cc:2572
unsigned int offset(bool)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
void labelXAxisSector(MonitorElement *myMe)
Definition: utils.h:236
std::vector< MonitorElement * > myOccupancyMe_
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
End Lumi Block.
virtual int segment()
Definition: RPCGeomServ.cc:467
int detId2RollNr(const RPCDetId &_id)
Definition: utils.h:18
std::vector< uint32_t > TagList
Definition: DQMNet.h:83
void beginJob(DQMStore *, std::string)
BeginJob.
std::vector< RPCDetId > myDetIds_
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:106
float getQTresult(void) const
get test result i.e. prob value
Definition: QReport.h:20
double getBinContent(int binx) const
get content of bin (1-D)
void beginRun(const edm::Run &, const edm::EventSetup &)
int getNbinsX(void) const
get # of bins in X-axis
RPCDeadChannelTest(const edm::ParameterSet &ps)
Constructor.
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:845
MonitorElement * DEADDisk[10]
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Begin Lumi block.
void analyze(const edm::Event &, const edm::EventSetup &)
Analyze.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
void clientOperation(edm::EventSetup const &c)
Definition: Run.h:33
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:67
int station() const
Definition: RPCDetId.h:100