Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-16 06:16:10

0001 #ifndef HGCalValidator_h
0002 #define HGCalValidator_h
0003 
0004 /** \class HGCalValidator
0005  *  Class that produces histograms to validate HGCal Reconstruction performances
0006  *
0007  *  \author HGCal
0008  */
0009 #include "FWCore/Framework/interface/Event.h"
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 #include "FWCore/Utilities/interface/EDGetToken.h"
0012 #include "FWCore/Framework/interface/Frameworkfwd.h"
0013 #include "FWCore/ParameterSet/interface/FileInPath.h"
0014 
0015 #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h"
0016 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
0017 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0018 #include "DataFormats/HGCalReco/interface/Trackster.h"
0019 #include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h"
0020 #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h"
0021 #include "SimDataFormats/Vertex/interface/SimVertex.h"
0022 
0023 #include "DQMServices/Core/interface/DQMGlobalEDAnalyzer.h"
0024 
0025 #include "Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h"
0026 #include "Validation/HGCalValidation/interface/CaloParticleSelector.h"
0027 #include "RecoLocalCalo/HGCalRecProducers/interface/HGCalClusteringAlgoBase.h"
0028 
0029 #include "SimDataFormats/Associations/interface/LayerClusterToCaloParticleAssociator.h"
0030 #include "SimDataFormats/Associations/interface/LayerClusterToSimClusterAssociator.h"
0031 
0032 class PileupSummaryInfo;
0033 
0034 struct HGCalValidatorHistograms {
0035   HGVHistoProducerAlgoHistograms histoProducerAlgo;
0036   std::vector<dqm::reco::MonitorElement*> h_layerclusters_coll;
0037 };
0038 
0039 class HGCalValidator : public DQMGlobalEDAnalyzer<HGCalValidatorHistograms> {
0040 public:
0041   using Histograms = HGCalValidatorHistograms;
0042 
0043   /// Constructor
0044   HGCalValidator(const edm::ParameterSet& pset);
0045 
0046   /// Destructor
0047   ~HGCalValidator() override;
0048 
0049   /// Method called once per event
0050   void dqmAnalyze(const edm::Event&, const edm::EventSetup&, const Histograms&) const override;
0051   /// Method called to book the DQM histograms
0052   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&, Histograms&) const override;
0053 
0054   void cpParametersAndSelection(const Histograms& histograms,
0055                                 std::vector<CaloParticle> const& cPeff,
0056                                 std::vector<SimVertex> const& simVertices,
0057                                 std::vector<size_t>& selected_cPeff,
0058                                 unsigned int layers,
0059                                 std::unordered_map<DetId, const HGCRecHit*> const&) const;
0060 
0061 protected:
0062   edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeomToken_;
0063   edm::InputTag label_lcl;
0064   std::vector<edm::InputTag> label_tst;
0065   edm::InputTag label_simTS, label_simTSFromCP;
0066   edm::InputTag associator_;
0067   edm::InputTag associatorSim_;
0068   const bool SaveGeneralInfo_;
0069   const bool doCaloParticlePlots_;
0070   const bool doCaloParticleSelection_;
0071   const bool doSimClustersPlots_;
0072   edm::InputTag label_SimClustersPlots_, label_SimClustersLevel_;
0073   const bool doLayerClustersPlots_;
0074   edm::InputTag label_layerClustersPlots_, label_LCToCPLinking_;
0075   const bool doTrackstersPlots_;
0076   std::string label_TS_, label_TSToCPLinking_, label_TSToSTSPR_;
0077   std::vector<edm::InputTag> label_clustersmask;
0078   const edm::FileInPath cummatbudinxo_;
0079 
0080   std::vector<edm::EDGetTokenT<reco::CaloClusterCollection>> labelToken;
0081   edm::EDGetTokenT<std::vector<SimCluster>> simClusters_;
0082   edm::EDGetTokenT<reco::CaloClusterCollection> layerclusters_;
0083   std::vector<edm::EDGetTokenT<ticl::TracksterCollection>> label_tstTokens;
0084   edm::EDGetTokenT<ticl::TracksterCollection> simTracksters_;
0085   edm::EDGetTokenT<ticl::TracksterCollection> simTracksters_fromCPs_;
0086   edm::EDGetTokenT<std::map<uint, std::vector<uint>>> simTrackstersMap_;
0087   edm::EDGetTokenT<std::vector<CaloParticle>> label_cp_effic;
0088   edm::EDGetTokenT<std::vector<CaloParticle>> label_cp_fake;
0089   edm::EDGetTokenT<std::vector<SimVertex>> simVertices_;
0090   std::vector<edm::EDGetTokenT<std::vector<float>>> clustersMaskTokens_;
0091   edm::EDGetTokenT<std::unordered_map<DetId, const HGCRecHit*>> hitMap_;
0092   edm::EDGetTokenT<Density> density_;
0093   edm::EDGetTokenT<hgcal::RecoToSimCollection> associatorMapRtS;
0094   edm::EDGetTokenT<hgcal::SimToRecoCollection> associatorMapStR;
0095   edm::EDGetTokenT<hgcal::SimToRecoCollectionWithSimClusters> associatorMapSimtR;
0096   edm::EDGetTokenT<hgcal::RecoToSimCollectionWithSimClusters> associatorMapRtSim;
0097   std::unique_ptr<HGVHistoProducerAlgo> histoProducerAlgo_;
0098 
0099 private:
0100   CaloParticleSelector cpSelector;
0101   std::shared_ptr<hgcal::RecHitTools> tools_;
0102   std::map<double, double> cummatbudg;
0103   std::vector<int> particles_to_monitor_;
0104   unsigned totallayers_to_monitor_;
0105   std::vector<int> thicknesses_to_monitor_;
0106   std::string dirName_;
0107 };
0108 
0109 #endif