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
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 ("rpcdeadchanneltest") << "[RPCDeadChannelTest]: Constructor";
00021
00022 prescaleFactor_ = ps.getUntrackedParameter<int>("DiagnosticPrescale", 1);
00023 numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 3);
00024 numberOfRings_ = ps.getUntrackedParameter<int>("NumberOfEndcapRings", 2);
00025 }
00026
00027 RPCDeadChannelTest::~RPCDeadChannelTest(){dbe_ = 0;}
00028
00029 void RPCDeadChannelTest::beginJob(DQMStore * dbe, std::string workingFolder ){
00030 edm::LogVerbatim ("rpcdeadchanneltest") << "[RPCDeadChannelTest]: Begin Job";
00031 globalFolder_ = workingFolder;
00032 dbe_=dbe;
00033 }
00034
00035 void RPCDeadChannelTest::endRun(const edm::Run& r, const edm::EventSetup& iSetup){
00036
00037 edm::LogVerbatim ("rpcdeadchanneltest") << "[RPCDeadChannelTest]: End run";
00038
00039 }
00040
00041
00042 void RPCDeadChannelTest::getMonitorElements(std::vector<MonitorElement *> & meVector, std::vector<RPCDetId> & detIdVector){
00043
00044
00045
00046 for (unsigned int i = 0 ; i<meVector.size(); i++){
00047
00048 bool flag= false;
00049
00050 DQMNet::TagList tagList;
00051 tagList = meVector[i]->getTags();
00052 DQMNet::TagList::iterator tagItr = tagList.begin();
00053
00054 while (tagItr != tagList.end() && !flag ) {
00055 if((*tagItr) == rpcdqm::OCCUPANCY)
00056 flag= true;
00057
00058 tagItr++;
00059 }
00060
00061 if(flag){
00062 myOccupancyMe_.push_back(meVector[i]);
00063 myDetIds_.push_back(detIdVector[i]);
00064 }
00065 }
00066 }
00067
00068 void RPCDeadChannelTest::beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& context) {}
00069
00070 void RPCDeadChannelTest::analyze(const edm::Event& iEvent, const edm::EventSetup& c){}
00071
00072 void RPCDeadChannelTest::endLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& iSetup){}
00073
00074 void RPCDeadChannelTest::clientOperation( edm::EventSetup const& iSetup){
00075
00076 edm::LogVerbatim ("rpcdeadchanneltest") <<"[RPCDeadChannelTest]:Client Operation";
00077
00078
00079 MonitorElement * DEAD = NULL;
00080
00081
00082
00083 for (unsigned int i = 0 ; i<myOccupancyMe_.size();i++){
00084
00085 RPCDetId & detId = myDetIds_[i];
00086 MonitorElement * myMe = myOccupancyMe_[i];
00087
00088 if (! myMe ) continue;
00089
00090 const QReport * theOccupancyQReport = myMe->getQReport("DeadChannel_0");
00091
00092 float deadFraction = 0.0 ;
00093
00094 if(theOccupancyQReport) {
00095
00096 float qtresult = theOccupancyQReport->getQTresult();
00097
00098 deadFraction = 1.0 - qtresult;
00099
00100 }else{
00101 int xBins = myMe->getNbinsX();
00102 float emptyBins = 0.0;
00103 for(int x = 1 ; x<= xBins ; x++){if(myMe->getBinContent(x) == 0 ) {emptyBins++;}}
00104 if (xBins != 0){ deadFraction = emptyBins/xBins;}
00105 }
00106
00107 if (detId.region()==0) DEAD = DEADWheel[detId.ring() + 2] ;
00108 else{
00109 if(-detId.station()+ numberOfDisks_ >= 0 ){
00110
00111 if(detId.region()<0){
00112 DEAD = DEADDisk[-detId.station() + numberOfDisks_];
00113 }else{
00114 DEAD = DEADDisk[detId.station() + numberOfDisks_-1];
00115 }
00116 }
00117 }
00118
00119 if (DEAD){
00120 int xBin,yBin;
00121 if(detId.region()==0){
00122 xBin= detId.sector();
00123 rpcdqm::utils rollNumber;
00124 yBin = rollNumber.detId2RollNr(detId);
00125 }else{
00126
00127 RPCGeomServ RPCServ(detId);
00128 xBin = RPCServ.segment();
00129 (numberOfRings_ == 3 ? yBin= detId.ring()*3-detId.roll()+1 : yBin= (detId.ring()-1)*3-detId.roll()+1);
00130 }
00131 DEAD->setBinContent(xBin,yBin, deadFraction );
00132
00133 }
00134
00135 }
00136
00137 }
00138
00139 void RPCDeadChannelTest::beginRun(const edm::Run& r, const edm::EventSetup& c){
00140
00141 MonitorElement* me;
00142 dbe_->setCurrentFolder( globalFolder_);
00143
00144 std::stringstream histoName;
00145
00146 rpcdqm::utils rpcUtils;
00147
00148 int limit = numberOfDisks_;
00149 if(numberOfDisks_ < 2) limit = 2;
00150
00151 for (int i = -1 * limit; i<= limit;i++ ){
00152 if (i>-3 && i<3){
00153 histoName.str("");
00154 histoName<<"DeadChannelFraction_Roll_vs_Sector_Wheel"<<i;
00155 me = 0;
00156 me = dbe_->get(globalFolder_ +"/"+ histoName.str());
00157 if (0!=me ) {
00158 dbe_->removeElement(me->getName());
00159 }
00160 DEADWheel[i+2] = dbe_->book2D(histoName.str().c_str(), histoName.str().c_str(), 12, 0.5, 12.5, 21, 0.5, 21.5);
00161
00162 for (int x = 1; x<=12; x++)
00163 for(int y=1; y<=21; y++)
00164 DEADWheel[i+2]->setBinContent(x,y,-1);
00165
00166 rpcUtils.labelXAxisSector( DEADWheel[i+2]);
00167 rpcUtils.labelYAxisRoll( DEADWheel[i+2], 0, i);
00168 }
00169
00170 if (i == 0 || i > numberOfDisks_ || i< (-1 * numberOfDisks_))continue;
00171
00172 int offset = numberOfDisks_;
00173 if (i>0) offset --;
00174
00175 histoName.str("");
00176 histoName<<"DeadChannelFraction_Ring_vs_Segment_Disk"<<i;
00177 me = 0;
00178 me = dbe_->get(globalFolder_ +"/"+ histoName.str());
00179 if (0!=me ) {
00180 dbe_->removeElement(me->getName());
00181 }
00182
00183 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);
00184
00185 rpcUtils.labelXAxisSegment(DEADDisk[i+offset]);
00186 rpcUtils.labelYAxisRing(DEADDisk[i+offset], numberOfRings_);
00187
00188
00189 }
00190
00191
00192 }
00193
00194 void RPCDeadChannelTest::endJob(){}
00195