UParticle.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. #ifndef UPARTICLE_H
  2. #define UPARTICLE_H
  3. #include "TObject.h"
  4. #include "TLorentzVector.h"
  5. #include "TMath.h"
  6. class TParticle;
  7. /**
  8. * unigen particle
  9. */
  10. class UParticle : public TObject {
  11. private:
  12. Int_t fIndex; // index of this particle
  13. Int_t fPdg; // PDG code
  14. Int_t fStatus; // Status
  15. Int_t fParent; // Index of parent
  16. Int_t fParentDecay; // Parent decay index
  17. Int_t fMate; // index of last collision partner
  18. Int_t fDecay; // decay index (-1 if not decayed)
  19. Int_t fChild[2]; // index of first and last child
  20. Double32_t fPx; // px (GeV)
  21. Double32_t fPy; // py (GeV)
  22. Double32_t fPz; // pz (GeV)
  23. Double32_t fE; // Energy (GeV)
  24. Double32_t fX; // x (fm)
  25. Double32_t fY; // y (fm)
  26. Double32_t fZ; // z (fm)
  27. Double32_t fT; // t (fm)
  28. Double32_t fWeight; // weight
  29. public:
  30. /**
  31. * default constructor
  32. */
  33. UParticle();
  34. /**
  35. * constructor
  36. * @param index particle index
  37. * @param pdg pid of track
  38. * @param status particle status
  39. * @param parent parent index
  40. * @param parentDecay parent decay index
  41. * @param mate index of last collision partner
  42. * @param decay decay index (-1 if not decayed)
  43. * @param child index of first and last child
  44. * @param px px momentum
  45. * @param py py momentum
  46. * @param pz pz momentum
  47. * @param e energy
  48. * @param x freezout -x
  49. * @param y freezout -y
  50. * @param z freezout - z
  51. * @param t freezout - t
  52. * @param weight particle weight
  53. */
  54. UParticle(Int_t index, Int_t pdg, Int_t status,
  55. Int_t parent, Int_t parentDecay,
  56. Int_t mate, Int_t decay, Int_t child[2],
  57. Double_t px, Double_t py, Double_t pz, Double_t e,
  58. Double_t x, Double_t y, Double_t z, Double_t t,
  59. Double_t weight);
  60. /**
  61. * constructor
  62. * @param index particle index
  63. * @param pdg pid of track
  64. * @param status particle status
  65. * @param parent parent index
  66. * @param parentDecay parent decay index
  67. * @param mate index of last collision partner
  68. * @param decay decay index (-1 if not decayed)
  69. * @param child index of first and last child
  70. * @param mom particle momentum
  71. * @param pos particle freezout postion
  72. * @param weight particle weight
  73. */
  74. UParticle(Int_t index, Int_t pdg, Int_t status,
  75. Int_t parent, Int_t parentDecay,
  76. Int_t mate, Int_t decay, Int_t child[2],
  77. TLorentzVector mom, TLorentzVector pos,
  78. Double_t weight);
  79. /**
  80. * copy constructor
  81. * @param right uparticle to copy
  82. */
  83. UParticle(const UParticle& right);
  84. /**
  85. * copy ctor
  86. * @param right TParticle to copy
  87. */
  88. UParticle(const TParticle& right);
  89. virtual ~UParticle();
  90. /**
  91. * operator =
  92. * @param right particle
  93. * @return this overwriten particle
  94. */
  95. const UParticle& operator = (const UParticle& right);
  96. /**
  97. * copy TParticle into this particle
  98. * @param right TParticle to copy
  99. * @return copy of TParticle in Unigen format
  100. */
  101. const UParticle& operator = (const TParticle& right);
  102. /**
  103. * comare tracks
  104. * @param right track to compare
  105. * @return true if particles are the same, false otherwise
  106. */
  107. const Bool_t operator == (const UParticle& right) const;
  108. /**
  109. * print info about this particle
  110. * @param option not used
  111. */
  112. void Print(Option_t* option = "");
  113. /**
  114. *
  115. * @return particle index
  116. */
  117. inline Int_t GetIndex() const {return fIndex;}
  118. /**
  119. *
  120. * @return particle pid
  121. */
  122. inline Int_t GetPdg() const {return fPdg;}
  123. /**
  124. *
  125. * @return particle status
  126. */
  127. inline Int_t GetStatus() const {return fStatus;}
  128. /**
  129. *
  130. * @return particle's parent index
  131. */
  132. inline Int_t GetParent() const {return fParent;}
  133. /**
  134. *
  135. * @return particle's parent decay index
  136. */
  137. inline Int_t GetParentDecay() const {return fParentDecay;}
  138. /**
  139. *
  140. * @return index of last collision partner
  141. */
  142. inline Int_t GetMate() const {return fMate;}
  143. /**
  144. *
  145. * @return decay index (-1 if not decayed)
  146. */
  147. inline Int_t GetDecay() const {return fDecay;}
  148. /**
  149. *
  150. * @return first child index
  151. */
  152. inline Int_t GetFirstChild() const {return fChild[0];}
  153. /**
  154. *
  155. * @return last child index
  156. */
  157. inline Int_t GetLastChild() const {return fChild[1];}
  158. /**
  159. *
  160. * @return px
  161. */
  162. inline Double_t Px() const {return fPx;}
  163. /**
  164. *
  165. * @return py
  166. */
  167. inline Double_t Py() const {return fPy;}
  168. /**
  169. *
  170. * @return pz
  171. */
  172. inline Double_t Pz() const {return fPz;}
  173. /**
  174. *
  175. * @return energy
  176. */
  177. inline Double_t E() const {return fE;}
  178. /**
  179. *
  180. * @return track momentum
  181. */
  182. inline TLorentzVector GetMomentum() const {return TLorentzVector(fPx,fPy,fPz,fE);}
  183. /**
  184. *
  185. * @param mom momentum to fill
  186. */
  187. inline void Momentum(TLorentzVector& mom) const {mom.SetPxPyPzE(fPx,fPy,fPz,fE);}
  188. /**
  189. *
  190. * @return freezout-X
  191. */
  192. inline Double_t X() const {return fX;}
  193. /**
  194. *
  195. * @return freezout-Y
  196. */
  197. inline Double_t Y() const {return fY;}
  198. /**
  199. *
  200. * @return freezout-Z
  201. */
  202. inline Double_t Z() const {return fZ;}
  203. /**
  204. *
  205. * @return freezout-T
  206. */
  207. inline Double_t T() const {return fT;}
  208. /**
  209. *
  210. * @return freezout position
  211. */
  212. inline TLorentzVector GetPosition() const {return TLorentzVector(fX,fY,fZ,fT);}
  213. /**
  214. *
  215. * @param pos position to fill by this track position coord.
  216. */
  217. inline void Position(TLorentzVector& pos) const {pos.SetXYZT(fX,fY,fZ,fT);}
  218. /**
  219. *
  220. * @return particle weight
  221. */
  222. inline Double_t GetWeight() const {return fWeight;}
  223. /**
  224. *
  225. * @param index index
  226. */
  227. inline void SetIndex (Int_t index) {fIndex = index;}
  228. /**
  229. *
  230. * @param pdg pid code
  231. */
  232. inline void SetPdg (Int_t pdg) {fPdg = pdg;}
  233. /**
  234. *
  235. * @param status status
  236. */
  237. inline void SetStatus (Int_t status) {fStatus = status;}
  238. /**
  239. *
  240. * @param parent parent index
  241. */
  242. inline void SetParent (Int_t parent) {fParent = parent;}
  243. /**
  244. *
  245. * @param parentDecay parent decay index
  246. */
  247. inline void SetParentDecay(Int_t parentDecay) {fParentDecay = parentDecay;}
  248. /**
  249. *
  250. * @param mate index of last collision partner
  251. */
  252. inline void SetMate (Int_t mate) {fMate = mate;}
  253. /**
  254. *
  255. * @param decay decay code (-1 if no decayed)
  256. */
  257. inline void SetDecay (Int_t decay) {fDecay = decay;}
  258. /**
  259. *
  260. * @param child index of first and last child
  261. */
  262. inline void SetChild (Int_t child[2]) {fChild[0]=child[0]; fChild[1]=child[1];}
  263. /**
  264. *
  265. * @param child first child index
  266. */
  267. inline void SetFirstChild (Int_t child) {fChild[0] = child;}
  268. /**
  269. *
  270. * @param child last child index
  271. */
  272. inline void SetLastChild (Int_t child) {fChild[1] = child;}
  273. /**
  274. *
  275. * @param px px momentum
  276. */
  277. inline void SetPx (Double_t px) {fPx = px;}
  278. /**
  279. *
  280. * @param py py momentum
  281. */
  282. inline void SetPy (Double_t py) {fPy = py;}
  283. /**
  284. *
  285. * @param pz pz momentum
  286. */
  287. inline void SetPz (Double_t pz) {fPz = pz;}
  288. /**
  289. *
  290. * @param e energy
  291. */
  292. inline void SetE (Double_t e) {fE = e;}
  293. /**
  294. * set momentum
  295. * @param px px
  296. * @param py py
  297. * @param pz pz
  298. * @param e energy
  299. */
  300. inline void SetMomentum(Double_t px, Double_t py, Double_t pz, Double_t e)
  301. {fPx = px; fPy = py; fPz = pz; fE = e;}
  302. /**
  303. * set momentum
  304. * @param mom momentum
  305. */
  306. inline void SetMomentum(TLorentzVector mom) {fPx=mom.Px(); fPy=mom.Py(); fPz=mom.Pz(); fE=mom.E();}
  307. /**
  308. *
  309. * @param x freezout-X
  310. */
  311. inline void SetX (Double_t x) {fX = x;}
  312. /**
  313. *
  314. * @param y freezout-Y
  315. */
  316. inline void SetY (Double_t y) {fY = y;}
  317. /**
  318. *
  319. * @param z freezout-Z
  320. */
  321. inline void SetZ (Double_t z) {fZ = z;}
  322. /**
  323. *
  324. * @param t freezout-T
  325. */
  326. inline void SetT (Double_t t) {fT = t;}
  327. /**
  328. * set freezout position
  329. * @param x X
  330. * @param y Y
  331. * @param z Z
  332. * @param t T
  333. */
  334. inline void SetPosition(Double_t x, Double_t y, Double_t z, Double_t t)
  335. {fX = x; fY = y; fZ = z; fT = t;}
  336. /**
  337. * set postition
  338. * @param pos new position
  339. */
  340. inline void SetPosition(TLorentzVector pos) {fX=pos.X(); fY=pos.Y(); fZ=pos.Z(); fT=pos.T();}
  341. /**
  342. *
  343. * @param weight weight
  344. */
  345. inline void SetWeight (Double_t weight) {fWeight = weight;}
  346. ClassDef(UParticle, 1)
  347. };
  348. #endif