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

void beginRun (const edm::Run &iRun, const edm::EventSetup &iSetup)
 
 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 31 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::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)

Definition at line 81 of file CastorChannelQualityMonitor.cc.

References DQMStore::book2D(), DQMStore::bookFloat(), gather_cfg::cout, MonitorElement::Fill(), fraction, CastorBaseMonitor::fVerbosity, MonitorElement::getTH2F(), h_reportSummaryMap, CastorBaseMonitor::m_dbe, NULL, offline_, overallStatus, reportSummary, reportSummaryMap, CastorBaseMonitor::rootFolder_, and DQMStore::setCurrentFolder().

Referenced by CastorMonitorModule::beginRun().

82  {
83  if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::beginRun (start)" << std::endl;
84 
85  if ( m_dbe !=NULL )
86  {
88  m_dbe->setCurrentFolder(rootFolder_+"CastorChannelQuality");
89  reportSummary = m_dbe->bookFloat("RecHit Energy based reportSummary");
90  reportSummaryMap = m_dbe->book2D("RecHitEnergyBasedSummaryMap","RecHitEnergyBasedSummaryMap",14,0.0,14.0,16,0.0,16.0);
91  if(offline_)
92  {
94  h_reportSummaryMap->SetOption("textcolz");
95  h_reportSummaryMap->GetXaxis()->SetTitle("module");
96  h_reportSummaryMap->GetYaxis()->SetTitle("sector");
97  }
98 
99  overallStatus = m_dbe->bookFloat("RecHit Energy based fraction of good channels");
100 
102  fraction=0.;
104 
105  }
106  else
107  {
108  if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::beginRun - NO DQMStore service" << std::endl;
109  }
110 
111 
112  if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::beginRun (end)" << std::endl;
113 
114 
115  return;
116 }
#define NULL
Definition: scimark2.h:8
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:908
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:1099
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:684
void CastorChannelQualityMonitor::processEvent ( const CastorRecHitCollection castorHits)

Definition at line 123 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().

124  {
125  if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::processEvent (begin)" << std::endl;
126 
127  if(!m_dbe) {
128  if(fVerbosity>0) std::cout <<"CastorChannelQualityMonitor::processEvent => DQMStore is not instantiated !!!"<<std::endl;
129  return;
130  }
131 
132  if(fVerbosity>1){
133  std::cout << "CastorChannelQualityMonitor: Noisy Threshold is set to: "<< nThreshold_ << std::endl;
134  std::cout << "CastorChannelQualityMonitor: Dead Threshold is set to: " << dThreshold_ << std::endl;
135  }
136 
137  castorModule = -1; castorSector = -1; castorEnergy = -1.;
138 
139  if (castorHits.size()>0) iRecHit=true;
140  else iRecHit=false;
141 
142 
144  for(CastorRecHitCollection::const_iterator recHit = castorHits.begin(); recHit != castorHits.end(); ++recHit){
145 
146  HcalCastorDetId CastorID = HcalCastorDetId(recHit->id());
147  if(fVerbosity>1) std::cout << "Castor ID = " << CastorID << std::endl;
148  CastorRecHitCollection::const_iterator rh = castorHits.find(CastorID);
150  castorModule = CastorID.module();
151  castorSector = CastorID.sector();
152  castorEnergy = rh->energy();
153  //if(ievt_ % 1000 == 0) std::cout << "==> module=" << module << " sector=" << sector << " energy= "<< energy << std::endl;
154  iRecHit=true;
155 
161  if(castorEnergy>1) { //if(castorEnergy>0) {
164  }
165 
166  }
167 
168 
169 
170 
172  ievt_++;
173 
174 
178 
179  // if( (ievt_ == 25 || ievt_ % 500 == 0) && iRecHit ) {
180  // no particular event selection done
181  if( iRecHit ) {
182 
183  status = -99; numOK = 0;
184 
186  // if(offline_) reportSummaryMap->Reset();
187 
188 
190  for (int sector=0; sector<16; sector++){
191  for (int module=0; module<14; module++){
192 
193 
195 
196  if(aboveThr[module][sector] >0)
197  averageEnergy= energyArray[module][sector]/double(aboveThr[module][sector]); // calculate the average energy in each channel
198  else averageEnergy=0;
199 
201  if( averageEnergy > nThreshold_ ) status= 0;
202  if( averageEnergy < dThreshold_ ) { status= -1;
203  if(fVerbosity>1) std::cout << "!!! dChannels ===> module="<< module+1 << " sector="<< sector+1 << std::endl;
204  }
205  if( averageEnergy < nThreshold_ && averageEnergy > dThreshold_ ) status= 1;
206 
207  if(fVerbosity>1)
208  std::cout << "===> module="<< module+1 << " sector="<< sector+1 <<" *** average Energy="
209  << averageEnergy << " => energy=" << energyArray[module][sector] << " events="
210  << ievt_ << " aboveThr="<< double(aboveThr[module][sector]) <<std::endl;
211  }
212 
213 
214  else{
215  //-- look at the arrays
216  counter1= aboveNoisyThreshold[module][sector]; //counter1 defines how many times the energy was above a noisythreshold
217  counter2= belowDThreshold[module][sector]; //counter2 defines how many times the energy was below a dthreshold
218  wcounter1= double(counter1)/double(ievt_);
219  wcounter2= double(counter2)/double(ievt_);
221  if( wcounter1 > 0.85 ) status= 0;
222  if( wcounter2 > 0.85 ) {status= -1;
223  if(fVerbosity>1) std::cout << "!!! dChannels ===> module="<< module+1 << " sector="<< sector+1 << std::endl;
224  }
225  if( wcounter1 < 0.85 && wcounter2 < 0.85 ) status= 1;
226 
227  if(fVerbosity>1)
228  std::cout << "===> module="<< module+1 << " sector="<< sector+1 <<" *** counter1="
229  << counter1 << " => counter2=" << counter2 << " events="<< ievt_
230  << " wcounter1=" << wcounter1 << " wcounter2=" << wcounter2
231  << " *** ==> STATUS=" << status <<std::endl;
232  }
233 
235  // reportSummaryMap->Fill(module,sector,status);
236  reportSummaryMap->getTH2F()->SetBinContent(module+1,sector+1,double(status));
237  if (status == 1) numOK++;
238 
239  }
240  }
242  fraction=double(numOK)/224;
244  }
245 
246  if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::processEvent (end)" << std::endl;
247 
248  return;
249 }
int sector() const
get the sector (1-16)
std::vector< CastorRecHit >::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:208
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, cuy::col, counter1, counter2, gather_cfg::cout, dThreshold_, energyArray, fraction, CastorBaseMonitor::fVerbosity, edm::ParameterSet::getUntrackedParameter(), ievt_, iRecHit, nThreshold_, numOK, offline_, 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  // baseFolder_ = rootFolder_+"CastorChannelQualityMonitor";
48 
49  if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::setup (start)" << std::endl;
50 
52  for (int row=0; row<14; row++) {
53  for (int col=0; col<16; col++){
54  aboveNoisyThreshold[row][col] = 0;
55  belowDThreshold[row][col] = 0;
56  energyArray[row][col] = 0;
57  aboveThr[row][col] = 0;
58  }
59  }
60 
62  ievt_=0; counter1=0; counter2=0; wcounter1=0.; wcounter2=0.;
64  fraction=0.;
66  status = -99; numOK = 0;
68  iRecHit=false;
70  averageEnergy=0.;
71 
72  if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor::setup (end)" << std::endl;
73 
74  return;
75 }
T getUntrackedParameter(std::string const &, T const &) const
virtual void setup(const edm::ParameterSet &ps, DQMStore *dbe)
tuple cout
Definition: gather_cfg.py:121
int col
Definition: cuy.py:1008

