]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Class for user defined primary ions.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 Apr 2008 09:29:03 +0000 (09:29 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 Apr 2008 09:29:03 +0000 (09:29 +0000)
TFluka/TFlukaIon.cxx [new file with mode: 0644]
TFluka/TFlukaIon.h [new file with mode: 0644]
TFluka/TFlukaLinkDef.h
TFluka/libTFluka.pkg

diff --git a/TFluka/TFlukaIon.cxx b/TFluka/TFlukaIon.cxx
new file mode 100644 (file)
index 0000000..c9cdb9f
--- /dev/null
@@ -0,0 +1,83 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$*/
+
+//
+// Stores user defined ion properties. 
+// Fluka allows only one user defined ion which can be used as a beam particle.
+// Author:
+// A. Morsch 
+// andreas.morsch@cern.ch
+//
+
+#include "TFlukaIon.h"
+#include <TDatabasePDG.h>
+   
+ClassImp(TFlukaIon)
+
+
+TFlukaIon::TFlukaIon() : 
+    TNamed("", "Ion"),
+    fZ(0), 
+    fA(0),
+    fQ(0),
+    fExEnergy(0.),
+    fMass(0.)
+{
+// Default constructor
+}
+
+
+TFlukaIon::TFlukaIon(const char* name, Int_t z, Int_t a, Int_t q, Double_t exE, Double_t mass) :
+    TNamed(name, "Ion"),
+    fZ(z), 
+    fA(a),
+    fQ(q),
+    fExEnergy(exE),
+    fMass(mass)
+
+{
+// Constructor
+    AddIon(a, z);
+}
+
+Int_t TFlukaIon::GetIonPdg(Int_t z, Int_t a, Int_t i)
+{
+// Acording to
+// http://cepa.fnal.gov/psm/stdhep/pdg/montecarlorpp-2006.pdf
+
+  return 1000000000 + 10*1000*z + 10*a + i;
+}  
+
+void TFlukaIon::AddIon(Int_t a, Int_t z)
+{
+
+    // Add a new ion
+    TDatabasePDG *pdgDB = TDatabasePDG::Instance();
+    const Double_t kAu2Gev   = 0.9314943228;
+    Int_t pdg =  GetIonPdg(z, a);
+    if (pdgDB->GetParticle(pdg)) return;
+    
+    pdgDB->AddParticle(Form("Iion A  = %5d Z = %5d", a, z),"Ion", Float_t(a) * kAu2Gev + 8.071e-3, kTRUE,
+                      0, 3 * z, "Ion", pdg);
+}
+
+void TFlukaIon::WriteUserInputCard(FILE* pFlukaVmcInp) const
+{
+    // Write the user input card
+    
+    fprintf(pFlukaVmcInp,"HI-PROPE  %10.1f%10.1f%10.3f\n", (Float_t)GetZ(), (Float_t)GetA(), GetExcitationEnergy());
+}
diff --git a/TFluka/TFlukaIon.h b/TFluka/TFlukaIon.h
new file mode 100644 (file)
index 0000000..ddc9ae2
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef TFLUKAION_H
+#define TFLUKAION_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//                                                                           //
+// Class that gives access to properties of ions used as primary particles   //
+//                                                                           //
+//                                                                           //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+
+#include <TNamed.h>
+
+class TFlukaIon : public TNamed
+{
+
+public:
+    TFlukaIon();
+    TFlukaIon(const char* name, Int_t z, Int_t a, Int_t q, Double_t exE, Double_t mass = 0.);
+    Int_t    GetZ()                const  {return fZ;}
+    Int_t    GetA()                const  {return fA;}
+    Int_t    GetQ()                const  {return fQ;}
+    Double_t GetExcitationEnergy() const  {return fExEnergy;}
+    Double_t GetMass()             const  {return fMass;}
+    Int_t    GetPdgCode()          const  {return GetIonPdg(fZ, fA);}
+    //
+    void     WriteUserInputCard(FILE* file) const;
+    //
+    static void  AddIon(Int_t a, Int_t z);
+    static Int_t GetIonPdg(Int_t z, Int_t a, Int_t i = 0);
+ protected:
+    Int_t    fZ;         // Z
+    Int_t    fA;         // A
+    Int_t    fQ;         // Q
+    Double_t fExEnergy;  // Excitation energy
+    Double_t fMass;      // Mass
+ private:
+    // Copy constructor and operator= declared but not implemented (-Weff++ flag)
+    TFlukaIon(const TFlukaIon&);
+    TFlukaIon& operator=(const TFlukaIon&);
+    
+    ClassDef(TFlukaIon, 1)          // Ion Properties
+};
+       
+#endif
+       
index 2b902bee54fc78e52d0d68cf60be17de147c5258..6667fe7fad876bd51153bb7c6c8c5695900ea8ce 100644 (file)
@@ -8,11 +8,14 @@
 #pragma link off all classes;
 #pragma link off all functions;
  
+
 #pragma link C++ class  TFluka+;
+#pragma link C++ class  TFlukaIon+;
 #pragma link C++ class  TFlukaMCGeometry+;
 #pragma link C++ class  TFlukaCerenkov+;
 #pragma link C++ class  TFlukaConfigOption+;
 #pragma link C++ class  TFlukaScoringOption+;
+
 #endif
 
 
index 8e44e0f2a453ed042d8524673a5ab44db1eff4a0..c7fb61970b843d649a91ac089a058b3b76d05e6a 100644 (file)
@@ -1,13 +1,13 @@
 # Sources
 SRCS:=  TFluka.cxx TFlukaMCGeometry.cxx TFlukaCerenkov.cxx \
-       TFlukaConfigOption.cxx TFlukaScoringOption.cxx\
+       TFlukaConfigOption.cxx TFlukaScoringOption.cxx TFlukaIon.cxx \
         magfld.cxx source.cxx mgdraw.cxx bxdraw.cxx eedraw.cxx \
        endraw.cxx sodraw.cxx usdraw.cxx stupre.cxx stuprf.cxx \
        abscff.cxx dffcff.cxx queffc.cxx rflctv.cxx rfrndx.cxx 
 
 # Headers
 HDRS:= TFluka.h TFlukaMCGeometry.h TFlukaCerenkov.h TFlukaConfigOption.h \
-       TFlukaScoringOption.h
+       TFlukaScoringOption.h TFlukaIon.h
 
 FSRCS:= FLUKA_input.f crnkvp.f