#include <TF1.h>
#include <TCanvas.h>
#include <TH1.h>
+#include <TMath.h>
#include "AliMC.h"
ClassImp(AliGenParam)
*/
//End_Html
-//____________________________________________________________
//____________________________________________________________
AliGenParam::AliGenParam()
{
}
-
+//____________________________________________________________
AliGenParam::AliGenParam(Int_t npart, AliGenLib * Library, Int_t param, char* tname):AliGenMC(npart)
{
// Constructor using number of particles parameterisation id and library
SetForceDecay();
SetDeltaPt();
}
-
//____________________________________________________________
-
-AliGenParam::AliGenParam(Int_t npart, Int_t param, char* tname):AliGenMC(npart)
+AliGenParam::AliGenParam(Int_t npart, Int_t param, const char* tname, const char* name):AliGenMC(npart)
{
// Constructor using parameterisation id and number of particles
//
- fName = "Param";
- fTitle= "Particle Generator using pT and y parameterisation";
+ fName = name;
+ fTitle= "Particle Generator using pT and y parameterisation";
AliGenLib* pLibrary = new AliGenMUONlib();
SetChildThetaRange();
SetDeltaPt();
}
+//____________________________________________________________
AliGenParam::AliGenParam(Int_t npart, Int_t param,
Double_t (*PtPara) (Double_t*, Double_t*),
char name[256];
sprintf(name, "pt-parameterisation for %s", GetName());
+ if (fPtPara) fPtPara->Delete();
fPtPara = new TF1(name, fPtParaFunc, fPtMin, fPtMax,0);
// Set representation precision to 10 MeV
Int_t npx= Int_t((fPtMax - fPtMin) / fDeltaPt);
fPtPara->SetNpx(npx);
sprintf(name, "y-parameterisation for %s", GetName());
+ if (fYPara) fYPara->Delete();
fYPara = new TF1(name, fYParaFunc, fYMin, fYMax, 0);
sprintf(name, "pt-for-%s", GetName());
//
//
// Reinitialize decayer
- fDecayer->Init();
+ fDecayer->SetForceDecay(fForceDecay);
+ fDecayer->Init();
+
//
Float_t polar[3]= {0,0,0}; // Polarisation of the parent particle (for GEANT tracking)
Float_t origin0[3]; // Origin of the generated parent particle (for GEANT tracking)
while (ipa<fNpart) {
while(1) {
//
-// particle type
+// particle type
Int_t iPart = fIpParaFunc(fRandom);
fChildWeight=(fDecayer->GetPartialBranchingRatio(iPart))*fParentWeight;
TParticlePDG *particle = pDataBase->GetParticle(iPart);
} // event loop
SetHighWaterMark(nt);
}
+//____________________________________________________________________________________
+Float_t AliGenParam::GetRelativeArea(Float_t ptMin, Float_t ptMax, Float_t yMin, Float_t yMax, Float_t phiMin, Float_t phiMax)
+{
+//
+// Normalisation for selected kinematic region
+//
+ Float_t ratio =
+ fPtPara->Integral(ptMin,ptMax) / fPtPara->Integral( fPtPara->GetXmin(), fPtPara->GetXmax()) *
+ fYPara->Integral(yMin,yMax)/fYPara->Integral(fYPara->GetXmin(),fYPara->GetXmax()) *
+ (phiMax-phiMin)/360.;
+ return TMath::Abs(ratio);
+}
+
+//____________________________________________________________________________________
void AliGenParam::Draw( const char * /*opt*/)
{
/* $Id$ */
//
-// Class to generate particles from using paramtrized pT and y distributions.
+// Class to generate particles from using parametrized pT and y distributions.
// Distributions are obtained from pointer to object of type AliGenLib.
// (For example AliGenMUONlib)
//
public:
AliGenParam();
AliGenParam(Int_t npart, AliGenLib * Library, Int_t param, char* tname = 0);
- AliGenParam(Int_t npart, Int_t param, char* tname = 0);
+ AliGenParam(Int_t npart, Int_t param, const char* tname = 0, const char* name = 0);
AliGenParam(Int_t npart, Int_t param,
Double_t (*PtPara)(Double_t*, Double_t*),
Double_t (*YPara )(Double_t*, Double_t*),
virtual void SetDeltaPt(Float_t delta=0.01) {fDeltaPt = delta;}
virtual void SetDecayer(AliDecayer* decayer) {fDecayer = decayer;}
virtual void Draw(const char * opt);
+ TF1 * GetPt() { return fPtPara;}
+ TF1 * GetY() {return fYPara;}
+ Float_t GetRelativeArea(Float_t ptMin, Float_t ptMax, Float_t yMin, Float_t yMax, Float_t phiMin, Float_t phiMax);
+
AliGenParam & operator=(const AliGenParam & rhs);
protected:
Double_t (*fPtParaFunc)(Double_t*, Double_t*); //! Pointer to Pt parametrisation function