Member Data Documentation

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

Definition at line 60 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

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

Definition at line 63 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

double CastorChannelQualityMonitor::averageEnergy
private

Definition at line 68 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

bool CastorChannelQualityMonitor::averageEnergyMethod_
private

Definition at line 70 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

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

Definition at line 61 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

double CastorChannelQualityMonitor::castorEnergy
private

Definition at line 53 of file CastorChannelQualityMonitor.h.

Referenced by processEvent().

int CastorChannelQualityMonitor::castorModule
private

Definition at line 53 of file CastorChannelQualityMonitor.h.

Referenced by processEvent().

int CastorChannelQualityMonitor::castorSector
private

Definition at line 53 of file CastorChannelQualityMonitor.h.

Referenced by processEvent().

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

Definition at line 64 of file CastorChannelQualityMonitor.h.

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

int CastorChannelQualityMonitor::counter2
private

Definition at line 65 of file CastorChannelQualityMonitor.h.

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

double CastorChannelQualityMonitor::dThreshold_
private

Definition at line 59 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

std::vector<float> CastorChannelQualityMonitor::energy

Definition at line 46 of file CastorChannelQualityMonitor.h.

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

Definition at line 62 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

double CastorChannelQualityMonitor::fraction
private

Definition at line 76 of file CastorChannelQualityMonitor.h.

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

TH2F* CastorChannelQualityMonitor::h_reportSummaryMap
private

Definition at line 74 of file CastorChannelQualityMonitor.h.

Referenced by beginRun().

std::string CastorChannelQualityMonitor::histo
private

Definition at line 56 of file CastorChannelQualityMonitor.h.

int CastorChannelQualityMonitor::ievt_
private

Definition at line 52 of file CastorChannelQualityMonitor.h.

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

bool CastorChannelQualityMonitor::iRecHit
private

Definition at line 72 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

int CastorChannelQualityMonitor::module

Definition at line 44 of file CastorChannelQualityMonitor.h.

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

double CastorChannelQualityMonitor::nThreshold_
private

Definition at line 58 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

int CastorChannelQualityMonitor::numOK
private

Definition at line 54 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

bool CastorChannelQualityMonitor::offline_
private

Definition at line 71 of file CastorChannelQualityMonitor.h.

Referenced by beginRun(), and setup().

MonitorElement* CastorChannelQualityMonitor::overallStatus
private

Definition at line 75 of file CastorChannelQualityMonitor.h.

Referenced by beginRun(), and processEvent().

MonitorElement* CastorChannelQualityMonitor::reportSummary
private

Definition at line 73 of file CastorChannelQualityMonitor.h.

Referenced by beginRun(), and processEvent().

MonitorElement* CastorChannelQualityMonitor::reportSummaryMap
private

Definition at line 74 of file CastorChannelQualityMonitor.h.

Referenced by beginRun(), and processEvent().

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

Definition at line 66 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().

double CastorChannelQualityMonitor::wcounter2
private

Definition at line 67 of file CastorChannelQualityMonitor.h.

Referenced by processEvent(), and setup().