CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Types | Private Attributes

CastorChannelQualityMonitor Class Reference

#include <CastorChannelQualityMonitor.h>

Inheritance diagram for CastorChannelQualityMonitor:
CastorBaseMonitor

List of all members.

Public Member Functions

 CastorChannelQualityMonitor ()
void processEvent (const CastorRecHitCollection &castorHits)
void reset ()
void setup (const edm::ParameterSet &ps, DQMStore *dbe)
 ~CastorChannelQualityMonitor ()

Public Attributes

struct {
   std::vector< float >   energy
   int   module
   int   sector
ChannelStatus

Private Types

typedef std::map< uint32_t,
float, std::less< uint32_t > > 
MapType

Private Attributes

int aboveNoisyThreshold [14][16]
int aboveThr [14][16]
double averageEnergy
bool averageEnergyMethod_
int belowDThreshold [14][16]
double castorEnergy
int castorModule
int castorSector
int counter1
int counter2
double dThreshold_
double energyArray [14][16]
double fraction
TH2F * h_reportSummaryMap
std::string histo
int ievt_
bool iRecHit
double nThreshold_
int numOK
bool offline_
MonitorElementoverallStatus
MonitorElementreportSummary
MonitorElementreportSummaryMap
int status
double wcounter1
double wcounter2

Detailed Description

Definition at line 28 of file CastorChannelQualityMonitor.h.


Member Typedef Documentation

typedef std::map<uint32_t,float,std::less<uint32_t> > CastorChannelQualityMonitor::MapType [private]

Definition at line 30 of file CastorChannelQualityMonitor.h.


Constructor & Destructor Documentation

CastorChannelQualityMonitor::CastorChannelQualityMonitor ( )

Definition at line 17 of file CastorChannelQualityMonitor.cc.

References counter1, counter2, and ievt_.

                                                        {
 ievt_=0;
 counter1=0;
 counter2=0;
}
CastorChannelQualityMonitor::~CastorChannelQualityMonitor ( )

Definition at line 27 of file CastorChannelQualityMonitor.cc.

                                                         {
}

Member Function Documentation

void CastorChannelQualityMonitor::processEvent ( const CastorRecHitCollection castorHits)

Definition at line 103 of file CastorChannelQualityMonitor.cc.

References aboveNoisyThreshold, aboveThr, averageEnergy, averageEnergyMethod_, edm::SortedCollection< T, SORT >::begin(), belowDThreshold, castorEnergy, castorModule, castorSector, counter1, counter2, gather_cfg::cout, dThreshold_, edm::SortedCollection< T, SORT >::end(), energyArray, MonitorElement::Fill(), edm::SortedCollection< T, SORT >::find(), fraction, CastorBaseMonitor::fVerbosity, MonitorElement::getTH2F(), ievt_, iRecHit, CastorBaseMonitor::m_dbe, module, HcalCastorDetId::module(), nThreshold_, numOK, overallStatus, reportSummary, reportSummaryMap, sector, HcalCastorDetId::sector(), edm::SortedCollection< T, SORT >::size(), status, wcounter1, and wcounter2.

Referenced by CastorMonitorModule::analyze().

