CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Types | Private Attributes
CastorChannelQualityMonitor Class Reference

#include <CastorChannelQualityMonitor.h>

Inheritance diagram for CastorChannelQualityMonitor:
CastorBaseMonitor

Public Member Functions

 CastorChannelQualityMonitor ()
 
void processEvent (const CastorRecHitCollection &castorHits)
 
void reset ()
 
void setup (const edm::ParameterSet &ps, DQMStore *dbe)
 
 ~CastorChannelQualityMonitor ()
 
- Public Member Functions inherited from CastorBaseMonitor
 CastorBaseMonitor ()
 
virtual void clearME ()
 
virtual void done ()
 
bool getDiagnostics () const
 
int getVerbosity () const
 
void setDiagnostics (bool myval)
 
void setVerbosity (int verb)
 
bool vetoCell (HcalCastorDetId id)
 
virtual ~CastorBaseMonitor ()
 

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
 

Additional Inherited Members

- Protected Attributes inherited from CastorBaseMonitor
std::string baseFolder_
 
edm::CPUTimer cpu_timer
 
int fVerbosity
 
DQMStorem_dbe
 
bool makeDiagnostics
 
std::string rootFolder_
 
bool showTiming
 

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 ( )
CastorChannelQualityMonitor::~CastorChannelQualityMonitor ( )

Definition at line 27 of file CastorChannelQualityMonitor.cc.

27  {
28 }

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().

103  {
104 
105  if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::processEvent !!!" << std::endl;
106 
107  if(!m_dbe) {
108  if(fVerbosity>0) std::cout <<"CastorChannelQualityMonitor::processEvent => DQMStore is not instantiated !!!"<<std::endl;
109  return;
110  }
111 
112  if(fVerbosity>0){
113  std::cout << "CastorChannelQualityMonitor: Noisy Threshold is set to: "<< nThreshold_ << std::endl;
114  std::cout << "CastorChannelQualityMonitor: Dead Threshold is set to: " << dThreshold_ << std::endl;
115  }
116 
117  castorModule = -1; castorSector = -1; castorEnergy = -1.;
118 
119  if (castorHits.size()>0) iRecHit=true;
120  else iRecHit=false;
121 
122 
124  for(CastorRecHitCollection::const_iterator recHit = castorHits.begin(); recHit != castorHits.end(); ++recHit){
125 
126  HcalCastorDetId CastorID = HcalCastorDetId(recHit->id());
127  if(fVerbosity>0) std::cout << "Castor ID = " << CastorID << std::endl;
128  CastorRecHitCollection::const_iterator rh = castorHits.find(CastorID);
130  castorModule = CastorID.module();
131  castorSector = CastorID.sector();
132  castorEnergy = rh->energy();
133  //if(ievt_ % 1000 == 0) std::cout << "==> module=" << module << " sector=" << sector << " energy= "<< energy << std::endl;
134  iRecHit=true;
135 
141  if(castorEnergy>1) { //if(castorEnergy>0) {
144  }
145 
146  }
147 
148 
149 
150 
152  ievt_++;
153 
154 
158 
159  // if( (ievt_ == 25 || ievt_ % 500 == 0) && iRecHit ) {
160  // no particular event selection done
161  if( iRecHit ) {
162 
163  status = -99; numOK = 0;
164 
166  // if(offline_) reportSummaryMap->Reset();
167 
168 
170  for (int sector=0; sector<16; sector++){
171  for (int module=0; module<14; module++){
172 
173 
175 
176  if(aboveThr[module][sector] >0)
177  averageEnergy= energyArray[module][sector]/double(aboveThr[module][sector]); // calculate the average energy in each channel
178  else averageEnergy=0;
179 
181  if( averageEnergy > nThreshold_ ) status= 0;
182  if( averageEnergy < dThreshold_ ) { status= -1;
183  if(fVerbosity>0) std::cout << "!!! dChannels ===> module="<< module+1 << " sector="<< sector+1 << std::endl;
184  }
185  if( averageEnergy < nThreshold_ && averageEnergy > dThreshold_ ) status= 1;
186 
187  if(fVerbosity>0)
188  std::cout << "===> module="<< module+1 << " sector="<< sector+1 <<" *** average Energy="
189  << averageEnergy << " => energy=" << energyArray[module][sector] << " events="
190  << ievt_ << " aboveThr="<< double(aboveThr[module][sector]) <<std::endl;
191  }
192 
193 
194  else{
195  //-- look at the arrays
196  counter1= aboveNoisyThreshold[module][sector]; //counter1 defines how many times the energy was above a noisythreshold
197  counter2= belowDThreshold[module][sector]; //counter2 defines how many times the energy was below a dthreshold
198  wcounter1= double(counter1)/double(ievt_);
199  wcounter2= double(counter2)/double(ievt_);
201  if( wcounter1 > 0.85 ) status= 0;
202  if( wcounter2 > 0.85 ) {status= -1;
203  if(fVerbosity>0) std::cout << "!!! dChannels ===> module="<< module+1 << " sector="<< sector+1 << std::endl;
204  }
205  if( wcounter1 < 0.85 && wcounter2 < 0.85 ) status= 1;
206 
207  if(fVerbosity>0)
208  std::cout << "===> module="<< module+1 << " sector="<< sector+1 <<" *** counter1="
209  << counter1 << " => counter2=" << counter2 << " events="<< ievt_
210  << " wcounter1=" << wcounter1 << " wcounter2=" << wcounter2
211  << " *** ==> STATUS=" << status <<std::endl;
212  }
213 
215  // reportSummaryMap->Fill(module,sector,status);
216  reportSummaryMap->getTH2F()->SetBinContent(module+1,sector+1,double(status));
217  if (status == 1) numOK++;
218 
219  }
220  }
222  fraction=double(numOK)/224;
224  }
225 
226 
227  return;
228 }
int sector() const
get the sector (1-16)
std::vector< T >::const_iterator const_iterator
int module() const
get the module (1-2 for EM, 1-12 for HAD)
void Fill(long long x)
const_iterator end() const
iterator find(key_type k)
size_type size() const
tuple cout
Definition: gather_cfg.py:121
TH2F * getTH2F(void) const
Definition: vlib.h:209
const_iterator begin() const
void CastorChannelQualityMonitor::reset ( void  )

