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 // 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_
TrackFilterForPVFinding.h
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::sim_vertices_internal
std::vector< const simPrimaryVertex * > sim_vertices_internal
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:123
PrimaryVertexAnalyzer4PUSlimmed::matchRecoTrack2SimSignal
bool matchRecoTrack2SimSignal(const reco::TrackBaseRef &)
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:711
dqm::impl::MonitorElement
Definition: MonitorElement.h:98
PileupSummaryInfo.h
mps_fire.i
i
Definition: mps_fire.py:355
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::NONE
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:99
PrimaryVertexAnalyzer4PUSlimmed::mes_
std::map< std::string, std::map< std::string, MonitorElement * > > mes_
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:170
PrimaryVertexAnalyzer4PUSlimmed::HIGHEST_PT
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:64
PrimaryVertexAnalyzer4PUSlimmed::PrimaryVertexAnalyzer4PUSlimmed
PrimaryVertexAnalyzer4PUSlimmed(const edm::ParameterSet &)
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:44
PrimaryVertexAnalyzer4PUSlimmed::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:1108
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::kind_of_vertex
int kind_of_vertex
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:121
ESHandle.h
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::MATCHED
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:99
PrimaryVertexAnalyzer4PUSlimmed::use_only_charged_tracks_
bool use_only_charged_tracks_
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:166
PrimaryVertexAnalyzer4PUSlimmed::trackingParticleCollectionToken_
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleCollectionToken_
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:177
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::sim_vertices
std::vector< const TrackingVertex * > sim_vertices
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:122
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::purity
double purity
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:118
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::z
double z
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:113
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
PrimaryVertexAnalyzer4PUSlimmed::~PrimaryVertexAnalyzer4PUSlimmed
~PrimaryVertexAnalyzer4PUSlimmed() override
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:68
PrimaryVertexAnalyzer4PUSlimmed::do_generic_sim_plots_
const bool do_generic_sim_plots_
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:167
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::num_matched_sim_tracks
int num_matched_sim_tracks
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:120
PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::closest_vertex_distance_z
double closest_vertex_distance_z
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:88
DQMStore.h
PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::ptsq
double ptsq
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:87
PrimaryVertexAnalyzer4PUSlimmed::calculatePurityAndFillHistograms
void calculatePurityAndFillHistograms(const std::string &, std::vector< recoPrimaryVertex > &, int, bool)
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:728
EDAnalyzer.h
PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::ptot
HepMC::FourVector ptot
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:85
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::nRecoTrk
int nRecoTrk
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:119
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::VertexProperties
VertexProperties
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:99
findQualityFiles.v
v
Definition: findQualityFiles.py:179
edm::Handle
Definition: AssociativeIterator.h:50
PrimaryVertexAnalyzer4PUSlimmed::fillGenericGenVertexHistograms
void fillGenericGenVertexHistograms(const simPrimaryVertex &v)
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:488
edm::Ref< TrackingVertexCollection >
PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::z
double z
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:83
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::ptsq
double ptsq
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:116
EncodedEventId
Definition: EncodedEventId.h:11
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
PrimaryVertexAnalyzer4PUSlimmed::fillResolutionAndPullHistograms
void fillResolutionAndPullHistograms(const std::string &, int, recoPrimaryVertex &v, bool)
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:641
Track.h
TrackFwd.h
PrimaryVertexAnalyzer4PUSlimmed::trackingVertexCollectionToken_
edm::EDGetTokenT< TrackingVertexCollection > trackingVertexCollectionToken_
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:178
PrimaryVertexAnalyzer4PUSlimmed::reco_vertex_collections_
std::vector< edm::InputTag > reco_vertex_collections_
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:176
PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::nGenTrk
int nGenTrk
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:89
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
PrimaryVertexAnalyzer4PUSlimmed
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:61
PrimaryVertexAnalyzer4PUSlimmed::vecPileupSummaryInfoToken_
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > vecPileupSummaryInfoToken_
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:174
PrimaryVertexAnalyzer4PUSlimmed::fillRecoAssociatedGenVertexHistograms
void fillRecoAssociatedGenVertexHistograms(const std::string &, const simPrimaryVertex &v)
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:509
PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::sim_vertex
TrackingVertexRef sim_vertex
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:93
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::recoPrimaryVertex
recoPrimaryVertex(double x1, double y1, double z1)
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:100
PrimaryVertexAnalyzer4PUSlimmed::getSimPVs
std::vector< PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex > getSimPVs(const edm::Handle< TrackingVertexCollection > &)
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:796
DQMEDAnalyzer.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::closest_vertex_distance_z
double closest_vertex_distance_z
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:117
DQMEDAnalyzer
Definition: DQMEDAnalyzer.py:1
PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::p4
LorentzVector p4
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:86
edm::View
Definition: CaloClusterFwd.h:14
TrackToTrackingParticleAssociator.h
edm::ParameterSet
Definition: ParameterSet.h:36
PrimaryVertexAnalyzer4PUSlimmed::s2r_
const reco::SimToRecoCollection * s2r_
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:172
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::DUPLICATE
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:99
PrimaryVertexAnalyzer4PUSlimmed::reco_vertex_collection_tokens_
std::vector< edm::EDGetTokenT< edm::View< reco::Vertex > > > reco_vertex_collection_tokens_
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:175
edm::AssociationMap< edm::OneToManyWithQuality< TrackingVertexCollection, edm::View< reco::Vertex >, double > >
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::pt
double pt
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:115
LorentzVector.h
PrimaryVertexAnalyzer4PUSlimmed::IS_ASSOC2ANY_RECO
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:64
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::r
double r
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:113
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:98
universalConfigTemplate.collection
collection
Definition: universalConfigTemplate.py:81
PrimaryVertexAnalyzer4PUSlimmed::r2s_
const reco::RecoToSimCollection * r2s_
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:171
edm::EventSetup
Definition: EventSetup.h:57
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::y
double y
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:113
PrimaryVertexAnalyzer4PUSlimmed::matchSim2RecoVertices
void matchSim2RecoVertices(std::vector< simPrimaryVertex > &, const reco::VertexSimToRecoCollection &)
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:1045
PrimaryVertexAnalyzer4PUSlimmed::getRecoPVs
std::vector< PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex > getRecoPVs(const edm::Handle< edm::View< reco::Vertex >> &)
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:953
PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::r
double r
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:83
PrimaryVertexAnalyzer4PUSlimmed::matchReco2SimVertices
void matchReco2SimVertices(std::vector< recoPrimaryVertex > &, const reco::VertexRecoToSimCollection &, const std::vector< simPrimaryVertex > &)
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:1074
VertexFwd.h
TrackingParticle.h
PrimaryVertexAnalyzer4PUSlimmed::LorentzVector
math::XYZTLorentzVector LorentzVector
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:62
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::recVtx
const reco::Vertex * recVtx
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:125
Frameworkfwd.h
T
long double T
Definition: Basic3DVectorLD.h:48
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::simPrimaryVertex
simPrimaryVertex(double x1, double y1, double z1)
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:68
PrimaryVertexAnalyzer4PUSlimmed::SignalVertexKind
SignalVertexKind
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:64
PrimaryVertexAnalyzer4PUSlimmed::vertexAssociatorToken_
edm::EDGetTokenT< reco::VertexToTrackingVertexAssociator > vertexAssociatorToken_
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:181
Point3D.h
edm::RefToBase< reco::Vertex >
PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::num_matched_reco_tracks
int num_matched_reco_tracks
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:90
dqm::implementation::IBooker
Definition: DQMStore.h:43
PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::eventId
EncodedEventId eventId
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:92
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::x
double x
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:113
PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::average_match_quality
float average_match_quality
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:91
PrimaryVertexAnalyzer4PUSlimmed::errorPrintedForColl_
std::vector< bool > errorPrintedForColl_
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:183
PrimaryVertexAnalyzer4PUSlimmed::bookHistograms
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:73
PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::rec_vertices
std::vector< const reco::Vertex * > rec_vertices
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:94
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:56
PrimaryVertexAnalyzer4PUSlimmed::verbose_
bool verbose_
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:165
PrimaryVertexAnalyzer4PUSlimmed::recoToSimAssociationToken_
edm::EDGetTokenT< reco::RecoToSimCollection > recoToSimAssociationToken_
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:180
edm::Event
Definition: Event.h:73
PrimaryVertexAnalyzer4PUSlimmed::simToRecoAssociationToken_
edm::EDGetTokenT< reco::SimToRecoCollection > simToRecoAssociationToken_
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:179
PrimaryVertexAnalyzer4PUSlimmed::resetSimPVAssociation
void resetSimPVAssociation(std::vector< simPrimaryVertex > &)
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:1038
PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::x
double x
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:83
label
const char * label
Definition: PFTauDecayModeTools.cc:11
reco::Vertex
Definition: Vertex.h:35
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::recVtxRef
reco::VertexBaseRef recVtxRef
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:126
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::sim_vertices_num_shared_tracks
std::vector< unsigned int > sim_vertices_num_shared_tracks
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:124
PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:67
PrimaryVertexAnalyzer4PUSlimmed::fillGenAssociatedRecoVertexHistograms
void fillGenAssociatedRecoVertexHistograms(const std::string &, int, recoPrimaryVertex &v)
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:553
PrimaryVertexAnalyzer4PUSlimmed::computePairDistance
void computePairDistance(const T &collection, MonitorElement *me)
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:1364
VertexToTrackingVertexAssociator.h
PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::y
double y
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:83
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::MERGED
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:99
PrimaryVertexAnalyzer4PUSlimmed::fillRecoAssociatedGenPVHistograms
void fillRecoAssociatedGenPVHistograms(const std::string &label, const PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex &v, bool genPVMatchedToRecoPV)
Definition: PrimaryVertexAnalyzer4PUSlimmed.cc:541
PrimaryVertexAnalyzer4PUSlimmed::IS_ASSOC2FIRST_RECO
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:64
PrimaryVertexAnalyzer4PUSlimmed::root_folder_
std::string root_folder_
Definition: PrimaryVertexAnalyzer4PUSlimmed.h:168