CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/DQM/HcalMonitorTasks/src/HcalRecHitMonitor.cc

Go to the documentation of this file.
00001 #include "DQM/HcalMonitorTasks/interface/HcalRecHitMonitor.h"
00002 #include "FWCore/Framework/interface/LuminosityBlock.h"
00003 #include "FWCore/Common/interface/TriggerNames.h" 
00004 #include "CondFormats/HcalObjects/interface/HcalChannelStatus.h"
00005 #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
00006 
00007 #include "CalibCalorimetry/HcalAlgos/interface/HcalLogicalMapGenerator.h"
00008 #include "CondFormats/HcalObjects/interface/HcalLogicalMap.h"
00009 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalCaloFlagLabels.h"
00010 #include "DataFormats/Common/interface/TriggerResults.h"
00011 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00012 #include "Geometry/HcalTowerAlgo/src/HcalHardcodeGeometryData.h" // for eta bounds
00013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00014 #include <cmath>
00015 
00016 HcalRecHitMonitor::HcalRecHitMonitor(const edm::ParameterSet& ps)
00017 {
00018   // Common Base Class parameters
00019   Online_                = ps.getUntrackedParameter<bool>("online",false);
00020   mergeRuns_             = ps.getUntrackedParameter<bool>("mergeRuns",false);
00021   enableCleanup_         = ps.getUntrackedParameter<bool>("enableCleanup",false);
00022   debug_                 = ps.getUntrackedParameter<int>("debug",0);
00023   prefixME_              = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
00024   if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
00025     prefixME_.append("/");
00026   subdir_                = ps.getUntrackedParameter<std::string>("TaskFolder","RecHitMonitor_Hcal/"); 
00027   if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
00028     subdir_.append("/");
00029   subdir_=prefixME_+subdir_;
00030   AllowedCalibTypes_     = ps.getUntrackedParameter<std::vector<int> > ("AllowedCalibTypes");
00031   skipOutOfOrderLS_      = ps.getUntrackedParameter<bool>("skipOutOfOrderLS",false);
00032   NLumiBlocks_           = ps.getUntrackedParameter<int>("NLumiBlocks",4000);
00033   makeDiagnostics_       = ps.getUntrackedParameter<bool>("makeDiagnostics",false);
00034 
00035   hbheRechitLabel_       = ps.getUntrackedParameter<edm::InputTag>("hbheRechitLabel");
00036   hoRechitLabel_         = ps.getUntrackedParameter<edm::InputTag>("hoRechitLabel");
00037   hfRechitLabel_         = ps.getUntrackedParameter<edm::InputTag>("hfRechitLabel");
00038   l1gtLabel_             = ps.getUntrackedParameter<edm::InputTag>("L1GTLabel"); // should be l1GtUnpack
00039 
00040   hltresultsLabel_       = ps.getUntrackedParameter<edm::InputTag>("HLTResultsLabel");
00041   HcalHLTBits_           = ps.getUntrackedParameter<std::vector<std::string> >("HcalHLTBits");
00042   MinBiasHLTBits_        = ps.getUntrackedParameter<std::vector<std::string> >("MinBiasHLTBits");
00043 
00044   // energy/ET threshold plots also require that at least one MinBias trigger bit fires
00045   energyThreshold_       = ps.getUntrackedParameter<double>("energyThreshold",2);
00046   HBenergyThreshold_     = ps.getUntrackedParameter<double>("HB_energyThreshold",energyThreshold_);
00047   HEenergyThreshold_     = ps.getUntrackedParameter<double>("HE_energyThreshold",energyThreshold_);
00048   HOenergyThreshold_     = ps.getUntrackedParameter<double>("HO_energyThreshold",energyThreshold_);
00049   HFenergyThreshold_     = ps.getUntrackedParameter<double>("HF_energyThreshold",energyThreshold_);
00050   
00051   ETThreshold_       = ps.getUntrackedParameter<double>("ETThreshold",0);
00052   HBETThreshold_     = ps.getUntrackedParameter<double>("HB_ETThreshold",ETThreshold_);
00053   HEETThreshold_     = ps.getUntrackedParameter<double>("HE_ETThreshold",ETThreshold_);
00054   HOETThreshold_     = ps.getUntrackedParameter<double>("HO_ETThreshold",ETThreshold_);
00055   HFETThreshold_     = ps.getUntrackedParameter<double>("HF_ETThreshold",ETThreshold_);
00056 
00057   timediffThresh_    = ps.getUntrackedParameter<double>("collisiontimediffThresh",10.);
00058 
00059 } //constructor
00060 
00061 HcalRecHitMonitor::~HcalRecHitMonitor()
00062 {
00063 } //destructor
00064 
00065 
00066 /* ------------------------------------ */ 
00067 
00068 
00069 void HcalRecHitMonitor::setup()
00070 {
00071   HcalBaseDQMonitor::setup();
00072 
00073 
00074   if (debug_>0)
00075     std::cout <<"<HcalRecHitMonitor::setup>  Setting up histograms"<<std::endl;
00076 
00077   // Can we include this just in the setup, or do we need to get a new logical map with every run?
00078   HcalLogicalMapGenerator gen;
00079   logicalMap=new HcalLogicalMap(gen.createMap());
00080 
00081   // RecHit Monitor - specific cfg variables
00082 
00083   if (debug_>1)
00084     std::cout <<"<HcalRecHitMonitor::setup>  Creating Histograms"<<std::endl;
00085 
00086   dbe_->setCurrentFolder(subdir_);
00087   h_TriggeredEvents=dbe_->book1D("EventTriggers","EventTriggers",3,-0.5,2.5);
00088   h_TriggeredEvents->setBinLabel(1,"AllEvents");
00089   h_TriggeredEvents->setBinLabel(2,"HLT_Minbias");
00090   h_TriggeredEvents->setBinLabel(3,"HLT_Hcal");
00091 
00092   dbe_->setCurrentFolder(subdir_+"rechit_parameters");
00093   MonitorElement* THR;
00094   dbe_->setCurrentFolder(subdir_+"rechit_parameters/thresholds");
00095   THR=dbe_->bookFloat("HB_Rechit_Energy_Threshold");
00096   THR->Fill(HBenergyThreshold_);
00097   THR=dbe_->bookFloat("HE_Rechit_Energy_Threshold");
00098   THR->Fill(HEenergyThreshold_);
00099   THR=dbe_->bookFloat("HO_Rechit_Energy_Threshold");
00100   THR->Fill(HOenergyThreshold_);
00101   THR=dbe_->bookFloat("HF_Rechit_Energy_Threshold");
00102   THR->Fill(HFenergyThreshold_);
00103   THR=dbe_->bookFloat("HB_Rechit_ET_Threshold");
00104   THR->Fill(HBETThreshold_);
00105   THR=dbe_->bookFloat("HE_Rechit_ET_Threshold");
00106   THR->Fill(HEETThreshold_);
00107   THR=dbe_->bookFloat("HO_Rechit_ET_Threshold");
00108   THR->Fill(HOETThreshold_);
00109   THR=dbe_->bookFloat("HF_Rechit_ET_Threshold");
00110   THR->Fill(HFETThreshold_);
00111   THR=dbe_->bookFloat("Maximum_HFM_HFP_time_difference_for_luminosityplots");
00112   THR->Fill(timediffThresh_);
00113 
00114   
00115   // Set up histograms that are filled by all rechits
00116   dbe_->setCurrentFolder(subdir_+"Distributions_AllRecHits");
00117   SetupEtaPhiHists(OccupancyByDepth,"RecHit Occupancy","");
00118   h_rechitieta = dbe_->book1D("HcalRecHitIeta",
00119                               "Hcal RecHit ieta",
00120                               83,-41.5,41.5);
00121   h_rechitiphi = dbe_->book1D("HcalRecHitIphi",
00122                               "Hcal RecHit iphi",
00123                               72,0.5,72.5);
00124 
00125   h_rechitieta_05 = dbe_->book1D("HcalRecHitIeta05",
00126                                  "Hcal RecHit ieta E>0.5 GeV",
00127                                  83,-41.5,41.5);
00128   h_rechitiphi_05 = dbe_->book1D("HcalRecHitIphi05",
00129                                  "Hcal RecHit iphi E>0.5 GeV",
00130                                  72,0.5,72.5);
00131   h_rechitieta_10 = dbe_->book1D("HcalRecHitIeta10",
00132                                  "Hcal RecHit ieta E>1.0 GeV",
00133                                  83,-41.5,41.5);
00134   h_rechitiphi_10 = dbe_->book1D("HcalRecHitIphi10",
00135                                  "Hcal RecHit iphi E>1.0 GeV",
00136                                  72,0.5,72.5);
00137   h_rechitieta_25 = dbe_->book1D("HcalRecHitIeta25",
00138                                  "Hcal RecHit ieta E>2.5 GeV",
00139                                  83,-41.5,41.5);
00140   h_rechitiphi_25 = dbe_->book1D("HcalRecHitIphi25",
00141                                  "Hcal RecHit iphi E>2.5 GeV",
00142                                  72,0.5,72.5);
00143   h_rechitieta_100 = dbe_->book1D("HcalRecHitIeta100",
00144                                   "Hcal RecHit ieta E>10.0 GeV",
00145                                   83,-41.5,41.5);
00146   h_rechitiphi_100 = dbe_->book1D("HcalRecHitIphi100",
00147                                   "Hcal RecHit iphi E>10.0 GeV",
00148                                   72,0.5,72.5);
00149 
00150 
00151 
00152   h_LumiPlot_LS_allevents = dbe_->book1D("AllEventsPerLS",
00153                                          "LS # of all events",
00154                                          NLumiBlocks_,0.5,NLumiBlocks_+0.5);
00155   h_LumiPlot_BX_allevents = dbe_->book1D("BX_allevents",
00156                                          "BX # of all events",
00157                                          3600,0,3600);
00158   h_LumiPlot_MinTime_vs_MinHT = dbe_->book2D("MinTime_vs_MinSumET",
00159                                              "Energy-Weighted Time vs Min (HF+,HF-) Scalar Sum ET;min Sum ET(GeV);time(ns)",
00160                                              100,0,10,80,-40,40);
00161 
00162   h_LumiPlot_timeHT_HFM = dbe_->book2D("HFM_Time_vs_SumET",
00163                                        "Energy-Weighted Time vs HFMinus Scalar Sum ET;Sum ET(GeV);time(ns)",
00164                                        100,0,10,80,-40,40);
00165   
00166   h_LumiPlot_timeHT_HFP = dbe_->book2D("HFP_Time_vs_SumET",
00167                                        "Energy-Weighted Time vs HFPlus Scalar Sum ET;Sum ET(GeV);time(ns)",
00168                                        100,0,10,80,-40,40);
00169 
00170 
00171   dbe_->setCurrentFolder(subdir_+"Distributions_AllRecHits/sumplots");
00172   SetupEtaPhiHists(SumEnergyByDepth,"RecHit Summed Energy","GeV");
00173   SetupEtaPhiHists(SqrtSumEnergy2ByDepth,"RecHit Sqrt Summed Energy2","GeV");
00174   SetupEtaPhiHists(SumTimeByDepth,"RecHit Summed Time","nS");
00175 
00176   // Histograms for events that passed MinBias triggers
00177   dbe_->setCurrentFolder(subdir_+"Distributions_PassedMinBias");
00178 
00179   h_HBP_weightedTime = dbe_->book1D("WeightedTime_HBP","Weighted Time for HBP",
00180                                     300,-150,150);
00181   h_HBM_weightedTime = dbe_->book1D("WeightedTime_HBM","Weighted Time for HBM",
00182                                     300,-150,150);
00183   h_HEP_weightedTime = dbe_->book1D("WeightedTime_HEP","Weighted Time for HEP",
00184                                     300,-150,150);
00185   h_HEM_weightedTime = dbe_->book1D("WeightedTime_HEM","Weighted Time for HEM",
00186                                     300,-150,150);
00187   h_HFP_weightedTime = dbe_->book1D("WeightedTime_HFP","Weighted Time for HFP",
00188                                     300,-150,150);
00189   h_HFM_weightedTime = dbe_->book1D("WeightedTime_HFM","Weighted Time for HFM",
00190                                     300,-150,150);
00191 
00192   h_HFtimedifference = dbe_->book1D("HFweightedtimeDifference",
00193                                     "Energy-Weighted time difference between HF+ and HF- passing MinBias (no HT cut)",
00194                                     251,-250.5,250.5);
00195   h_HEtimedifference = dbe_->book1D("HEweightedtimeDifference",
00196                                     "Energy-Weighted time difference between HE+ and HE- passing MinBias (no HT cut)",
00197                                     251,-250.5,250.5);
00198   
00199   HFP_HFM_Energy = dbe_->book2D("HFP_HFM_Energy",
00200                                 "HFP VS HFM Energy; Total Energy in HFMinus (TeV); Total Energy in HFPlus (TeV)",
00201                                 100,0,100, 100,0,100);
00202   
00203   // Would these work better as 2D plots?
00204   h_HFenergydifference = dbe_->book1D("HFenergyDifference",
00205                                       "Sum(E_HFPlus - E_HFMinus)/Sum(E_HFPlus + E_HFMinus)",
00206                                       200,-1,1);
00207   h_HEenergydifference = dbe_->book1D("HEenergyDifference",
00208                                       "Sum(E_HEPlus - E_HEMinus)/Sum(E_HEPlus + E_HEMinus)",
00209                                       200,-1,1);
00210 
00211   h_LumiPlot_LS_MinBiasEvents=dbe_->book1D("MinBiasEventsPerLS",
00212                                            "Number of MinBias Events vs LS (HT cut and HFM-HFP time cut)",
00213                                            NLumiBlocks_/10,0.5,NLumiBlocks_+0.5); 
00214   h_LumiPlot_LS_MinBiasEvents_notimecut=dbe_->book1D("MinBiasEventsPerLS_notimecut",
00215                                                      "Number of Events with MinBias vs LS (HFM,HFP HT>1,no time cut)",
00216                                                      NLumiBlocks_/10,0.5,NLumiBlocks_+0.5); 
00217 
00218   h_LumiPlot_SumHT_HFPlus_vs_HFMinus = dbe_->book2D("SumHT_plus_minus",
00219                                                     "HF+ Sum HT vs HF- Sum HT",60,0,30,60,0,30);
00220   h_LumiPlot_SumEnergy_HFPlus_vs_HFMinus = dbe_->book2D("SumEnergy_plus_minus",
00221                                                         "HF+ Sum Energy  vs HF- Sum Energy",
00222                                                         60,0,150,60,0,150);
00223   h_LumiPlot_timeHFPlus_vs_timeHFMinus = dbe_->book2D("timeHFplus_vs_timeHFminus",
00224                                                       "Energy-weighted time average of HF+ vs HF-",
00225                                                       60,-60,60,60,-60,60);
00226   h_LumiPlot_BX_MinBiasEvents = dbe_->book1D("BX_MinBias_Events_TimeCut",
00227                                           "BX # of MinBias events (HFM & HFP HT>1 & HFM-HFP time cut)",
00228                                           3600,0,3600);
00229   h_LumiPlot_BX_MinBiasEvents_notimecut = dbe_->book1D("BX_MinBias_Events_notimecut",
00230                                                        "BX # of MinBias events (HFM,HFP HT>1, no time cut)",
00231                                                        3600,0,3600);
00232   // threshold plots must pass MinBias Trigger
00233   SetupEtaPhiHists(OccupancyThreshByDepth,"Above Threshold RecHit Occupancy","");
00234   h_rechitieta_thresh = dbe_->book1D("HcalRecHitIeta_thresh",
00235                               "Hcal RecHit ieta above energy and ET threshold",
00236                               83,-41.5,41.5);
00237   h_rechitiphi_thresh = dbe_->book1D("HcalRecHitIphi_thresh",
00238                               "Hcal RecHit iphi above energy and ET threshold",
00239                               72,0.5,72.5);
00240 
00241   dbe_->setCurrentFolder(subdir_+"Distributions_PassedMinBias/sumplots");
00242   SetupEtaPhiHists(SumEnergyThreshByDepth,"Above Threshold RecHit Summed Energy","GeV");
00243   SetupEtaPhiHists(SumTimeThreshByDepth,"Above Threshold RecHit Summed Time","nS");
00244   SetupEtaPhiHists(SqrtSumEnergy2ThreshByDepth,"Above Threshold RecHit Sqrt Summed Energy2","GeV");
00245 
00246   dbe_->setCurrentFolder(subdir_+"Distributions_PassedMinBias/rechit_1D_plots");
00247   h_HBThreshTime=dbe_->book1D("HB_time_thresh", 
00248                               "HB RecHit Time Above Threshold",
00249                               int(RECHITMON_TIME_MAX-RECHITMON_TIME_MIN),RECHITMON_TIME_MIN,RECHITMON_TIME_MAX);
00250   h_HBThreshOccupancy=dbe_->book1D("HB_occupancy_thresh",
00251                                    "HB RecHit Occupancy Above Threshold",260,-0.5,2599.5);
00252   h_HEThreshTime=dbe_->book1D("HE_time_thresh", 
00253                               "HE RecHit Time Above Threshold",
00254                               int(RECHITMON_TIME_MAX-RECHITMON_TIME_MIN),RECHITMON_TIME_MIN,RECHITMON_TIME_MAX);
00255   h_HEThreshOccupancy=dbe_->book1D("HE_occupancy_thresh",
00256                                    "HE RecHit Occupancy Above Threshold",260,-0.5,2599.5);
00257   h_HOThreshTime=dbe_->book1D("HO_time_thresh", 
00258                               "HO RecHit Time Above Threshold",
00259                               int(RECHITMON_TIME_MAX-RECHITMON_TIME_MIN),RECHITMON_TIME_MIN,RECHITMON_TIME_MAX);
00260   h_HOThreshOccupancy=dbe_->book1D("HO_occupancy_thresh",
00261                                    "HO RecHit Occupancy Above Threshold",217,-0.5,2169.5);
00262   h_HFThreshTime=dbe_->book1D("HF_time_thresh", 
00263                               "HF RecHit Time Above Threshold",
00264                               int(RECHITMON_TIME_MAX-RECHITMON_TIME_MIN),RECHITMON_TIME_MIN,RECHITMON_TIME_MAX);
00265   h_HFThreshOccupancy=dbe_->book1D("HF_occupancy_thresh",
00266                                    "HF RecHit Occupancy Above Threshold",
00267                                    173,-0.5,1729.5);
00268 
00269   // Histograms for events that did passed Hcal-specfied HLT triggers
00270   dbe_->setCurrentFolder(subdir_+"Distributions_PassedHcalHLTriggers");
00271   
00272   h_LumiPlot_BX_HcalHLTEvents = dbe_->book1D("BX_HcalHLT_Events_TimeCut",
00273                                           "BX # of HcalHLT events (HFM & HFP HT>1 & HFM-HFP time cut)",
00274                                           3600,0,3600);
00275   h_LumiPlot_BX_HcalHLTEvents_notimecut = dbe_->book1D("BX_HcalHLT_Events_notimecut",
00276                                                        "BX # of HcalHLT events (HFM,HFP HT>1, no time cut)",
00277                                                        3600,0,3600);
00278   h_LumiPlot_LS_HcalHLTEvents=dbe_->book1D("HcalHLTEventsPerLS",
00279                                            "Number of HcalHLT Events vs LS (HT cut and HFM-HFP time cut)",
00280                                            NLumiBlocks_/10,0.5,NLumiBlocks_+0.5); 
00281   h_LumiPlot_LS_HcalHLTEvents_notimecut=dbe_->book1D("HcalHLTEventsPerLS_notimecut",
00282                                                      "Number of Events with HcalHLT vs LS (HFM,HFP HT>1,no time cut)",
00283                                                      NLumiBlocks_/10,0.5,NLumiBlocks_+0.5); 
00284   
00285 
00286   dbe_->setCurrentFolder(subdir_+"Distributions_PassedHcalHLTriggers/");
00287   h_HF_HcalHLT_weightedtimedifference = dbe_->book1D("HF_HcalHLT_weightedtimeDifference",
00288                                              "Energy-Weighted time difference between HF+ and HF- Hcal HLT",
00289                                              251,-250.5,250.5);
00290   h_HE_HcalHLT_weightedtimedifference = dbe_->book1D("HE_HcalHLT_weightedtimeDifference",
00291                                              "Energy-Weighted time difference between HE+ and HE- Hcal HLT",
00292                                              251,-250.5,250.5);
00293   h_HF_HcalHLT_energydifference = dbe_->book1D("HF_HcalHLT_energyDifference",
00294                                              "Sum(E_HFPlus - E_HFMinus)/Sum(E_HFPlus + E_HFMinus)",
00295                                              200,-1,1);
00296   h_HE_HcalHLT_energydifference = dbe_->book1D("HE_HcalHLT_energyDifference",
00297                                              "Sum(E_HEPlus - E_HEMinus)/Sum(E_HEPlus + E_HEMinus)",
00298                                              200,-1,1);
00299 
00300   // Do we want separate directories for Minbias, other flags at some point?
00301   dbe_->setCurrentFolder(subdir_+"AnomalousCellFlags");// HB Flag Histograms
00302 
00303 
00304   h_HFLongShort_vs_LS=dbe_->book1D("HFLongShort_vs_LS",
00305                                    "HFLongShort Flags vs Lumi Section",
00306                                    NLumiBlocks_/10,0.5,0.5+NLumiBlocks_);
00307   h_HFDigiTime_vs_LS=dbe_->book1D("HFDigiTime_vs_LS",
00308                                   "HFDigiTime Flags vs Lumi Section",
00309                                   NLumiBlocks_/10,0.5,0.5+NLumiBlocks_);
00310   h_HBHEHPDMult_vs_LS=dbe_->book1D("HBHEHPDMult_vs_LS",
00311                                    "HBHEHPDMult Flags vs Lumi Section",
00312                                    NLumiBlocks_/10,0.5,0.5+NLumiBlocks_);
00313   h_HBHEPulseShape_vs_LS=dbe_->book1D("HBHEPulseShape_vs_LS",
00314                                       "HBHEPulseShape Flags vs Lumi Section",
00315                                       NLumiBlocks_/10,0.5,0.5+NLumiBlocks_);
00316 
00317   h_HF_FlagCorr=dbe_->book2D("HF_FlagCorrelation",
00318                              "HF LongShort vs. DigiTime flags; DigiTime; LongShort", 
00319                              2,-0.5,1.5,2,-0.5,1.5);
00320   h_HF_FlagCorr->setBinLabel(1,"OFF",1);
00321   h_HF_FlagCorr->setBinLabel(2,"ON",1);
00322   h_HF_FlagCorr->setBinLabel(1,"OFF",2);
00323   h_HF_FlagCorr->setBinLabel(2,"ON",2);
00324 
00325   h_HBHE_FlagCorr=dbe_->book2D("HBHE_FlagCorrelation",
00326                                "HBHE HpdHitMultiplicity vs. PulseShape flags; PulseShape; HpdHitMultiplicity", 
00327                                2,-0.5,1.5,2,-0.5,1.5);
00328   h_HBHE_FlagCorr->setBinLabel(1,"OFF",1);
00329   h_HBHE_FlagCorr->setBinLabel(2,"ON",1);
00330   h_HBHE_FlagCorr->setBinLabel(1,"OFF",2);
00331   h_HBHE_FlagCorr->setBinLabel(2,"ON",2);
00332 
00333   h_FlagMap_HPDMULT=dbe_->book2D("FlagMap_HPDMULT",
00334                                  "RBX Map of HBHEHpdHitMultiplicity Flags;RBX;RM",
00335                                   72,-0.5,71.5,4,0.5,4.5);
00336   h_FlagMap_PULSESHAPE=dbe_->book2D("FlagMap_PULSESHAPE",
00337                                     "RBX Map of HBHEPulseShape Flags;RBX;RM",
00338                                   72,-0.5,71.5,4,0.5,4.5);
00339   h_FlagMap_DIGITIME=dbe_->book2D("FlagMap_DIGITIME",
00340                                   "RBX Map of HFDigiTime Flags;RBX;RM",
00341                                   24,131.5,155.5,4,0.5,4.5);
00342   h_FlagMap_LONGSHORT=dbe_->book2D("FlagMap_LONGSHORT",
00343                                    "RBX Map of HFLongShort Flags;RBX;RM",
00344                                    24,131.5,155.5,4,0.5,4.5);
00345 
00346   h_FlagMap_TIMEADD=dbe_->book2D("FlagMap_TIMEADD",
00347                                  "RBX Map of Timing Added Flags;RBX;RM",
00348                                    156,-0.5,155.5,4,0.5,4.5);
00349   h_FlagMap_TIMESUBTRACT=dbe_->book2D("FlagMap_TIMESUBTRACT",
00350                                       "RBX Map of Timing Subtracted Flags;RBX;RM",
00351                                    156,-0.5,155.5,4,0.5,4.5);
00352   h_FlagMap_TIMEERROR=dbe_->book2D("FlagMap_TIMEERROR",
00353                                    "RBX Map of Timing Error Flags;RBX;RM",
00354                                    156,-0.5,155.5,4,0.5,4.5);
00355 
00356   h_HBflagcounter=dbe_->book1D("HBflags","HB flags",32,-0.5,31.5);
00357   h_HBflagcounter->setBinLabel(1+HcalCaloFlagLabels::HBHEHpdHitMultiplicity, "HpdHitMult",1);
00358   h_HBflagcounter->setBinLabel(1+HcalCaloFlagLabels::HBHEPulseShape, "PulseShape",1);
00359   h_HBflagcounter->setBinLabel(1+HcalCaloFlagLabels::HSCP_R1R2, "HSCP R1R2",1);
00360   h_HBflagcounter->setBinLabel(1+HcalCaloFlagLabels::HSCP_FracLeader, "HSCP FracLeader",1);
00361   h_HBflagcounter->setBinLabel(1+HcalCaloFlagLabels::HSCP_OuterEnergy, "HSCP OuterEnergy",1);
00362   h_HBflagcounter->setBinLabel(1+HcalCaloFlagLabels::HSCP_ExpFit, "HSCP ExpFit",1);
00363   // 2-bit timing counter
00364   h_HBflagcounter->setBinLabel(1+HcalCaloFlagLabels::HBHETimingTrustBits,"TimingTrust1",1);
00365   h_HBflagcounter->setBinLabel(2+HcalCaloFlagLabels::HBHETimingTrustBits,"TimingTrust2",1);
00366   //3-bit timing shape cut
00367   h_HBflagcounter->setBinLabel(1+HcalCaloFlagLabels::HBHETimingShapedCutsBits,"TimingShape1",1);
00368   h_HBflagcounter->setBinLabel(2+HcalCaloFlagLabels::HBHETimingShapedCutsBits,"TimingShape2",1);
00369   h_HBflagcounter->setBinLabel(3+HcalCaloFlagLabels::HBHETimingShapedCutsBits,"TimingShape3",1);
00370 
00371   // common flags
00372   h_HBflagcounter->setBinLabel(1+HcalCaloFlagLabels::TimingSubtractedBit, "Subtracted",1);
00373   h_HBflagcounter->setBinLabel(1+HcalCaloFlagLabels::TimingAddedBit, "Added",1);
00374   h_HBflagcounter->setBinLabel(1+HcalCaloFlagLabels::TimingErrorBit, "TimingError",1);
00375   h_HBflagcounter->setBinLabel(1+HcalCaloFlagLabels::ADCSaturationBit, "Saturation",1);
00376   h_HBflagcounter->setBinLabel(1+HcalCaloFlagLabels::Fraction2TS,"Frac2TS",1);
00377 
00378   // HE Flag Histograms
00379   h_HEflagcounter=dbe_->book1D("HEflags","HE flags",32,-0.5,31.5);
00380   h_HEflagcounter->setBinLabel(1+HcalCaloFlagLabels::HBHEHpdHitMultiplicity, "HpdHitMult",1);
00381   h_HEflagcounter->setBinLabel(1+HcalCaloFlagLabels::HBHEPulseShape, "PulseShape",1);
00382   h_HEflagcounter->setBinLabel(1+HcalCaloFlagLabels::HSCP_R1R2, "HSCP R1R2",1);
00383   h_HEflagcounter->setBinLabel(1+HcalCaloFlagLabels::HSCP_FracLeader, "HSCP FracLeader",1);
00384   h_HEflagcounter->setBinLabel(1+HcalCaloFlagLabels::HSCP_OuterEnergy, "HSCP OuterEnergy",1);
00385   h_HEflagcounter->setBinLabel(1+HcalCaloFlagLabels::HSCP_ExpFit, "HSCP ExpFit",1);
00386   // 2-bit timing counter
00387   h_HEflagcounter->setBinLabel(1+HcalCaloFlagLabels::HBHETimingTrustBits,"TimingTrust1",1);
00388   h_HEflagcounter->setBinLabel(2+HcalCaloFlagLabels::HBHETimingTrustBits,"TimingTrust2",1);
00389   //3-bit timing shape cut
00390   h_HEflagcounter->setBinLabel(1+HcalCaloFlagLabels::HBHETimingShapedCutsBits,"TimingShape1",1);
00391   h_HEflagcounter->setBinLabel(2+HcalCaloFlagLabels::HBHETimingShapedCutsBits,"TimingShape2",1);
00392   h_HEflagcounter->setBinLabel(3+HcalCaloFlagLabels::HBHETimingShapedCutsBits,"TimingShape3",1);
00393   h_HEflagcounter->setBinLabel(1+HcalCaloFlagLabels::TimingSubtractedBit, "Subtracted",1);
00394   h_HEflagcounter->setBinLabel(1+HcalCaloFlagLabels::TimingAddedBit, "Added",1);
00395   h_HEflagcounter->setBinLabel(1+HcalCaloFlagLabels::TimingErrorBit, "TimingError",1);
00396   h_HEflagcounter->setBinLabel(1+HcalCaloFlagLabels::ADCSaturationBit, "Saturation",1);
00397   h_HEflagcounter->setBinLabel(1+HcalCaloFlagLabels::Fraction2TS,"Frac2TS",1);
00398 
00399   // HO Flag Histograms
00400   h_HOflagcounter=dbe_->book1D("HOflags","HO flags",32,-0.5,31.5);
00401   h_HOflagcounter->setBinLabel(1+HcalCaloFlagLabels::TimingSubtractedBit, "Subtracted",1);
00402   h_HOflagcounter->setBinLabel(1+HcalCaloFlagLabels::TimingAddedBit, "Added",1);
00403   h_HOflagcounter->setBinLabel(1+HcalCaloFlagLabels::TimingErrorBit, "TimingError",1);
00404   h_HOflagcounter->setBinLabel(1+HcalCaloFlagLabels::ADCSaturationBit, "Saturation",1);
00405   h_HOflagcounter->setBinLabel(1+HcalCaloFlagLabels::Fraction2TS,"Frac2TS",1);
00406 
00407   // HF Flag Histograms
00408   h_HFflagcounter=dbe_->book1D("HFflags","HF flags",32,-0.5,31.5);
00409   h_HFflagcounter->setBinLabel(1+HcalCaloFlagLabels::HFLongShort, "LongShort",1);
00410   h_HFflagcounter->setBinLabel(1+HcalCaloFlagLabels::HFDigiTime, "DigiTime",1);
00411   h_HFflagcounter->setBinLabel(1+HcalCaloFlagLabels::HFTimingTrustBits,"TimingTrust1",1);
00412   h_HFflagcounter->setBinLabel(1+HcalCaloFlagLabels::TimingSubtractedBit, "Subtracted",1);
00413   h_HFflagcounter->setBinLabel(1+HcalCaloFlagLabels::TimingAddedBit, "Added",1);
00414   h_HFflagcounter->setBinLabel(1+HcalCaloFlagLabels::TimingErrorBit, "TimingError",1);
00415   h_HFflagcounter->setBinLabel(1+HcalCaloFlagLabels::ADCSaturationBit, "Saturation",1);
00416   h_HFflagcounter->setBinLabel(1+HcalCaloFlagLabels::Fraction2TS,"Frac2TS",1);
00417 
00418   h_HBflagcounter->getTH1F()->LabelsOption("v");
00419   h_HEflagcounter->getTH1F()->LabelsOption("v");
00420   h_HOflagcounter->getTH1F()->LabelsOption("v");
00421   h_HFflagcounter->getTH1F()->LabelsOption("v");
00422 
00423 
00424   // Diagnostic plots are currently filled for all rechits (no trigger/threshold requirement)
00425   // hb
00426   dbe_->setCurrentFolder(subdir_+"diagnostics/hb");
00427   
00428   h_HBTimeVsEnergy=dbe_->book2D("HBTimeVsEnergy","HB Time Vs Energy (All RecHits);Energy (GeV); time(nS)",100,0,500,40,-100,100);
00429 
00430   h_HBsizeVsLS=dbe_->bookProfile("HBRecHitsVsLB","HB RecHits vs Luminosity Block",
00431                                  NLumiBlocks_,0.5,NLumiBlocks_+0.5,
00432                                  100,0,10000);
00433 
00434   h_HBTime=dbe_->book1D("HB_time","HB RecHit Time",
00435                         int(RECHITMON_TIME_MAX-RECHITMON_TIME_MIN),RECHITMON_TIME_MIN,RECHITMON_TIME_MAX);
00436   h_HBOccupancy=dbe_->book1D("HB_occupancy",
00437                              "HB RecHit Occupancy",260,-0.5,2599.5);
00438   
00439   //he
00440   dbe_->setCurrentFolder(subdir_+"diagnostics/he");
00441 
00442   h_HETimeVsEnergy=dbe_->book2D("HETimeVsEnergy","HE Time Vs Energy (All RecHits);Energy (GeV); time(nS)",100,0,500,40,-100,100);
00443 
00444   h_HEsizeVsLS=dbe_->bookProfile("HERecHitsVsLB","HE RecHits vs Luminosity Block",
00445                                  NLumiBlocks_,0.5,NLumiBlocks_+0.5,
00446                                  100,0,10000);
00447         
00448   h_HETime=dbe_->book1D("HE_time","HE RecHit Time",
00449                         int(RECHITMON_TIME_MAX-RECHITMON_TIME_MIN),RECHITMON_TIME_MIN,RECHITMON_TIME_MAX);
00450   h_HEOccupancy=dbe_->book1D("HE_occupancy","HE RecHit Occupancy",260,-0.5,2599.5);
00451    
00452   // ho
00453   dbe_->setCurrentFolder(subdir_+"diagnostics/ho");     
00454 
00455   h_HOTimeVsEnergy=dbe_->book2D("HOTimeVsEnergy","HO Time Vs Energy (All RecHits);Energy (GeV); time(nS)",100,0,500,40,-100,100);
00456 
00457   h_HOsizeVsLS=dbe_->bookProfile("HORecHitsVsLB","HO RecHits vs Luminosity Block",
00458                                  NLumiBlocks_,0.5,NLumiBlocks_+0.5,
00459                                  100,0,10000);
00460   h_HOTime=dbe_->book1D("HO_time",
00461                         "HO RecHit Time",
00462                         int(RECHITMON_TIME_MAX-RECHITMON_TIME_MIN),RECHITMON_TIME_MIN,RECHITMON_TIME_MAX);
00463   h_HOOccupancy=dbe_->book1D("HO_occupancy",
00464                              "HO RecHit Occupancy",217,-0.5,2169.5);
00465   
00466   // hf
00467   dbe_->setCurrentFolder(subdir_+"diagnostics/hf");
00468 
00469   h_HFTimeVsEnergy=dbe_->book2D("HFTimeVsEnergy","HF Time Vs Energy (All RecHits);Energy (GeV); time(nS)",100,0,500,40,-100,100);
00470 
00471   h_HFsizeVsLS=dbe_->bookProfile("HFRecHitsVsLB",
00472                                  "HF RecHits vs Luminosity Block",
00473                                  NLumiBlocks_,0.5,NLumiBlocks_+0.5,
00474                                  100, 0,10000); 
00475   h_HFTime=dbe_->book1D("HF_time","HF RecHit Time",
00476                         int(RECHITMON_TIME_MAX-RECHITMON_TIME_MIN),RECHITMON_TIME_MIN,RECHITMON_TIME_MAX);
00477   h_HFOccupancy=dbe_->book1D("HF_occupancy","HF RecHit Occupancy",173,-0.5,1729.5);
00478 
00479   // clear all counters, reset histograms
00480   this->zeroCounters();
00481   this->reset();
00482 
00483   return;
00484 } //void HcalRecHitMonitor::setup(...)
00485 
00486 void HcalRecHitMonitor::beginRun(const edm::Run& run, const edm::EventSetup& c)
00487 {
00488 
00489   if (debug_>0) std::cout <<"HcalRecHitMonitor::beginRun():  task =  '"<<subdir_<<"'"<<std::endl;
00490   HcalBaseDQMonitor::beginRun(run, c);
00491   if (tevt_==0) // create histograms, if they haven't been created already
00492     this->setup();
00493   // Clear histograms at the start of each run if not merging runs
00494   if (mergeRuns_==false)
00495     this->reset();
00496 
00497   if (tevt_!=0) return;
00498   // create histograms displaying trigger parameters?  Specify names?
00499   dbe_->setCurrentFolder(subdir_+"rechit_parameters");
00500   std::string tnames="";
00501   if (HcalHLTBits_.size()>0)
00502     tnames=HcalHLTBits_[0];
00503   for (unsigned int i=1;i<HcalHLTBits_.size();++i)
00504     tnames=tnames + " OR " + HcalHLTBits_[i];
00505   dbe_->bookString("HcalHLTriggerRequirements",tnames);
00506   tnames="";
00507   if (MinBiasHLTBits_.size()>0)
00508     tnames=MinBiasHLTBits_[0];
00509   for (unsigned int i=1;i<MinBiasHLTBits_.size();++i)
00510     tnames=tnames + " OR " + MinBiasHLTBits_[i];
00511   dbe_->bookString("MinBiasHLTriggerRequirements",tnames);
00512   return;
00513   
00514 } //void HcalRecHitMonitor::beginRun(...)
00515 
00516 
00517 void HcalRecHitMonitor::endRun(const edm::Run& run, const edm::EventSetup& c)
00518 {
00519   if (debug_>0) std::cout <<"HcalRecHitMonitor::endRun():  task =  '"<<subdir_<<"'"<<std::endl;
00520 
00521   //Any special fill calls needed?  Shouldn't be necessary; last endLuminosityBlock should do necessary fills
00522 } // void HcalRecHitMonitor::endrun(...)
00523 
00524 
00525 /* --------------------------- */
00526 
00527 void HcalRecHitMonitor::reset()
00528 {
00529   std::vector<MonitorElement*> hists = dbe_->getAllContents(subdir_);
00530   for (unsigned int i=0;i<hists.size();++i)
00531     {
00532       if (hists[i]->kind()==MonitorElement::DQM_KIND_TH1F ||
00533           hists[i]->kind()==MonitorElement::DQM_KIND_TH2F ||
00534           hists[i]->kind()==MonitorElement::DQM_KIND_TPROFILE)
00535         hists[i]->Reset();
00536     }
00537 }  
00538 
00539 void HcalRecHitMonitor::endJob()
00540 {
00541   if (!enableCleanup_) return;
00542   HcalBaseDQMonitor::cleanup();
00543   this->cleanup();
00544 }
00545 
00546 
00547 /* --------------------------------- */
00548 
00549 void HcalRecHitMonitor::cleanup()
00550 {
00551   //Add code to clean out subdirectories
00552   if (!enableCleanup_) return;
00553   if (dbe_)
00554     {
00555       dbe_->setCurrentFolder(subdir_); dbe_->removeContents();
00556       dbe_->setCurrentFolder(subdir_+"rechit_parameters"); dbe_->removeContents();
00557       dbe_->setCurrentFolder(subdir_+"rechit_parameters/thresholds"); dbe_->removeContents();
00558       dbe_->setCurrentFolder(subdir_+"Distributions_AllRecHits"); dbe_->removeContents();
00559       dbe_->setCurrentFolder(subdir_+"Distributions_AllRecHits/sumplots"); dbe_->removeContents();
00560       dbe_->setCurrentFolder(subdir_+"Distributions_PassedMinBias"); dbe_->removeContents();
00561       dbe_->setCurrentFolder(subdir_+"Distributions_PassedMinBias/sumplots"); dbe_->removeContents();
00562       dbe_->setCurrentFolder(subdir_+"Distributions_PassedHcalHLTriggers"); dbe_->removeContents();
00563       dbe_->setCurrentFolder(subdir_+"Distributions_PassedHcalHLTriggers/passedTechTriggers/"); dbe_->removeContents();
00564 
00565       dbe_->setCurrentFolder(subdir_+"AnomalousCellFlags"); dbe_->removeContents();
00566       dbe_->setCurrentFolder(subdir_+"diagnostics/hb"); dbe_->removeContents();
00567       dbe_->setCurrentFolder(subdir_+"diagnostics/he"); dbe_->removeContents();
00568       dbe_->setCurrentFolder(subdir_+"diagnostics/ho"); dbe_->removeContents();
00569       dbe_->setCurrentFolder(subdir_+"diagnostics/hf"); dbe_->removeContents();
00570     }
00571   return;
00572 } // void HcalRecHitMonitor::cleanup()
00573 
00574 /* -------------------------------- */
00575 
00576 void HcalRecHitMonitor::analyze(edm::Event const&e, edm::EventSetup const&s)
00577 {
00578   if (debug_>0)  std::cout <<"HcalRecHitMonitor::analyze; debug = "<<debug_<<std::endl;
00579 
00580   if (!IsAllowedCalibType()) return;
00581   if (LumiInOrder(e.luminosityBlock())==false) return;
00582 
00583   // Get objects
00584   edm::Handle<HBHERecHitCollection> hbhe_rechit;
00585   edm::Handle<HORecHitCollection> ho_rechit;
00586   edm::Handle<HFRecHitCollection> hf_rechit;
00587 
00588   if (!(e.getByLabel(hbheRechitLabel_,hbhe_rechit)))
00589     {
00590       edm::LogWarning("HcalHotCellMonitor")<< hbheRechitLabel_<<" hbhe_rechit not available";
00591       return;
00592     }
00593 
00594   if (!(e.getByLabel(hfRechitLabel_,hf_rechit)))
00595     {
00596       edm::LogWarning("HcalHotCellMonitor")<< hfRechitLabel_<<" hf_rechit not available";
00597       return;
00598     }
00599   
00600   if (!(e.getByLabel(hoRechitLabel_,ho_rechit)))
00601     {
00602       edm::LogWarning("HcalHotCellMonitor")<< hoRechitLabel_<<" ho_rechit not available";
00603       return;
00604     }
00605 
00606 
00607   h_LumiPlot_LS_allevents->Fill(currentLS);
00608   h_LumiPlot_BX_allevents->Fill(e.bunchCrossing());
00609   processEvent(*hbhe_rechit, *ho_rechit, *hf_rechit, e.bunchCrossing(), e);
00610 
00611   HcalBaseDQMonitor::analyze(e,s);
00612 } // void HcalRecHitMonitor::analyze()
00613 
00614 
00615 void HcalRecHitMonitor::processEvent(const HBHERecHitCollection& hbHits,
00616                                      const HORecHitCollection& hoHits,
00617                                      const HFRecHitCollection& hfHits,
00618                                      int BCN,
00619                                      const edm::Event & iEvent
00620                                      )
00621 {
00622 
00623   
00624   if (debug_>1) std::cout <<"<HcalRecHitMonitor::processEvent> Processing event..."<<std::endl;
00625 
00626 
00627   bool passedHcalHLT=false;
00628   bool passedMinBiasHLT=false;
00629 
00630   edm::Handle<edm::TriggerResults> hltRes;
00631   if (!(iEvent.getByLabel(hltresultsLabel_,hltRes)))
00632     {
00633       if (debug_>0) edm::LogWarning("HcalRecHitMonitor")<<" Could not get HLT results with tag "<<hltresultsLabel_<<std::endl;
00634     }
00635   else
00636     {
00637       const edm::TriggerNames & triggerNames = iEvent.triggerNames(*hltRes);
00638       const unsigned int nTrig(triggerNames.size());
00639       for (unsigned int i=0;i<nTrig;++i)
00640         {
00641           // trigger decision is based on 'OR' of any specified trigger names
00642           for (unsigned int k=0;k<HcalHLTBits_.size();++k)
00643             {
00644               // if (triggerNames.triggerName(i)==HcalHLTBits_[k] && hltRes->accept(i))
00645               if (triggerNames.triggerName(i).find(HcalHLTBits_[k])!=std::string::npos && hltRes->accept(i))
00646                 { 
00647                   passedHcalHLT=true;
00648                   break;
00649                 }
00650             }
00651           // repeat for minbias triggers
00652           for (unsigned int k=0;k<MinBiasHLTBits_.size();++k)
00653             {
00654               // if (triggerNames.triggerName(i)==MinBiasHLTBits_[k] && hltRes->accept(i))              
00655               if (triggerNames.triggerName(i).find(MinBiasHLTBits_[k])!=std::string::npos && hltRes->accept(i))
00656                 { 
00657                   passedMinBiasHLT=true;
00658                   break;
00659                 }
00660             }
00661         }
00662     } //else
00663 
00664   if (debug_>2 && passedHcalHLT)  std::cout <<"\t<HcalRecHitMonitor::processEvent>  Passed Hcal HLT trigger  "<<std::endl;
00665   if (debug_>2 && passedMinBiasHLT)  std::cout <<"\t<HcalRecHitMonitor::processEvent>  Passed MinBias HLT trigger  "<<std::endl;
00666   
00667   h_TriggeredEvents->Fill(0); // all events
00668   if (passedMinBiasHLT) h_TriggeredEvents->Fill(1); // Minbias;
00669   if (passedHcalHLT)    h_TriggeredEvents->Fill(2); // hcal HLT
00670   processEvent_rechit(hbHits, hoHits, hfHits,passedHcalHLT,passedMinBiasHLT,BCN);
00671 
00672   return;
00673 } // void HcalRecHitMonitor::processEvent(...)
00674 
00675 
00676 /* --------------------------------------- */
00677 
00678 
00679 void HcalRecHitMonitor::processEvent_rechit( const HBHERecHitCollection& hbheHits,
00680                                              const HORecHitCollection& hoHits,
00681                                              const HFRecHitCollection& hfHits,
00682                                              bool passedHcalHLT,
00683                                              bool passedMinBiasHLT,
00684                                              int BCN)
00685 {
00686   // Gather rechit info
00687   
00688   //const float area[]={0.111,0.175,0.175,0.175,0.175,0.175,0.174,0.178,0.172,0.175,0.178,0.346,0.604};
00689 
00690   if (debug_>1) std::cout <<"<HcalRecHitMonitor::processEvent_rechitenergy> Processing rechits..."<<std::endl;
00691   
00692   // loop over HBHE
00693   
00694   int     hbocc=0;
00695   int     heocc=0;
00696   int     hboccthresh=0;
00697   int     heoccthresh=0;
00698 
00699   double HtPlus =0, HtMinus=0;
00700   double HFePlus=0, HFeMinus=0;
00701   double HBePlus=0, HBeMinus=0;
00702   double HEePlus=0, HEeMinus=0;
00703   double HFtPlus=0, HFtMinus=0;
00704   double HBtPlus=0, HBtMinus=0;
00705   double HEtPlus=0, HEtMinus=0;
00706 
00707   int hbpocc=0, hbmocc=0, hepocc=0, hemocc=0, hfpocc=0, hfmocc=0;
00708 
00709   for (unsigned int i=0;i<4;++i)
00710     {
00711       OccupancyByDepth.depth[i]->update();
00712       OccupancyThreshByDepth.depth[i]->update();
00713       SumEnergyByDepth.depth[i]->update();
00714       SqrtSumEnergy2ByDepth.depth[i]->update();
00715       SumTimeByDepth.depth[i]->update();
00716     }
00717     
00718   h_HBflagcounter->update();
00719   h_HEflagcounter->update();
00720   h_HFflagcounter->update();
00721   h_HOflagcounter->update();
00722   
00723   
00724   for (HBHERecHitCollection::const_iterator HBHEiter=hbheHits.begin(); HBHEiter!=hbheHits.end(); ++HBHEiter) 
00725     { // loop over all hits
00726       float en = HBHEiter->energy();
00727       float ti = HBHEiter->time();
00728       HcalDetId id(HBHEiter->detid().rawId());
00729       int ieta = id.ieta();
00730       int iphi = id.iphi();
00731       int depth = id.depth();
00732 
00733       if (en>0.5)
00734         {
00735           h_rechitieta_05->Fill(ieta);
00736           h_rechitiphi_05->Fill(iphi);
00737           if (en>1.)
00738             {
00739               h_rechitieta_10->Fill(ieta);
00740               h_rechitiphi_10->Fill(iphi);
00741               if (en>2.5)
00742                 {
00743                   h_rechitieta_25->Fill(ieta);
00744                   h_rechitiphi_25->Fill(iphi);
00745                   if (en>10.)
00746                     {
00747                       h_rechitieta_100->Fill(ieta);
00748                       h_rechitiphi_100->Fill(iphi);
00749                     }
00750                 }
00751             }
00752         }
00753 
00754 
00755 
00756       HcalSubdetector subdet = id.subdet();
00757       double fEta=fabs(0.5*(theHBHEEtaBounds[abs(ieta)-1]+theHBHEEtaBounds[abs(ieta)]));
00758 
00759       int calcEta = CalcEtaBin(subdet,ieta,depth);
00760       int rbxindex=logicalMap->getHcalFrontEndId(HBHEiter->detid()).rbxIndex();
00761       int rm= logicalMap->getHcalFrontEndId(HBHEiter->detid()).rm();
00762 
00763       // Fill HBHE flag plots
00764       h_HBHE_FlagCorr->Fill(HBHEiter->flagField(HcalCaloFlagLabels::HBHEPulseShape),
00765                             HBHEiter->flagField(HcalCaloFlagLabels::HBHEHpdHitMultiplicity)); 
00766 
00767       if (HBHEiter->flagField(HcalCaloFlagLabels::HBHEHpdHitMultiplicity))
00768         {
00769           h_FlagMap_HPDMULT->Fill(rbxindex,rm);
00770           h_HBHEHPDMult_vs_LS->Fill(currentLS,1);
00771         }
00772       if (HBHEiter->flagField(HcalCaloFlagLabels::HBHEPulseShape))
00773         {
00774           h_FlagMap_PULSESHAPE->Fill(rbxindex,rm);
00775           h_HBHEPulseShape_vs_LS->Fill(currentLS,1);
00776         }
00777       if (HBHEiter->flagField(HcalCaloFlagLabels::TimingSubtractedBit))
00778         h_FlagMap_TIMESUBTRACT->Fill(rbxindex,rm);
00779       else if (HBHEiter->flagField(HcalCaloFlagLabels::TimingAddedBit))
00780         h_FlagMap_TIMEADD->Fill(rbxindex,rm);
00781       else if (HBHEiter->flagField(HcalCaloFlagLabels::TimingErrorBit))
00782         h_FlagMap_TIMEERROR->Fill(rbxindex,rm);
00783 
00784       if (subdet==HcalBarrel)
00785         {
00786           if (en>HBenergyThreshold_)
00787             h_HBTimeVsEnergy->Fill(en,ti);
00788           //Looping over HB searching for flags --- cris
00789           for (int f=0;f<32;f++)
00790             {
00791               // Let's display HSCP just to see if these bits are set
00792               /*
00793                if (f == HcalCaloFlagLabels::HSCP_R1R2)         continue;
00794                if (f == HcalCaloFlagLabels::HSCP_FracLeader)   continue;
00795                if (f == HcalCaloFlagLabels::HSCP_OuterEnergy)  continue;
00796                if (f == HcalCaloFlagLabels::HSCP_ExpFit)       continue;
00797               */
00798               if (HBHEiter->flagField(f))
00799                 ++HBflagcounter_[f];
00800             }
00801           ++occupancy_[calcEta][iphi-1][depth-1];
00802           energy_[calcEta][iphi-1][depth-1]+=en;
00803           energy2_[calcEta][iphi-1][depth-1]+=pow(en,2);
00804           time_[calcEta][iphi-1][depth-1]+=ti;
00805           if (ti<RECHITMON_TIME_MIN || ti>RECHITMON_TIME_MAX)
00806             h_HBTime->Fill(ti);
00807           else
00808             ++HBtime_[int(ti-RECHITMON_TIME_MIN)];
00809           ++hbocc; 
00810 
00811           // Threshold plots;  require E> threshold and minbias trigger
00812           if (
00813               en>=HBenergyThreshold_ && 
00814               en/cosh(fEta)>=HBETThreshold_ 
00815               ) 
00816             {
00817               if (passedMinBiasHLT==true)
00818                 {
00819                   ++occupancy_thresh_[calcEta][iphi-1][depth-1];
00820                   energy_thresh_[calcEta][iphi-1][depth-1]+=en;
00821                   energy2_thresh_[calcEta][iphi-1][depth-1]+=pow(en,2);
00822                   time_thresh_[calcEta][iphi-1][depth-1]+=ti;
00823                   
00824                   ++hboccthresh;
00825                   if (ti<RECHITMON_TIME_MIN || ti>RECHITMON_TIME_MAX)
00826                     h_HBThreshTime->Fill(ti);
00827                   else
00828                     ++HBtime_thresh_[int(ti-RECHITMON_TIME_MIN)];
00829                 }
00830 
00831               if (ieta>0)
00832                 {
00833                   HBePlus+=en;
00834                   HBtPlus+=ti*en;
00835                   hbpocc++;
00836                 }
00837               else
00838                 {
00839                   HBeMinus+=en;
00840                   HBtMinus+=ti*en;
00841                   hbmocc++;
00842                 }
00843             } // if (HB  en>thresh, ET>thresh)
00844         } // if (id.subdet()==HcalBarrel)
00845 
00846       else if (subdet==HcalEndcap)
00847         {
00848           if (en>HEenergyThreshold_)
00849             h_HETimeVsEnergy->Fill(en,ti);
00850           //Looping over HE searching for flags --- cris
00851           for (int f=0;f<32;f++)
00852             {
00853               if (HBHEiter->flagField(f))
00854                 ++HEflagcounter_[f];
00855             }
00856 
00857           ++occupancy_[calcEta][iphi-1][depth-1];
00858           energy_[calcEta][iphi-1][depth-1]+=en;
00859           energy2_[calcEta][iphi-1][depth-1]+=pow(en,2);
00860           time_[calcEta][iphi-1][depth-1]+=ti;
00861 
00862           ++heocc;
00863           if (ti<RECHITMON_TIME_MIN || ti>RECHITMON_TIME_MAX)
00864             h_HETime->Fill(ti);
00865           else
00866             ++HEtime_[int(ti-RECHITMON_TIME_MIN)];
00867 
00868           // Threshold plots require e>E_thresh, ET>ET_thresh
00869           if (en>=HEenergyThreshold_
00870               && en/cosh(fEta)>=HEETThreshold_
00871               )
00872             {
00873               // occupancy plots also require passedMinBiasHLT
00874               if (passedMinBiasHLT==true)
00875                 {
00876                   ++occupancy_thresh_[calcEta][iphi-1][depth-1];
00877                   energy_thresh_[calcEta][iphi-1][depth-1]+=en;
00878                   energy2_thresh_[calcEta][iphi-1][depth-1]+=pow(en,2);
00879                   time_thresh_[calcEta][iphi-1][depth-1]+=ti;
00880                   ++heoccthresh;
00881                   if (ti<RECHITMON_TIME_MIN || ti>RECHITMON_TIME_MAX)
00882                       h_HEThreshTime->Fill(ti);
00883                   else
00884                     ++HEtime_thresh_[int(ti-RECHITMON_TIME_MIN)];
00885                 }
00886               // ePlus, tPlus calculated regardless of trigger
00887               if (ieta>0)
00888                 {
00889                   HEePlus+=en;
00890                   HEtPlus+=ti*en;
00891                   hepocc++;
00892                 }
00893               else
00894                 {
00895                   HEeMinus+=en;
00896                   HEtMinus+=ti*en;
00897                   hemocc++;
00898                 }
00899             } // if (en>=HEenergyThreshold_ && ET>threshold)
00900 
00901         } // else if (id.subdet()==HcalEndcap)
00902      
00903     } //for (HBHERecHitCollection::const_iterator HBHEiter=...)
00904   
00905   // Calculate normalized time
00906   HEePlus>0  ?  HEtPlus/=HEePlus   :  HEtPlus=10000;
00907   HEeMinus>0 ?  HEtMinus/=HEeMinus :  HEtMinus=-10000;
00908   HBePlus>0  ?  HBtPlus/=HBePlus   :  HBtPlus=10000;
00909   HBeMinus>0 ?  HBtMinus/=HBeMinus :  HBtMinus=-10000;
00910   
00911   ++HB_occupancy_[hbocc/10];
00912   ++HE_occupancy_[heocc/10];
00913   ++HB_occupancy_thresh_[hboccthresh/10];
00914   ++HE_occupancy_thresh_[heoccthresh/10];
00915   h_HBsizeVsLS->Fill(currentLS,hbocc);
00916   h_HEsizeVsLS->Fill(currentLS,heocc);
00917 
00918   // loop over HO
00919 
00920   h_HOsizeVsLS->Fill(currentLS,hoHits.size());
00921   int hoocc=0;
00922   int hooccthresh=0;
00923   for (HORecHitCollection::const_iterator HOiter=hoHits.begin(); HOiter!=hoHits.end(); ++HOiter) 
00924     { // loop over all hits
00925       float en = HOiter->energy();
00926       float ti = HOiter->time();
00927       if (en>HOenergyThreshold_)
00928         h_HOTimeVsEnergy->Fill(en,ti);
00929 
00930       HcalDetId id(HOiter->detid().rawId());
00931       int ieta = id.ieta();
00932       int iphi = id.iphi();
00933       int depth = id.depth();
00934 
00935       if (en>0.5)
00936         {
00937           h_rechitieta_05->Fill(ieta);
00938           h_rechitiphi_05->Fill(iphi);
00939           if (en>1.)
00940             {
00941               h_rechitieta_10->Fill(ieta);
00942               h_rechitiphi_10->Fill(iphi);
00943               if (en>2.5)
00944                 {
00945                   h_rechitieta_25->Fill(ieta);
00946                   h_rechitiphi_25->Fill(iphi);
00947                   if (en>10.)
00948                     {
00949                       h_rechitieta_100->Fill(ieta);
00950                       h_rechitiphi_100->Fill(iphi);
00951                     }
00952                 }
00953             }
00954         }
00955 
00956 
00957 
00958       int calcEta = CalcEtaBin(HcalOuter,ieta,depth);
00959       double fEta=fabs(0.5*(theHBHEEtaBounds[abs(ieta)-1]+theHBHEEtaBounds[abs(ieta)]));
00960       
00961       int rbxindex=logicalMap->getHcalFrontEndId(HOiter->detid()).rbxIndex();
00962       int rm= logicalMap->getHcalFrontEndId(HOiter->detid()).rm();
00963       
00964       if (HOiter->flagField(HcalCaloFlagLabels::TimingSubtractedBit))
00965         h_FlagMap_TIMESUBTRACT->Fill(rbxindex,rm);
00966       else if (HOiter->flagField(HcalCaloFlagLabels::TimingAddedBit))
00967         h_FlagMap_TIMEADD->Fill(rbxindex,rm);
00968       else if (HOiter->flagField(HcalCaloFlagLabels::TimingErrorBit))
00969         h_FlagMap_TIMEERROR->Fill(rbxindex,rm);
00970       
00971       
00972       //Looping over HO searching for flags --- cris
00973       for (int f=0;f<32;f++)
00974         {
00975           if (HOiter->flagField(f))
00976             HOflagcounter_[f]++;
00977         }
00978       
00979       ++occupancy_[calcEta][iphi-1][depth-1];
00980       energy_[calcEta][iphi-1][depth-1]+=en;
00981       energy2_[calcEta][iphi-1][depth-1]+=pow(en,2);
00982       time_[calcEta][iphi-1][depth-1]+=ti;
00983       ++hoocc;
00984       if (ti<RECHITMON_TIME_MIN || ti>RECHITMON_TIME_MAX)
00985         h_HOTime->Fill(ti);
00986       else
00987         ++HOtime_[int(ti-RECHITMON_TIME_MIN)];
00988 
00989       // We don't calculate HOplus/HOminus values (independent of trigger), so require min bias trigger 
00990       // along with E, ET thresholds directly in this HO loop:
00991 
00992       if (en>=HOenergyThreshold_  
00993           && en/cosh(fEta)>=HOETThreshold_
00994           && passedMinBiasHLT==true   
00995           )
00996         {
00997           ++occupancy_thresh_[calcEta][iphi-1][depth-1];
00998           energy_thresh_[calcEta][iphi-1][depth-1]+=en;
00999           energy2_thresh_[calcEta][iphi-1][depth-1]+=pow(en,2);
01000           time_thresh_[calcEta][iphi-1][depth-1]+=ti;
01001 
01002           ++hooccthresh;
01003           if (ti<RECHITMON_TIME_MIN || ti>RECHITMON_TIME_MAX)
01004             h_HOThreshTime->Fill(ti);
01005           else
01006             ++HOtime_thresh_[int(ti-RECHITMON_TIME_MIN)];
01007         } 
01008     } // loop over all HO hits
01009 
01010   ++HO_occupancy_[hoocc/10];
01011   ++HO_occupancy_thresh_[hooccthresh/10];
01012    
01013   // loop over HF
01014   h_HFsizeVsLS->Fill(currentLS,hfHits.size());
01015 
01016   HtPlus=0; HtMinus=0;
01017   
01018   int hfocc=0;
01019   int hfoccthresh=0;
01020   for (HFRecHitCollection::const_iterator HFiter=hfHits.begin(); HFiter!=hfHits.end(); ++HFiter) 
01021     { // loop over all hits
01022       float en = HFiter->energy();
01023       float ti = HFiter->time();
01024       if (en> HFenergyThreshold_)
01025         h_HFTimeVsEnergy->Fill(en,ti);
01026 
01027       HcalDetId id(HFiter->detid().rawId());
01028       int ieta = id.ieta();
01029       int iphi = id.iphi();
01030       int depth = id.depth();
01031 
01032       if (en>0.5)
01033         {
01034           h_rechitieta_05->Fill(ieta);
01035           h_rechitiphi_05->Fill(iphi);
01036           if (en>1.)
01037             {
01038               h_rechitieta_10->Fill(ieta);
01039               h_rechitiphi_10->Fill(iphi);
01040               if (en>2.5)
01041                 {
01042                   h_rechitieta_25->Fill(ieta);
01043                   h_rechitiphi_25->Fill(iphi);
01044                   if (en>10.)
01045                     {
01046                       h_rechitieta_100->Fill(ieta);
01047                       h_rechitiphi_100->Fill(iphi);
01048                     }
01049                 }
01050             }
01051         }
01052 
01053       double fEta=fabs(0.5*(theHFEtaBounds[abs(ieta)-29]+theHFEtaBounds[abs(ieta)-28]));
01054       int calcEta = CalcEtaBin(HcalForward,ieta,depth);
01055 
01056       int rbxindex=logicalMap->getHcalFrontEndId(HFiter->detid()).rbxIndex();
01057       int rm= logicalMap->getHcalFrontEndId(HFiter->detid()).rm(); 
01058          
01059       h_HF_FlagCorr->Fill(HFiter->flagField(HcalCaloFlagLabels::HFDigiTime),HFiter->flagField(HcalCaloFlagLabels::HFLongShort)); 
01060       if (HFiter->flagField(HcalCaloFlagLabels::TimingSubtractedBit))
01061         h_FlagMap_TIMESUBTRACT->Fill(rbxindex,rm);
01062       else if (HFiter->flagField(HcalCaloFlagLabels::TimingAddedBit))
01063         h_FlagMap_TIMEADD->Fill(rbxindex,rm);
01064       else if (HFiter->flagField(HcalCaloFlagLabels::TimingErrorBit))
01065         h_FlagMap_TIMEERROR->Fill(rbxindex,rm);
01066 
01067       if (HFiter->flagField(HcalCaloFlagLabels::HFDigiTime))
01068         {
01069           h_FlagMap_DIGITIME->Fill(rbxindex,rm);
01070           h_HFDigiTime_vs_LS->Fill(currentLS,1);
01071         }
01072       if (HFiter->flagField(HcalCaloFlagLabels::HFLongShort))
01073         {
01074           h_FlagMap_LONGSHORT->Fill(rbxindex,rm);
01075           h_HFLongShort_vs_LS->Fill(currentLS,1);
01076         }
01077       //Looping over HF searching for flags --- cris
01078       for (int f=0;f<32;f++)
01079         {
01080           if (HFiter->flagField(f))
01081             HFflagcounter_[f]++;
01082         }
01083 
01084       // Occupancy plots, without threshold
01085       ++occupancy_[calcEta][iphi-1][depth-1];
01086       energy_[calcEta][iphi-1][depth-1]+=en;
01087       energy2_[calcEta][iphi-1][depth-1]+=pow(en,2);
01088       time_[calcEta][iphi-1][depth-1]+=ti;
01089       ++hfocc;
01090       if (ti<RECHITMON_TIME_MIN || ti>RECHITMON_TIME_MAX)
01091         h_HFTime->Fill(ti);
01092       else
01093         ++HFtime_[int(ti-RECHITMON_TIME_MIN)];
01094 
01095       ieta>0 ?  HtPlus+=en/cosh(fEta)  : HtMinus+=en/cosh(fEta);  // add energy from all cells, or only those > threshold?
01096 
01097       if (en>=HFenergyThreshold_ && 
01098           en/cosh(fEta)>=HFETThreshold_ 
01099           )
01100         {
01101           // Occupancy plots require min bias trigger, along with thresholds exceeded
01102           if (passedMinBiasHLT)
01103             {
01104               ++occupancy_thresh_[calcEta][iphi-1][depth-1];
01105               energy_thresh_[calcEta][iphi-1][depth-1]+=en;
01106               energy2_thresh_[calcEta][iphi-1][depth-1]+=pow(en,2);
01107               time_thresh_[calcEta][iphi-1][depth-1]+=ti;
01108               
01109               ++hfoccthresh;
01110               if (ti<RECHITMON_TIME_MIN || ti>RECHITMON_TIME_MAX)
01111                 h_HFThreshTime->Fill(ti);
01112               else
01113                 ++HFtime_thresh_[int(ti-RECHITMON_TIME_MIN)];
01114             }
01115 
01116           if (ieta>0)
01117             {
01118               HFtPlus+=en*ti;
01119               HFePlus+=en;
01120               hfpocc++;
01121             }
01122           else if (ieta<0)
01123             {
01124               HFtMinus+=en*ti;
01125               HFeMinus+=en;
01126               hfmocc++;
01127             }
01128         } // if (en>thresh, ET>thresh)
01129     } // loop over all HF hits
01130      
01131   ++HF_occupancy_[hfocc/10];
01132   ++HF_occupancy_thresh_[hfoccthresh/10];
01133 
01134   
01135   // Form event-wide variables (time averages, etc.), and plot them
01136 
01137   // Calculate weighted times.  (Set tPlus, tMinus to overflow in case where total energy < 0)
01138   HFePlus>0  ? HFtPlus/=HFePlus    : HFtPlus  =  10000;
01139   HFeMinus>0 ? HFtMinus/=HFeMinus  : HFtMinus = -10000;
01140      
01141   double mintime=99;  // used to be min(tPlus,tMinus);
01142   double minHT=std::min(HtMinus,HtPlus);
01143   minHT==HtMinus ?  mintime=HFtMinus : mintime = HFtPlus;
01144   //mintime = min(HFtPlus,HFtMinus); // I think we might want to use this value for mintime?
01145 
01146 
01147   h_LumiPlot_MinTime_vs_MinHT->Fill(minHT, mintime);
01148   h_LumiPlot_timeHT_HFM->Fill(HtMinus,HFtMinus);
01149   h_LumiPlot_timeHT_HFP->Fill(HtPlus,HFtPlus);
01150 
01151   if (passedMinBiasHLT==true)
01152     {
01153       h_LumiPlot_SumHT_HFPlus_vs_HFMinus->Fill(HtMinus,HtPlus);
01154       // HtMinus, HtPlus require no energy cuts for their contributing cells
01155       // HFeMinus, HFePlus require that cells be > threshold cut
01156       
01157       if (HtMinus>1 && HtPlus > 1) // is this the condition we want, or do we want hfmocc>0 && hfpocc >0?
01158         {
01159           h_LumiPlot_SumEnergy_HFPlus_vs_HFMinus->Fill(HFeMinus,HFePlus);
01160           h_LumiPlot_timeHFPlus_vs_timeHFMinus->Fill(HFtMinus,HFtPlus);
01161 
01162           h_HFP_weightedTime->Fill(HFtPlus);
01163           h_HFM_weightedTime->Fill(HFtMinus);
01164           h_HBP_weightedTime->Fill(HBtPlus);
01165           h_HBM_weightedTime->Fill(HBtMinus);
01166           
01167           h_HEP_weightedTime->Fill(HEtPlus);
01168           h_HEM_weightedTime->Fill(HEtMinus);
01169 
01170           if (hepocc>0 && hemocc>0)
01171             {
01172               h_HEtimedifference->Fill(HEtPlus-HEtMinus);
01173               if (HEePlus-HEeMinus!=0) h_HEenergydifference->Fill((HEePlus-HEeMinus)/(HEePlus+HEeMinus));
01174             }
01175           if (hfpocc>0 && hfmocc>0)  // which condition do we want?
01176             {
01177               h_HFtimedifference->Fill((HFtPlus)-(HFtMinus));
01178               if (HFePlus+HFeMinus!=0) h_HFenergydifference->Fill((HFePlus-HFeMinus)/(HFePlus+HFeMinus));
01179             }
01180 
01181           h_LumiPlot_LS_MinBiasEvents_notimecut->Fill(currentLS);
01182           h_LumiPlot_BX_MinBiasEvents_notimecut->Fill(BCN);
01183           if (fabs(HFtPlus-HFtMinus)<timediffThresh_)
01184             {
01185               h_LumiPlot_LS_MinBiasEvents->Fill(currentLS);
01186               h_LumiPlot_BX_MinBiasEvents->Fill(BCN);
01187             }
01188           
01189           HFP_HFM_Energy->Fill(HFeMinus/1000., HFePlus/1000.);
01190         }
01191  
01192       if (debug_>1) std::cout <<"\t<HcalRecHitMonitor:: HF averages>  TPLUS = "<<HFtPlus<<"  EPLUS = "<<HFePlus<<"  TMINUS = "<<HFtMinus<<"  EMINUS = "<<HFeMinus<<"  Weighted Time Diff = "<<((HFtPlus)-(HFtMinus))<<std::endl;
01193       
01194 
01195     } // if (passedMinBiasHLT)
01196 
01197   if (passedHcalHLT && HtMinus>1 && HtPlus> 1 )
01198     {
01199       if (hfpocc>0 && hfmocc>0)
01200         {
01201           h_HF_HcalHLT_weightedtimedifference->Fill(HFtPlus-HFtMinus);
01202           if (HFePlus+HFeMinus!=0) h_HF_HcalHLT_energydifference->Fill((HFePlus-HFeMinus)/(HFePlus+HFeMinus));
01203         }
01204       if  (hepocc>0 && hemocc>0)
01205         {
01206           h_HE_HcalHLT_weightedtimedifference->Fill(HEtPlus-HEtMinus);
01207           if (HEePlus-HEeMinus!=0) h_HE_HcalHLT_energydifference->Fill((HEePlus-HEeMinus)/(HEePlus+HEeMinus));
01208         }
01209 
01210       h_LumiPlot_LS_HcalHLTEvents_notimecut->Fill(currentLS);
01211       h_LumiPlot_BX_HcalHLTEvents_notimecut->Fill(BCN);
01212       if (fabs(HFtPlus-HFtMinus)<timediffThresh_)
01213         {
01214           h_LumiPlot_LS_HcalHLTEvents->Fill(currentLS);
01215           h_LumiPlot_BX_HcalHLTEvents->Fill(BCN);
01216         }
01217      } // passsed Hcal HLT
01218    
01219  return;
01220 } // void HcalRecHitMonitor::processEvent_rechitenergy
01221 
01222 /* --------------------------------------- */
01223 
01224 
01225 void HcalRecHitMonitor::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
01226                                            const edm::EventSetup& c)
01227 
01228 {
01229   // don't fill lumi block information if it's already been filled
01230   if (LumiInOrder(lumiSeg.luminosityBlock())==false) return;
01231   fill_Nevents();
01232   return;
01233 } //endLuminosityBlock
01234 
01235 
01236 void HcalRecHitMonitor::fill_Nevents(void)
01237 {
01238   // looking at the contents of HbFlagcounters
01239   if (debug_>0)
01240     {
01241       for (int k = 0; k < 32; k++){
01242         std::cout << "<HcalRecHitMonitor::fill_Nevents>  HF Flag counter:  Bin #" << k+1 << " = "<< HFflagcounter_[k] << std::endl;
01243       }
01244     }
01245 
01246   for (int i=0;i<32;i++)
01247     {
01248       h_HBflagcounter->Fill(i,HBflagcounter_[i]);
01249       h_HEflagcounter->Fill(i,HEflagcounter_[i]);
01250       h_HOflagcounter->Fill(i,HOflagcounter_[i]);
01251       h_HFflagcounter->Fill(i,HFflagcounter_[i]);
01252       HBflagcounter_[i]=0;
01253       HEflagcounter_[i]=0;
01254       HOflagcounter_[i]=0;
01255       HFflagcounter_[i]=0;
01256     }
01257 
01258   // Fill Occupancy & Sum Energy, Time plots
01259   int myieta=-1;
01260   if (ievt_>0)
01261     {
01262       for (int mydepth=0;mydepth<4;++mydepth)
01263         {
01264           for (int eta=0;eta<OccupancyByDepth.depth[mydepth]->getNbinsX();++eta)
01265             {
01266               myieta=CalcIeta(eta,mydepth+1);
01267 
01268               for (int phi=0;phi<72;++phi)
01269                 {
01270                   if (occupancy_[eta][phi][mydepth]>0)
01271                     {
01272                       h_rechitieta->Fill(myieta,occupancy_[eta][phi][mydepth]);
01273                       h_rechitiphi->Fill(phi+1,occupancy_[eta][phi][mydepth]);
01274                     }
01275                   if (occupancy_thresh_[eta][phi][mydepth]>0)
01276                     {
01277                       h_rechitieta_thresh->Fill(myieta,occupancy_thresh_[eta][phi][mydepth]);
01278                       h_rechitiphi_thresh->Fill(phi+1,occupancy_thresh_[eta][phi][mydepth]);
01279                     }
01280                   OccupancyByDepth.depth[mydepth]->setBinContent(eta+1,phi+1,occupancy_[eta][phi][mydepth]);
01281                   SumEnergyByDepth.depth[mydepth]->setBinContent(eta+1,phi+1,energy_[eta][phi][mydepth]);
01282                   SqrtSumEnergy2ByDepth.depth[mydepth]->setBinContent(eta+1,phi+1,sqrt(energy2_[eta][phi][mydepth]));
01283                   SumTimeByDepth.depth[mydepth]->setBinContent(eta+1,phi+1,time_[eta][phi][mydepth]);
01284 
01285                   OccupancyThreshByDepth.depth[mydepth]->setBinContent(eta+1,phi+1,occupancy_thresh_[eta][phi][mydepth]);
01286                   SumEnergyThreshByDepth.depth[mydepth]->setBinContent(eta+1,phi+1,energy_thresh_[eta][phi][mydepth]);
01287                   SqrtSumEnergy2ThreshByDepth.depth[mydepth]->setBinContent(eta+1,phi+1,sqrt(energy2_thresh_[eta][phi][mydepth]));
01288                   SumTimeThreshByDepth.depth[mydepth]->setBinContent(eta+1,phi+1,time_thresh_[eta][phi][mydepth]);
01289                 } // for (int phi=0;phi<72;++phi)
01290             } // for (int eta=0;eta<OccupancyByDepth...;++eta)
01291         } // for (int mydepth=0;...)
01292 
01293       FillUnphysicalHEHFBins(OccupancyByDepth);
01294       FillUnphysicalHEHFBins(OccupancyThreshByDepth);
01295       FillUnphysicalHEHFBins(SumEnergyByDepth);
01296       FillUnphysicalHEHFBins(SqrtSumEnergy2ByDepth);
01297       FillUnphysicalHEHFBins(SumEnergyThreshByDepth);
01298       FillUnphysicalHEHFBins(SqrtSumEnergy2ThreshByDepth);
01299       FillUnphysicalHEHFBins(SumTimeByDepth);
01300       FillUnphysicalHEHFBins(SumTimeThreshByDepth);
01301 
01302     } // if (ievt_>0)
01303 
01304   // Fill subdet plots
01305 
01306   for (int i=0;i<(RECHITMON_TIME_MAX-RECHITMON_TIME_MIN);++i)
01307     {
01308       if (HBtime_[i]!=0)
01309         {
01310           h_HBTime->setBinContent(i+1,HBtime_[i]);
01311         }
01312       if (HBtime_thresh_[i]!=0)
01313         {
01314           h_HBThreshTime->setBinContent(i+1,HBtime_thresh_[i]);
01315         }
01316       if (HEtime_[i]!=0)
01317         {
01318 
01319           h_HETime->setBinContent(i+1,HEtime_[i]);
01320         }
01321       if (HEtime_thresh_[i]!=0)
01322         {
01323           h_HEThreshTime->setBinContent(i+1,HEtime_thresh_[i]);
01324         }
01325       if (HOtime_[i]!=0)
01326         {
01327           h_HOTime->setBinContent(i+1,HOtime_[i]);
01328         }
01329       if (HOtime_thresh_[i]!=0)
01330         {
01331           h_HOThreshTime->setBinContent(i+1,HOtime_thresh_[i]);
01332         }
01333       if (HFtime_[i]!=0)
01334         {
01335           h_HFTime->setBinContent(i+1,HFtime_[i]);
01336         }
01337       if (HFtime_thresh_[i]!=0)
01338         {
01339           h_HFThreshTime->setBinContent(i+1,HFtime_thresh_[i]);
01340         }
01341     } // for (int  i=0;i<(RECHITMON_TIME_MAX-RECHITMON_TIME_MIN);++i)
01342 
01343   for (int i=0;i<260;++i)
01344     {
01345       if (HB_occupancy_[i]>0)
01346         {
01347           h_HBOccupancy->setBinContent(i+1,HB_occupancy_[i]);
01348         }
01349       if (HB_occupancy_thresh_[i]>0)
01350         {
01351           h_HBThreshOccupancy->setBinContent(i+1,HB_occupancy_thresh_[i]);
01352         }
01353       if (HE_occupancy_[i]>0)
01354         {
01355           h_HEOccupancy->setBinContent(i+1,HE_occupancy_[i]);
01356         }
01357       if (HE_occupancy_thresh_[i]>0)
01358         {
01359           h_HEThreshOccupancy->setBinContent(i+1,HE_occupancy_thresh_[i]);
01360         }
01361     }//for (int i=0;i<260;++i)
01362 
01363   for (int i=0;i<217;++i)
01364     {
01365       if (HO_occupancy_[i]>0)
01366         {
01367           h_HOOccupancy->setBinContent(i+1,HO_occupancy_[i]);
01368         }
01369       if (HO_occupancy_thresh_[i]>0)
01370         {
01371           h_HOThreshOccupancy->setBinContent(i+1,HO_occupancy_thresh_[i]);
01372         }
01373     }//  for (int i=0;i<217;++i)
01374 
01375   for (int i=0;i<173;++i)
01376     {
01377       if (HF_occupancy_[i]>0)
01378         {
01379           h_HFOccupancy->setBinContent(i+1,HF_occupancy_[i]);
01380         }
01381       if (HF_occupancy_thresh_[i]>0)
01382         {
01383           h_HFThreshOccupancy->setBinContent(i+1,HF_occupancy_thresh_[i]);
01384         }
01385     }//  for (int i=0;i<173;++i)
01386 
01387   //zeroCounters();
01388 
01389   if (debug_>0)
01390     std::cout <<"<HcalRecHitMonitor::fill_Nevents> FILLED REC HIT CELL PLOTS"<<std::endl;
01391 
01392 } // void HcalRecHitMonitor::fill_Nevents(void)
01393 
01394 
01395 void HcalRecHitMonitor::zeroCounters(void)
01396 {
01397   // Set all histogram counters back to zero
01398 
01399   for (int i=0;i<32;++i)
01400     {
01401       HBflagcounter_[i]=0;
01402       HEflagcounter_[i]=0;
01403       HOflagcounter_[i]=0;
01404       HFflagcounter_[i]=0;
01405 
01406     }
01407   // TH2F counters
01408   for (int i=0;i<85;++i)
01409     {
01410       for (int j=0;j<72;++j)
01411         {
01412           for (int k=0;k<4;++k)
01413             {
01414               occupancy_[i][j][k]=0;
01415               occupancy_thresh_[i][j][k]=0;
01416               energy_[i][j][k]=0;
01417               energy2_[i][j][k]=0;
01418               energy_thresh_[i][j][k]=0;
01419               energy2_thresh_[i][j][k]=0;
01420               time_[i][j][k]=0;
01421               time_thresh_[i][j][k]=0;
01422             }
01423         } // for (int j=0;j<PHIBINS;++j)
01424     } // for (int i=0;i<87;++i)
01425 
01426   // TH1F counters
01427   
01428   for (int i=0;i<200;++i)
01429     {
01430       HFenergyLong_[i]=0;
01431       HFenergyLong_thresh_[i]=0;
01432       HFenergyShort_[i]=0;
01433       HFenergyShort_thresh_[i]=0;
01434     }
01435 
01436   // time
01437   for (int i=0;i<(RECHITMON_TIME_MAX-RECHITMON_TIME_MIN);++i)
01438     {
01439       HBtime_[i]=0;
01440       HBtime_thresh_[i]=0;
01441       HEtime_[i]=0;
01442       HEtime_thresh_[i]=0;
01443       HOtime_[i]=0;
01444       HOtime_thresh_[i]=0;
01445       HFtime_[i]=0;
01446       HFtime_thresh_[i]=0;
01447       HFtimeLong_[i]=0;
01448       HFtimeLong_thresh_[i]=0;
01449       HFtimeShort_[i]=0;
01450       HFtimeShort_thresh_[i]=0;
01451     }
01452 
01453   // occupancy
01454   for (int i=0;i<865;++i)
01455     {
01456       if (i<260)
01457         {
01458           HB_occupancy_[i]=0;
01459           HE_occupancy_[i]=0;
01460           HB_occupancy_thresh_[i]=0;
01461           HE_occupancy_thresh_[i]=0;
01462         }
01463       if (i<218)
01464         {
01465           HO_occupancy_[i]=0;
01466           HO_occupancy_thresh_[i]=0;
01467         }
01468       if (i<174)
01469         {
01470           HF_occupancy_[i]=0;
01471           HF_occupancy_thresh_[i]=0;
01472         }
01473 
01474       HFlong_occupancy_[i] =0;
01475       HFshort_occupancy_[i]=0;
01476       HFlong_occupancy_thresh_[i] =0;
01477       HFshort_occupancy_thresh_[i]=0;
01478     } // for (int i=0;i<865;++i)
01479 
01480   return;
01481 } //void HcalRecHitMonitor::zeroCounters(void)
01482 
01483 DEFINE_FWK_MODULE(HcalRecHitMonitor);