CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PrimaryVertexAnalyzer.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: PrimaryVertexAnalyzer
4 // Class: PrimaryVertexAnalyzer
5 //
13 //
14 // Original Author: Wolfram Erdmann
15 // Created: Fri Jun 2 10:54:05 CEST 2006
16 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 #include <string>
23 #include <vector>
24 
25 // user include files
29 
30 // generator level
31 #include "HepMC/SimpleVector.h"
33 
34 // reco track
36 
37 // reco vertex
39 
40 // simulated track
42 
43 // simulated vertex
45 
47 
48 // ROOT forward declarations
49 class TDirectory;
50 class TFile;
51 class TH1;
52 
53 // class declaration
55 
56 
57 // auxiliary class holding simulated primary vertices
59 public:
60  simPrimaryVertex(double x1,double y1,double z1):x(x1),y(y1),z(z1),ptsq(0),nGenTrk(0){};
61  double x,y,z;
62  HepMC::FourVector ptot;
63  //HepLorentzVector ptot;
64  double ptsq;
65  int nGenTrk;
66  std::vector<int> finalstateParticles;
67  std::vector<int> simTrackIndex;
68  std::vector<int> genVertex;
70 };
71 
72 
73 
74 public:
77 
78  virtual void analyze(const edm::Event&, const edm::EventSetup&);
79  virtual void beginJob();
80  virtual void endJob();
81 
82 private:
83 
84  bool matchVertex(const simPrimaryVertex &vsim,
85  const reco::Vertex &vrec);
86  bool isResonance(const HepMC::GenParticle * p);
88  bool isCharged(const HepMC::GenParticle * p);
89 
93  std::vector<simPrimaryVertex> getSimPVs(const edm::Handle<edm::HepMCProduct> & evtMC, const std::string & suffix = "");
94  std::vector<simPrimaryVertex> getSimPVs(const edm::Handle<edm::HepMCProduct> & evt,
95  const edm::Handle<edm::SimVertexContainer> & simVtxs,
96  const edm::Handle<edm::SimTrackContainer> & simTrks);
97  // ----------member data ---------------------------
98  bool verbose_;
99  double simUnit_;
105  std::vector< edm::EDGetTokenT< reco::VertexCollection > > recoVertexCollectionTokens_;
106  std::string outputFile_; // output file
107  std::vector<std::string> suffixSample_; // which vertices to analyze
108  TFile* rootFile_;
109  std::map<std::string, TH1*> h;
110  std::map<std::string, TDirectory*> hdir;
111 
112 };
113 
void printRecVtxs(const edm::Handle< reco::VertexCollection > &recVtxs)
bool isCharged(const HepMC::GenParticle *p)
bool isFinalstateParticle(const HepMC::GenParticle *p)
edm::EDGetTokenT< edm::SimTrackContainer > edmSimTrackContainerToken_
std::map< std::string, TDirectory * > hdir
void printSimVtxs(const edm::Handle< edm::SimVertexContainer > &simVtxs)
simPrimaryVertex(double x1, double y1, double z1)
void printSimTrks(const edm::Handle< edm::SimTrackContainer > &simVtrks)
edm::ESHandle< ParticleDataTable > pdt
virtual void analyze(const edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< edm::HepMCProduct > edmHepMCProductToken_
bool isResonance(const HepMC::GenParticle *p)
std::map< std::string, TH1 * > h
std::vector< simPrimaryVertex > getSimPVs(const edm::Handle< edm::HepMCProduct > &evtMC, const std::string &suffix="")
std::vector< edm::EDGetTokenT< reco::VertexCollection > > recoVertexCollectionTokens_
edm::EDGetTokenT< reco::TrackCollection > recoTrackCollectionToken_
PrimaryVertexAnalyzer(const edm::ParameterSet &)
std::vector< std::string > suffixSample_
bool matchVertex(const simPrimaryVertex &vsim, const reco::Vertex &vrec)
edm::EDGetTokenT< edm::SimVertexContainer > edmSimVertexContainerToken_