CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 // system include files
21 #include <memory>
22 #include <string>
23 #include <vector>
24 #include <map>
25 #include <algorithm>
26 
27 // user include files
31 
32 // math
35 
36 // reco track
39 
40 // reco vertex
42 
43 // simulated track
46 
47 // pile-up
49 
50 // vertexing
52 
53 // simulated vertex
55 
56 // DQM
59 
60 // class declaration
63 
65 
66  // auxiliary class holding simulated vertices
68  simPrimaryVertex(double x1, double y1, double z1)
69  : x(x1),
70  y(y1),
71  z(z1),
72  ptsq(0),
74  nGenTrk(0),
77  ptot.setPx(0);
78  ptot.setPy(0);
79  ptot.setPz(0);
80  ptot.setE(0);
81  p4 = LorentzVector(0, 0, 0, 0);
82  r = sqrt(x * x + y * y);
83  };
84  double x, y, z, r;
85  HepMC::FourVector ptot;
87  double ptsq;
89  int nGenTrk;
94  std::vector<const reco::Vertex *> rec_vertices;
95  };
96 
97  // auxiliary class holding reconstructed vertices
99  enum VertexProperties { NONE = 0, MATCHED = 1, DUPLICATE = 2, MERGED = 4 };
100  recoPrimaryVertex(double x1, double y1, double z1)
101  : x(x1),
102  y(y1),
103  z(z1),
104  pt(0),
105  ptsq(0),
107  purity(-1.),
108  nRecoTrk(0),
110  kind_of_vertex(0),
111  recVtx(nullptr) {
112  r = sqrt(x * x + y * y);
113  };
114  double x, y, z, r;
115  double pt;
116  double ptsq;
118  double purity; // calculated and assigned in calculatePurityAndFillHistograms
119  int nRecoTrk;
122  std::vector<const TrackingVertex *> sim_vertices;
123  std::vector<const simPrimaryVertex *> sim_vertices_internal;
124  std::vector<unsigned int> sim_vertices_num_shared_tracks;
127  };
128 
129 public:
132 
133  void analyze(const edm::Event &, const edm::EventSetup &) override;
134  void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override;
135 
136 private:
137  void resetSimPVAssociation(std::vector<simPrimaryVertex> &);
138  void matchSim2RecoVertices(std::vector<simPrimaryVertex> &, const reco::VertexSimToRecoCollection &);
139  void matchReco2SimVertices(std::vector<recoPrimaryVertex> &,
141  const std::vector<simPrimaryVertex> &);
144  // void fillGenericRecoVertexHistograms(const std::string &,
145  // const simPrimaryVertex &v);
149  bool genPVMatchedToRecoPV);
152 
153  void calculatePurityAndFillHistograms(const std::string &, std::vector<recoPrimaryVertex> &, int, bool);
154 
155  std::vector<PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex> getSimPVs(
157 
158  std::vector<PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex> getRecoPVs(
160 
161  template <class T>
163 
164  // ----------member data ---------------------------
165  bool verbose_;
169 
170  std::map<std::string, std::map<std::string, MonitorElement *>> mes_;
173 
175  std::vector<edm::EDGetTokenT<edm::View<reco::Vertex>>> reco_vertex_collection_tokens_;
176  std::vector<edm::InputTag> reco_vertex_collections_;
182 
183  std::vector<bool> errorPrintedForColl_;
184 };
185 
186 #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_
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_
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > vecPileupSummaryInfoToken_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
char const * label
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex > getSimPVs(const edm::Handle< TrackingVertexCollection > &)
std::vector< edm::InputTag > reco_vertex_collections_
T sqrt(T t)
Definition: SSEVec.h:19
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)
std::map< std::string, std::map< std::string, MonitorElement * > > mes_
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_
long double T
const reco::RecoToSimCollection * r2s_
Definition: Run.h:45
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleCollectionToken_