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 // $Id: PrimaryVertexAnalyzer.h,v 1.15 2009/03/06 15:08:42 werdmann Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 #include <string>
24 #include <vector>
25 
26 // user include files
31 
35 
36 //generator level
38 #include "HepMC/GenEvent.h"
39 #include "HepMC/GenVertex.h"
40 #include "HepMC/GenParticle.h"
41 
42 // vertex stuff
45 
46 // simulated vertices,..., add <use name=SimDataFormats/Vertex> and <../Track>
52 
53 // Root
54 #include <TH1.h>
55 #include <TFile.h>
56 #include <TDirectory.h>
57 
58 
59 
60 // class declaration
62 
63 
64 // auxiliary class holding simulated primary vertices
66 public:
67  simPrimaryVertex(double x1,double y1,double z1):x(x1),y(y1),z(z1),ptsq(0),nGenTrk(0){};
68  double x,y,z;
69  HepMC::FourVector ptot;
70  //HepLorentzVector ptot;
71  double ptsq;
72  int nGenTrk;
73  std::vector<int> finalstateParticles;
74  std::vector<int> simTrackIndex;
75  std::vector<int> genVertex;
77 };
78 
79 
80 
81 public:
84 
85  virtual void analyze(const edm::Event&, const edm::EventSetup&);
86  virtual void beginJob();
87  virtual void endJob();
88 
89 private:
90 
91  bool matchVertex(const simPrimaryVertex &vsim,
92  const reco::Vertex &vrec);
93  bool isResonance(const HepMC::GenParticle * p);
95  bool isCharged(const HepMC::GenParticle * p);
96 
100  std::vector<simPrimaryVertex> getSimPVs(const edm::Handle<edm::HepMCProduct> evtMC, std::string suffix);
101  std::vector<simPrimaryVertex> getSimPVs(const edm::Handle<edm::HepMCProduct> evt,
104  // ----------member data ---------------------------
105  std::string recoTrackProducer_;
106  std::string outputFile_; // output file
107  std::vector<std::string> vtxSample_; // which vertices to analyze
108  std::vector<std::string> suffixSample_;
109  TFile* rootFile_;
110  bool verbose_;
112  double simUnit_;
114 
115 
116  std::map<std::string, TH1*> h;
117  std::map<std::string, TDirectory*> hdir;
118 
119 };
120 
std::vector< simPrimaryVertex > getSimPVs(const edm::Handle< edm::HepMCProduct > evtMC, std::string suffix)
bool isCharged(const HepMC::GenParticle *p)
bool isFinalstateParticle(const HepMC::GenParticle *p)
std::map< std::string, TDirectory * > hdir
void printSimTrks(const edm::Handle< edm::SimTrackContainer > simVtrks)
simPrimaryVertex(double x1, double y1, double z1)
edm::ESHandle< ParticleDataTable > pdt
std::vector< std::string > vtxSample_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
bool isResonance(const HepMC::GenParticle *p)
std::map< std::string, TH1 * > h
void printRecVtxs(const edm::Handle< reco::VertexCollection > recVtxs)
PrimaryVertexAnalyzer(const edm::ParameterSet &)
std::vector< std::string > suffixSample_
bool matchVertex(const simPrimaryVertex &vsim, const reco::Vertex &vrec)
void printSimVtxs(const edm::Handle< edm::SimVertexContainer > simVtxs)