]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliRndm.cxx
AliTriggerConfiguration: fix for DTRUE and 5 bcmasks
[u/mrichter/AliRoot.git] / STEER / AliRndm.cxx
index 40881eb39d82b8a2e9a104896f0d4bdd71abe2ef..f089e66bea707ddda01884f2df580f152741641e 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.1  2000/11/30 07:12:48  alibrary
-Introducing new Rndm and QA classes
-
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-//                                                                           //
+// Random number class for AliRoot
+// This class allows to have different 
+// random number generator for different
+// elements of AliRoot                                                                          //
+// It also allows saving and retrieving of the random number seeds
 ///////////////////////////////////////////////////////////////////////////////
 
-#include "TSystem.h"
-#include "TFile.h"
+#include <TClass.h>
+#include <TFile.h>
+#include <TError.h>
+#include <TRandom3.h>
+#include <TSystem.h>
 
 #include "AliRndm.h"
-#include "TRandom3.h"
+#include "AliLog.h"
 
 ClassImp(AliRndm)
 
+//_______________________________________________________________________
+AliRndm::AliRndm():
+  fRandom(gRandom)
+{
+  // 
+  // Default ctor
+  //
+}
+
+//_______________________________________________________________________
+AliRndm::AliRndm(const AliRndm& rn):
+  fRandom(gRandom)
+{
+  //
+  // Copy constructor
+  //
+  rn.Copy(*this);
+}
+
+//_______________________________________________________________________
+void AliRndm::Copy(AliRndm&) const
+{
+  AliFatalClass("Not implemented");
+}
+
 
 //_____________________________________________________________________________
-void AliRndm::Rndm(Float_t* array, const Int_t size) const
+void AliRndm::Rndm(Float_t* array, Int_t size) const
 {
   //
   // Return an array of n random numbers uniformly distributed 
@@ -52,11 +78,14 @@ void AliRndm::Rndm(Float_t* array, const Int_t size) const
 //_____________________________________________________________________________
 void AliRndm::ReadRandom(const char *filename)
 {
+  //
+  // Reads saved random generator status from filename
+  //
   char *fntmp = gSystem->ExpandPathName(filename);
   TFile *file = new TFile(fntmp,"r");
   delete [] fntmp;
   if(!file) {
-    printf("AliRndm:: Could not open file %s\n",filename);
+    AliErrorClass(Form("Could not open file %s",filename));
   } else {
     if(!fRandom) fRandom = new TRandom();
     fRandom->Read("Random");
@@ -68,11 +97,14 @@ void AliRndm::ReadRandom(const char *filename)
 //_____________________________________________________________________________
 void AliRndm::WriteRandom(const char *filename) const
 {
+  //
+  // Writes random generator status to filename
+  //
   char *fntmp = gSystem->ExpandPathName(filename);
   TFile *file = new TFile(fntmp,"new");
   delete [] fntmp;
   if(!file) {
-    printf("AliRndm:: Could not open file %s\n",filename);
+    AliErrorClass(Form("Could not open file %s",filename));
   } else {
     fRandom->Write();
     file->Close();