CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FSimEvent.cc
Go to the documentation of this file.
1 //FAMOS Headers
3 
4 //C++ Headers
5 
7  : FBaseSimEvent(kine), id_(edm::EventID(0,0,0)), weight_(0)
8 {}
9 
11  const edm::ParameterSet& kine)
12  : FBaseSimEvent(vtx,kine), id_(edm::EventID(0,0,0)), weight_(0)
13 {}
14 
16 {}
17 
18 void
20  FBaseSimEvent::fill(parts, random);
21  id_ = Id;
22 }
23 
24 void
25 FSimEvent::fill(const HepMC::GenEvent& hev, edm::EventID& Id, RandomEngineAndDistribution const* random) {
26  FBaseSimEvent::fill(hev, random);
27  id_ = Id;
28 }
29 
30 void
31 FSimEvent::fill(const std::vector<SimTrack>& simTracks,
32  const std::vector<SimVertex>& simVertices) {
33  FBaseSimEvent::fill(simTracks,simVertices);
34  id_ = edm::EventID();
35 }
36 
38 FSimEvent::id() const {
39  return id_;
40 }
41 
42 float FSimEvent::weight() const {
43  return weight_;
44 }
45 
46 unsigned int
48  return FBaseSimEvent::nTracks();
49 }
50 
51 unsigned int
53  return FBaseSimEvent::nVertices();
54 }
55 
56 unsigned int
58  return FBaseSimEvent::nGenParts();
59 }
60 
61 void
63 {
64  for (unsigned int i=0; i<nTracks(); ++i) {
65  // SimTrack t = SimTrack(ip,p,iv,ig);
66  const SimTrack& t = embdTrack(i);
67  // Save all tracks
68  c.push_back(t);
69  // Save also some muons for later parameterization
70  if ( abs(t.type()) == 13 &&
71  t.momentum().perp2() > 1.0 &&
72  fabs(t.momentum().eta()) < 3.0 &&
73  track(i).noEndVertex() ) {
74  // Actually save the muon mother (and the attached muon) in case
75  if ( !track(i).noMother() && track(i).mother().closestDaughterId() == (int)i ) {
76  const SimTrack& T = embdTrack(track(i).mother().id());
77  m.push_back(T);
78  }
79  m.push_back(t);
80  }
81  }
82 }
83 
84 void
86 {
87  for (unsigned int i=0; i<nVertices(); ++i) {
88  // SimTrack t = SimTrack(ip,p,iv,ig);
89  c.push_back(embdVertex(i));
90  }
91 }
92 
93 
94 void
96 {
97 
98  for (unsigned int i=0; i<nVertices(); ++i) {
99  c.push_back(embdVertexType(i));
100  }
101 }
102 
103 
104 
105 
106 
107 
108 
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
int i
Definition: DBlmapReader.cc:9
bool noEndVertex() const
no end vertex
void fill(const HepMC::GenEvent &hev, edm::EventID &Id, RandomEngineAndDistribution const *)
fill the FBaseSimEvent from the current HepMC::GenEvent
Definition: FSimEvent.cc:25
void load(edm::SimTrackContainer &c, edm::SimTrackContainer &m) const
Load containers of tracks (and muons) and vertices for the edm::Event.
Definition: FSimEvent.cc:62
FSimEvent(const edm::ParameterSet &kine)
Default constructor.
Definition: FSimEvent.cc:6
TRandom random
Definition: MVATrainer.cc:138
double weight_
Definition: FSimEvent.h:75
unsigned int nVertices() const
Number of vertices.
Definition: FBaseSimEvent.h:99
const FSimVertexType & embdVertexType(int i) const
return embedded vertex type with given id
unsigned int nTracks() const
Number of tracks.
Definition: FBaseSimEvent.h:94
int closestDaughterId() const
Get the index of the closest charged daughter.
Definition: FSimTrack.h:187
void fill(const HepMC::GenEvent &hev, RandomEngineAndDistribution const *)
fill the FBaseSimEvent from the current HepMC::GenEvent
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< FSimVertexType > FSimVertexTypeCollection
collection of FSimVertexType objects
unsigned int nTracks() const
Number of tracks.
Definition: FSimEvent.cc:47
edm::EventID id() const
Method to return the EventId.
Definition: FSimEvent.cc:38
unsigned int nGenParts() const
Number of MC particles.
Definition: FSimEvent.cc:57
const SimVertex & embdVertex(int i) const
return embedded vertex with given id
virtual ~FSimEvent()
usual virtual destructor
Definition: FSimEvent.cc:15
unsigned int nVertices() const
Number of vertices.
Definition: FSimEvent.cc:52
std::vector< SimVertex > SimVertexContainer
const SimTrack & embdTrack(int i) const
return embedded track with given id
float weight() const
Method to return the event weight.
Definition: FSimEvent.cc:42
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:40
unsigned int nGenParts() const
Number of generator particles.
const math::XYZTLorentzVectorD & momentum() const
particle info...
Definition: CoreSimTrack.h:36
bool noMother() const
no mother particle
long double T
std::vector< SimTrack > SimTrackContainer
const FSimTrack & mother() const
mother
FSimTrack & track(int id) const
Return track with given Id.
edm::EventID id_
Definition: FSimEvent.h:74