]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TFluka/TFlukaIon.cxx
updated documentation and minor modifications; added test macro for RCU raw ddl data...
[u/mrichter/AliRoot.git] / TFluka / TFlukaIon.cxx
CommitLineData
03c90e71 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$*/
17
18//
19// Stores user defined ion properties.
20// Fluka allows only one user defined ion which can be used as a beam particle.
21// Author:
22// A. Morsch
23// andreas.morsch@cern.ch
24//
25
26#include "TFlukaIon.h"
27#include <TDatabasePDG.h>
28
29ClassImp(TFlukaIon)
30
31
32TFlukaIon::TFlukaIon() :
33 TNamed("", "Ion"),
34 fZ(0),
35 fA(0),
36 fQ(0),
37 fExEnergy(0.),
38 fMass(0.)
39{
40// Default constructor
41}
42
43
44TFlukaIon::TFlukaIon(const char* name, Int_t z, Int_t a, Int_t q, Double_t exE, Double_t mass) :
45 TNamed(name, "Ion"),
46 fZ(z),
47 fA(a),
48 fQ(q),
49 fExEnergy(exE),
50 fMass(mass)
51
52{
53// Constructor
54 AddIon(a, z);
55}
56
57Int_t TFlukaIon::GetIonPdg(Int_t z, Int_t a, Int_t i)
58{
59// Acording to
60// http://cepa.fnal.gov/psm/stdhep/pdg/montecarlorpp-2006.pdf
61
62 return 1000000000 + 10*1000*z + 10*a + i;
63}
64
7c33fcd7 65Int_t TFlukaIon::GetZ(Int_t pdg)
66{
67// Acording to
68// http://cepa.fnal.gov/psm/stdhep/pdg/montecarlorpp-2006.pdf
69
70 return (pdg - 1000000000)/10000;
71}
72
73
74Int_t TFlukaIon::GetA(Int_t pdg)
75{
76// Acording to
77// http://cepa.fnal.gov/psm/stdhep/pdg/montecarlorpp-2006.pdf
78
79 Int_t a = pdg - 1000000000;
80 a %= 10000;
81 a /= 10;
82 return (a);
83}
84
5fc9f5d5 85Int_t TFlukaIon::GetIsomerNumber(Int_t pdg)
86{
87// Acording to
88// http://cepa.fnal.gov/psm/stdhep/pdg/montecarlorpp-2006.pdf
89
90 Int_t is = pdg - 1000000000;
91 is %= 10000;
92 is %= 10;
93 return (is);
94}
95
03c90e71 96void TFlukaIon::AddIon(Int_t a, Int_t z)
97{
98
99 // Add a new ion
100 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
101 const Double_t kAu2Gev = 0.9314943228;
102 Int_t pdg = GetIonPdg(z, a);
103 if (pdgDB->GetParticle(pdg)) return;
104
105 pdgDB->AddParticle(Form("Iion A = %5d Z = %5d", a, z),"Ion", Float_t(a) * kAu2Gev + 8.071e-3, kTRUE,
106 0, 3 * z, "Ion", pdg);
107}
108
5fc9f5d5 109void TFlukaIon::AddIon(const char* name, Int_t z, Int_t a, Int_t q,
129dede3 110 Double_t exE, Double_t mass)
d3f271aa 111{
112// User defined ion
113 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
114 const Double_t kAu2Gev = 0.9314943228;
129dede3 115 Int_t is = (exE > 0.)? 1 : 0;
116 if (q == 0) q = z;
117 Int_t pdg = GetIonPdg(z, a, is);
d3f271aa 118 if (pdgDB->GetParticle(pdg)) return;
129dede3 119 if (mass == 0.) mass = Float_t(a) * kAu2Gev + 8.071e-3;
d3f271aa 120
129dede3 121 pdgDB->AddParticle(name, "User Ion", mass, kTRUE, 0, 3 * q, "Ion", pdg);
d3f271aa 122}
123
5fc9f5d5 124void TFlukaIon::WriteUserInputCard(FILE* pFlukaVmcInp)
03c90e71 125{
126 // Write the user input card
5fc9f5d5 127 // EVENTYPE 0. 0. 2. 0. 0. 0.DPMJET
128 fprintf(pFlukaVmcInp,"EVENTYPE 0. 0. 2. 0. 0. 0.DPMJET\n");
03c90e71 129}