                                                                                      {

  if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::processEvent !!!" << std::endl;

  if(!m_dbe) { 
    if(fVerbosity>0) std::cout <<"CastorChannelQualityMonitor::processEvent => DQMStore is not instantiated !!!"<<std::endl;  
    return; 
  }

  if(fVerbosity>0){
     std::cout << "CastorChannelQualityMonitor: Noisy Threshold is set to: "<< nThreshold_ << std::endl;
     std::cout << "CastorChannelQualityMonitor: Dead Threshold is set to: " << dThreshold_ << std::endl;
    }

  castorModule = -1;  castorSector = -1; castorEnergy = -1.; 
  
  if (castorHits.size()>0) iRecHit=true;
  else iRecHit=false;
 
 
 for(CastorRecHitCollection::const_iterator recHit = castorHits.begin(); recHit != castorHits.end(); ++recHit){

    HcalCastorDetId CastorID = HcalCastorDetId(recHit->id());
    if(fVerbosity>0) std::cout << "Castor ID = " << CastorID << std::endl;
    CastorRecHitCollection::const_iterator rh = castorHits.find(CastorID);
    castorModule = CastorID.module();
    castorSector = CastorID.sector();
    castorEnergy = rh->energy();
    //if(ievt_ % 1000 == 0) std::cout << "==> module=" << module << " sector=" << sector << " energy= "<< energy << std::endl;
    iRecHit=true; 
   
    if(castorEnergy > nThreshold_) ++aboveNoisyThreshold[castorModule-1][castorSector-1];
    if(castorEnergy < dThreshold_) ++belowDThreshold[castorModule-1][castorSector-1];
    if(castorEnergy>1) { //if(castorEnergy>0) {
      ++aboveThr[castorModule-1][castorSector-1]; 
      energyArray[castorModule-1][castorSector-1]=energyArray[castorModule-1][castorSector-1]+castorEnergy;
    }

   }




  ievt_++;



  // if( (ievt_ == 25 || ievt_ % 500 == 0) && iRecHit ) {
  // no particular event selection done 
   if( iRecHit ) {
   
   status = -99;  numOK = 0; 

    // if(offline_) reportSummaryMap->Reset();


 for (int sector=0; sector<16; sector++){
  for (int module=0; module<14; module++){
  

   if(averageEnergyMethod_){

     if(aboveThr[module][sector] >0)
     averageEnergy= energyArray[module][sector]/double(aboveThr[module][sector]); // calculate the average energy in each channel
     else averageEnergy=0;
 
     if( averageEnergy >  nThreshold_ )  status= 0;   
     if( averageEnergy < dThreshold_  ) { status= -1;  
          if(fVerbosity>0) std::cout << "!!! dChannels ===> module="<< module+1 << " sector="<< sector+1 << std::endl;
          }
     if( averageEnergy <  nThreshold_ && averageEnergy > dThreshold_ )  status= 1; 

     if(fVerbosity>0)
      std::cout << "===> module="<< module+1 << " sector="<< sector+1 <<" *** average Energy=" 
           << averageEnergy << " => energy=" << energyArray[module][sector] << " events="
           << ievt_ << " aboveThr="<< double(aboveThr[module][sector]) <<std::endl;
    }


   else{
      //-- look at the arrays
      counter1= aboveNoisyThreshold[module][sector]; //counter1 defines how many times the energy was above a noisythreshold
      counter2= belowDThreshold[module][sector];  //counter2 defines how many times the energy was below a dthreshold
      wcounter1= double(counter1)/double(ievt_);
      wcounter2= double(counter2)/double(ievt_);
      if( wcounter1 > 0.85 )  status= 0; 
      if( wcounter2 > 0.85 ) {status= -1;  
         if(fVerbosity>0) std::cout << "!!! dChannels ===> module="<< module+1 << " sector="<< sector+1 << std::endl; 
        }
      if( wcounter1 < 0.85 && wcounter2 <  0.85 ) status= 1; 

      if(fVerbosity>0)
        std::cout << "===> module="<< module+1 << " sector="<< sector+1 <<" *** counter1=" 
        << counter1 << " => counter2=" << counter2 << " events="<< ievt_ 
        << " wcounter1=" << wcounter1  << " wcounter2=" <<  wcounter2
        << " *** ==> STATUS=" << status <<std::endl;      
    }

   // reportSummaryMap->Fill(module,sector,status);
   reportSummaryMap->getTH2F()->SetBinContent(module+1,sector+1,double(status));
   if (status == 1) numOK++;

      }
    }
  fraction=double(numOK)/224;
  overallStatus->Fill(fraction); reportSummary->Fill(fraction); 
  }
  
  
   return;
} 
void CastorChannelQualityMonitor::reset ( void  )

Definition at line 31 of file CastorChannelQualityMonitor.cc.

Referenced by CastorMonitorModule::reset().

