Go to the documentation of this file.00001
00002
00003
00004 #include "DQM/RPCMonitorDigi/interface/utils.h"
00005 #include <DQM/RPCMonitorClient/interface/RPCDeadChannelTest.h>
00006
00007
00008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00009 #include <FWCore/Framework/interface/ESHandle.h>
00010
00011
00012 #include "Geometry/RPCGeometry/interface/RPCGeomServ.h"
00013 #include "Geometry/RPCGeometry/interface/RPCGeometry.h"
00014 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00015
00016 #include <sstream>
00017
00018 RPCDeadChannelTest::RPCDeadChannelTest(const edm::ParameterSet& ps ){
00019
00020 edm::LogVerbatim ("deadChannel") << "[RPCDeadChannelTest]: Constructor";
00021
00022 globalFolder_ = ps.getUntrackedParameter<std::string>("RPCGlobalFolder", "RPC/RecHits/SummaryHistograms");
00023 prescaleFactor_ = ps.getUntrackedParameter<int>("DiagnosticPrescale", 1);
00024 numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 3);
00025 numberOfRings_ = ps.getUntrackedParameter<int>("NumberOfEndcapRings", 2);
00026 }
00027
00028 RPCDeadChannelTest::~RPCDeadChannelTest(){dbe_ = 0;}
00029
00030 void RPCDeadChannelTest::beginJob(DQMStore * dbe ){
00031 dbe_=dbe;
00032 }
00033
00034 void RPCDeadChannelTest::endRun(const edm::Run& r, const edm::EventSetup& iSetup, std::vector<MonitorElement *> meVector, std::vector<RPCDetId> detIdVector){
00035
00036 edm::LogVerbatim ("deadChannel") << "[RPCDeadChannelTest]: End run";
00037
00038 MonitorElement* me;
00039 dbe_->setCurrentFolder( globalFolder_);
00040
00041 std::stringstream histoName;
00042
00043 rpcdqm::utils rpcUtils;
00044
00045 int limit = numberOfDisks_;
00046 if(numberOfDisks_ < 2) limit = 2;
00047
00048 for (int i = -1 * limit; i<= limit;i++ ){
00049 if (i>-3 && i<3){
00050 histoName.str("");
00051 histoName<<"DeadChannelFraction_Roll_vs_Sector_Wheel"<<i;
00052 me = 0;
00053 me = dbe_->get(globalFolder_ +"/"+ histoName.str());
00054 if (0!=me ) {
00055 dbe_->removeElement(me->getName());
00056 }
00057 DEADWheel[i+2] = dbe_->book2D(histoName.str().c_str(), histoName.str().c_str(), 12, 0.5, 12.5, 21, 0.5, 21.5);
00058
00059 for (int x = 1; x<=12; x++)
00060 for(int y=1; y<=21; y++)
00061 DEADWheel[i+2]->setBinContent(x,y,-1);
00062
00063 rpcUtils.labelXAxisSector( DEADWheel[i+2]);
00064 rpcUtils.labelYAxisRoll( DEADWheel[i+2], 0, i);
00065 }
00066
00067 if (i == 0 || i > numberOfDisks_ || i< (-1 * numberOfDisks_))continue;
00068
00069 int offset = numberOfDisks_;
00070 if (i>0) offset --;
00071
00072 histoName.str("");
00073 histoName<<"DeadChannelFraction_Ring_vs_Segment_Disk"<<i;
00074 me = 0;
00075 me = dbe_->get(globalFolder_ +"/"+ histoName.str());
00076 if (0!=me ) {
00077 dbe_->removeElement(me->getName());
00078 }
00079
00080 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);
00081
00082 rpcUtils.labelXAxisSegment(DEADDisk[i+offset]);
00083 rpcUtils.labelYAxisRing(DEADDisk[i+offset], numberOfRings_);
00084
00085
00086 }
00087
00088
00089
00090 for (unsigned int i = 0 ; i<meVector.size(); i++){
00091
00092 bool flag= false;
00093
00094 DQMNet::TagList tagList;
00095 tagList = meVector[i]->getTags();
00096 DQMNet::TagList::iterator tagItr = tagList.begin();
00097
00098 while (tagItr != tagList.end() && !flag ) {
00099 if((*tagItr) == rpcdqm::OCCUPANCY)
00100 flag= true;
00101
00102 tagItr++;
00103 }
00104
00105 if(flag){
00106 myOccupancyMe_.push_back(meVector[i]);
00107 myDetIds_.push_back(detIdVector[i]);
00108 }
00109 }
00110 }
00111
00112 void RPCDeadChannelTest::beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& context) {}
00113
00114 void RPCDeadChannelTest::analyze(const edm::Event& iEvent, const edm::EventSetup& c){}
00115
00116 void RPCDeadChannelTest::endLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& iSetup){}
00117
00118 void RPCDeadChannelTest::clientOperation( edm::EventSetup const& iSetup){
00119
00120 edm::LogVerbatim ("deadChannel") <<"[RPCDeadChannelTest]:Client Operation";
00121
00122
00123 for (unsigned int i = 0 ; i<myOccupancyMe_.size();i++){
00124 this->CalculateDeadChannelPercentage(myDetIds_[i],myOccupancyMe_[i],iSetup);
00125 }
00126
00127 }
00128
00129 void RPCDeadChannelTest::beginRun(const edm::Run& r, const edm::EventSetup& c){}
00130
00131 void RPCDeadChannelTest::endJob(){}
00132
00133
00134
00135
00136 void RPCDeadChannelTest::CalculateDeadChannelPercentage(RPCDetId & detId, MonitorElement * myMe, edm::EventSetup const& iSetup){
00137
00138 edm::ESHandle<RPCGeometry> rpcgeo;
00139 iSetup.get<MuonGeometryRecord>().get(rpcgeo);
00140
00141 const RPCRoll * rpcRoll = rpcgeo->roll(detId);
00142
00143 unsigned int nstrips =rpcRoll->nstrips();
00144
00145 MonitorElement * DEAD = NULL;
00146
00147 const QReport * theOccupancyQReport = myMe->getQReport("DeadChannel_0");
00148 if(theOccupancyQReport) {
00149
00150 std::vector<dqm::me_util::Channel> badChannels = theOccupancyQReport->getBadChannels();
00151
00152 if (detId.region()==0) DEAD = DEADWheel[detId.ring() + 2] ;
00153 else{
00154 if(-detId.station()+ numberOfDisks_ >= 0 ){
00155
00156 if(detId.region()<0){
00157 DEAD = DEADDisk[-detId.station() + numberOfDisks_];
00158 }else{
00159 DEAD = DEADDisk[detId.station() + numberOfDisks_-1];
00160 }
00161 }
00162 }
00163
00164 if (DEAD){
00165 int xBin,yBin;
00166 if(detId.region()==0){
00167 xBin= detId.sector();
00168 rpcdqm::utils rollNumber;
00169 yBin = rollNumber.detId2RollNr(detId);
00170 }else{
00171
00172 RPCGeomServ RPCServ(detId);
00173 xBin = RPCServ.segment();
00174 (numberOfRings_ == 3 ? yBin= detId.ring()*3-detId.roll()+1 : yBin= (detId.ring()-1)*3-detId.roll()+1);
00175 }
00176 DEAD->setBinContent(xBin,yBin, (float)badChannels.size()/nstrips );
00177
00178 }
00179
00180
00181
00182
00183 }
00184 }
00185
00186