From b22ee262ad0e9faf609244f71f2f41d962d420c4 Mon Sep 17 00:00:00 2001 From: morsch Date: Thu, 29 Jun 2000 21:08:27 +0000 Subject: [PATCH] All paramatrisation libraries derive from the pure virtual base class AliGenLib. 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 | 14 +++---- EVGEN/AliGenLib.cxx | 22 ++++++++++ EVGEN/AliGenLib.h | 30 ++++++++++++++ EVGEN/AliGenMUONlib.cxx | 9 ++-- EVGEN/AliGenMUONlib.h | 13 +++--- EVGEN/AliGenPHOSlib.cxx | 9 ++-- EVGEN/AliGenPHOSlib.h | 13 +++--- EVGEN/AliGenParam.cxx | 92 ++++++++++++++++++++++++++--------------- EVGEN/AliGenParam.h | 4 +- EVGEN/EVGENLinkDef.h | 1 + EVGEN/Makefile | 1 + 11 files changed, 145 insertions(+), 63 deletions(-) create mode 100644 EVGEN/AliGenLib.cxx create mode 100644 EVGEN/AliGenLib.h diff --git a/EVGEN/AliGenGSIlib.h b/EVGEN/AliGenGSIlib.h index 391f45693bc..7f0b994941f 100644 --- a/EVGEN/AliGenGSIlib.h +++ b/EVGEN/AliGenGSIlib.h @@ -5,10 +5,9 @@ /* $Id$ */ -#include -#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 index 00000000000..f060517fd35 --- /dev/null +++ b/EVGEN/AliGenLib.cxx @@ -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 index 00000000000..a03ae4f47e9 --- /dev/null +++ b/EVGEN/AliGenLib.h @@ -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 +#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 + + + + + + + diff --git a/EVGEN/AliGenMUONlib.cxx b/EVGEN/AliGenMUONlib.cxx index 02485e0dbf9..b86f9183f00 100644 --- a/EVGEN/AliGenMUONlib.cxx +++ b/EVGEN/AliGenMUONlib.cxx @@ -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; diff --git a/EVGEN/AliGenMUONlib.h b/EVGEN/AliGenMUONlib.h index 858766b90a9..896840c1e7c 100644 --- a/EVGEN/AliGenMUONlib.h +++ b/EVGEN/AliGenMUONlib.h @@ -5,11 +5,10 @@ /* $Id$ */ -#include -#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 diff --git a/EVGEN/AliGenPHOSlib.cxx b/EVGEN/AliGenPHOSlib.cxx index 6ce5c60195e..80141ab927f 100644 --- a/EVGEN/AliGenPHOSlib.cxx +++ b/EVGEN/AliGenPHOSlib.cxx @@ -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; diff --git a/EVGEN/AliGenPHOSlib.h b/EVGEN/AliGenPHOSlib.h index 52069c4b3d6..a9085e46b89 100644 --- a/EVGEN/AliGenPHOSlib.h +++ b/EVGEN/AliGenPHOSlib.h @@ -1,14 +1,13 @@ #ifndef ALIGENPHOSLIB_H #define ALIGENPHOSLIB_H -#include -#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 diff --git a/EVGEN/AliGenParam.cxx b/EVGEN/AliGenParam.cxx index f71e48456c2..d98ef7ba946 100644 --- a/EVGEN/AliGenParam.cxx +++ b/EVGEN/AliGenParam.cxx @@ -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, diff --git a/EVGEN/AliGenParam.h b/EVGEN/AliGenParam.h index 54244f471ee..7a10951650e 100644 --- a/EVGEN/AliGenParam.h +++ b/EVGEN/AliGenParam.h @@ -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*), diff --git a/EVGEN/EVGENLinkDef.h b/EVGEN/EVGENLinkDef.h index ef2bc4302a1..82400fad43f 100644 --- a/EVGEN/EVGENLinkDef.h +++ b/EVGEN/EVGENLinkDef.h @@ -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; diff --git a/EVGEN/Makefile b/EVGEN/Makefile index 4b1a0a8b661..0c0ed4ff581 100644 --- a/EVGEN/Makefile +++ b/EVGEN/Makefile @@ -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 \ -- 2.39.3