1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 // Stores user defined ion properties.
20 // Fluka allows only one user defined ion which can be used as a beam particle.
23 // andreas.morsch@cern.ch
26 #include "TFlukaIon.h"
27 #include <TDatabasePDG.h>
32 TFlukaIon::TFlukaIon() :
40 // Default constructor
44 TFlukaIon::TFlukaIon(const char* name, Int_t z, Int_t a, Int_t q, Double_t exE, Double_t mass) :
57 Int_t TFlukaIon::GetIonPdg(Int_t z, Int_t a, Int_t i)
60 // http://cepa.fnal.gov/psm/stdhep/pdg/montecarlorpp-2006.pdf
62 return 1000000000 + 10*1000*z + 10*a + i;
65 Int_t TFlukaIon::GetZ(Int_t pdg)
68 // http://cepa.fnal.gov/psm/stdhep/pdg/montecarlorpp-2006.pdf
70 return (pdg - 1000000000)/10000;
74 Int_t TFlukaIon::GetA(Int_t pdg)
77 // http://cepa.fnal.gov/psm/stdhep/pdg/montecarlorpp-2006.pdf
79 Int_t a = pdg - 1000000000;
85 Int_t TFlukaIon::GetIsomerNumber(Int_t pdg)
88 // http://cepa.fnal.gov/psm/stdhep/pdg/montecarlorpp-2006.pdf
90 Int_t is = pdg - 1000000000;
96 void TFlukaIon::AddIon(Int_t a, Int_t z)
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;
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);
109 void TFlukaIon::AddIon(const char* name, Int_t z, Int_t a, Int_t q,
110 Double_t exE, Double_t mass)
113 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
114 const Double_t kAu2Gev = 0.9314943228;
115 Int_t is = (exE > 0.)? 1 : 0;
117 Int_t pdg = GetIonPdg(z, a, is);
118 if (pdgDB->GetParticle(pdg)) return;
119 if (mass == 0.) mass = Float_t(a) * kAu2Gev + 8.071e-3;
121 pdgDB->AddParticle(name, "User Ion", mass, kTRUE, 0, 3 * q, "Ion", pdg);
124 void TFlukaIon::WriteUserInputCard(FILE* pFlukaVmcInp)
126 // Write the user input card
127 // EVENTYPE 0. 0. 2. 0. 0. 0.DPMJET
128 fprintf(pFlukaVmcInp,"EVENTYPE 0. 0. 2. 0. 0. 0.DPMJET\n");