Definition at line 31 of file CastorChannelQualityMonitor.cc.

Referenced by CastorMonitorModule::reset().

31  {
32 }
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(), CastorBaseMonitor::setup(), status, wcounter1, and wcounter2.

Referenced by CastorMonitorModule::CastorMonitorModule().

39  {
40 
42  averageEnergyMethod_ = ps.getUntrackedParameter<bool>("averageEnergyMethod", true);
43  offline_ = ps.getUntrackedParameter<bool>("OfflineMode", false);
44  nThreshold_ = ps.getUntrackedParameter<double>("nThreshold", 0);
45  dThreshold_ = ps.getUntrackedParameter<double>("dThreshold", 0);
46 
47  if ( m_dbe !=NULL ) {
49  m_dbe->setCurrentFolder(rootFolder_+"CastorChannelQuality");
50  reportSummary = m_dbe->bookFloat("RecHit Energy based reportSummary");
51  reportSummaryMap = m_dbe->book2D("RecHitEnergyBasedSummaryMap","RecHitEnergyBasedSummaryMap",14,0.0,14.0,16,0.0,16.0);
52  if(offline_){
54  h_reportSummaryMap->SetOption("textcolz");
55  h_reportSummaryMap->GetXaxis()->SetTitle("module");
56  h_reportSummaryMap->GetYaxis()->SetTitle("sector");
57  }
58 
59  overallStatus = m_dbe->bookFloat("RecHit Energy based fraction of good channels");
60  }
61 
62  else{
63  if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::setup - NO DQMStore service" << std::endl;
64  }
65 
66  // baseFolder_ = rootFolder_+"CastorChannelQualityMonitor";
67 
68  if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::setup (start)" << std::endl;
69 
71  for (int row=0; row<14; row++) {
72  for (int col=0; col<16; col++){
73  aboveNoisyThreshold[row][col] = 0;
74  belowDThreshold[row][col] = 0;
75  energyArray[row][col] = 0;
76  aboveThr[row][col] = 0;
77  }
78  }
79 
81  ievt_=0; counter1=0; counter2=0; wcounter1=0.; wcounter2=0.;
83  fraction=0.;
86  status = -99; numOK = 0;
88  iRecHit=false;
90  averageEnergy=0.;
91 
92  if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::setup (end)" << std::endl;
93 
94  return;
95 }
T getUntrackedParameter(std::string const &, T const &) const
virtual void setup(const edm::ParameterSet &ps, DQMStore *dbe)
#define NULL
Definition: scimark2.h:8
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:654
void Fill(long long x)
std::string rootFolder_
tuple cout
Definition: gather_cfg.py:121
TH2F * getTH2F(void) const
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:845
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429

