Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-13 03:24:16

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/TICLCandidateValidator.h"
0026 #include "Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h"
0027 #include "Validation/HGCalValidation/interface/CaloParticleSelector.h"
0028 #include "RecoLocalCalo/HGCalRecProducers/interface/HGCalClusteringAlgoBase.h"
0029 
0030 #include "SimDataFormats/Associations/interface/LayerClusterToCaloParticleAssociator.h"
0031 #include "SimDataFormats/Associations/interface/LayerClusterToSimClusterAssociator.h"
0032 
0033 class PileupSummaryInfo;
0034 
0035 struct HGCalValidatorHistograms {
0036   HGVHistoProducerAlgoHistograms histoProducerAlgo;
0037   TICLCandidateValidatorHistograms histoTICLCandidates;
0038   std::vector<dqm::reco::MonitorElement*> h_layerclusters_coll;
0039 };
0040 
0041 class HGCalValidator : public DQMGlobalEDAnalyzer<HGCalValidatorHistograms> {
0042 public:
0043   using Histograms = HGCalValidatorHistograms;
0044 
0045   /// Constructor
0046   HGCalValidator(const edm::ParameterSet& pset);
0047 
0048   /// Destructor
0049   ~HGCalValidator() override;
0050 
0051   /// Method called once per event
0052   void dqmAnalyze(const edm::Event&, const edm::EventSetup&, const Histograms&) const override;
0053   /// Method called to book the DQM histograms
0054   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&, Histograms&) const override;
0055 
0056   void cpParametersAndSelection(const Histograms& histograms,
0057                                 std::vector<CaloParticle> const& cPeff,
0058                                 std::vector<SimVertex> const& simVertices,
0059                                 std::vector<size_t>& selected_cPeff,
0060                                 unsigned int layers,
0061                                 std::unordered_map<DetId, const unsigned int> const&,
0062                                 std::vector<HGCRecHit> const& hits) const;
0063 
0064 protected:
0065   edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeomToken_;
0066   edm::InputTag label_lcl;
0067   std::vector<edm::InputTag> label_tst;
0068   edm::InputTag label_simTS, label_simTSFromCP;
0069   edm::InputTag associator_;
0070   edm::InputTag associatorSim_;
0071   const bool SaveGeneralInfo_;
0072   const bool doCaloParticlePlots_;
0073   const bool doCaloParticleSelection_;
0074   const bool doSimClustersPlots_;
0075   edm::InputTag label_SimClustersPlots_, label_SimClustersLevel_;
0076   const bool doLayerClustersPlots_;
0077   edm::InputTag label_layerClustersPlots_, label_LCToCPLinking_;
0078   const bool doTrackstersPlots_;
0079   std::string label_TS_, label_TSToCPLinking_, label_TSToSTSPR_;
0080   std::vector<edm::InputTag> label_clustersmask;
0081   const bool doCandidatesPlots_;
0082   std::string label_candidates_;
0083   const edm::FileInPath cummatbudinxo_;
0084   const bool isTICLv5_;
0085 
0086   std::vector<edm::EDGetTokenT<reco::CaloClusterCollection>> labelToken;
0087   edm::EDGetTokenT<std::vector<SimCluster>> simClusters_;
0088   edm::EDGetTokenT<reco::CaloClusterCollection> layerclusters_;
0089   std::vector<edm::EDGetTokenT<ticl::TracksterCollection>> label_tstTokens;
0090   edm::EDGetTokenT<ticl::TracksterCollection> simTracksters_;
0091   edm::EDGetTokenT<ticl::TracksterCollection> simTracksters_fromCPs_;
0092   edm::EDGetTokenT<std::map<uint, std::vector<uint>>> simTrackstersMap_;
0093   edm::EDGetTokenT<std::vector<CaloParticle>> label_cp_effic;
0094   edm::EDGetTokenT<std::vector<CaloParticle>> label_cp_fake;
0095   edm::EDGetTokenT<std::vector<SimVertex>> simVertices_;
0096   std::vector<edm::EDGetTokenT<std::vector<float>>> clustersMaskTokens_;
0097   edm::EDGetTokenT<std::unordered_map<DetId, const unsigned int>> hitMap_;
0098   edm::EDGetTokenT<ticl::RecoToSimCollection> associatorMapRtS;
0099   edm::EDGetTokenT<ticl::SimToRecoCollection> associatorMapStR;
0100   edm::EDGetTokenT<ticl::SimToRecoCollectionWithSimClusters> associatorMapSimtR;
0101   edm::EDGetTokenT<ticl::RecoToSimCollectionWithSimClusters> associatorMapRtSim;
0102   std::unique_ptr<HGVHistoProducerAlgo> histoProducerAlgo_;
0103   std::vector<edm::InputTag> hits_label_;
0104   std::vector<edm::EDGetTokenT<HGCRecHitCollection>> hits_token_;
0105   std::unique_ptr<TICLCandidateValidator> candidateVal_;
0106 
0107 private:
0108   CaloParticleSelector cpSelector;
0109   std::shared_ptr<hgcal::RecHitTools> tools_;
0110   std::map<double, double> cumulative_material_budget;
0111   std::vector<int> particles_to_monitor_;
0112   unsigned totallayers_to_monitor_;
0113   std::vector<int> thicknesses_to_monitor_;
0114   std::string dirName_;
0115 };
0116 
0117 #endif