                                       {
}
void CastorChannelQualityMonitor::setup ( const edm::ParameterSet ps,
DQMStore dbe 
) [virtual]

Reimplemented from CastorBaseMonitor.

Definition at line 39 of file CastorChannelQualityMonitor.cc.

References aboveNoisyThreshold, aboveThr, averageEnergy, averageEnergyMethod_, belowDThreshold, DQMStore::book2D(), DQMStore::bookFloat(), counter1, counter2, gather_cfg::cout, dThreshold_, energyArray, MonitorElement::Fill(), fraction, CastorBaseMonitor::fVerbosity, MonitorElement::getTH2F(), edm::ParameterSet::getUntrackedParameter(), h_reportSummaryMap, ievt_, iRecHit, CastorBaseMonitor::m_dbe, nThreshold_, NULL, numOK, offline_, overallStatus, reportSummary, reportSummaryMap, CastorBaseMonitor::rootFolder_, DQMStore::setCurrentFolder(), status, wcounter1, and wcounter2.

Referenced by CastorMonitorModule::CastorMonitorModule().

                                                                               {

  CastorBaseMonitor::setup(ps,dbe);
   averageEnergyMethod_ = ps.getUntrackedParameter<bool>("averageEnergyMethod", true); 
   offline_             = ps.getUntrackedParameter<bool>("OfflineMode", false); 
   nThreshold_          = ps.getUntrackedParameter<double>("nThreshold", 0);
   dThreshold_          = ps.getUntrackedParameter<double>("dThreshold", 0);

  if ( m_dbe !=NULL ) {    
    m_dbe->setCurrentFolder(rootFolder_+"CastorChannelQuality");
    reportSummary    = m_dbe->bookFloat("RecHit Energy based reportSummary");
    reportSummaryMap = m_dbe->book2D("RecHitEnergyBasedSummaryMap","RecHitEnergyBasedSummaryMap",14,0.0,14.0,16,0.0,16.0);
    if(offline_){
      h_reportSummaryMap =reportSummaryMap->getTH2F();
      h_reportSummaryMap->SetOption("textcolz");
      h_reportSummaryMap->GetXaxis()->SetTitle("module");
      h_reportSummaryMap->GetYaxis()->SetTitle("sector");
    }
    
    overallStatus = m_dbe->bookFloat("RecHit Energy based fraction of good channels");
   } 

  else{
  if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::setup - NO DQMStore service" << std::endl; 
 }

  // baseFolder_ = rootFolder_+"CastorChannelQualityMonitor";

  if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::setup (start)" << std::endl;

  for (int row=0; row<14; row++) {
    for (int col=0; col<16; col++){
        aboveNoisyThreshold[row][col] = 0;
        belowDThreshold[row][col]     = 0;
        energyArray[row][col]         = 0;
        aboveThr[row][col]         = 0;
    }
  }

  ievt_=0; counter1=0; counter2=0;  wcounter1=0.; wcounter2=0.; 
  fraction=0.; 
  overallStatus->Fill(fraction); reportSummary->Fill(fraction); 
  status = -99; numOK = 0; 
  iRecHit=false;
  averageEnergy=0.;

  if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::setup (end)" << std::endl;

  return;
}

Member Data Documentation

Definition at line 58 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 61 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 66 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 68 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 59 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 51 of file CastorChannelQualityMonitor.h.

Referenced by processEvent().

Definition at line 51 of file CastorChannelQualityMonitor.h.

Referenced by processEvent().

Definition at line 51 of file CastorChannelQualityMonitor.h.

Referenced by processEvent().

Definition at line 62 of file CastorChannelQualityMonitor.h.

Referenced by CastorChannelQualityMonitor(), processEvent(), and setup().

Definition at line 63 of file CastorChannelQualityMonitor.h.

Referenced by CastorChannelQualityMonitor(), processEvent(), and setup().

Definition at line 57 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 44 of file CastorChannelQualityMonitor.h.

double CastorChannelQualityMonitor::energyArray[14][16] [private]

Definition at line 60 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 74 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 72 of file CastorChannelQualityMonitor.h.

Referenced by setup().

std::string CastorChannelQualityMonitor::histo [private]

Definition at line 54 of file CastorChannelQualityMonitor.h.

Definition at line 50 of file CastorChannelQualityMonitor.h.

Referenced by CastorChannelQualityMonitor(), processEvent(), and setup().

Definition at line 70 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 42 of file CastorChannelQualityMonitor.h.

Referenced by processEvent().

Definition at line 56 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 52 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 69 of file CastorChannelQualityMonitor.h.

Referenced by setup().

Definition at line 73 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 71 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 72 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 43 of file CastorChannelQualityMonitor.h.

Referenced by processEvent().

Definition at line 52 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 64 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 65 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().