Member Data Documentation

int CastorChannelQualityMonitor::aboveNoisyThreshold[14][16]
private

Definition at line 58 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

int CastorChannelQualityMonitor::aboveThr[14][16]
private

Definition at line 61 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

double CastorChannelQualityMonitor::averageEnergy
private

Definition at line 66 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

bool CastorChannelQualityMonitor::averageEnergyMethod_
private

Definition at line 68 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

int CastorChannelQualityMonitor::belowDThreshold[14][16]
private

Definition at line 59 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

double CastorChannelQualityMonitor::castorEnergy
private

Definition at line 51 of file CastorChannelQualityMonitor.h.

Referenced by processEvent().

int CastorChannelQualityMonitor::castorModule
private

Definition at line 51 of file CastorChannelQualityMonitor.h.

Referenced by processEvent().

int CastorChannelQualityMonitor::castorSector
private

Definition at line 51 of file CastorChannelQualityMonitor.h.

Referenced by processEvent().

struct { ... } CastorChannelQualityMonitor::ChannelStatus
int CastorChannelQualityMonitor::counter1
private

Definition at line 62 of file CastorChannelQualityMonitor.h.

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

int CastorChannelQualityMonitor::counter2
private

Definition at line 63 of file CastorChannelQualityMonitor.h.

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

double CastorChannelQualityMonitor::dThreshold_
private

Definition at line 57 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

std::vector<float> CastorChannelQualityMonitor::energy

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().

double CastorChannelQualityMonitor::fraction
private

Definition at line 74 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

TH2F* CastorChannelQualityMonitor::h_reportSummaryMap
private

Definition at line 72 of file CastorChannelQualityMonitor.h.

Referenced by setup().

std::string CastorChannelQualityMonitor::histo
private

Definition at line 54 of file CastorChannelQualityMonitor.h.

int CastorChannelQualityMonitor::ievt_
private

Definition at line 50 of file CastorChannelQualityMonitor.h.

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

bool CastorChannelQualityMonitor::iRecHit
private

Definition at line 70 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

int CastorChannelQualityMonitor::module

Definition at line 42 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and TreeCrawler.Package::search().

double CastorChannelQualityMonitor::nThreshold_
private

Definition at line 56 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

int CastorChannelQualityMonitor::numOK
private

Definition at line 52 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

bool CastorChannelQualityMonitor::offline_
private

Definition at line 69 of file CastorChannelQualityMonitor.h.

Referenced by setup().

MonitorElement* CastorChannelQualityMonitor::overallStatus
private

Definition at line 73 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

MonitorElement* CastorChannelQualityMonitor::reportSummary
private

Definition at line 71 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

MonitorElement* CastorChannelQualityMonitor::reportSummaryMap
private

Definition at line 72 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

int CastorChannelQualityMonitor::sector
int CastorChannelQualityMonitor::status
private
double CastorChannelQualityMonitor::wcounter1
private

Definition at line 64 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

double CastorChannelQualityMonitor::wcounter2
private

Definition at line 65 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().