Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:32:31

0001 #ifndef HcalRecHitsValidation_H
0002 #define HcalRecHitsValidation_H
0003 
0004 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0005 #include "FWCore/Framework/interface/Event.h"
0006 #include "FWCore/Framework/interface/EventSetup.h"
0007 #include "FWCore/Framework/interface/Frameworkfwd.h"
0008 #include "FWCore/Framework/interface/MakerMacros.h"
0009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 #include "FWCore/PluginManager/interface/ModuleDef.h"
0012 #include "FWCore/ServiceRegistry/interface/Service.h"
0013 
0014 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
0015 #include "DataFormats/HcalRecHit/interface/HcalSourcePositionData.h"
0016 
0017 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0018 #include <DataFormats/EcalDetId/interface/EBDetId.h>
0019 #include <DataFormats/EcalDetId/interface/EEDetId.h>
0020 
0021 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0022 #include "DataFormats/HcalDetId/interface/HcalElectronicsId.h"
0023 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0024 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0025 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0026 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0027 #include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h"
0028 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0029 #include "Geometry/Records/interface/HcalRecNumberingRecord.h"
0030 
0031 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
0032 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
0033 
0034 #include "DQMServices/Core/interface/DQMStore.h"
0035 #include <algorithm>
0036 #include <cmath>
0037 #include <ostream>
0038 #include <string>
0039 #include <utility>
0040 #include <vector>
0041 
0042 #include "DataFormats/DetId/interface/DetId.h"
0043 // channel status
0044 #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
0045 #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
0046 
0047 #include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h"
0048 #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
0049 
0050 // severity level assignment for HCAL
0051 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputer.h"
0052 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputerRcd.h"
0053 
0054 // severity level assignment for ECAL
0055 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"
0056 
0057 class HcalRecHitsValidation : public DQMEDAnalyzer {
0058 public:
0059   HcalRecHitsValidation(edm::ParameterSet const &conf);
0060   ~HcalRecHitsValidation() override = default;
0061   void analyze(edm::Event const &ev, edm::EventSetup const &c) override;
0062 
0063   void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0064 
0065 private:
0066   virtual void fillRecHitsTmp(int subdet_, edm::Event const &ev);
0067   double dR(double eta1, double phi1, double eta2, double phi2);
0068   double phi12(double phi1, double en1, double phi2, double en2);
0069   double dPhiWsign(double phi1, double phi2);
0070 
0071   const std::string topFolderName_;
0072   const std::string outputFile_;
0073   const std::string hcalselector_;
0074   const std::string ecalselector_;
0075   const std::string sign_;
0076   const std::string mc_;
0077   const bool testNumber_;
0078 
0079   // RecHit Collection input tags
0080   const edm::InputTag EBRecHitCollectionLabel_;
0081   const edm::InputTag EERecHitCollectionLabel_;
0082   const edm::EDGetTokenT<edm::HepMCProduct> tok_evt_;
0083   const edm::EDGetTokenT<EBRecHitCollection> tok_EB_;
0084   const edm::EDGetTokenT<EERecHitCollection> tok_EE_;
0085   const edm::EDGetTokenT<edm::PCaloHitContainer> tok_hh_;
0086   const edm::EDGetTokenT<HBHERecHitCollection> tok_hbhe_;
0087   const edm::EDGetTokenT<HFRecHitCollection> tok_hf_;
0088   const edm::EDGetTokenT<HORecHitCollection> tok_ho_;
0089 
0090   const edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_HRNDC_;
0091   const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_Geom_;
0092 
0093   // choice of subdetector in config : noise/HB/HE/HO/HF/ALL (0/1/2/3/4/5)
0094   int subdet_;
0095 
0096   // single/multi-particle sample (1/2)
0097   int iz;
0098   int imc;
0099 
0100   // In ALL other cases : 2D ieta-iphi maps
0101   // without and with cuts (a la "Scheme B") on energy
0102   // - only in the cone around particle for single-part samples (mc = "yes")
0103   // - for all calls in milti-particle samples (mc = "no")
0104 
0105   MonitorElement *meEnConeEtaProfile;
0106   MonitorElement *meEnConeEtaProfile_E;
0107   MonitorElement *meEnConeEtaProfile_EH;
0108 
0109   // energy of rechits
0110   MonitorElement *meRecHitsEnergyHB;
0111   MonitorElement *meRecHitsEnergyHE;
0112   MonitorElement *meRecHitsEnergyHO;
0113   MonitorElement *meRecHitsEnergyHF;
0114 
0115   MonitorElement *meTEprofileHB_Low;
0116   MonitorElement *meTEprofileHB;
0117   MonitorElement *meTEprofileHB_High;
0118 
0119   MonitorElement *meTEprofileHE_Low;
0120   MonitorElement *meTEprofileHE;
0121 
0122   MonitorElement *meTEprofileHO;
0123   MonitorElement *meTEprofileHO_High;
0124 
0125   MonitorElement *meTEprofileHF_Low;
0126   MonitorElement *meTEprofileHF;
0127 
0128   // Histo (2D plot) for sum of RecHits vs SimHits (hcal only)
0129   MonitorElement *meRecHitSimHitHB;
0130   MonitorElement *meRecHitSimHitHE;
0131   MonitorElement *meRecHitSimHitHO;
0132   MonitorElement *meRecHitSimHitHF;
0133   MonitorElement *meRecHitSimHitHFL;
0134   MonitorElement *meRecHitSimHitHFS;
0135   // profile histo (2D plot) for sum of RecHits vs SimHits (hcal only)
0136   MonitorElement *meRecHitSimHitProfileHB;
0137   MonitorElement *meRecHitSimHitProfileHE;
0138   MonitorElement *meRecHitSimHitProfileHO;
0139   MonitorElement *meRecHitSimHitProfileHF;
0140   MonitorElement *meRecHitSimHitProfileHFL;
0141   MonitorElement *meRecHitSimHitProfileHFS;
0142 
0143   // 2D plot of sum of RecHits in HCAL as function of ECAL's one
0144   MonitorElement *meEnergyHcalVsEcalHB;
0145   MonitorElement *meEnergyHcalVsEcalHE;
0146 
0147   // Chi2
0148   MonitorElement *meRecHitsM2Chi2HB;
0149   MonitorElement *meRecHitsM2Chi2HE;
0150 
0151   MonitorElement *meLog10Chi2profileHB;
0152   MonitorElement *meLog10Chi2profileHE;
0153 
0154   const CaloGeometry *geometry_;
0155 
0156   // Filling vectors with essential RecHits data
0157   std::vector<int> csub;
0158   std::vector<int> cieta;
0159   std::vector<int> ciphi;
0160   std::vector<int> cdepth;
0161   std::vector<double> cen;
0162   std::vector<double> ceta;
0163   std::vector<double> cphi;
0164   std::vector<double> ctime;
0165   std::vector<double> cz;
0166   std::vector<uint32_t> cstwd;
0167   std::vector<uint32_t> cauxstwd;
0168   std::vector<double> cchi2;
0169 
0170   // counter
0171   int nevtot;
0172 };
0173 
0174 #endif