]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
All paramatrisation libraries derive from the pure virtual base class AliGenLib.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 29 Jun 2000 21:08:27 +0000 (21:08 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 29 Jun 2000 21:08:27 +0000 (21:08 +0000)
This allows to pass a pointer to a library directly to AliGenParam and avoids the
use of function pointers in Config.C.

EVGEN/AliGenGSIlib.h
EVGEN/AliGenLib.cxx [new file with mode: 0644]
EVGEN/AliGenLib.h [new file with mode: 0644]
EVGEN/AliGenMUONlib.cxx
EVGEN/AliGenMUONlib.h
EVGEN/AliGenPHOSlib.cxx
EVGEN/AliGenPHOSlib.h
EVGEN/AliGenParam.cxx
EVGEN/AliGenParam.h
EVGEN/EVGENLinkDef.h
EVGEN/Makefile

index 391f45693bc752fb45701efbad402129ee80d1fb..7f0b994941f99042cdd266cb30c189e84fb885e5 100644 (file)
@@ -5,10 +5,9 @@
 
 /* $Id$ */
 
-#include <TROOT.h>
-#include "GenTypeDefs.h"
+#include "AliGenLib.h"
 
-class AliGenGSIlib :public TObject{
+class AliGenGSIlib :public AliGenLib {
  public:
 
 // Upsilon RITMAN   
@@ -26,10 +25,11 @@ class AliGenGSIlib :public TObject{
 
 //
     typedef Double_t (*GenFunc)  (Double_t *, Double_t *);
-    typedef Int_t    (*GenFuncIp)();    
-    static GenFunc   GetPt(Param_t param,const char * tname=0);
-    static GenFunc   GetY(Param_t param,const char * tname=0);
-    static GenFuncIp GetIp(Param_t param,const char *tname=0);    
+    typedef Int_t    (*GenFuncIp)();
+    
+    GenFunc   GetPt(Param_t param, const char * tname=0);
+    GenFunc   GetY(Param_t param,  const char * tname=0);
+    GenFuncIp GetIp(Param_t param, const char * tname=0);    
     static void SetDebug(Bool_t debug){fgDebug=debug;}
 private:
     static Bool_t fgDebug;  // Debug flag 
diff --git a/EVGEN/AliGenLib.cxx b/EVGEN/AliGenLib.cxx
new file mode 100644 (file)
index 0000000..f060517
--- /dev/null
@@ -0,0 +1,22 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/*
+$Log $
+*/
+
+#include "AliGenLib.h"
+
+ClassImp(AliGenLib)
diff --git a/EVGEN/AliGenLib.h b/EVGEN/AliGenLib.h
new file mode 100644 (file)
index 0000000..a03ae4f
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef ALIGENLIB_H
+#define ALIGENLIB_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id */
+
+#include <TObject.h>
+#include "GenTypeDefs.h"
+
+class AliGenLib :
+public TObject
+{
+ public:
+//
+    typedef Double_t (*GenFunc)  (Double_t *, Double_t *);
+    typedef Int_t    (*GenFuncIp)();    
+    virtual GenFunc   GetPt(Param_t param, const char *tname)   = 0;
+    virtual GenFunc   GetY (Param_t param, const char *tname)  = 0;
+    virtual GenFuncIp GetIp(Param_t param, const char *tname)  = 0;    
+    ClassDef(AliGenLib,1) // Library providing y and pT parameterisations
+};
+#endif
+
+
+
+
+
+
+
index 02485e0dbf939ea83ea256496025ada288add5d4..b86f9183f00077332cbd44a6674cae372e4626b4 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.9  2000/06/14 15:20:56  morsch
+Include clean-up (IH)
+
 Revision 1.8  2000/06/09 20:32:11  morsch
 All coding rule violations except RS3 corrected
 
@@ -344,7 +347,7 @@ Int_t AliGenMUONlib::IpBeauty()
 }
 
 typedef Double_t (*GenFunc) (Double_t*,  Double_t*);
-GenFunc AliGenMUONlib::GetPt(Param_t param)
+GenFunc AliGenMUONlib::GetPt(Param_t param,  const char* tname)
 {
 // Return pointer to pT parameterisation
     GenFunc func;
@@ -378,7 +381,7 @@ GenFunc AliGenMUONlib::GetPt(Param_t param)
     return func;
 }
 
-GenFunc AliGenMUONlib::GetY(Param_t param)
+GenFunc AliGenMUONlib::GetY(Param_t param, const char* tname)
 {
 // Return pointer to y- parameterisation
     GenFunc func;
@@ -412,7 +415,7 @@ GenFunc AliGenMUONlib::GetY(Param_t param)
     return func;
 }
 typedef Int_t (*GenFuncIp) ();
-GenFuncIp AliGenMUONlib::GetIp(Param_t param)
+GenFuncIp AliGenMUONlib::GetIp(Param_t param,  const char* tname)
 {
 // Return pointer to particle type parameterisation
     GenFuncIp func;
index 858766b90a9c88f0df9aac496b5a2641b4a33dd4..896840c1e7c08c1efef226bb76dcee4a5003b52f 100644 (file)
@@ -5,11 +5,10 @@
 
 /* $Id$ */
 
-#include <TObject.h>
-#include "GenTypeDefs.h"
+#include "AliGenLib.h"
 
 class AliGenMUONlib :
-public TObject
+public AliGenLib
 {
  public:
 // pions
@@ -44,11 +43,9 @@ public TObject
     static Double_t YBeauty(Double_t *py, Double_t *dummy);
     static Int_t    IpBeauty();
 //
-    typedef Double_t (*GenFunc)  (Double_t *, Double_t *);
-    typedef Int_t    (*GenFuncIp)();    
-    static GenFunc   GetPt(Param_t param);
-    static GenFunc   GetY(Param_t param);
-    static GenFuncIp GetIp(Param_t param);    
+    GenFunc   GetPt(Param_t param, const char* tname=0);
+    GenFunc   GetY (Param_t param, const char* tname=0);
+    GenFuncIp GetIp(Param_t param, const char* tname=0);    
     ClassDef(AliGenMUONlib,1) // Library providing y and pT parameterisations
 };
 #endif
index 6ce5c60195e7a6ab9889659371c4aa2086a9785b..80141ab927f2e9040925288a2a349a53e1f542ba 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.4  2000/06/14 15:21:05  morsch
+Include clean-up (IH)
+
 Revision 1.3  2000/06/09 20:32:54  morsch
 All coding rule violations except RS3 corrected
 
@@ -405,7 +408,7 @@ ClassImp(AliGenPHOSlib)
 
 
 typedef Double_t (*GenFunc) (Double_t*,  Double_t*);
- GenFunc AliGenPHOSlib::GetPt(Param_t param)
+ GenFunc AliGenPHOSlib::GetPt(Param_t param, const char* tname)
 {
 // Return pinter to pT parameterisation
     GenFunc func;
@@ -437,7 +440,7 @@ typedef Double_t (*GenFunc) (Double_t*,  Double_t*);
     return func;
 }
 
- GenFunc AliGenPHOSlib::GetY(Param_t param)
+ GenFunc AliGenPHOSlib::GetY(Param_t param, const char* tname)
 {
 // Return pointer to Y parameterisation
     GenFunc func;
@@ -471,7 +474,7 @@ typedef Double_t (*GenFunc) (Double_t*,  Double_t*);
     return func;
 }
 typedef Int_t (*GenFuncIp) ();
- GenFuncIp AliGenPHOSlib::GetIp(Param_t param)
+ GenFuncIp AliGenPHOSlib::GetIp(Param_t param,  const char* tname)
 {
 // Return pointer to particle composition
     GenFuncIp func;
index 52069c4b3d6e9b3dfc749ed313d92448a8a25ba1..a9085e46b89b1e149e8b37e8444da44c04338278 100644 (file)
@@ -1,14 +1,13 @@
 #ifndef ALIGENPHOSLIB_H
 #define ALIGENPHOSLIB_H
-#include <TObject.h>
-#include "GenTypeDefs.h"
+#include "AliGenLib.h"
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
 /* $Id$ */
 
 class AliGenPHOSlib :
-public TObject
+public AliGenLib
 {
  public:
 // pions
@@ -41,11 +40,9 @@ public TObject
     static Double_t YBaryon( Double_t *py, Double_t *dummy);
     static Int_t    IpBaryon();
     
-    typedef Double_t (*GenFunc)  (Double_t *, Double_t *dummy);
-    typedef Int_t    (*GenFuncIp)();    
-    static GenFunc   GetPt(Param_t param);
-    static GenFunc   GetY(Param_t param);
-    static GenFuncIp GetIp(Param_t param);    
+    GenFunc   GetPt(Param_t param, const char* tname=0);
+    GenFunc   GetY (Param_t param, const char* tname=0);
+    GenFuncIp GetIp(Param_t param, const char* tname=0);    
     ClassDef(AliGenPHOSlib,1) // Library providing y and pT parameterisations
 };
 #endif
index f71e48456c2ca6d133be5648ad51322b915ff552..d98ef7ba94636b2845e43788a3f7ad664ecb2c98 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.17  2000/06/09 20:33:30  morsch
+All coding rule violations except RS3 corrected
+
 Revision 1.16  2000/05/02 07:51:31  morsch
 - Control precision of pT sampling TF1::SetNpx(..)
 - Correct initialisation of child-cuts in all constructors.
@@ -60,44 +63,67 @@ ClassImp(AliGenParam)
 AliGenParam::AliGenParam()
                  :AliGenerator()
 {
-// Constructor
-  fPtPara = 0;
-  fYPara  = 0;
-  fParam  = jpsi_p;
-  fAnalog = analog;
-  SetCutOnChild();
-  SetChildMomentumRange();
-  SetChildPtRange();
-  SetChildPhiRange();
-  SetChildThetaRange();  
-  SetDeltaPt();
+// Deafault constructor
+    fPtPara = 0;
+    fYPara  = 0;
+    fParam  = jpsi_p;
+    fAnalog = analog;
+    SetCutOnChild();
+    SetChildMomentumRange();
+    SetChildPtRange();
+    SetChildPhiRange();
+    SetChildThetaRange();  
+    SetDeltaPt();
+}
+
+AliGenParam::AliGenParam(Int_t npart, AliGenLib * Library,  Param_t param, char* tname):AliGenerator(npart)
+{
+// Constructor using number of particles parameterisation id and library
+    
+    fPtParaFunc = Library->GetPt(param, tname);
+    fYParaFunc  = Library->GetY (param, tname);
+    fIpParaFunc = Library->GetIp(param, tname);
+    
+    fPtPara = 0;
+    fYPara  = 0;
+    fParam  = param;
+    fAnalog = analog;
+    fChildSelect.Set(5);
+    for (Int_t i=0; i<5; i++) fChildSelect[i]=0;
+    SetForceDecay();
+    SetCutOnChild();
+    SetChildMomentumRange();
+    SetChildPtRange();
+    SetChildPhiRange();
+    SetChildThetaRange(); 
+    SetDeltaPt(); 
 }
 
 //____________________________________________________________
 
-AliGenParam::AliGenParam(Int_t npart, Param_t param:AliGenerator(npart)
+AliGenParam::AliGenParam(Int_t npart, Param_t param, char* tname):AliGenerator(npart)
 {
-// Constructor
-  //
-  //  fName="HMESONpara";
-  //  fTitle="Heavy Mesons Parametrisation";
-  fPtParaFunc = AliGenMUONlib::GetPt(param);
-  fYParaFunc  = AliGenMUONlib::GetY(param);
-  fIpParaFunc = AliGenMUONlib::GetIp(param);
-  
-  fPtPara = 0;
-  fYPara  = 0;
-  fParam  = param;
-  fAnalog = analog;
-  fChildSelect.Set(5);
-  for (Int_t i=0; i<5; i++) fChildSelect[i]=0;
-  SetForceDecay();
-  SetCutOnChild();
-  SetChildMomentumRange();
-  SetChildPtRange();
-  SetChildPhiRange();
-  SetChildThetaRange(); 
-  SetDeltaPt(); 
+// Constructor using parameterisation id and number of particles
+//      
+    AliGenLib* Library = new AliGenMUONlib();
+    fPtParaFunc = Library->GetPt(param, tname);
+    fYParaFunc  = Library->GetY (param, tname);
+    fIpParaFunc = Library->GetIp(param, tname);
+    
+    fPtPara = 0;
+    fYPara  = 0;
+    fParam  = param;
+    fAnalog = analog;
+    fChildSelect.Set(5);
+    for (Int_t i=0; i<5; i++) fChildSelect[i]=0;
+    SetForceDecay();
+    SetCutOnChild();
+    SetChildMomentumRange();
+    SetChildPtRange();
+    SetChildPhiRange();
+    SetChildThetaRange(); 
+    SetDeltaPt(); 
 }
 
 AliGenParam::AliGenParam(Int_t npart, Param_t param,
index 54244f471ee3cbae752a171622aee60ea15e391c..7a10951650e798b444664ed34388f83697f4ccfe 100644 (file)
@@ -11,6 +11,7 @@
 
 class AliPythia;
 class TParticle;
+class AliGenLib;
 class TF1;
 
 //-------------------------------------------------------------
@@ -18,7 +19,8 @@ class AliGenParam : public AliGenerator
 {
  public:
     AliGenParam();
-    AliGenParam(Int_t npart, Param_t param);
+    AliGenParam(Int_t npart, AliGenLib * Library, Param_t param, char* tname=0);
+    AliGenParam(Int_t npart, Param_t param, char* tname=0);
     AliGenParam(Int_t npart, Param_t param,
                Double_t (*PtPara)(Double_t*, Double_t*),
                Double_t (*YPara )(Double_t*, Double_t*),
index ef2bc4302a10bd65fde147c2a244a6c236347471..82400fad43f34c20f0b48a34cc6cf4e06098ed68 100644 (file)
@@ -25,6 +25,7 @@
 #pragma link C++ class  AliGenScan;
 #pragma link C++ class  AliGenDoubleScan;
 #pragma link C++ class  AliPythia;
+#pragma link C++ class  AliGenLib;
 #pragma link C++ class  AliGenMUONlib;
 #pragma link C++ class  AliGenFLUKAsource;
 #pragma link C++ class  AliGenHalo;
index 4b1a0a8b66190f954ab9ccc7cd014f89a9a11be7..0c0ed4ff581675dc5378c36a5ed5a573619ea91c 100644 (file)
@@ -11,6 +11,7 @@ PACKAGE = EVGEN
 
 SRCS          = AliGenHIJINGpara.cxx AliGenBox.cxx AliGenFixed.cxx \
                AliGenCocktail.cxx AliGenFLUKAsource.cxx \
+               AliGenLib.cxx \
                 AliGenMUONlib.cxx AliGenParam.cxx AliGenPythia.cxx \
                 AliPythia.cxx AliDimuCombinator.cxx AliGenHalo.cxx \
                 AliGenExtFile.cxx AliGenScan.cxx AliGenPHOSlib.cxx \