]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Random number service class added.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 Jul 2003 09:55:26 +0000 (09:55 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 Jul 2003 09:55:26 +0000 (09:55 +0000)
DPMJET/AliDpmJetRndm.cxx [new file with mode: 0644]
DPMJET/AliDpmJetRndm.h [new file with mode: 0644]
DPMJET/dpmjetLinkDef.h [new file with mode: 0644]
DPMJET/libdpmjet.pkg

diff --git a/DPMJET/AliDpmJetRndm.cxx b/DPMJET/AliDpmJetRndm.cxx
new file mode 100644 (file)
index 0000000..bf5de78
--- /dev/null
@@ -0,0 +1,118 @@
+/**************************************************************************
+ * 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$ */
+
+//-----------------------------------------------------------------------------
+//   Class: AliDpmJetRndm
+//   Random Number Interface to Fortran 
+//   Since AliGenDpmJet belongs to another module (TDPMjet) one cannot
+//   pass the ponter to the generator via static variable
+//-----------------------------------------------------------------------------
+
+#include <TError.h>
+
+#include "AliDpmJetRndm.h"
+
+TRandom * AliDpmJetRndm::fgDpmJetRandom=0;
+
+ClassImp(AliDpmJetRndm)
+
+//_______________________________________________________________________
+AliDpmJetRndm::AliDpmJetRndm()
+{
+  // 
+  // Default ctor
+  //
+}
+
+//_______________________________________________________________________
+AliDpmJetRndm::AliDpmJetRndm(const AliDpmJetRndm& rn)
+{
+  //
+  // Copy constructor
+  //
+  rn.Copy(*this);
+}
+
+//_______________________________________________________________________
+AliDpmJetRndm::~AliDpmJetRndm() {
+  //
+  // Destructor
+  //
+  fgDpmJetRandom=0;
+}
+
+//_______________________________________________________________________
+void AliDpmJetRndm::Copy(AliDpmJetRndm&) const
+{
+  //
+  // No copy is allowed
+  //
+  ::Fatal("Copy","Not implemented\n");
+}
+
+//_______________________________________________________________________
+void AliDpmJetRndm::SetDpmJetRandom(TRandom *ran) {
+  //
+  // Sets the pointer to an existing random numbers generator
+  //
+  if(ran) fgDpmJetRandom=ran;
+  else fgDpmJetRandom=gRandom;
+}
+
+//_______________________________________________________________________
+TRandom * AliDpmJetRndm::GetDpmJetRandom() {
+  //
+  // Retrieves the pointer to the random numbers generator
+  //
+  return fgDpmJetRandom;
+}
+
+#ifndef WIN32
+# define dt_rndm_dpmjet   dt_rndm_dpmjet_
+# define dt_rndmst_dpmjet dt_rndmst_dpmjet_
+# define dt_rndmin_dpmjet dt_rndmin_dpmjet_
+# define dt_rndmou_dpmjet dt_rndmou_dpmjet_
+# define type_of_call
+#else
+# define dt_rndm_dpmjet   DT_RNDM_DPMJET_
+# define dt_rndmst_dpmjet DT_RNDMST_DPMJET
+# define dt_rndmin_dpmjet DT_RNDMIN_DPMJET
+# define dt_rndmou_dpmjet DT_RNDMOU_DPMJET
+# define type_of_call _stdcall
+#endif
+
+
+extern "C" {
+  void type_of_call dt_rndmst_dpmjet(Int_t &, Int_t &, Int_t &, Int_t &)
+  {printf("Dummy version of dt_rndmst reached\n");}
+
+  void type_of_call dt_rndmin_dpmjet(Int_t &, Int_t &, Int_t &, Int_t &, Int_t &, Int_t &)
+  {printf("Dummy version of dt_rndmin reached\n");}
+
+  void type_of_call dt_rndmou_dpmjet(Int_t &, Int_t &, Int_t &, Int_t &, Int_t &, Int_t &)
+  {printf("Dummy version of dt_rndmou reached\n");}
+
+  Double_t type_of_call dt_rndm_dpmjet(Int_t &) 
+  {
+      Float_t r;
+      do r = AliDpmJetRndm::GetDpmJetRandom()->Rndm();
+      while(0 >= r || r >= 1);
+      return r;
+  }
+}
+
+
diff --git a/DPMJET/AliDpmJetRndm.h b/DPMJET/AliDpmJetRndm.h
new file mode 100644 (file)
index 0000000..79b8e43
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef ALIDPMJETRNDM_H
+#define ALIDPMJETRNDM_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#include "TRandom.h"
+
+class AliDpmJetRndm {
+ public:
+  AliDpmJetRndm();
+  AliDpmJetRndm(const AliDpmJetRndm &rnd);
+  virtual ~AliDpmJetRndm();
+  AliDpmJetRndm & operator=(const AliDpmJetRndm& rn) 
+    {rn.Copy(*this); return (*this);}
+  
+  static void SetDpmJetRandom(TRandom *ran=0);
+  static TRandom * GetDpmJetRandom();
+
+private:
+  void Copy(AliDpmJetRndm &rn) const;
+
+  static TRandom * fgDpmJetRandom; //! pointer to the random number generator
+
+  ClassDef(AliDpmJetRndm,0)  //Random Number generator wrapper (non persistent)
+};
+
+#endif 
+
diff --git a/DPMJET/dpmjetLinkDef.h b/DPMJET/dpmjetLinkDef.h
new file mode 100644 (file)
index 0000000..8d7b4a2
--- /dev/null
@@ -0,0 +1,8 @@
+#ifdef __CINT__
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+#pragma link C++ class AliDpmJetRndm+;
+#endif
index 88e1815b29e25f84a7b3d7e822e68838d0ddaba2..1e01996af4688fe6bd38f2ae6b60eeed164ac26c 100644 (file)
@@ -1,3 +1,9 @@
+SRCS:=AliDpmJetRndm.cxx
+
+HDRS= $(SRCS:.cxx=.h) 
+
+DHDR:=dpmjetLinkDef.h
+
 FSRCS:= \
 dpmjet3.0-4.f \
 phojet1.12-35c.f \