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 /*
2  * \author Anna Cimmino
3  */
6 
7 // Framework
10 
11 // Geometry
15 
16 #include <sstream>
17 
19 
20  edm::LogVerbatim ("deadChannel") << "[RPCDeadChannelTest]: Constructor";
21 
22  globalFolder_ = ps.getUntrackedParameter<std::string>("RPCGlobalFolder", "RPC/RecHits/SummaryHistograms");
23  prescaleFactor_ = ps.getUntrackedParameter<int>("DiagnosticPrescale", 1);
24  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 3);
25  numberOfRings_ = ps.getUntrackedParameter<int>("NumberOfEndcapRings", 2);
26 }
27 
29 
31  dbe_=dbe;
32 }
33 
34 void RPCDeadChannelTest::endRun(const edm::Run& r, const edm::EventSetup& iSetup, std::vector<MonitorElement *> meVector, std::vector<RPCDetId> detIdVector){
35 
36  edm::LogVerbatim ("deadChannel") << "[RPCDeadChannelTest]: End run";
37 
38  MonitorElement* me;
40 
41  std::stringstream histoName;
42 
43  rpcdqm::utils rpcUtils;
44 
45  int limit = numberOfDisks_;
46  if(numberOfDisks_ < 2) limit = 2;
47 
48  for (int i = -1 * limit; i<= limit;i++ ){//loop on wheels and disks
49  if (i>-3 && i<3){//wheels
50  histoName.str("");
51  histoName<<"DeadChannelFraction_Roll_vs_Sector_Wheel"<<i;
52  me = 0;
53  me = dbe_->get(globalFolder_ +"/"+ histoName.str());
54  if (0!=me ) {
55  dbe_->removeElement(me->getName());
56  }
57  DEADWheel[i+2] = dbe_->book2D(histoName.str().c_str(), histoName.str().c_str(), 12, 0.5, 12.5, 21, 0.5, 21.5);
58 
59  for (int x = 1; x<=12; x++)
60  for(int y=1; y<=21; y++)
61  DEADWheel[i+2]->setBinContent(x,y,-1);
62 
63  rpcUtils.labelXAxisSector( DEADWheel[i+2]);
64  rpcUtils.labelYAxisRoll( DEADWheel[i+2], 0, i);
65  }//end wheels
66 
67  if (i == 0 || i > numberOfDisks_ || i< (-1 * numberOfDisks_))continue;
68 
69  int offset = numberOfDisks_;
70  if (i>0) offset --; //used to skip case equale to zero
71 
72  histoName.str("");
73  histoName<<"DeadChannelFraction_Ring_vs_Segment_Disk"<<i;
74  me = 0;
75  me = dbe_->get(globalFolder_ +"/"+ histoName.str());
76  if (0!=me ) {
77  dbe_->removeElement(me->getName());
78  }
79 
80  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);
81 
82  rpcUtils.labelXAxisSegment(DEADDisk[i+offset]);
83  rpcUtils.labelYAxisRing(DEADDisk[i+offset], numberOfRings_);
84 
85 
86  }//end loop on wheels and disks
87 
88  //Get Occuoancy ME for each roll
89 
90  for (unsigned int i = 0 ; i<meVector.size(); i++){
91 
92  bool flag= false;
93 
94  DQMNet::TagList tagList;
95  tagList = meVector[i]->getTags();
96  DQMNet::TagList::iterator tagItr = tagList.begin();
97 
98  while (tagItr != tagList.end() && !flag ) {
99  if((*tagItr) == rpcdqm::OCCUPANCY)
100  flag= true;
101 
102  tagItr++;
103  }
104 
105  if(flag){
106  myOccupancyMe_.push_back(meVector[i]);
107  myDetIds_.push_back(detIdVector[i]);
108  }
109  }
110 }
111 
113 
115 
117 
119 
120  edm::LogVerbatim ("deadChannel") <<"[RPCDeadChannelTest]:Client Operation";
121 
122  //Loop on chambers
123  for (unsigned int i = 0 ; i<myOccupancyMe_.size();i++){
125  }//End loop on rolls in given chambers
126 
127 }
128 
130 
132 
133 //
134 //User Defined methods
135 //
137 
139  iSetup.get<MuonGeometryRecord>().get(rpcgeo);
140 
141  const RPCRoll * rpcRoll = rpcgeo->roll(detId);
142 
143  unsigned int nstrips =rpcRoll->nstrips();
144 
145  MonitorElement * DEAD = NULL;
146 
147  const QReport * theOccupancyQReport = myMe->getQReport("DeadChannel_0");
148  if(theOccupancyQReport) {
149 
150  std::vector<dqm::me_util::Channel> badChannels = theOccupancyQReport->getBadChannels();
151 
152  if (detId.region()==0) DEAD = DEADWheel[detId.ring() + 2] ;
153  else{
154  if(-detId.station()+ numberOfDisks_ >= 0 ){
155 
156  if(detId.region()<0){
157  DEAD = DEADDisk[-detId.station() + numberOfDisks_];
158  }else{
159  DEAD = DEADDisk[detId.station() + numberOfDisks_-1];
160  }
161  }
162  }
163 
164  if (DEAD){
165  int xBin,yBin;
166  if(detId.region()==0){//Barrel
167  xBin= detId.sector();
168  rpcdqm::utils rollNumber;
169  yBin = rollNumber.detId2RollNr(detId);
170  }else{//Endcap
171  //get segment number
172  RPCGeomServ RPCServ(detId);
173  xBin = RPCServ.segment();
174  (numberOfRings_ == 3 ? yBin= detId.ring()*3-detId.roll()+1 : yBin= (detId.ring()-1)*3-detId.roll()+1);
175  }
176  DEAD->setBinContent(xBin,yBin, (float)badChannels.size()/nstrips );
177 
178  }
179 
180 
181 
182 
183  }
184 }
185 
186 
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 CalculateDeadChannelPercentage(RPCDetId &, MonitorElement *, edm::EventSetup const &)
MonitorElement * DEADWheel[5]
void beginJob(DQMStore *)
BeginJob.
int nstrips() const
Definition: RPCRoll.cc:46
void labelXAxisSegment(MonitorElement *myMe)
Definition: utils.h:221
#define NULL
Definition: scimark2.h:8
virtual ~RPCDeadChannelTest()
Destructor.
int iEvent
Definition: GenABIO.cc:243
int roll() const
Definition: RPCDetId.h:122
int ring() const
Definition: RPCDetId.h:74
void removeElement(const std::string &name)
Definition: DQMStore.cc:2338
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:1270
void labelXAxisSector(MonitorElement *myMe)
Definition: utils.h:206
std::vector< MonitorElement * > myOccupancyMe_
const std::vector< DQMChannel > & getBadChannels(void) const
Definition: QReport.h:33
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
End Lumi Block.
void endRun(const edm::Run &, const edm::EventSetup &, std::vector< MonitorElement * >, std::vector< RPCDetId >)
virtual int segment()
Definition: RPCGeomServ.cc:375
int detId2RollNr(const RPCDetId &_id)
Definition: utils.h:18
std::vector< uint32_t > TagList
Definition: DQMNet.h:82
const T & get() const
Definition: EventSetup.h:55
std::vector< RPCDetId > myDetIds_
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:104
void labelYAxisRoll(MonitorElement *myMe, int region, int ring)
Definition: utils.h:239
void beginRun(const edm::Run &, const edm::EventSetup &)
RPCDeadChannelTest(const edm::ParameterSet &ps)
Constructor.
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:647
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:237
virtual void clientOperation(edm::EventSetup const &c)
void labelYAxisRing(MonitorElement *myMe, int numberOfRings)
Definition: utils.h:266
Definition: Run.h:31
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:65
int station() const
Definition: RPCDetId.h:98