1 |
bendavid |
1.1 |
//--------------------------------------------------------------------------------------------------
|
2 |
loizides |
1.3 |
// $Id: MCParticle.h,v 1.2 2008/07/29 12:29:47 bendavid Exp $
|
3 |
bendavid |
1.1 |
//
|
4 |
|
|
// MCParticle
|
5 |
|
|
//
|
6 |
|
|
// Stores MC information for both gen and sim level
|
7 |
|
|
//
|
8 |
|
|
// Authors: C.Loizides, J.Bendavid...
|
9 |
|
|
//--------------------------------------------------------------------------------------------------
|
10 |
|
|
|
11 |
loizides |
1.3 |
#ifndef MITANA_DATATREE_MCPARTICLE_H
|
12 |
|
|
#define MITANA_DATATREE_MCPARTICLE_H
|
13 |
bendavid |
1.1 |
|
14 |
|
|
#include <TRef.h>
|
15 |
|
|
#include <TDatabasePDG.h>
|
16 |
|
|
#include <TParticlePDG.h>
|
17 |
|
|
#include "MitAna/DataTree/interface/CompositeParticle.h"
|
18 |
|
|
|
19 |
|
|
namespace mithep
|
20 |
|
|
{
|
21 |
|
|
class MCParticle : public CompositeParticle
|
22 |
|
|
{
|
23 |
|
|
public:
|
24 |
|
|
MCParticle() : fIsGenerated(kFALSE), fIsSimulated(kFALSE) {}
|
25 |
|
|
MCParticle(Double_t px, Double_t py, Double_t pz, Double_t e, Int_t id, Int_t s) :
|
26 |
|
|
fPdgId(id), fStatus(s),
|
27 |
|
|
fFourVector(px,py,pz,e), fDecayVertex(0,0,0),
|
28 |
|
|
fIsGenerated(kFALSE), fIsSimulated(kFALSE) {}
|
29 |
|
|
~MCParticle() {}
|
30 |
|
|
|
31 |
loizides |
1.3 |
Int_t AbsPdgId() const { return (fPdgId<0 ? -fPdgId:fPdgId); }
|
32 |
|
|
void AddDaughter(MCParticle *p) { fDaughters.Add(p); }
|
33 |
|
|
Double_t Charge() const;
|
34 |
|
|
const ThreeVector &DecayVertex() const { return fDecayVertex; }
|
35 |
|
|
const MCParticle *Daughter(UInt_t i) const;
|
36 |
|
|
Bool_t HasMother() const { return fMother.IsValid(); }
|
37 |
|
|
Bool_t IsGenerated() const { return fIsGenerated; }
|
38 |
|
|
Bool_t IsSimulated() const { return fIsSimulated; }
|
39 |
|
|
Bool_t IsNeutrino() const;
|
40 |
|
|
const MCParticle *Mother() const;
|
41 |
|
|
FourVector Mom() const { return fFourVector; }
|
42 |
bendavid |
1.1 |
void SetIsGenerated(Bool_t t=kTRUE) { fIsGenerated = t; }
|
43 |
|
|
void SetIsSimulated(Bool_t t=kTRUE) { fIsSimulated = t; }
|
44 |
loizides |
1.3 |
TParticlePDG *PdgEntry() const;
|
45 |
|
|
Int_t PdgId() const { return fPdgId; }
|
46 |
bendavid |
1.1 |
void SetMom(Double_t px, Double_t py, Double_t pz, Double_t e);
|
47 |
loizides |
1.3 |
void SetMother(MCParticle *p) { fMother = p; }
|
48 |
|
|
void SetStatus(Int_t s) { fStatus = s; }
|
49 |
bendavid |
1.2 |
void SetVertex(Double_t x, Double_t y, Double_t z);
|
50 |
loizides |
1.3 |
Int_t Status() const { return fStatus; }
|
51 |
|
|
void Print(Option_t *opt="") const;
|
52 |
bendavid |
1.1 |
|
53 |
|
|
enum EPartType {
|
54 |
|
|
kUnknown=0,
|
55 |
|
|
kEl=11, kMu=13, kTau=15,
|
56 |
|
|
kElNu=12, kMuNu=14, kTauNu=16,
|
57 |
|
|
kGlu=21, kGamma=22
|
58 |
|
|
};
|
59 |
|
|
|
60 |
|
|
protected:
|
61 |
|
|
Int_t fPdgId; //pdg identifier
|
62 |
|
|
Int_t fStatus; //status flag of generator or simulation
|
63 |
|
|
FourVector fFourVector; //four momentum vector
|
64 |
bendavid |
1.2 |
ThreeVector fDecayVertex; //gen decay vertex
|
65 |
bendavid |
1.1 |
TRef fMother; //reference to mother
|
66 |
loizides |
1.3 |
Bool_t fIsGenerated; //=true if generated particle
|
67 |
|
|
Bool_t fIsSimulated; //=true if simulated particle
|
68 |
bendavid |
1.1 |
|
69 |
|
|
ClassDef(MCParticle,2) // Generated particle class
|
70 |
|
|
};
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
//--------------------------------------------------------------------------------------------------
|
74 |
|
|
inline const mithep::MCParticle *mithep::MCParticle::Daughter(UInt_t i) const
|
75 |
|
|
{
|
76 |
|
|
// Return daughter corresponding to given index.
|
77 |
|
|
|
78 |
|
|
return static_cast<const MCParticle*>(fDaughters.At(i));
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
//--------------------------------------------------------------------------------------------------
|
82 |
|
|
inline const mithep::MCParticle *mithep::MCParticle::Mother() const
|
83 |
|
|
{
|
84 |
|
|
// Return mother.
|
85 |
|
|
|
86 |
|
|
return static_cast<const MCParticle*>(fMother.GetObject());
|
87 |
|
|
}
|
88 |
|
|
|
89 |
|
|
//--------------------------------------------------------------------------------------------------
|
90 |
|
|
inline Bool_t mithep::MCParticle::IsNeutrino() const
|
91 |
|
|
{
|
92 |
|
|
// Return true if particle is neutrino.
|
93 |
|
|
|
94 |
|
|
Int_t ap = AbsPdgId();
|
95 |
|
|
if ((ap==kElNu) ||
|
96 |
|
|
(ap==kMuNu) ||
|
97 |
|
|
(ap==kTauNu))
|
98 |
|
|
return kTRUE;
|
99 |
|
|
|
100 |
|
|
return kFALSE;
|
101 |
|
|
}
|
102 |
|
|
|
103 |
|
|
//--------------------------------------------------------------------------------------------------
|
104 |
|
|
inline TParticlePDG *mithep::MCParticle::PdgEntry() const
|
105 |
|
|
{
|
106 |
|
|
// Return entry to pdg database.
|
107 |
|
|
|
108 |
|
|
return TDatabasePDG::Instance()->GetParticle(fPdgId);
|
109 |
|
|
}
|
110 |
|
|
|
111 |
|
|
//--------------------------------------------------------------------------------------------------
|
112 |
|
|
inline void mithep::MCParticle::SetMom(Double_t px, Double_t py, Double_t pz, Double_t e)
|
113 |
|
|
{
|
114 |
|
|
// Set four vector.
|
115 |
|
|
|
116 |
|
|
fFourVector.SetXYZT(px, py, pz, e);
|
117 |
|
|
}
|
118 |
|
|
|
119 |
|
|
//--------------------------------------------------------------------------------------------------
|
120 |
|
|
inline void mithep::MCParticle::SetVertex(Double_t x, Double_t y, Double_t z)
|
121 |
|
|
{
|
122 |
|
|
// Set decay vertex.
|
123 |
|
|
|
124 |
|
|
fDecayVertex.SetXYZ(x,y,z);
|
125 |
|
|
}
|
126 |
|
|
#endif
|