Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-11 02:41:10

0001 #ifndef HcalSimHitsValidation_H
0002 #define HcalSimHitsValidation_H
0003 
0004 #include "DQMServices/Core/interface/DQMOneEDAnalyzer.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 "DQMServices/Core/interface/DQMStore.h"
0015 
0016 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
0017 #include "DataFormats/HcalRecHit/interface/HcalSourcePositionData.h"
0018 
0019 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0020 #include <DataFormats/EcalDetId/interface/EBDetId.h>
0021 #include <DataFormats/EcalDetId/interface/EEDetId.h>
0022 
0023 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0024 #include "DataFormats/HcalDetId/interface/HcalElectronicsId.h"
0025 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0026 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0027 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0028 #include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h"
0029 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0030 #include "Geometry/Records/interface/HcalRecNumberingRecord.h"
0031 
0032 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
0033 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
0034 
0035 #include <algorithm>
0036 #include <cmath>
0037 #include <ostream>
0038 #include <string>
0039 #include <utility>
0040 #include <vector>
0041 
0042 class HcalSimHitsValidation : public DQMOneEDAnalyzer<> {
0043 public:
0044   HcalSimHitsValidation(edm::ParameterSet const &conf);
0045   ~HcalSimHitsValidation() override = default;
0046 
0047   void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0048 
0049   void analyze(edm::Event const &ev, edm::EventSetup const &c) override;
0050   void endJob() override;
0051 
0052 private:
0053   double dR(double eta1, double phi1, double eta2, double phi2);
0054   double phi12(double phi1, double en1, double phi2, double en2);
0055   double dPhiWsign(double phi1, double phi2);
0056 
0057   const std::string g4Label_, hcalHits_, ebHits_, eeHits_;
0058 
0059   // sampling factors
0060   const double hf1_;
0061   const double hf2_;
0062 
0063   const std::string outputFile_;
0064   const bool testNumber_;
0065   const bool auxPlots_;
0066 
0067   const edm::EDGetTokenT<edm::HepMCProduct> tok_evt_;
0068   const edm::EDGetTokenT<edm::PCaloHitContainer> tok_hcal_;
0069   const edm::EDGetTokenT<edm::PCaloHitContainer> tok_ecalEB_;
0070   const edm::EDGetTokenT<edm::PCaloHitContainer> tok_ecalEE_;
0071   const edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_HRNDC_;
0072   const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_geom_;
0073 
0074   const HcalDDDRecConstants *hcons_;
0075   const CaloGeometry *geometry_;
0076   int maxDepthHB_, maxDepthHE_;
0077   int maxDepthHO_, maxDepthHF_;
0078 
0079   // Hits counters
0080   std::vector<MonitorElement *> Nhb;
0081   std::vector<MonitorElement *> Nhe;
0082   MonitorElement *Nho;
0083   std::vector<MonitorElement *> Nhf;
0084 
0085   // In ALL other cases : 2D ieta-iphi maps
0086   // without and with cuts (a la "Scheme B") on energy
0087   // - only in the cone around particle for single-part samples (mc = "yes")
0088   // - for all calls in milti-particle samples (mc = "no")
0089 
0090   std::vector<MonitorElement *> emean_vs_ieta_HB;
0091   std::vector<MonitorElement *> emean_vs_ieta_HE;
0092   MonitorElement *emean_vs_ieta_HO;
0093   std::vector<MonitorElement *> emean_vs_ieta_HF;
0094 
0095   std::vector<MonitorElement *> occupancy_vs_ieta_HB;
0096   std::vector<MonitorElement *> occupancy_vs_ieta_HE;
0097   MonitorElement *occupancy_vs_ieta_HO;
0098   std::vector<MonitorElement *> occupancy_vs_ieta_HF;
0099 
0100   // for single monoenergetic particles - cone collection profile vs ieta.
0101   MonitorElement *meEnConeEtaProfile;
0102   MonitorElement *meEnConeEtaProfile_E;
0103   MonitorElement *meEnConeEtaProfile_EH;
0104 
0105   // energy of rechits
0106   std::vector<MonitorElement *> meSimHitsEnergyHB;
0107   std::vector<MonitorElement *> meSimHitsEnergyHE;
0108   MonitorElement *meSimHitsEnergyHO;
0109   std::vector<MonitorElement *> meSimHitsEnergyHF;
0110 
0111   // counter
0112   int nevtot;
0113 };
0114 
0115 #endif