CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
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;
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,
106  MERGED = 4
107  };
108  recoPrimaryVertex(double x1, double y1, double z1)
109  :x(x1), y(y1), z(z1),
110  ptsq(0), closest_vertex_distance_z(-1.), purity(-1.),
111  nRecoTrk(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 ptsq;
120  double purity; // calculated and assigned in calculatePurityAndFillHistograms
121  int nRecoTrk;
124  std::vector<const TrackingVertex *> sim_vertices;
125  std::vector<const simPrimaryVertex *> sim_vertices_internal;
126  std::vector<unsigned int> sim_vertices_num_shared_tracks;
129  };
130 
131  public:
134 
135  virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
136  virtual void bookHistograms(DQMStore::IBooker &i,
137  edm::Run const&,
138  edm::EventSetup const&) override;
139 
140  private:
141  void resetSimPVAssociation(std::vector<simPrimaryVertex>&);
142  void matchSim2RecoVertices(std::vector<simPrimaryVertex>&,
144  void matchReco2SimVertices(std::vector<recoPrimaryVertex>&,
146  const std::vector<simPrimaryVertex>&);
149  // void fillGenericRecoVertexHistograms(const std::string &,
150  // const simPrimaryVertex &v);
152  const simPrimaryVertex &v);
154  int,
157  int,
159 
161  std::vector<recoPrimaryVertex>&,
162  int, bool);
163 
164  std::vector<PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex> getSimPVs(
166 
167  std::vector<PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex> getRecoPVs(
169 
170  template<class T>
172 
173  // ----------member data ---------------------------
174  bool verbose_;
177  double abs_z_match_;
179 
180  std::map<std::string, std::map<std::string, MonitorElement*> > mes_;
183 
185  std::vector<edm::EDGetTokenT<edm::View<reco::Vertex> > > reco_vertex_collection_tokens_;
186  std::vector<edm::InputTag > reco_vertex_collections_;
194 };
195 
196 #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 >> &)
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< edm::View< reco::Track > > edmView_recoTrack_Token_
bool matchRecoTrack2SimSignal(const reco::TrackBaseRef &)
void resetSimPVAssociation(std::vector< simPrimaryVertex > &)
edm::EDGetTokenT< reco::SimToRecoCollection > simToRecoAssociationToken_
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > vecPileupSummaryInfoToken_
void computePairDistance(const T &collection, MonitorElement *me)
virtual void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
PrimaryVertexAnalyzer4PUSlimmed(const edm::ParameterSet &)
edm::EDGetTokenT< reco::TrackCollection > recoTrackCollectionToken_
edm::EDGetTokenT< TrackingVertexCollection > trackingVertexCollectionToken_
#define nullptr
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
virtual 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:48
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:41
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleCollectionToken_
void fillResolutionAndPullHistograms(const std::string &, int, recoPrimaryVertex &v)