Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef ValidationSimHitsValidationHcal_H
0002 #define ValidationSimHitsValidationHcal_H
0003 
0004 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0005 #include "FWCore/Framework/interface/Frameworkfwd.h"
0006 
0007 #include "FWCore/Framework/interface/Event.h"
0008 #include "FWCore/Framework/interface/EventSetup.h"
0009 #include "FWCore/Framework/interface/MakerMacros.h"
0010 
0011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0013 
0014 #include "DQMServices/Core/interface/DQMStore.h"
0015 #include "FWCore/ServiceRegistry/interface/Service.h"
0016 
0017 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0018 #include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h"
0019 #include "Geometry/Records/interface/HcalRecNumberingRecord.h"
0020 #include "SimDataFormats/CaloHit/interface/PCaloHit.h"
0021 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
0022 
0023 #include <fstream>
0024 #include <iostream>
0025 #include <map>
0026 #include <string>
0027 #include <vector>
0028 
0029 class SimHitsValidationHcal : public DQMEDAnalyzer {
0030 public:
0031   SimHitsValidationHcal(const edm::ParameterSet &ps);
0032   ~SimHitsValidationHcal() override = default;
0033   static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0034 
0035 protected:
0036   void analyze(const edm::Event &e, const edm::EventSetup &c) override;
0037   void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0038 
0039   void analyzeHits(std::vector<PCaloHit> &);
0040 
0041 private:
0042   struct energysum {
0043     double e25, e50, e100, e250;
0044     energysum() { e25 = e50 = e100 = e250 = 0.0; }
0045   };
0046 
0047   struct idType {
0048     idType() {
0049       subdet = HcalEmpty;
0050       z = depth1 = depth2 = 0;
0051     }
0052     idType(HcalSubdetector det, int iz, int d1, int d2) {
0053       subdet = det;
0054       z = iz;
0055       depth1 = d1;
0056       depth2 = d2;
0057     }
0058     HcalSubdetector subdet;
0059     int z, depth1, depth2;
0060   };
0061 
0062   struct etaRange {
0063     etaRange() {
0064       bins = 0;
0065       low = high = 0;
0066     }
0067     etaRange(int bin, double min, double max) {
0068       bins = bin;
0069       low = min;
0070       high = max;
0071     }
0072     int bins;
0073     double low, high;
0074   };
0075 
0076   std::vector<std::pair<std::string, std::string>> getHistogramTypes();
0077   etaRange getLimits(idType);
0078   std::pair<int, int> histId(int subdet, int eta, int depth, unsigned int dep);
0079 
0080   bool initialized;
0081   const std::string g4Label_, hcalHits_;
0082   const bool verbose_, testNumber_;
0083   const edm::EDGetTokenT<edm::PCaloHitContainer> tok_hits_;
0084   const edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_HRNDC_;
0085   const HcalDDDRecConstants *hcons;
0086   std::vector<idType> types;
0087   int maxDepthHB_, maxDepthHE_;
0088   int maxDepthHO_, maxDepthHF_;
0089 
0090   std::vector<MonitorElement *> meHcalHitEta_, meHcalHitTimeEta_;
0091   std::vector<MonitorElement *> meHcalEnergyl25_, meHcalEnergyl50_;
0092   std::vector<MonitorElement *> meHcalEnergyl100_, meHcalEnergyl250_;
0093   MonitorElement *meEnergy_HB, *metime_HB, *metime_enweighted_HB;
0094   MonitorElement *meEnergy_HE, *metime_HE, *metime_enweighted_HE;
0095   MonitorElement *meEnergy_HO, *metime_HO, *metime_enweighted_HO;
0096   MonitorElement *meEnergy_HF, *metime_HF, *metime_enweighted_HF;
0097 };
0098 
0099 #endif