CMS 3D CMS Logo

HcalHotCellMonitor.h

Go to the documentation of this file.
00001 #ifndef DQM_HCALMONITORTASKS_HCALHOTCELLMONITOR_H
00002 #define DQM_HCALMONITORTASKS_HCALHOTCELLMONITOR_H
00003 
00004 #include "DQM/HcalMonitorTasks/interface/HcalBaseMonitor.h"
00005 //#include "CalibFormats/HcalObjects/interface/HcalCalibrationWidths.h"
00006 #include "DQMServices/Core/interface/DQMStore.h"
00007 #include "DQMServices/Core/interface/MonitorElement.h"
00008 #include "CondFormats/HcalObjects/interface/HcalChannelStatus.h"
00009 #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
00010 
00011 #include <cmath>
00012 #include <iostream>
00013 #include <fstream>
00014 
00022 struct hotNeighborParams{
00023   int DeltaIphi;
00024   int DeltaIeta;
00025   int DeltaDepth;
00026   double minCellEnergy; // cells below this threshold can never be considered "hot" by this algorithm
00027   double minNeighborEnergy; //neighbors must have some amount of energy to be counted
00028   double maxEnergy; //  a cell above this energy will always be considered hot
00029   double HotEnergyFrac; // a cell will be considered hot if neighbor energy/ cell energy is less than this value
00030 };
00031 
00032 class HcalHotCellMonitor: public HcalBaseMonitor {
00033 
00034  public:
00035   HcalHotCellMonitor();
00036 
00037   ~HcalHotCellMonitor();
00038 
00039   void setup(const edm::ParameterSet& ps, DQMStore* dbe);
00040   void setupNeighborParams(const edm::ParameterSet& ps, hotNeighborParams& N, char* type);
00041   void done(std::map<HcalDetId, unsigned int>& myqual); 
00042   void clearME(); // overrides base class function
00043   void reset();
00044 
00045   void createMaps(const HcalDbService& cond);
00046   
00047   void processEvent(const HBHERecHitCollection& hbHits,
00048                     const HORecHitCollection& hoHits,
00049                     const HFRecHitCollection& hfHits,
00050                     //const ZDCRecHitCollection& zdcHits,
00051                     const HBHEDigiCollection& hbhedigi,
00052                     const HODigiCollection& hodigi,
00053                     const HFDigiCollection& hfdigi,
00054                     //const ZDCDigiCollection& zdcdigi, 
00055                     const HcalDbService& cond
00056                     );
00057 
00058   void processEvent_pedestal(const HBHEDigiCollection& hbhedigi,
00059                              const HODigiCollection& hodigi,
00060                              const HFDigiCollection& hfdigi,
00061                              //const ZDCDigiCollection& zdcdigi, 
00062                              const HcalDbService& cond
00063                              );
00064 
00065   void processEvent_rechitenergy( const HBHERecHitCollection& hbheHits,
00066                                   const HORecHitCollection& hoHits,
00067                                   const HFRecHitCollection& hfHits);
00068 
00069   void processEvent_rechitneighbors( const HBHERecHitCollection& hbheHits,
00070                                      const HORecHitCollection& hoHits,
00071                                      const HFRecHitCollection& hfHits);
00072   void fillHotHistosAtEndRun();
00073 
00074  private:
00075   void fillNevents_pedestal();
00076   void fillNevents_neighbor();
00077   void fillNevents_energy();
00078   void fillNevents_persistentenergy();
00079 
00080   void fillNevents_problemCells();
00081 
00082   bool doFCpeds_; //specify whether pedestals are in fC (if not, assume ADC)
00083   bool hotmon_makeDiagnostics_;
00084 
00085   // Booleans to control which of the three hot cell checking routines are used
00086   bool hotmon_test_pedestal_;
00087   bool hotmon_test_neighbor_;
00088   bool hotmon_test_energy_;
00089   bool hotmon_test_persistent_;
00090 
00091   int hotmon_checkNevents_;  // specify how often to check is cell is hot
00092   // Let each test have its own checkNevents value
00093   int hotmon_checkNevents_pedestal_;
00094   int hotmon_checkNevents_neighbor_;
00095   int hotmon_checkNevents_energy_;
00096   int hotmon_checkNevents_persistent_;
00097 
00098   double energyThreshold_, HBenergyThreshold_, HEenergyThreshold_, HOenergyThreshold_, HFenergyThreshold_, ZDCenergyThreshold_;
00099   double persistentThreshold_, HBpersistentThreshold_, HEpersistentThreshold_, HOpersistentThreshold_, HFpersistentThreshold_, ZDCpersistentThreshold_;
00100 
00101   MonitorElement* meEVT_;
00102   int ievt_;
00103 
00104   double hotmon_minErrorFlag_; // minimum error rate needed to dump out bad bin info 
00105 
00106   // Problem Histograms
00107   MonitorElement* ProblemHotCells;
00108   std::vector<MonitorElement*> ProblemHotCellsByDepth;
00109   
00110   double nsigma_;
00111   double HBnsigma_, HEnsigma_, HOnsigma_, HFnsigma_, ZDCnsigma_;
00112   std::vector<MonitorElement*>AboveNeighborsHotCellsByDepth;
00113   std::vector<MonitorElement*>AboveEnergyThresholdCellsByDepth;
00114   std::vector<MonitorElement*>AbovePersistentThresholdCellsByDepth; 
00115   std::vector<MonitorElement*>AbovePedestalHotCellsByDepth;
00116  
00117   // map of pedestals from database (in ADC)
00118   std::map<HcalDetId, float> pedestals_;
00119   std::map<HcalDetId, float> widths_;
00120   std::map<HcalDetId, float> pedestal_thresholds_;
00121   std::map<HcalDetId, double> rechitEnergies_;
00122   
00123 
00124   unsigned int abovepedestal[ETABINS][PHIBINS][4]; // filled when digi is above pedestal+nsigma
00125   unsigned int aboveneighbors[ETABINS][PHIBINS][4];
00126   unsigned int aboveenergy[ETABINS][PHIBINS][4]; // when rechit is above threshold energy
00127   unsigned int abovepersistent[ETABINS][PHIBINS][4]; // when rechit is consistently above some threshold
00128   unsigned int rechit_occupancy_sum[ETABINS][PHIBINS][4];
00129   float rechit_energy_sum[ETABINS][PHIBINS][4];
00130   
00131   // counters for diagnostic plots
00132   int diagADC_HB[300];
00133   int diagADC_HE[300];
00134   int diagADC_HO[300];
00135   int diagADC_HF[300];
00136   int diagADC_ZDC[300];
00137 
00138 
00139   // Diagnostic plots
00140   MonitorElement* d_HBnormped;
00141   MonitorElement* d_HEnormped;
00142   MonitorElement* d_HOnormped;
00143   MonitorElement* d_HFnormped;
00144   MonitorElement* d_ZDCnormped;
00145 
00146   MonitorElement* d_HBrechitenergy;
00147   MonitorElement* d_HErechitenergy;
00148   MonitorElement* d_HOrechitenergy;
00149   MonitorElement* d_HFrechitenergy;
00150   MonitorElement* d_ZDCrechitenergy;
00151  
00152   MonitorElement* d_HBenergyVsNeighbor;
00153   MonitorElement* d_HEenergyVsNeighbor;
00154   MonitorElement* d_HOenergyVsNeighbor;
00155   MonitorElement* d_HFenergyVsNeighbor;
00156   MonitorElement* d_ZDCenergyVsNeighbor;
00157 
00158   std::vector<MonitorElement*> d_avgrechitenergymap;
00159   
00160   hotNeighborParams defaultNeighborParams_, HBNeighborParams_, HENeighborParams_, HONeighborParams_, HFNeighborParams_, ZDCNeighborParams_;
00161 };
00162 
00163 #endif

Generated on Tue Jun 9 17:32:57 2009 for CMSSW by  doxygen 1.5.4