CMS 3D CMS Logo

PrimaryVertexAnalyzer4PUSlimmed.h
Go to the documentation of this file.
1 #ifndef VALIDATION_RECOVERTEX_INTERFACE_PRIMARYVERTEXANALYZER4PUSLIMMED_H_
2 #define VALIDATION_RECOVERTEX_INTERFACE_PRIMARYVERTEXANALYZER4PUSLIMMED_H_
3 
4 // -*- C++ -*-
5 //
6 // Package: PrimaryVertexAnalyzer4PUSlimmed
7 // Class: PrimaryVertexAnalyzer4PUSlimmed
8 //
16 //
17 // Original Author: Marco Rovere (code adapted from old code by
18 // Wolfram Erdmann)
19 
20 
21 // system include files
22 #include <memory>
23 #include <string>
24 #include <vector>
25 #include <map>
26 #include <algorithm>
27 
28 // user include files
32 
33 // math
36 
37 // reco track
40 
41 // reco vertex
43 
44 // simulated track
47 
48 // pile-up
50 
51 // vertexing
53 
54 // simulated vertex
56 
57 // DQM
59 
60 class MonitorElement;
61 
62 // class declaration
65 
70  };
71 
72  // auxiliary class holding simulated vertices
74  simPrimaryVertex(double x1, double y1, double z1)
75  :x(x1), y(y1), z(z1),
77  nGenTrk(0),
80  ptot.setPx(0);
81  ptot.setPy(0);
82  ptot.setPz(0);
83  ptot.setE(0);
84  p4 = LorentzVector(0, 0, 0, 0);
85  r = sqrt(x*x + y*y);
86  };
87  double x, y, z, r;
88  HepMC::FourVector ptot;
89  LorentzVector p4;
90  double ptsq;
92  int nGenTrk;
97  std::vector<const reco::Vertex *> rec_vertices;
98  };
99 
100  // auxiliary class holding reconstructed vertices
103  NONE = 0,
104  MATCHED = 1,
105  DUPLICATE = 2,
106  MERGED = 4
107  };
108  recoPrimaryVertex(double x1, double y1, double z1)
109  :x(x1), y(y1), z(z1),
110  pt(0), ptsq(0), closest_vertex_distance_z(-1.), purity(-1.),
111  nRecoTrk(0),
112  num_matched_sim_tracks(0),
113  kind_of_vertex(0),
114  recVtx(nullptr) {
115  r = sqrt(x*x + y*y);
116  };
117  double x, y, z, r;
118  double pt;
119  double ptsq;
121  double purity; // calculated and assigned in calculatePurityAndFillHistograms
122  int nRecoTrk;
125  std::vector<const TrackingVertex *> sim_vertices;
126  std::vector<const simPrimaryVertex *> sim_vertices_internal;
127  std::vector<unsigned int> sim_vertices_num_shared_tracks;
130  };
131 
132  public:
135 
136  void analyze(const edm::Event&, const edm::EventSetup&) override;
138  edm::Run const&,
139  edm::EventSetup const&) override;
140 
141  private:
142  void resetSimPVAssociation(std::vector<simPrimaryVertex>&);
143  void matchSim2RecoVertices(std::vector<simPrimaryVertex>&,
145  void matchReco2SimVertices(std::vector<recoPrimaryVertex>&,
147  const std::vector<simPrimaryVertex>&);
150  // void fillGenericRecoVertexHistograms(const std::string &,
151  // const simPrimaryVertex &v);
153  const simPrimaryVertex &v);
156  bool genPVMatchedToRecoPV);
158  int,
161  int,
163  bool);
164 
166  std::vector<recoPrimaryVertex>&,
167  int, bool);
168 
169  std::vector<PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex> getSimPVs(
171 
172  std::vector<PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex> getRecoPVs(
174 
175  template<class T>
177 
178  // ----------member data ---------------------------
179  bool verbose_;
183 
184  std::map<std::string, std::map<std::string, MonitorElement*> > mes_;
187 
189  std::vector<edm::EDGetTokenT<edm::View<reco::Vertex> > > reco_vertex_collection_tokens_;
190  std::vector<edm::InputTag > reco_vertex_collections_;
196 
197  std::vector<bool> errorPrintedForColl_;
198 };
199 
200 #endif // VALIDATION_RECOVERTEX_INTERFACE_PRIMARYVERTEXANALYZER4PUSLIMMED_H_
void matchSim2RecoVertices(std::vector< simPrimaryVertex > &, const reco::VertexSimToRecoCollection &)
void fillGenAssociatedRecoVertexHistograms(const std::string &, int, recoPrimaryVertex &v)
std::vector< PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex > getRecoPVs(const edm::Handle< edm::View< reco::Vertex >> &)
bool matchRecoTrack2SimSignal(const reco::TrackBaseRef &)
void resetSimPVAssociation(std::vector< simPrimaryVertex > &)
edm::EDGetTokenT< reco::SimToRecoCollection > simToRecoAssociationToken_
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > vecPileupSummaryInfoToken_
void fillRecoAssociatedGenPVHistograms(const std::string &label, const PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex &v, bool genPVMatchedToRecoPV)
void computePairDistance(const T &collection, MonitorElement *me)
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
PrimaryVertexAnalyzer4PUSlimmed(const edm::ParameterSet &)
edm::EDGetTokenT< TrackingVertexCollection > trackingVertexCollectionToken_
#define nullptr
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex > getSimPVs(const edm::Handle< TrackingVertexCollection > &)
T sqrt(T t)
Definition: SSEVec.h:18
void fillResolutionAndPullHistograms(const std::string &, int, recoPrimaryVertex &v, bool)
void calculatePurityAndFillHistograms(const std::string &, std::vector< recoPrimaryVertex > &, int, bool)
const reco::SimToRecoCollection * s2r_
std::vector< edm::EDGetTokenT< edm::View< reco::Vertex > > > reco_vertex_collection_tokens_
void fillGenericGenVertexHistograms(const simPrimaryVertex &v)
void fillRecoAssociatedGenVertexHistograms(const std::string &, const simPrimaryVertex &v)
void matchReco2SimVertices(std::vector< recoPrimaryVertex > &, const reco::VertexRecoToSimCollection &, const std::vector< simPrimaryVertex > &)
edm::EDGetTokenT< reco::VertexToTrackingVertexAssociator > vertexAssociatorToken_
edm::EDGetTokenT< reco::RecoToSimCollection > recoToSimAssociationToken_
std::vector< edm::InputTag > reco_vertex_collections_
std::map< std::string, std::map< std::string, MonitorElement * > > mes_
long double T
const reco::RecoToSimCollection * r2s_
Definition: Run.h:44
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleCollectionToken_