Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-29 23:10:22

0001 #ifndef _DQMOFFLINE_HCAL_CALOTOWERSANALYZER_H_
0002 #define _DQMOFFLINE_HCAL_CALOTOWERSANALYZER_H_
0003 
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006 #include "FWCore/Framework/interface/Frameworkfwd.h"
0007 #include "FWCore/Framework/interface/MakerMacros.h"
0008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0010 #include "FWCore/PluginManager/interface/ModuleDef.h"
0011 #include "FWCore/Utilities/interface/ESGetToken.h"
0012 
0013 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0014 #include "DQMServices/Core/interface/DQMStore.h"
0015 
0016 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0017 #include "DataFormats/HcalDetId/interface/HcalElectronicsId.h"
0018 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0019 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0020 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0021 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0022 #include "Geometry/CaloTopology/interface/HcalTopology.h"
0023 #include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h"
0024 #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h"
0025 #include "Geometry/Records/interface/HcalRecNumberingRecord.h"
0026 
0027 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
0028 #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h"
0029 #include "DataFormats/DetId/interface/DetId.h"
0030 #include "DataFormats/Math/interface/Vector3D.h"
0031 
0032 #include <algorithm>
0033 #include <cmath>
0034 #include <ostream>
0035 #include <string>
0036 #include <utility>
0037 #include <vector>
0038 
0039 class CaloTowersAnalyzer : public DQMEDAnalyzer {
0040 public:
0041   CaloTowersAnalyzer(edm::ParameterSet const &conf);
0042   ~CaloTowersAnalyzer() override;
0043 
0044   void analyze(edm::Event const &, edm::EventSetup const &) override;
0045   void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0046   void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override;
0047 
0048 private:
0049   double dR(double eta1, double phi1, double eta2, double phi2);
0050 
0051   std::string outputFile_;
0052   std::string hcalselector_;
0053   std::string mc_;
0054   bool useAllHistos_;
0055 
0056   typedef math::RhoEtaPhiVector Vector;
0057 
0058   edm::EDGetTokenT<CaloTowerCollection> tok_towers_;
0059   edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> hcalDDDRecConstantsToken_;
0060 
0061   int isub;
0062   int nevent;
0063 
0064   int imc;
0065 
0066   // eta limits to calcualte MET, SET (not to include HF if not needed)
0067   double etaMax[3];
0068   double etaMin[3];
0069 
0070   int iphi_bins_;
0071   float iphi_min_, iphi_max_;
0072 
0073   int ieta_bins_;
0074   float ieta_min_, ieta_max_;
0075 
0076   // ieta scan
0077   MonitorElement *emean_vs_ieta_E;
0078   MonitorElement *emean_vs_ieta_H;
0079   MonitorElement *emean_vs_ieta_EH;
0080 
0081   MonitorElement *emean_vs_ieta_E1;
0082   MonitorElement *emean_vs_ieta_H1;
0083   MonitorElement *emean_vs_ieta_EH1;
0084 
0085   MonitorElement *Ntowers_vs_ieta;
0086   MonitorElement *occupancy_map;
0087   MonitorElement *occupancy_vs_ieta;
0088 
0089   // Global maps
0090   MonitorElement *mapEnergy_E;
0091   MonitorElement *mapEnergy_H;
0092   MonitorElement *mapEnergy_EH;
0093   MonitorElement *mapEnergy_N;
0094 
0095   // for number of bad, recovered and problematic Ecal and Hcal cells
0096   MonitorElement *numBadCellsEcal_EB;
0097   MonitorElement *numBadCellsEcal_EE;
0098   MonitorElement *numRcvCellsEcal_EB;
0099   MonitorElement *numRcvCellsEcal_EE;
0100   MonitorElement *numPrbCellsEcal_EB;
0101   MonitorElement *numPrbCellsEcal_EE;
0102 
0103   MonitorElement *numBadCellsHcal_HB;
0104   MonitorElement *numBadCellsHcal_HE;
0105   MonitorElement *numBadCellsHcal_HF;
0106   MonitorElement *numRcvCellsHcal_HB;
0107   MonitorElement *numRcvCellsHcal_HE;
0108   MonitorElement *numRcvCellsHcal_HF;
0109   MonitorElement *numPrbCellsHcal_HB;
0110   MonitorElement *numPrbCellsHcal_HE;
0111   MonitorElement *numPrbCellsHcal_HF;
0112 
0113   // HB
0114   MonitorElement *meEnergyHcalvsEcal_HB;
0115   MonitorElement *meEnergyHO_HB;
0116   MonitorElement *meEnergyEcal_HB;
0117   MonitorElement *meEnergyHcal_HB;
0118   MonitorElement *meNumFiredTowers_HB;
0119 
0120   MonitorElement *meEnergyEcalTower_HB;
0121   MonitorElement *meEnergyHcalTower_HB;
0122   MonitorElement *meTotEnergy_HB;
0123 
0124   MonitorElement *meIphiHcalTower_HBP;
0125   MonitorElement *meIphiHcalTower_HBM;
0126 
0127   MonitorElement *mapEnergy_HB;
0128   MonitorElement *mapEnergyEcal_HB;
0129   MonitorElement *mapEnergyHcal_HB;
0130   MonitorElement *MET_HB;
0131   MonitorElement *SET_HB;
0132   MonitorElement *phiMET_HB;
0133 
0134   MonitorElement *emTiming_HB;
0135   MonitorElement *hadTiming_HB;
0136 
0137   MonitorElement *emEnergyTiming_Low_HB;
0138   MonitorElement *emEnergyTiming_HB;
0139   MonitorElement *emEnergyTiming_High_HB;
0140   MonitorElement *emEnergyTiming_profile_Low_HB;
0141   MonitorElement *emEnergyTiming_profile_HB;
0142   MonitorElement *emEnergyTiming_profile_High_HB;
0143 
0144   MonitorElement *hadEnergyTiming_Low_HB;
0145   MonitorElement *hadEnergyTiming_HB;
0146   MonitorElement *hadEnergyTiming_High_HB;
0147   MonitorElement *hadEnergyTiming_profile_Low_HB;
0148   MonitorElement *hadEnergyTiming_profile_HB;
0149   MonitorElement *hadEnergyTiming_profile_High_HB;
0150 
0151   // HE
0152   MonitorElement *meEnergyHcalvsEcal_HE;
0153   MonitorElement *meEnergyHO_HE;
0154   MonitorElement *meEnergyEcal_HE;
0155   MonitorElement *meEnergyHcal_HE;
0156   MonitorElement *meNumFiredTowers_HE;
0157 
0158   MonitorElement *meEnergyEcalTower_HE;
0159   MonitorElement *meEnergyHcalTower_HE;
0160   MonitorElement *meTotEnergy_HE;
0161 
0162   MonitorElement *meIphiHcalTower_HEP;
0163   MonitorElement *meIphiHcalTower_HEM;
0164 
0165   MonitorElement *mapEnergy_HE;
0166   MonitorElement *mapEnergyEcal_HE;
0167   MonitorElement *mapEnergyHcal_HE;
0168   MonitorElement *MET_HE;
0169   MonitorElement *SET_HE;
0170   MonitorElement *phiMET_HE;
0171 
0172   MonitorElement *emTiming_HE;
0173   MonitorElement *hadTiming_HE;
0174 
0175   MonitorElement *emEnergyTiming_Low_HE;
0176   MonitorElement *emEnergyTiming_HE;
0177   MonitorElement *emEnergyTiming_profile_Low_HE;
0178   MonitorElement *emEnergyTiming_profile_HE;
0179 
0180   MonitorElement *hadEnergyTiming_Low_HE;
0181   MonitorElement *hadEnergyTiming_HE;
0182   MonitorElement *hadEnergyTiming_profile_Low_HE;
0183   MonitorElement *hadEnergyTiming_profile_HE;
0184 
0185   // HF
0186   MonitorElement *meEnergyHcalvsEcal_HF;
0187   MonitorElement *meEnergyHO_HF;
0188   MonitorElement *meEnergyEcal_HF;
0189   MonitorElement *meEnergyHcal_HF;
0190   MonitorElement *meNumFiredTowers_HF;
0191 
0192   MonitorElement *meEnergyEcalTower_HF;
0193   MonitorElement *meEnergyHcalTower_HF;
0194   MonitorElement *meTotEnergy_HF;
0195 
0196   MonitorElement *meIphiCaloTower_HFP;
0197   MonitorElement *meIphiCaloTower_HFM;
0198 
0199   MonitorElement *mapEnergy_HF;
0200   MonitorElement *mapEnergyEcal_HF;
0201   MonitorElement *mapEnergyHcal_HF;
0202   MonitorElement *MET_HF;
0203   MonitorElement *SET_HF;
0204   MonitorElement *phiMET_HF;
0205 
0206   MonitorElement *emTiming_HF;
0207   MonitorElement *hadTiming_HF;
0208   MonitorElement *emEnergyTiming_HF;
0209   MonitorElement *emEnergyTiming_profile_HF;
0210 
0211   MonitorElement *hadEnergyTiming_Low_HF;
0212   MonitorElement *hadEnergyTiming_HF;
0213   MonitorElement *hadEnergyTiming_profile_Low_HF;
0214   MonitorElement *hadEnergyTiming_profile_HF;
0215 };
0216 
0217 #endif