File indexing completed on 2024-04-06 12:33:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include <memory>
0022 #include <array>
0023
0024
0025 #include "FWCore/Framework/interface/Frameworkfwd.h"
0026
0027 #include "FWCore/Framework/interface/Event.h"
0028 #include "FWCore/Framework/interface/MakerMacros.h"
0029
0030 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0031 #include "FWCore/ServiceRegistry/interface/Service.h"
0032 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0033
0034 #include "DQMServices/Core/interface/DQMStore.h"
0035 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0036
0037 #include "FWCore/ServiceRegistry/interface/Service.h"
0038
0039 #include "DataFormats/TrackReco/interface/Track.h"
0040 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0041 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0042 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0043 #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h"
0044 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h"
0045 #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h"
0046 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0047 #include "TrackingTools/PatternTools/interface/TrajectoryStateClosestToBeamLineBuilder.h"
0048 #include "TrackingTools/PatternTools/interface/ClosestApproachInRPhi.h"
0049
0050 #include "DataFormats/Candidate/interface/Candidate.h"
0051 #include "DataFormats/Candidate/interface/VertexCompositeCandidate.h"
0052 #include "DataFormats/V0Candidate/interface/V0Candidate.h"
0053 #include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
0054
0055 #include "SimTracker/TrackHistory/interface/TrackClassifier.h"
0056 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h"
0057
0058 #include "Geometry/CommonDetUnit/interface/TrackingGeometry.h"
0059 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0060 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0061 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0062 #include "Geometry/CommonDetUnit/interface/GluedGeomDet.h"
0063
0064 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0065 #include "MagneticField/VolumeBasedEngine/interface/VolumeBasedMagneticField.h"
0066
0067 #include "RecoVertex/VertexTools/interface/VertexDistance3D.h"
0068 #include "DataFormats/VertexReco/interface/Vertex.h"
0069
0070 #include "HepMC/GenVertex.h"
0071 #include "HepMC/GenParticle.h"
0072
0073 #include "TROOT.h"
0074 #include "TMath.h"
0075 #include "TH1F.h"
0076 #include "TH1I.h"
0077 #include "TH2F.h"
0078
0079 class V0Validator : public DQMEDAnalyzer {
0080 public:
0081 explicit V0Validator(const edm::ParameterSet &);
0082 ~V0Validator() override;
0083 enum V0Type { KSHORT, LAMBDA };
0084 struct V0Couple {
0085 reco::TrackRef one;
0086 reco::TrackRef two;
0087 explicit V0Couple(reco::TrackRef first_daughter, reco::TrackRef second_daughter) {
0088 one = first_daughter.key() < second_daughter.key() ? first_daughter : second_daughter;
0089 two = first_daughter.key() > second_daughter.key() ? first_daughter : second_daughter;
0090 assert(one != two);
0091 }
0092 bool operator<(const V0Couple &rh) const { return one.key() < rh.one.key(); }
0093 bool operator==(const V0Couple &rh) const { return ((one.key() == rh.one.key()) && (two.key() == rh.two.key())); }
0094 };
0095
0096 private:
0097 void analyze(const edm::Event &, const edm::EventSetup &) override;
0098 void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0099 void doFakeRates(const reco::VertexCompositeCandidateCollection &collection,
0100 const reco::RecoToSimCollection &recotosimCollection,
0101 V0Type t,
0102 int particle_pdgid,
0103 int misreconstructed_particle_pdgid);
0104
0105 void doEfficiencies(const TrackingVertexCollection &gen_vertices,
0106 V0Type t,
0107 int parent_particle_id,
0108 int first_daughter_id,
0109 int second_daughter_id,
0110 const reco::VertexCompositeCandidateCollection &collection,
0111 const reco::SimToRecoCollection &simtorecoCollection);
0112
0113
0114
0115 std::array<MonitorElement *, 2> candidateEffVsR_num_;
0116 std::array<MonitorElement *, 2> candidateEffVsEta_num_;
0117 std::array<MonitorElement *, 2> candidateEffVsPt_num_;
0118 std::array<MonitorElement *, 2> candidateTkEffVsR_num_;
0119 std::array<MonitorElement *, 2> candidateTkEffVsEta_num_;
0120 std::array<MonitorElement *, 2> candidateTkEffVsPt_num_;
0121 std::array<MonitorElement *, 2> candidateFakeVsR_num_;
0122 std::array<MonitorElement *, 2> candidateFakeVsEta_num_;
0123 std::array<MonitorElement *, 2> candidateFakeVsPt_num_;
0124 std::array<MonitorElement *, 2> candidateTkFakeVsR_num_;
0125 std::array<MonitorElement *, 2> candidateTkFakeVsEta_num_;
0126 std::array<MonitorElement *, 2> candidateTkFakeVsPt_num_;
0127
0128 std::array<MonitorElement *, 2> candidateFakeVsR_denom_;
0129 std::array<MonitorElement *, 2> candidateFakeVsEta_denom_;
0130 std::array<MonitorElement *, 2> candidateFakeVsPt_denom_;
0131 std::array<MonitorElement *, 2> candidateEffVsR_denom_;
0132 std::array<MonitorElement *, 2> candidateEffVsEta_denom_;
0133 std::array<MonitorElement *, 2> candidateEffVsPt_denom_;
0134
0135 std::array<MonitorElement *, 2> nCandidates_;
0136 std::array<MonitorElement *, 2> candidateStatus_;
0137 std::array<MonitorElement *, 2> fakeCandidateMass_;
0138 std::array<MonitorElement *, 2> candidateFakeDauRadDist_;
0139 std::array<MonitorElement *, 2> candidateMassAll;
0140 std::array<MonitorElement *, 2> goodCandidateMass;
0141
0142 std::string theDQMRootFileName;
0143 std::string dirName;
0144 edm::EDGetTokenT<reco::RecoToSimCollection> recoRecoToSimCollectionToken_;
0145 edm::EDGetTokenT<reco::SimToRecoCollection> recoSimToRecoCollectionToken_;
0146 edm::EDGetTokenT<TrackingVertexCollection> trackingVertexCollection_Token_;
0147 edm::EDGetTokenT<std::vector<reco::Vertex> > vec_recoVertex_Token_;
0148 edm::EDGetTokenT<reco::VertexCompositeCandidateCollection> recoVertexCompositeCandidateCollection_k0s_Token_,
0149 recoVertexCompositeCandidateCollection_lambda_Token_;
0150 };