Go to the documentation of this file.00001 #include "DQM/CastorMonitor/interface/CastorChannelQualityMonitor.h"
00002 #include "DQMServices/Core/interface/DQMStore.h"
00003 #include "DQMServices/Core/interface/MonitorElement.h"
00004
00005
00006
00007
00008
00009
00013
00014
00015
00016
00017 CastorChannelQualityMonitor::CastorChannelQualityMonitor(){
00018 ievt_=0;
00019 counter1=0;
00020 counter2=0;
00021 }
00022
00023
00024
00025
00026
00027 CastorChannelQualityMonitor::~CastorChannelQualityMonitor(){
00028 }
00029
00030
00031 void CastorChannelQualityMonitor::reset(){
00032 }
00033
00034
00035
00036
00037
00038
00039 void CastorChannelQualityMonitor::setup(const edm::ParameterSet& ps, DQMStore* dbe){
00040
00041 CastorBaseMonitor::setup(ps,dbe);
00042 averageEnergyMethod_ = ps.getUntrackedParameter<bool>("averageEnergyMethod", true);
00043 offline_ = ps.getUntrackedParameter<bool>("OfflineMode", false);
00044 nThreshold_ = ps.getUntrackedParameter<double>("nThreshold", 0);
00045 dThreshold_ = ps.getUntrackedParameter<double>("dThreshold", 0);
00046
00047 if ( m_dbe !=NULL ) {
00049 m_dbe->setCurrentFolder(rootFolder_+"CastorChannelQuality");
00050 reportSummary = m_dbe->bookFloat("RecHit Energy based reportSummary");
00051 reportSummaryMap = m_dbe->book2D("RecHitEnergyBasedSummaryMap","RecHitEnergyBasedSummaryMap",14,0.0,14.0,16,0.0,16.0);
00052 if(offline_){
00053 h_reportSummaryMap =reportSummaryMap->getTH2F();
00054 h_reportSummaryMap->SetOption("textcolz");
00055 h_reportSummaryMap->GetXaxis()->SetTitle("module");
00056 h_reportSummaryMap->GetYaxis()->SetTitle("sector");
00057 }
00058
00059 overallStatus = m_dbe->bookFloat("RecHit Energy based fraction of good channels");
00060 }
00061
00062 else{
00063 if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::setup - NO DQMStore service" << std::endl;
00064 }
00065
00066
00067
00068 if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::setup (start)" << std::endl;
00069
00071 for (int row=0; row<14; row++) {
00072 for (int col=0; col<16; col++){
00073 aboveNoisyThreshold[row][col] = 0;
00074 belowDThreshold[row][col] = 0;
00075 energyArray[row][col] = 0;
00076 aboveThr[row][col] = 0;
00077 }
00078 }
00079
00081 ievt_=0; counter1=0; counter2=0; wcounter1=0.; wcounter2=0.;
00083 fraction=0.;
00084 overallStatus->Fill(fraction); reportSummary->Fill(fraction);
00086 status = -99; numOK = 0;
00088 iRecHit=false;
00090 averageEnergy=0.;
00091
00092 if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::setup (end)" << std::endl;
00093
00094 return;
00095 }
00096
00097
00098
00099
00100
00101
00102
00103 void CastorChannelQualityMonitor::processEvent(const CastorRecHitCollection& castorHits){
00104
00105 if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::processEvent !!!" << std::endl;
00106
00107 if(!m_dbe) {
00108 if(fVerbosity>0) std::cout <<"CastorChannelQualityMonitor::processEvent => DQMStore is not instantiated !!!"<<std::endl;
00109 return;
00110 }
00111
00112 if(fVerbosity>0){
00113 std::cout << "CastorChannelQualityMonitor: Noisy Threshold is set to: "<< nThreshold_ << std::endl;
00114 std::cout << "CastorChannelQualityMonitor: Dead Threshold is set to: " << dThreshold_ << std::endl;
00115 }
00116
00117 castorModule = -1; castorSector = -1; castorEnergy = -1.;
00118
00119 if (castorHits.size()>0) iRecHit=true;
00120 else iRecHit=false;
00121
00122
00124 for(CastorRecHitCollection::const_iterator recHit = castorHits.begin(); recHit != castorHits.end(); ++recHit){
00125
00126 HcalCastorDetId CastorID = HcalCastorDetId(recHit->id());
00127 if(fVerbosity>0) std::cout << "Castor ID = " << CastorID << std::endl;
00128 CastorRecHitCollection::const_iterator rh = castorHits.find(CastorID);
00130 castorModule = CastorID.module();
00131 castorSector = CastorID.sector();
00132 castorEnergy = rh->energy();
00133
00134 iRecHit=true;
00135
00138 if(castorEnergy > nThreshold_) ++aboveNoisyThreshold[castorModule-1][castorSector-1];
00139 if(castorEnergy < dThreshold_) ++belowDThreshold[castorModule-1][castorSector-1];
00141 if(castorEnergy>1) {
00142 ++aboveThr[castorModule-1][castorSector-1];
00143 energyArray[castorModule-1][castorSector-1]=energyArray[castorModule-1][castorSector-1]+castorEnergy;
00144 }
00145
00146 }
00147
00148
00149
00150
00152 ievt_++;
00153
00154
00158
00159
00160
00161 if( iRecHit ) {
00162
00163 status = -99; numOK = 0;
00164
00166
00167
00168
00170 for (int sector=0; sector<16; sector++){
00171 for (int module=0; module<14; module++){
00172
00173
00174 if(averageEnergyMethod_){
00175
00176 if(aboveThr[module][sector] >0)
00177 averageEnergy= energyArray[module][sector]/double(aboveThr[module][sector]);
00178 else averageEnergy=0;
00179
00181 if( averageEnergy > nThreshold_ ) status= 0;
00182 if( averageEnergy < dThreshold_ ) { status= -1;
00183 if(fVerbosity>0) std::cout << "!!! dChannels ===> module="<< module+1 << " sector="<< sector+1 << std::endl;
00184 }
00185 if( averageEnergy < nThreshold_ && averageEnergy > dThreshold_ ) status= 1;
00186
00187 if(fVerbosity>0)
00188 std::cout << "===> module="<< module+1 << " sector="<< sector+1 <<" *** average Energy="
00189 << averageEnergy << " => energy=" << energyArray[module][sector] << " events="
00190 << ievt_ << " aboveThr="<< double(aboveThr[module][sector]) <<std::endl;
00191 }
00192
00193
00194 else{
00195
00196 counter1= aboveNoisyThreshold[module][sector];
00197 counter2= belowDThreshold[module][sector];
00198 wcounter1= double(counter1)/double(ievt_);
00199 wcounter2= double(counter2)/double(ievt_);
00201 if( wcounter1 > 0.85 ) status= 0;
00202 if( wcounter2 > 0.85 ) {status= -1;
00203 if(fVerbosity>0) std::cout << "!!! dChannels ===> module="<< module+1 << " sector="<< sector+1 << std::endl;
00204 }
00205 if( wcounter1 < 0.85 && wcounter2 < 0.85 ) status= 1;
00206
00207 if(fVerbosity>0)
00208 std::cout << "===> module="<< module+1 << " sector="<< sector+1 <<" *** counter1="
00209 << counter1 << " => counter2=" << counter2 << " events="<< ievt_
00210 << " wcounter1=" << wcounter1 << " wcounter2=" << wcounter2
00211 << " *** ==> STATUS=" << status <<std::endl;
00212 }
00213
00215
00216 reportSummaryMap->getTH2F()->SetBinContent(module+1,sector+1,double(status));
00217 if (status == 1) numOK++;
00218
00219 }
00220 }
00222 fraction=double(numOK)/224;
00223 overallStatus->Fill(fraction); reportSummary->Fill(fraction);
00224 }
00225
00226
00227 return;
00228 }
00229