Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef Validation_HGCalValidation_TICLCandidateValidator_h
0002 #define Validation_HGCalValidation_TICLCandidateValidator_h
0003 
0004 #include <iostream>
0005 #include <vector>
0006 #include <unordered_map>
0007 
0008 #include "FWCore/Framework/interface/ConsumesCollector.h"
0009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0010 #include "FWCore/Framework/interface/EventSetup.h"
0011 #include "FWCore/Framework/interface/Event.h"
0012 #include "FWCore/Utilities/interface/EDGetToken.h"
0013 #include "FWCore/Framework/interface/Frameworkfwd.h"
0014 
0015 #include "DataFormats/TrackReco/interface/Track.h"
0016 #include "DataFormats/HGCalReco/interface/Trackster.h"
0017 #include "DataFormats/HGCalReco/interface/TICLCandidate.h"
0018 
0019 #include "SimDataFormats/Associations/interface/TracksterToSimTracksterHitLCAssociator.h"
0020 
0021 #include "DQMServices/Core/interface/DQMStore.h"
0022 
0023 struct TICLCandidateValidatorHistograms {
0024   dqm::reco::MonitorElement* h_tracksters_in_candidate;
0025   dqm::reco::MonitorElement* h_candidate_raw_energy;
0026   dqm::reco::MonitorElement* h_candidate_regressed_energy;
0027   dqm::reco::MonitorElement* h_candidate_pT;
0028   dqm::reco::MonitorElement* h_candidate_charge;
0029   dqm::reco::MonitorElement* h_candidate_pdgId;
0030   dqm::reco::MonitorElement* h_candidate_partType;
0031 
0032   std::vector<dqm::reco::MonitorElement*> h_den_chg_energy_candidate;
0033   std::vector<dqm::reco::MonitorElement*> h_num_chg_energy_candidate_track;
0034   std::vector<dqm::reco::MonitorElement*> h_num_chg_energy_candidate_pdgId;
0035   std::vector<dqm::reco::MonitorElement*> h_num_chg_energy_candidate_energy;
0036   std::vector<dqm::reco::MonitorElement*> h_den_chg_pt_candidate;
0037   std::vector<dqm::reco::MonitorElement*> h_num_chg_pt_candidate_track;
0038   std::vector<dqm::reco::MonitorElement*> h_num_chg_pt_candidate_pdgId;
0039   std::vector<dqm::reco::MonitorElement*> h_num_chg_pt_candidate_energy;
0040   std::vector<dqm::reco::MonitorElement*> h_den_chg_eta_candidate;
0041   std::vector<dqm::reco::MonitorElement*> h_num_chg_eta_candidate_track;
0042   std::vector<dqm::reco::MonitorElement*> h_num_chg_eta_candidate_pdgId;
0043   std::vector<dqm::reco::MonitorElement*> h_num_chg_eta_candidate_energy;
0044   std::vector<dqm::reco::MonitorElement*> h_den_chg_phi_candidate;
0045   std::vector<dqm::reco::MonitorElement*> h_num_chg_phi_candidate_track;
0046   std::vector<dqm::reco::MonitorElement*> h_num_chg_phi_candidate_pdgId;
0047   std::vector<dqm::reco::MonitorElement*> h_num_chg_phi_candidate_energy;
0048 
0049   std::vector<dqm::reco::MonitorElement*> h_den_neut_energy_candidate;
0050   std::vector<dqm::reco::MonitorElement*> h_num_neut_energy_candidate_pdgId;
0051   std::vector<dqm::reco::MonitorElement*> h_num_neut_energy_candidate_energy;
0052   std::vector<dqm::reco::MonitorElement*> h_den_neut_pt_candidate;
0053   std::vector<dqm::reco::MonitorElement*> h_num_neut_pt_candidate_pdgId;
0054   std::vector<dqm::reco::MonitorElement*> h_num_neut_pt_candidate_energy;
0055   std::vector<dqm::reco::MonitorElement*> h_den_neut_eta_candidate;
0056   std::vector<dqm::reco::MonitorElement*> h_num_neut_eta_candidate_pdgId;
0057   std::vector<dqm::reco::MonitorElement*> h_num_neut_eta_candidate_energy;
0058   std::vector<dqm::reco::MonitorElement*> h_den_neut_phi_candidate;
0059   std::vector<dqm::reco::MonitorElement*> h_num_neut_phi_candidate_pdgId;
0060   std::vector<dqm::reco::MonitorElement*> h_num_neut_phi_candidate_energy;
0061 
0062   std::vector<dqm::reco::MonitorElement*> h_den_fake_chg_energy_candidate;
0063   std::vector<dqm::reco::MonitorElement*> h_num_fake_chg_energy_candidate_track;
0064   std::vector<dqm::reco::MonitorElement*> h_num_fake_chg_energy_candidate_pdgId;
0065   std::vector<dqm::reco::MonitorElement*> h_num_fake_chg_energy_candidate_energy;
0066   std::vector<dqm::reco::MonitorElement*> h_den_fake_chg_pt_candidate;
0067   std::vector<dqm::reco::MonitorElement*> h_num_fake_chg_pt_candidate_track;
0068   std::vector<dqm::reco::MonitorElement*> h_num_fake_chg_pt_candidate_pdgId;
0069   std::vector<dqm::reco::MonitorElement*> h_num_fake_chg_pt_candidate_energy;
0070   std::vector<dqm::reco::MonitorElement*> h_den_fake_chg_eta_candidate;
0071   std::vector<dqm::reco::MonitorElement*> h_num_fake_chg_eta_candidate_track;
0072   std::vector<dqm::reco::MonitorElement*> h_num_fake_chg_eta_candidate_pdgId;
0073   std::vector<dqm::reco::MonitorElement*> h_num_fake_chg_eta_candidate_energy;
0074   std::vector<dqm::reco::MonitorElement*> h_den_fake_chg_phi_candidate;
0075   std::vector<dqm::reco::MonitorElement*> h_num_fake_chg_phi_candidate_track;
0076   std::vector<dqm::reco::MonitorElement*> h_num_fake_chg_phi_candidate_pdgId;
0077   std::vector<dqm::reco::MonitorElement*> h_num_fake_chg_phi_candidate_energy;
0078 
0079   std::vector<dqm::reco::MonitorElement*> h_den_fake_neut_energy_candidate;
0080   std::vector<dqm::reco::MonitorElement*> h_num_fake_neut_energy_candidate_pdgId;
0081   std::vector<dqm::reco::MonitorElement*> h_num_fake_neut_energy_candidate_energy;
0082   std::vector<dqm::reco::MonitorElement*> h_den_fake_neut_pt_candidate;
0083   std::vector<dqm::reco::MonitorElement*> h_num_fake_neut_pt_candidate_pdgId;
0084   std::vector<dqm::reco::MonitorElement*> h_num_fake_neut_pt_candidate_energy;
0085   std::vector<dqm::reco::MonitorElement*> h_den_fake_neut_eta_candidate;
0086   std::vector<dqm::reco::MonitorElement*> h_num_fake_neut_eta_candidate_pdgId;
0087   std::vector<dqm::reco::MonitorElement*> h_num_fake_neut_eta_candidate_energy;
0088   std::vector<dqm::reco::MonitorElement*> h_den_fake_neut_phi_candidate;
0089   std::vector<dqm::reco::MonitorElement*> h_num_fake_neut_phi_candidate_pdgId;
0090   std::vector<dqm::reco::MonitorElement*> h_num_fake_neut_phi_candidate_energy;
0091 
0092   std::vector<dqm::reco::MonitorElement*> h_chg_tracksters_in_candidate;
0093   std::vector<dqm::reco::MonitorElement*> h_chg_candidate_regressed_energy;
0094   std::vector<dqm::reco::MonitorElement*> h_chg_candidate_charge;
0095   std::vector<dqm::reco::MonitorElement*> h_chg_candidate_pdgId;
0096   std::vector<dqm::reco::MonitorElement*> h_chg_candidate_partType;
0097 
0098   std::vector<dqm::reco::MonitorElement*> h_neut_tracksters_in_candidate;
0099   std::vector<dqm::reco::MonitorElement*> h_neut_candidate_regressed_energy;
0100   std::vector<dqm::reco::MonitorElement*> h_neut_candidate_charge;
0101   std::vector<dqm::reco::MonitorElement*> h_neut_candidate_pdgId;
0102   std::vector<dqm::reco::MonitorElement*> h_neut_candidate_partType;
0103 };
0104 
0105 class TICLCandidateValidator {
0106 public:
0107   typedef dqm::legacy::DQMStore DQMStore;
0108   typedef dqm::legacy::MonitorElement MonitorElement;
0109 
0110   TICLCandidateValidator(){};
0111   TICLCandidateValidator(edm::EDGetTokenT<std::vector<TICLCandidate>> TICLCandidates,
0112                          edm::EDGetTokenT<std::vector<TICLCandidate>> simTICLCandidatesToken,
0113                          edm::EDGetTokenT<std::vector<reco::Track>> recoTracksToken,
0114                          edm::EDGetTokenT<std::vector<ticl::Trackster>> trackstersToken,
0115                          edm::EDGetTokenT<ticl::RecoToSimCollectionSimTracksters> associatorMapRtSToken,
0116                          edm::EDGetTokenT<ticl::SimToRecoCollectionSimTracksters> associatorMapStRToken,
0117                          edm::EDGetTokenT<ticl::RecoToSimCollectionSimTracksters> associatorMapRtSPUToken,
0118                          bool isTICLv5);
0119   ~TICLCandidateValidator();
0120 
0121   using Histograms = TICLCandidateValidatorHistograms;
0122 
0123   void bookCandidatesHistos(DQMStore::IBooker& ibook, Histograms& histograms, std::string baseDir) const;
0124 
0125   void fillCandidateHistos(const edm::Event& event,
0126                            const Histograms& histograms,
0127                            edm::Handle<ticl::TracksterCollection> simTrackstersCP_h) const;
0128 
0129 private:
0130   edm::EDGetTokenT<std::vector<TICLCandidate>> TICLCandidatesToken_;
0131   edm::EDGetTokenT<std::vector<TICLCandidate>> simTICLCandidatesToken_;
0132   edm::EDGetTokenT<std::vector<reco::Track>> recoTracksToken_;
0133   edm::EDGetTokenT<std::vector<ticl::Trackster>> trackstersToken_;
0134   edm::EDGetTokenT<ticl::RecoToSimCollectionSimTracksters> associatorMapRtSToken_;
0135   edm::EDGetTokenT<ticl::SimToRecoCollectionSimTracksters> associatorMapStRToken_;
0136   edm::EDGetTokenT<ticl::RecoToSimCollectionSimTracksters> associatorMapRtSPUToken_;
0137   bool isTICLv5_ = false;
0138 };
0139 
0140 #endif