]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenParam.cxx
Possibility to force transport of all particles.
[u/mrichter/AliRoot.git] / EVGEN / AliGenParam.cxx
index 506347f5e663cc4ff4ca7a89faa14dd57545dd0d..9428bb87b13daa5686ce71f15644370adada336f 100644 (file)
@@ -64,12 +64,13 @@ ClassImp(AliGenParam)
        fBias(0.),
        fTrials(0),
        fDeltaPt(0.01),
+       fSelectAll(kFALSE),
        fDecayer(0)
 {
 // Default constructor
 }
 //____________________________________________________________
-AliGenParam::AliGenParam(Int_t npart, AliGenLib * Library,  Int_t param, char* tname)
+AliGenParam::AliGenParam(Int_t npart, const AliGenLib * Library,  Int_t param, const char* tname)
     :AliGenMC(npart),
      fPtParaFunc(Library->GetPt(param, tname)),
      fYParaFunc (Library->GetY (param, tname)),
@@ -83,6 +84,7 @@ AliGenParam::AliGenParam(Int_t npart, AliGenLib * Library,  Int_t param, char* t
      fBias(0.),
      fTrials(0),
      fDeltaPt(0.01),
+     fSelectAll(kFALSE),
      fDecayer(0)
 {
 // Constructor using number of particles parameterisation id and library
@@ -106,6 +108,7 @@ AliGenParam::AliGenParam(Int_t npart, Int_t param, const char* tname, const char
     fBias(0.),
     fTrials(0),
     fDeltaPt(0.01),
+    fSelectAll(kFALSE),
     fDecayer(0)
 {
 // Constructor using parameterisation id and number of particles
@@ -148,6 +151,7 @@ AliGenParam::AliGenParam(Int_t npart, Int_t param,
      fBias(0.),
      fTrials(0),
      fDeltaPt(0.01),
+     fSelectAll(kFALSE),
      fDecayer(0)
 {
 // Constructor
@@ -186,7 +190,7 @@ void AliGenParam::Init()
   */
   //End_Html
     char name[256];
-    sprintf(name, "pt-parameterisation for %s", GetName());
+    snprintf(name, 256, "pt-parameterisation for %s", GetName());
     
     if (fPtPara) fPtPara->Delete();
     fPtPara = new TF1(name, fPtParaFunc, fPtMin, fPtMax,0);
@@ -196,15 +200,15 @@ void AliGenParam::Init()
     
     fPtPara->SetNpx(npx);
 
-    sprintf(name, "y-parameterisation  for %s", GetName());
+    snprintf(name, 256, "y-parameterisation  for %s", GetName());
     if (fYPara) fYPara->Delete();
     fYPara  = new TF1(name, fYParaFunc, fYMin, fYMax, 0);
     gROOT->GetListOfFunctions()->Remove(fYPara);
 
     
-    sprintf(name, "pt-for-%s", GetName());
+    snprintf(name, 256, "pt-for-%s", GetName());
     TF1 ptPara(name ,fPtParaFunc, 0, 15, 0);
-    sprintf(name, "y-for-%s", GetName());
+    snprintf(name, 256, "y-for-%s", GetName());
     TF1 yPara(name, fYParaFunc, -6, 6, 0);
 
 //
@@ -377,7 +381,7 @@ void AliGenParam::Generate()
              
              if (np >1) {
                  decayed = kTRUE;
-                 TParticle* iparticle =  (TParticle *) particles->At(0);
+                 TParticle* iparticle =  0;
                  Int_t ipF, ipL;
                  for (i = 1; i<np ; i++) {
                      trackIt[i] = 1;
@@ -413,7 +417,7 @@ void AliGenParam::Generate()
 //
 // children
                      
-                     if ((ChildSelected(TMath::Abs(kf)) || fForceDecay == kAll) && trackIt[i])
+                     if ((ChildSelected(TMath::Abs(kf)) || fForceDecay == kAll || fSelectAll) && trackIt[i])
                      {
                          if (fCutOnChild) {
                              pc[0]=iparticle->Px();