Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef HCALDIGISVALIDATION_H
0002 #define HCALDIGISVALIDATION_H
0003 
0004 #include <memory>
0005 
0006 #include "FWCore/Framework/interface/Frameworkfwd.h"
0007 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0008 
0009 #include "FWCore/Framework/interface/Event.h"
0010 
0011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0012 #include "DQMServices/Core/interface/DQMStore.h"
0013 
0014 #include "FWCore/ServiceRegistry/interface/Service.h"
0015 #include "FWCore/Utilities/interface/EDGetToken.h"
0016 
0017 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0018 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0019 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0020 #include "Geometry/CaloTopology/interface/HcalTopology.h"
0021 #include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h"
0022 #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h"
0023 #include "Geometry/HcalTowerAlgo/interface/HcalTrigTowerGeometry.h"
0024 
0025 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0026 #include "Geometry/Records/interface/HcalGeometryRecord.h"
0027 #include "Geometry/Records/interface/HcalRecNumberingRecord.h"
0028 
0029 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
0030 
0031 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
0032 #include "CalibFormats/HcalObjects/interface/HcalCoderDb.h"
0033 #include "CalibFormats/HcalObjects/interface/HcalCalibrations.h"
0034 #include "CondFormats/HcalObjects/interface/HcalQIEShape.h"
0035 
0036 #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h"
0037 #include "CalibFormats/HcalObjects/interface/HcalDbService.h"
0038 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0039 
0040 /*TP Code*/
0041 #include "CalibFormats/CaloTPG/interface/CaloTPGTranscoder.h"
0042 #include "CalibFormats/CaloTPG/interface/CaloTPGRecord.h"
0043 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0044 /*~TP Code*/
0045 
0046 #include <map>
0047 #include <vector>
0048 #include <utility>
0049 #include <ostream>
0050 #include <string>
0051 #include <algorithm>
0052 #include <cmath>
0053 #include <iostream>
0054 
0055 class HcalDigisValidation : public DQMEDAnalyzer {
0056 public:
0057   explicit HcalDigisValidation(const edm::ParameterSet &);
0058 
0059   ~HcalDigisValidation() override;
0060 
0061   void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0062   void dqmBeginRun(const edm::Run &run, const edm::EventSetup &c) override;
0063 
0064 private:
0065   struct HistLim {
0066     HistLim(int nbin, double mini, double maxi) : n(nbin), min(mini), max(maxi) {}
0067     int n;
0068     double min;
0069     double max;
0070   };
0071 
0072   void analyze(const edm::Event &, const edm::EventSetup &) override;
0073 
0074   std::map<std::string, MonitorElement *> *msm_;
0075 
0076   void book1D(DQMStore::IBooker &ib, std::string name, int n, double min, double max);
0077 
0078   void book1D(DQMStore::IBooker &ib, std::string name, const HistLim &limX);
0079 
0080   void fill1D(std::string name, double X, double weight = 1);
0081 
0082   void book2D(DQMStore::IBooker &ib, std::string name, const HistLim &limX, const HistLim &limY);
0083 
0084   void fill2D(std::string name, double X, double Y, double weight = 1);
0085 
0086   void bookPf(DQMStore::IBooker &ib, std::string name, const HistLim &limX, const HistLim &limY);
0087 
0088   void bookPf(DQMStore::IBooker &ib, std::string name, const HistLim &limX, const HistLim &limY, const char *option);
0089 
0090   void fillPf(std::string name, double X, double Y);
0091 
0092   MonitorElement *monitor(std::string name);
0093 
0094   void booking(DQMStore::IBooker &ib, std::string subdetopt, int bnoise, int bmc);
0095 
0096   std::string str(int x);
0097 
0098   template <class Digi>
0099   void reco(const edm::Event &iEvent,
0100             const edm::EventSetup &iSetup,
0101             const edm::EDGetTokenT<edm::SortedCollection<Digi> > &tok);
0102   template <class dataFrameType>
0103   void reco(const edm::Event &iEvent,
0104             const edm::EventSetup &iSetup,
0105             const edm::EDGetTokenT<HcalDataFrameContainer<dataFrameType> > &tok);
0106 
0107   std::string outputFile_;
0108   std::string subdet_;
0109   std::string zside_;
0110   std::string dirName_;
0111   //    std::string inputLabel_;
0112   edm::InputTag inputTag_;
0113   edm::InputTag QIE10inputTag_;
0114   edm::InputTag QIE11inputTag_;
0115   edm::InputTag emulTPsTag_;
0116   edm::InputTag dataTPsTag_;
0117   std::string mode_;
0118   std::string mc_;
0119   int noise_;
0120   bool testNumber_;
0121   bool hep17_;
0122   bool HEPhase1_;
0123   bool HBPhase1_;
0124   bool Plot_TP_ver_;
0125 
0126   edm::EDGetTokenT<edm::PCaloHitContainer> tok_mc_;
0127   edm::EDGetTokenT<HBHEDigiCollection> tok_hbhe_;
0128   edm::EDGetTokenT<HODigiCollection> tok_ho_;
0129   edm::EDGetTokenT<HFDigiCollection> tok_hf_;
0130   edm::EDGetTokenT<HcalTrigPrimDigiCollection> tok_emulTPs_;
0131   edm::EDGetTokenT<HcalTrigPrimDigiCollection> tok_dataTPs_;
0132 
0133   edm::EDGetTokenT<QIE10DigiCollection> tok_qie10_hf_;
0134   edm::EDGetTokenT<QIE11DigiCollection> tok_qie11_hbhe_;
0135 
0136   edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_HRNDC_;
0137   edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_Geom_;
0138   edm::ESGetToken<CaloTPGTranscoder, CaloTPGRecord> tok_Decoder_;
0139   edm::ESGetToken<HcalTrigTowerGeometry, CaloGeometryRecord> tok_TPGeom_;
0140   edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> tok_Topo_;
0141   edm::ESGetToken<HcalDbService, HcalDbRecord> tok_Cond_;
0142 
0143   const HcalDbService *conditions_;
0144   const HcalDDDRecConstants *hcons_;
0145   const HcalTopology *htopo_;
0146 
0147   int nevent1;
0148   int nevent2;
0149   int nevent3;
0150   int nevent4;
0151   int nevtot;
0152 
0153   int maxDepth_[5];   // 0:any, 1:HB, 2:HE, 3:HF
0154   int nChannels_[5];  // 0:any, 1:HB, 2:HE,
0155 
0156   bool skipDataTPs;
0157 };
0158 
0159 #endif