CMS 3D CMS Logo

Particle.h
Go to the documentation of this file.
1 /*
2 
3 Nikolai Amelin, Ludmila Malinina, Timur Pocheptsov (C) JINR/Dubna
4 amelin@sunhe.jinr.ru, malinina@sunhe.jinr.ru, pocheptsov@sunhe.jinr.ru
5 November. 2, 2005
6 
7 */
8 
9 #ifndef PARTICLE_INCLUDED
10 #define PARTICLE_INCLUDED
11 
12 #include <list>
13 
14 #include <TLorentzRotation.h>
15 #include <TLorentzVector.h>
16 
17 #include <TVector3.h>
18 #include "ParticlePDG.h"
19 #include <iostream>
20 
21 class Particle {
22  protected:
23  TLorentzVector fPosition;
24  TLorentzVector fMomentum;
25  TLorentzVector fLastMotherDecayCoor;
26  TLorentzVector fLastMotherDecayMom;
32  int fType; //0-hydro, 1-jets
33  int fIndex; // index (0 based) of particle in the final particle list which will contain both primaries and secondaries
34  int fMotherIndex; // index of the mother (-1 if its a primary particle)
35  int fNDaughters; // number of daughter particles (0 if the particle had not decayed)
36  int fFirstDaughterIndex; // index for the first daughter particle (-1 if non-existing)
37  int fLastDaughterIndex; // index for the last daughter particle (-1 if non-existing)
38  static int fLastIndex; // the last index assigned
39  bool fDecayed; // true if the decay procedure already applied
40 
41  public:
42  Particle(ParticlePDG *pdg = nullptr);
43  Particle(ParticlePDG *pdg, const TLorentzVector &pos, const TLorentzVector &mom,
44  double lastInterTime = 0., int lastInterNum = 0, int type=0);
45  Particle(ParticlePDG *pdg, const TLorentzVector &pos, const TLorentzVector &mom,
46  double lastInterTime, int lastInterNum, int type, int motherPdg,
47  const TLorentzVector &motherPos, const TLorentzVector &motherMom);
48 
49  double X()const{return fPosition.X();}
50  double X(double val){fPosition.SetX(val); return val;}
51  double Y()const{return fPosition.Y();}
52  double Y(double val){fPosition.SetY(val); return val;}
53  double Z()const{return fPosition.Z();}
54  double Z(double val){fPosition.SetZ(val); return val;}
55  double T()const{return fPosition.T();}
56  double T(double val){fPosition.SetT(val); return val;}
57  double Px()const{return fMomentum.Px();}
58  double Px(double val){fMomentum.SetPx(val); return val;}
59  double Py()const{return fMomentum.Py();}
60  double Py(double val){fMomentum.SetPy(val); return val;}
61  double Pz()const{return fMomentum.Pz();}
62  double Pz(double val){fMomentum.SetPz(val); return val;}
63  double E()const{return fMomentum.E();}
64  double E(double val){fMomentum.SetE(val); return val;}
65 
66  TLorentzVector &Pos(){return fPosition;}
67  const TLorentzVector &Pos()const{return fPosition;}
68  TLorentzVector &Pos(const TLorentzVector &val){return fPosition = val;}
69  TLorentzVector &Mom(){return fMomentum;}
70  const TLorentzVector &Mom()const{return fMomentum;}
71  TLorentzVector &Mom(const TLorentzVector &val){return fMomentum = val;}
72 
73  void SetDecayed() {fDecayed = kTRUE;}
74  bool GetDecayed() const {return fDecayed;}
75 
76  void Boost(const TVector3 &val){fMomentum.Boost(val);}
77  void Boost(const TLorentzVector &val){fMomentum.Boost(val.BoostVector());}
78  void TransformMomentum(const TRotation &rotator){fMomentum *= rotator;}
79  void TransformPosition(const TRotation &rotator){fPosition *= rotator;}
80  void Shift(const TVector3 &val){fPosition += TLorentzVector(val, 0.);}
81 
82  //Pseudorapidity
83  double Eta ()const;
84  //Rapidity
85  double Rapidity()const;
86  double Phi()const;
87  double Theta()const;
88  double Pt()const;
89 
90  int Encoding() const;
91  double TableMass() const;
92  ParticlePDG *Def() const {return fParticleProperties;}
93  ParticlePDG *Def(ParticlePDG *newProp) {return fParticleProperties = newProp;}
94  //mother
95  void SetLastMotherPdg(int value){fLastMotherPdg = value;}
96  int GetLastMotherPdg() const {return fLastMotherPdg;}
97 
98  // aic(2008/08/08): functions added in order to enable tracking of mother/daughter particles by a unique index
99  // The index coincides with the position of the particle in the secondaries list.
100  int SetIndex() {fIndex = ++fLastIndex; return fIndex;}
101  int GetIndex() {return fIndex;}
102  static int GetLastIndex() {return fLastIndex;}
103  static void InitIndexing() {
104  fLastIndex = -1;
105  }
106  void SetMother(int value) {fMotherIndex = value;}
107  int GetMother() {return fMotherIndex;}
108  void SetFirstDaughterIndex(int index) {fFirstDaughterIndex = index;}
109  void SetLastDaughterIndex(int index) {fLastDaughterIndex = index;}
110  void SetPythiaStatusCode(int code) {fPythiaStatusCode = code;}
113  if(fFirstDaughterIndex==-1 || fLastDaughterIndex==-1)
114  return 0;
115  else
116  return fLastDaughterIndex-fFirstDaughterIndex+1;
117  }
120 
121  TLorentzVector &SetLastMotherDecayCoor(const TLorentzVector &val){return fLastMotherDecayCoor = val;}
122  const TLorentzVector &GetLastMotherDecayCoor()const{return fLastMotherDecayCoor;}
123  TLorentzVector &SetLastMotherDecayMom(const TLorentzVector &val){return fLastMotherDecayMom = val;}
124  const TLorentzVector &GetLastMotherDecayMom()const{return fLastMotherDecayMom;}
125 
126  void SetLastInterTime(double value){fLastInteractionTime = value;}
127  double GetLastInterTime()const{return fLastInteractionTime;}
128  void SetLastInterNumber(int value){fInteractionNumber = value;}
131 
132  void SetType(int value){fType = value;}
133  int GetType()const{return fType;}
134 
135 
136 };
137 
138 double S(const TLorentzVector &, const TLorentzVector &);
139 double T(const TLorentzVector &, const TLorentzVector &);
140 
141 typedef std::list<Particle> List_t;
142 typedef std::list<Particle>::iterator LPIT_t;
143 
145  public:
146  void AddParticle(const Particle & particle, List_t & list);
147  void FreeListNode(List_t & list, LPIT_t it);
148  void FreeList(List_t & list);
149 
150  private:
152 };
153 
154 #endif
TLorentzVector & SetLastMotherDecayCoor(const TLorentzVector &val)
Definition: Particle.h:121
void SetLastDaughterIndex(int index)
Definition: Particle.h:109
type
Definition: HCALResponse.h:21
TLorentzVector & SetLastMotherDecayMom(const TLorentzVector &val)
Definition: Particle.h:123
ParticlePDG * Def() const
Definition: Particle.h:92
double T() const
Definition: Particle.h:55
void SetPythiaStatusCode(int code)
Definition: Particle.h:110
void SetLastInterTime(double value)
Definition: Particle.h:126
const TLorentzVector & GetLastMotherDecayMom() const
Definition: Particle.h:124
void Boost(const TLorentzVector &val)
Definition: Particle.h:77
double Px() const
Definition: Particle.h:57
void SetMother(int value)
Definition: Particle.h:106
double Phi() const
Definition: Particle.cc:87
const TLorentzVector & GetLastMotherDecayCoor() const
Definition: Particle.h:122
int SetIndex()
Definition: Particle.h:100
double Py() const
Definition: Particle.h:59
int GetPythiaStatusCode()
Definition: Particle.h:111
int GetLastMotherPdg() const
Definition: Particle.h:96
int fPythiaStatusCode
Definition: Particle.h:30
int GetNDaughters()
Definition: Particle.h:112
std::list< Particle > List_t
Definition: Particle.h:141
int GetLastDaughterIndex()
Definition: Particle.h:119
double X() const
Definition: Particle.h:49
int fFirstDaughterIndex
Definition: Particle.h:36
void SetType(int value)
Definition: Particle.h:132
double GetLastInterTime() const
Definition: Particle.h:127
void TransformMomentum(const TRotation &rotator)
Definition: Particle.h:78
int Encoding() const
Definition: Particle.cc:67
double Z() const
Definition: Particle.h:53
void SetLastMotherPdg(int value)
Definition: Particle.h:95
double Pt() const
Definition: Particle.cc:95
int fLastMotherPdg
Definition: Particle.h:31
double Y(double val)
Definition: Particle.h:52
ParticlePDG * fParticleProperties
Definition: Particle.h:27
void TransformPosition(const TRotation &rotator)
Definition: Particle.h:79
const TLorentzVector & Mom() const
Definition: Particle.h:70
int fIndex
Definition: Particle.h:33
int fLastDaughterIndex
Definition: Particle.h:37
double Py(double val)
Definition: Particle.h:60
double Pz() const
Definition: Particle.h:61
double E(double val)
Definition: Particle.h:64
int fNDaughters
Definition: Particle.h:35
Definition: value.py:1
double Eta() const
Definition: Particle.cc:75
int GetMother()
Definition: Particle.h:107
int GetIndex()
Definition: Particle.h:101
static int fLastIndex
Definition: Particle.h:38
static void InitIndexing()
Definition: Particle.h:103
double fLastInteractionTime
Definition: Particle.h:28
static int GetLastIndex()
Definition: Particle.h:102
ParticlePDG * Def(ParticlePDG *newProp)
Definition: Particle.h:93
double TableMass() const
Definition: Particle.cc:71
List_t fFreeNodes
Definition: Particle.h:151
int GetLastInterNumber() const
Definition: Particle.h:129
void SetLastInterNumber(int value)
Definition: Particle.h:128
TLorentzVector & Pos()
Definition: Particle.h:66
TLorentzVector fMomentum
Definition: Particle.h:24
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:99
int fMotherIndex
Definition: Particle.h:34
void SetDecayed()
Definition: Particle.h:73
double T(double val)
Definition: Particle.h:56
int fType
Definition: Particle.h:32
int fInteractionNumber
Definition: Particle.h:29
double Px(double val)
Definition: Particle.h:58
TLorentzVector fPosition
Definition: Particle.h:23
double Z(double val)
Definition: Particle.h:54
TLorentzVector & Mom()
Definition: Particle.h:69
double Rapidity() const
Definition: Particle.cc:81
double Pz(double val)
Definition: Particle.h:62
void IncInter()
Definition: Particle.h:130
TLorentzVector & Mom(const TLorentzVector &val)
Definition: Particle.h:71
void Shift(const TVector3 &val)
Definition: Particle.h:80
double X(double val)
Definition: Particle.h:50
TLorentzVector fLastMotherDecayCoor
Definition: Particle.h:25
std::list< Particle >::iterator LPIT_t
Definition: Particle.h:142
TLorentzVector fLastMotherDecayMom
Definition: Particle.h:26
const TLorentzVector & Pos() const
Definition: Particle.h:67
void Boost(const TVector3 &val)
Definition: Particle.h:76
double Theta() const
Definition: Particle.cc:91
double E() const
Definition: Particle.h:63
void SetFirstDaughterIndex(int index)
Definition: Particle.h:108
bool GetDecayed() const
Definition: Particle.h:74
TLorentzVector & Pos(const TLorentzVector &val)
Definition: Particle.h:68
int GetFirstDaughterIndex()
Definition: Particle.h:118
double Y() const
Definition: Particle.h:51
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
int GetType() const
Definition: Particle.h:133
bool fDecayed
Definition: Particle.h:39
Particle(ParticlePDG *pdg=0)
Definition: Particle.cc:13