Better control of momentum range in GenBox
authorfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 8 Jun 2000 13:34:51 +0000 (13:34 +0000)
committerfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 8 Jun 2000 13:34:51 +0000 (13:34 +0000)
EVGEN/AliSimpleGen.cxx
EVGEN/AliSimpleGen.h
STEER/AliGenerator.cxx
STEER/AliGenerator.h

index 39b07693cae95f1eeec54842d242d612b23604be..042e8a2f3bc583453736103e6c4e26ebee33aa9c 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.7  2000/06/07 16:29:58  fca
+Adding check for pt range in AliGenBox
+
 Revision 1.6  1999/11/03 17:43:20  fca
 New version from G.Martinez & A.Morsch
 
@@ -46,6 +49,8 @@ Introduction of the Copyright and cvs Log
 #include "AliSimpleGen.h"
 #include "AliRun.h"
 #include "AliConst.h"
+#include "AliPDG.h"
+#include "TF1.h"
 
 ClassImp(AliGenHIJINGpara)
 
@@ -57,51 +62,53 @@ static Double_t ptpi(Double_t *px, Double_t *)
   //     POWER LAW FOR PT > 500 MEV
   //     MT SCALING BELOW (T=160 MEV)
   //
-  const Double_t p0 = 1.3;
-  const Double_t xn = 8.28;
-  const Double_t xlim=0.5;
-  const Double_t t=0.160;
-  const Double_t xmpi=0.139;
-  const Double_t b=1.;
+  const Double_t kp0 = 1.3;
+  const Double_t kxn = 8.28;
+  const Double_t kxlim=0.5;
+  const Double_t kt=0.160;
+  const Double_t kxmpi=0.139;
+  const Double_t kb=1.;
   Double_t y, y1, xmpi2, ynorm, a;
   Double_t x=*px;
   //
-  y1=TMath::Power(p0/(p0+xlim),xn);
-  xmpi2=xmpi*xmpi;
-  ynorm=b*(TMath::Exp(-sqrt(xlim*xlim+xmpi2)/t));
+  y1=TMath::Power(kp0/(kp0+kxlim),kxn);
+  xmpi2=kxmpi*kxmpi;
+  ynorm=kb*(TMath::Exp(-sqrt(kxlim*kxlim+xmpi2)/kt));
   a=ynorm/y1;
-  if (x > xlim)
-    y=a*TMath::Power(p0/(p0+x),xn);
+  if (x > kxlim)
+    y=a*TMath::Power(kp0/(kp0+x),kxn);
   else
-    y=b*TMath::Exp(-sqrt(x*x+xmpi2)/t);
+    y=kb*TMath::Exp(-sqrt(x*x+xmpi2)/kt);
   return y*x;
 }
 
 //_____________________________________________________________________________
 static Double_t ptscal(Double_t pt, Int_t np)
 {
-  //    SCALING EN MASSE PAR RAPPORT A PTPI
-  //     MASS PI,K,ETA,RHO,OMEGA,ETA',PHI
-  const Double_t hm[10] = {.13957,.493,.5488,.769,.7826,.958,1.02,0,0,0};
-  //     VALUE MESON/PI AT 5 GEV
-  const Double_t fmax[10]={1.,0.3,0.55,1.0,1.0,1.0,1.0,0,0,0};
-  np--;
-  Double_t f5=TMath::Power(((sqrt(100.018215)+2.)/(sqrt(100.+hm[np]*hm[np])+2.0)),12.3);
-  Double_t fmax2=f5/fmax[np];
-  // PIONS
-  Double_t ptpion=100.*ptpi(&pt, (Double_t*) 0);
-  Double_t fmtscal=TMath::Power(((sqrt(pt*pt+0.018215)+2.)/
-                                (sqrt(pt*pt+hm[np]*hm[np])+2.0)),12.3)/ fmax2;
-  return fmtscal*ptpion;
+    //    SCALING EN MASSE PAR RAPPORT A PTPI
+    //     MASS PI,K,ETA,RHO,OMEGA,ETA',PHI
+    const Double_t khm[10] = {.13957,.493,.5488,.769,.7826,.958,1.02,0,0,0};
+    //     VALUE MESON/PI AT 5 GEV
+    const Double_t kfmax[10]={1.,0.3,0.55,1.0,1.0,1.0,1.0,0,0,0};
+    np--;
+    Double_t f5=TMath::Power(((
+       sqrt(100.018215)+2.)/(sqrt(100.+khm[np]*khm[np])+2.0)),12.3);
+    Double_t fmax2=f5/kfmax[np];
+    // PIONS
+    Double_t ptpion=100.*ptpi(&pt, (Double_t*) 0);
+    Double_t fmtscal=TMath::Power(((
+       sqrt(pt*pt+0.018215)+2.)/ (sqrt(pt*pt+khm[np]*khm[np])+2.0)),12.3)/ 
+       fmax2;
+    return fmtscal*ptpion;
 }
 
 //_____________________________________________________________________________
 static Double_t ptka( Double_t *px, Double_t *)
 {
-  //
-  // pt parametrisation for k
-  //
-  return ptscal(*px,2);
+    //
+    // pt parametrisation for k
+    //
+    return ptscal(*px,2);
 }
 
 
@@ -111,49 +118,49 @@ static Double_t etapic( Double_t *py, Double_t *)
   //
   // eta parametrisation for pi
   //
-  const Double_t a1    = 4913.;
-  const Double_t a2    = 1819.;
-  const Double_t eta1  = 0.22;
-  const Double_t eta2  = 3.66;
-  const Double_t deta1 = 1.47;
-  const Double_t deta2 = 1.51;
-  Double_t y=TMath::Abs(*py);
-  //
-  Double_t ex1 = (y-eta1)*(y-eta1)/(2*deta1*deta1);
-  Double_t ex2 = (y-eta2)*(y-eta2)/(2*deta2*deta2);
-  return a1*TMath::Exp(-ex1)+a2*TMath::Exp(-ex2);
+    const Double_t ka1    = 4913.;
+    const Double_t ka2    = 1819.;
+    const Double_t keta1  = 0.22;
+    const Double_t keta2  = 3.66;
+    const Double_t kdeta1 = 1.47;
+    const Double_t kdeta2 = 1.51;
+    Double_t y=TMath::Abs(*py);
+    //
+    Double_t ex1 = (y-keta1)*(y-keta1)/(2*kdeta1*kdeta1);
+    Double_t ex2 = (y-keta2)*(y-keta2)/(2*kdeta2*kdeta2);
+    return ka1*TMath::Exp(-ex1)+ka2*TMath::Exp(-ex2);
 }
 
 //_____________________________________________________________________________
 static Double_t etakac( Double_t *py, Double_t *)
 {
-  //
-  // eta parametrisation for ka
-  //
-  const Double_t a1    = 497.6;
-  const Double_t a2    = 215.6;
-  const Double_t eta1  = 0.79;
-  const Double_t eta2  = 4.09;
-  const Double_t deta1 = 1.54;
-  const Double_t deta2 = 1.40;
-  Double_t y=TMath::Abs(*py);
-  //
-  Double_t ex1 = (y-eta1)*(y-eta1)/(2*deta1*deta1);
-  Double_t ex2 = (y-eta2)*(y-eta2)/(2*deta2*deta2);
-  return a1*TMath::Exp(-ex1)+a2*TMath::Exp(-ex2);
+    //
+    // eta parametrisation for ka
+    //
+    const Double_t ka1    = 497.6;
+    const Double_t ka2    = 215.6;
+    const Double_t keta1  = 0.79;
+    const Double_t keta2  = 4.09;
+    const Double_t kdeta1 = 1.54;
+    const Double_t kdeta2 = 1.40;
+    Double_t y=TMath::Abs(*py);
+    //
+    Double_t ex1 = (y-keta1)*(y-keta1)/(2*kdeta1*kdeta1);
+    Double_t ex2 = (y-keta2)*(y-keta2)/(2*kdeta2*kdeta2);
+    return ka1*TMath::Exp(-ex1)+ka2*TMath::Exp(-ex2);
 }
 
 //_____________________________________________________________________________
 AliGenHIJINGpara::AliGenHIJINGpara()
   :AliGenerator()
 {
-  //
-  // Default constructor
-  //
-  fPtpi = 0;
-  fPtka = 0;
-  fETApic = 0;
-  fETAkac = 0;
+    //
+    // Default constructor
+    //
+    fPtpi = 0;
+    fPtka = 0;
+    fETApic = 0;
+    fETAkac = 0;
 }
 
 //_____________________________________________________________________________
@@ -163,12 +170,12 @@ AliGenHIJINGpara::AliGenHIJINGpara(Int_t npart)
   // 
   // Standard constructor
   //
-  fName="HIGINGpara";
-  fTitle="HIJING Parametrisation Particle Generator";
-  fPtpi = 0;
-  fPtka = 0;
-  fETApic = 0;
-  fETAkac = 0;
+    fName="HIGINGpara";
+    fTitle="HIJING Parametrisation Particle Generator";
+    fPtpi = 0;
+    fPtka = 0;
+    fETApic = 0;
+    fETAkac = 0;
 }
 
 //_____________________________________________________________________________
@@ -177,10 +184,10 @@ AliGenHIJINGpara::~AliGenHIJINGpara()
   //
   // Standard destructor
   //
-  delete fPtpi;
-  delete fPtka;
-  delete fETApic;
-  delete fETAkac;
+    delete fPtpi;
+    delete fPtka;
+    delete fETApic;
+    delete fETAkac;
 }
 
 //_____________________________________________________________________________
@@ -189,33 +196,35 @@ void AliGenHIJINGpara::Init()
   //
   // Initialise the HIJING parametrisation
   //
-  Float_t etaMin = -TMath::Log(TMath::Tan(TMath::Min((Double_t)fThetaMax/2,TMath::Pi()/2-1.e-10)));
-  Float_t etaMax = -TMath::Log(TMath::Tan(TMath::Max((Double_t)fThetaMin/2,              1.e-10)));
-  fPtpi = new TF1("ptpi",&ptpi,0,20,0);
-  fPtka = new TF1("ptka",&ptka,0,20,0);
-  fETApic = new TF1("etapic",&etapic,etaMin,etaMax,0);
-  fETAkac = new TF1("etakac",&etakac,etaMin,etaMax,0);
-  TF1 *ETApic0 = new TF1("etapic",&etapic,-7,7,0);
-  TF1 *ETAkac0 = new TF1("etakac",&etakac,-7,7,0);
-  Float_t IntETApi  = ETApic0->Integral(-0.5, 0.5);
-  Float_t IntETAka  = ETAkac0->Integral(-0.5, 0.5);
-  Float_t scalePi=7316/(IntETApi/1.5);
-  Float_t scaleKa= 684/(IntETAka/2.0);
-
-  Float_t IntPt  = (0.877*ETApic0->Integral(0, 15)+
-                   0.123*ETAkac0->Integral(0, 15));
-  Float_t IntPtSel = (0.877*ETApic0->Integral(fPtMin, fPtMax)+
-                     0.123*ETAkac0->Integral(fPtMin, fPtMax));
-  Float_t PtFrac = IntPtSel/IntPt;
-  
-
-  Float_t IntETASel  = (scalePi*ETApic0->Integral(etaMin, etaMax)+
-                       scaleKa*ETAkac0->Integral(etaMin, etaMax));
-  Float_t PhiFrac = (fPhiMax-fPhiMin)/2/TMath::Pi();
-  fParentWeight = Float_t(fNpart)/IntETASel*PtFrac*PhiFrac;
-  
-  printf("\n The number of particles in the selected kinematic region corresponds to %f percent of a full event\n ", 100.*fParentWeight);
-  
+    Float_t etaMin =-TMath::Log(TMath::Tan(
+       TMath::Min((Double_t)fThetaMax/2,TMath::Pi()/2-1.e-10)));
+    Float_t etaMax = -TMath::Log(TMath::Tan(
+       TMath::Max((Double_t)fThetaMin/2,1.e-10)));
+    fPtpi = new TF1("ptpi",&ptpi,0,20,0);
+    fPtka = new TF1("ptka",&ptka,0,20,0);
+    fETApic = new TF1("etapic",&etapic,etaMin,etaMax,0);
+    fETAkac = new TF1("etakac",&etakac,etaMin,etaMax,0);
+    TF1 *etaPic0 = new TF1("etapic",&etapic,-7,7,0);
+    TF1 *etaKac0 = new TF1("etakac",&etakac,-7,7,0);
+    Float_t intETApi  = etaPic0->Integral(-0.5, 0.5);
+    Float_t intETAka  = etaKac0->Integral(-0.5, 0.5);
+    Float_t scalePi=7316/(intETApi/1.5);
+    Float_t scaleKa= 684/(intETAka/2.0);
+    
+    Float_t intPt  = (0.877*etaPic0->Integral(0, 15)+
+                     0.123*etaKac0->Integral(0, 15));
+    Float_t intPtSel = (0.877*etaPic0->Integral(fPtMin, fPtMax)+
+                       0.123*etaKac0->Integral(fPtMin, fPtMax));
+    Float_t ptFrac = intPtSel/intPt;
+    
+    
+    Float_t intETASel  = (scalePi*etaPic0->Integral(etaMin, etaMax)+
+                         scaleKa*etaKac0->Integral(etaMin, etaMax));
+    Float_t phiFrac = (fPhiMax-fPhiMin)/2/TMath::Pi();
+    fParentWeight = Float_t(fNpart)/intETASel*ptFrac*phiFrac;
+    
+    printf("\n The number of particles in the selected kinematic region corresponds to %f percent of a full event\n ", 100.*fParentWeight);
+    
 }
 
 //_____________________________________________________________________________
@@ -226,65 +235,65 @@ void AliGenHIJINGpara::Generate()
   //
 
   
-  const Float_t raKpic=0.14;
-  const Float_t borne=1/(1+raKpic);
-  Float_t polar[3]= {0,0,0};
-  //
-  const Int_t pions[3] = {kPi0, kPiPlus, kPiMinus};
-  const Int_t kaons[4] = {kK0Long, kK0Short, kKPlus, kKMinus};
-  //
-  Float_t origin[3];
-  Float_t pt, pl, ptot;
-  Float_t phi, theta;
-  Float_t p[3];
-  Int_t i, part, nt, j;
-  //
-  TF1 *ptf;
-  TF1 *etaf;
-  //
-  Float_t random[6];
-  //
-  for (j=0;j<3;j++) origin[j]=fOrigin[j];
-  if(fVertexSmear==perEvent) {
-    gMC->Rndm(random,6);
-    for (j=0;j<3;j++) {
-      origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
-       TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
-    }
-  }
-  for(i=0;i<fNpart;i++) {
-    while(1) {
-      gMC->Rndm(random,3);
-      if(random[0]<borne) {
-       part=pions[Int_t (random[1]*3)];
-       ptf=fPtpi;
-       etaf=fETApic;
-      } else {
-       part=kaons[Int_t (random[1]*4)];
-       ptf=fPtka;
-       etaf=fETAkac;
-      }
-      phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
-      theta=2*TMath::ATan(TMath::Exp(-etaf->GetRandom()));
-      if(theta<fThetaMin || theta>fThetaMax) continue;
-      pt=ptf->GetRandom();
-      pl=pt/TMath::Tan(theta);
-      ptot=TMath::Sqrt(pt*pt+pl*pl);
-      if(ptot<fPMin || ptot>fPMax) continue;
-      p[0]=pt*TMath::Cos(phi);
-      p[1]=pt*TMath::Sin(phi);
-      p[2]=pl;
-      if(fVertexSmear==perTrack) {
+    const Float_t kRaKpic=0.14;
+    const Float_t kBorne=1/(1+kRaKpic);
+    Float_t polar[3]= {0,0,0};
+    //
+    const Int_t kPions[3] = {kPi0, kPiPlus, kPiMinus};
+    const Int_t kKaons[4] = {kK0Long, kK0Short, kKPlus, kKMinus};
+    //
+    Float_t origin[3];
+    Float_t pt, pl, ptot;
+    Float_t phi, theta;
+    Float_t p[3];
+    Int_t i, part, nt, j;
+    //
+    TF1 *ptf;
+    TF1 *etaf;
+    //
+    Float_t random[6];
+    //
+    for (j=0;j<3;j++) origin[j]=fOrigin[j];
+    if(fVertexSmear==perEvent) {
        gMC->Rndm(random,6);
        for (j=0;j<3;j++) {
-         origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
-           TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
+           origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
+               TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
+       }
+    }
+    for(i=0;i<fNpart;i++) {
+       while(1) {
+           gMC->Rndm(random,3);
+           if(random[0]<kBorne) {
+               part=kPions[Int_t (random[1]*3)];
+               ptf=fPtpi;
+             etaf=fETApic;
+           } else {
+               part=kKaons[Int_t (random[1]*4)];
+               ptf=fPtka;
+               etaf=fETAkac;
+           }
+           phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
+           theta=2*TMath::ATan(TMath::Exp(-etaf->GetRandom()));
+           if(theta<fThetaMin || theta>fThetaMax) continue;
+           pt=ptf->GetRandom();
+           pl=pt/TMath::Tan(theta);
+           ptot=TMath::Sqrt(pt*pt+pl*pl);
+           if(ptot<fPMin || ptot>fPMax) continue;
+           p[0]=pt*TMath::Cos(phi);
+           p[1]=pt*TMath::Sin(phi);
+           p[2]=pl;
+           if(fVertexSmear==perTrack) {
+               gMC->Rndm(random,6);
+               for (j=0;j<3;j++) {
+                   origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
+                       TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
+               }
+           }
+           gAlice->SetTrack(fTrackIt,-1,part,p,origin,polar,0,"Primary",nt,fParentWeight);
+           break;
        }
-      }
-      gAlice->SetTrack(fTrackIt,-1,part,p,origin,polar,0,"Primary",nt,fParentWeight);
-      break;
     }
-  }
 }
   
 ClassImp(AliGenFixed)
@@ -330,7 +339,7 @@ void AliGenFixed::Generate()
 }
   
 //_____________________________________________________________________________
-void AliGenFixed::SetSigma(Float_t, Float_t, Float_t)
+void AliGenFixed::SetSigma(Float_t sx, Float_t sy, Float_t sz)
 {
   //
   // Set the interaction point sigma
@@ -365,49 +374,63 @@ AliGenBox::AliGenBox(Int_t npart)
 }
 
 //_____________________________________________________________________________
+
 void AliGenBox::Generate()
 {
   //
   // Generate one trigger
   //
   
-  Float_t polar[3]= {0,0,0};
-  //
-  Float_t origin[3];
-  Float_t p[3];
-  Int_t i, j, nt;
-  Float_t pmom, theta, phi;
+    Float_t polar[3]= {0,0,0};
   //
-  Float_t random[6];
+    Float_t origin[3];
+    Float_t p[3];
+    Int_t i, j, nt;
+    Double_t pmom, theta, phi, pt;
+    //
+    Float_t random[6];
   //
-  for (j=0;j<3;j++) origin[j]=fOrigin[j];
-  if(fVertexSmear==perEvent) {
-    gMC->Rndm(random,6);
-    for (j=0;j<3;j++) {
-      origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
-       TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
+    for (j=0;j<3;j++) origin[j]=fOrigin[j];
+    if(fVertexSmear==perEvent) {
+       gMC->Rndm(random,6);
+       for (j=0;j<3;j++) {
+           origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
+               TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
+       }
     }
-  }
-  for(i=0;i<fNpart;i++) {
-    gMC->Rndm(random,3);
-    do {
-      pmom=fPMin+random[0]*(fPMax-fPMin);
-      theta=fThetaMin+random[1]*(fThetaMax-fThetaMin);
-      phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
-      p[0] = pmom*TMath::Cos(phi)*TMath::Sin(theta);
-      p[1] = pmom*TMath::Sin(phi)*TMath::Sin(theta);
-      p[2] = pmom*TMath::Cos(theta);
-    } while (fPtMin<=TMath::Sqrt(p[0]*p[0]+p[1]*p[1]) && 
-            TMath::Sqrt(p[0]*p[0]+p[1]*p[1])<=fPtMax);
-    if(fVertexSmear==perTrack) {
-      gMC->Rndm(random,6);
-      for (j=0;j<3;j++) {
-       origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
-         TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
-      }
+    for(i=0;i<fNpart;i++) {
+       gMC->Rndm(random,3);
+       theta=fThetaMin+random[0]*(fThetaMax-fThetaMin);
+       if(TestBit(kMomentumRange)) {
+           pmom=fPMin+random[1]*(fPMax-fPMin);
+           pt=pmom*TMath::Sin(theta);
+       } else {
+
+           pt=fPtMin+random[1]*(fPtMax-fPtMin);
+           pmom=pt/TMath::Sin(theta);
+       }
+       phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
+       p[0] = pt*TMath::Cos(phi);
+       p[1] = pt*TMath::Sin(phi);
+       p[2] = pmom*TMath::Cos(theta);
+
+       if(fVertexSmear==perTrack) {
+           gMC->Rndm(random,6);
+           for (j=0;j<3;j++) {
+               origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
+                   TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
+           }
+       }
+       gAlice->SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,"Primary",nt);
     }
-    gAlice->SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,"Primary",nt);
-  }
 }
 
+//_____________________________________________________________________________
 
+void AliGenBox::Init()
+{
+  if(TestBit(kPtRange)&&TestBit(kMomentumRange)) 
+    Fatal("Init","You should not set the momentum range and the pt range!\n");
+  if((!TestBit(kPtRange))&&(!TestBit(kMomentumRange))) 
+    Fatal("Init","You should set either the momentum or the pt range!\n");
+}
index aeade82eba058a682c07a4296ab816cf0ba4ac8c..6d57bf64d48031d467247a9a5b59e685e1ec07ab 100644 (file)
 ///////////////////////////////////////////////////////////
 
 #include "AliGenerator.h"
-#include "AliPDG.h"
-#include "TF1.h"
+class TF1;
+
 
 
 class AliGenHIJINGpara : public AliGenerator
 {
-protected:
-
-  TF1* fPtpi; // Parametrised pt distribution for pi
-  TF1* fPtka; // Parametrised pt distribution for ka
-  TF1* fETApic; // Parametrised eta distribution for pi
-  TF1* fETAkac; // Parametrised eta distribution fro ka
-
-public:
+ public:
 
   AliGenHIJINGpara();
   AliGenHIJINGpara(Int_t npart);
@@ -35,29 +27,33 @@ public:
   virtual void Generate();
   virtual void Init();
 
+ protected:
+
+  TF1* fPtpi; // Parametrised pt distribution for pi
+  TF1* fPtka; // Parametrised pt distribution for ka
+  TF1* fETApic; // Parametrised eta distribution for pi
+  TF1* fETAkac; // Parametrised eta distribution fro ka
+
   ClassDef(AliGenHIJINGpara,1) // Hijing parametrisation generator
 };
 
 class AliGenFixed : public AliGenerator
 {
-protected:
-
-  Int_t fIpart; // Particle type
-
-public:
-
+ public:
   AliGenFixed();
   AliGenFixed(Int_t npart);
   virtual ~AliGenFixed() {}
   virtual void Generate();
   virtual void Init() {}
-  virtual void SetSigma(Float_t, Float_t, Float_t);
-  //
+  virtual void SetSigma(Float_t sx, Float_t sy, Float_t sz);
   virtual void SetMomentum(Float_t pmom) {fPMin=pmom; fPMax=pmom;}
   virtual void SetPhi(Float_t phi) {fPhiMin=phi*TMath::Pi()/180; fPhiMax=phi*TMath::Pi()/180;}
   virtual void SetTheta(Float_t theta) {fThetaMin=theta*TMath::Pi()/180; fThetaMax=theta*TMath::Pi()/180;}
   virtual void SetPart(Int_t part) {fIpart=part;}
+protected:
+
+  Int_t fIpart; // Particle type
 
   ClassDef(AliGenFixed,1) // Single particle generator
 };
@@ -65,19 +61,17 @@ public:
 
 class AliGenBox : public AliGenerator
 {
-protected:
-
-  Int_t fIpart; // Particle type
-
-public:
+ public:
 
   AliGenBox();
   AliGenBox(Int_t npart);
   virtual ~AliGenBox() {}
   virtual void Generate();
-  virtual void Init() {}
+  virtual void Init();
   virtual void SetPart(Int_t part) {fIpart=part;}
+protected:
+
+  Int_t fIpart; // Particle type
 
   ClassDef(AliGenBox,1) // Square box random generator
 };
index 42d8efbee6e166ed74087fb15012d72e194f93f7..0fde4ff3668992298c86431b0c262eeea7428e21 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.4  1999/09/29 09:24:29  fca
+Introduction of the Copyright and cvs Log
+
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -47,44 +50,40 @@ TGenerator* AliGenerator::fgMCEvGen=0;
 //____________________________________________________________
 AliGenerator::AliGenerator()
 {
-    printf("\n Initialising AliGenerator\n\n");
+    printf("\n AliGenerator Default Constructor\n\n");
     
     gAlice->SetGenerator(this);
-    SetThetaRange();
-    SetPhiRange();
-    SetMomentumRange();
-    SetPtRange();
-    SetYRange();
+    SetThetaRange(); ResetBit(kThetaRange);
+    SetPhiRange(); ResetBit(kPhiRange);
+    SetMomentumRange(); ResetBit(kMomentumRange);
+    SetPtRange(); ResetBit(kPtRange);
+    SetYRange(); ResetBit(kYRange);
     SetNumberParticles();
     SetTrackingFlag();
-  //
-  //  fName="Default";
-  //  fTitle="Base Generator Class";
-  //
+
     fOrigin.Set(3);
     fOsigma.Set(3);
     fOrigin[0]=fOrigin[1]=fOrigin[2]=0;
     fOsigma[0]=fOsigma[1]=fOsigma[2]=0;
+    fVMin.Set(3);
+    fVMin[0]=fVMin[1]=fVMin[2]=0;
+    fVMax.Set(3);
+    fVMax[0]=fVMax[1]=fVMax[2]=10000;
 }
 
 //____________________________________________________________
 AliGenerator::AliGenerator(Int_t npart)
     : TNamed(" "," ")
 {
-    printf("\n Initialising AliGenerator\n\n");
+    printf("\n AliGenerator Constructor initializing number of particles \n\n");
     gAlice->SetGenerator(this);
-    SetThetaRange();
-    SetPhiRange();
-    SetMomentumRange();
-    SetPtRange();
-    SetYRange();
-    SetNumberParticles(npart);
+    SetThetaRange(); ResetBit(kThetaRange);
+    SetPhiRange(); ResetBit(kPhiRange);
+    SetMomentumRange(); ResetBit(kMomentumRange);
+    SetPtRange(); ResetBit(kPtRange);
+    SetYRange(); ResetBit(kYRange);
     SetTrackingFlag();
-  //
-  //  fName="Default";
-  //  fTitle="Base Generator Class";
-  //
-    fVertexSmear=none;
+
     fOrigin.Set(3);
     fOsigma.Set(3);
     fOrigin[0]=fOrigin[1]=fOrigin[2]=0;
@@ -93,6 +92,8 @@ AliGenerator::AliGenerator(Int_t npart)
     fVMin[0]=fVMin[1]=fVMin[2]=0;
     fVMax.Set(3);
     fVMax[0]=fVMax[1]=fVMax[2]=10000;
+
+    SetNumberParticles(npart);
 }
 
 //____________________________________________________________
index 5975a4ea74afc7f9644abec86bcc51e83170f70e..a8772e415b5c76a82795d242b4c7c24ce09e8b23 100644 (file)
@@ -46,6 +46,9 @@ protected:
     TArrayF     fOrigin;     //Origin of event
     TArrayF     fOsigma;     //Sigma of the Origin of event
 
+    enum {kThetaRange=1, kVertexRange=2, kPhiRange=4, kPtRange=8,
+         kYRange=32, kMomentumRange=16};
+
  public:
     AliGenerator();
     AliGenerator(Int_t npart);
@@ -58,26 +61,31 @@ protected:
     virtual void SetSigma(Float_t sx, Float_t sy, Float_t sz)
        {fOsigma[0]=sx;fOsigma[1]=sy;fOsigma[2]=sz;}
     virtual void SetMomentumRange(Float_t pmin=0, Float_t pmax=1.e10)
-       {fPMin = pmin; fPMax = pmax;}
+       {fPMin = pmin; fPMax = pmax; SetBit(kMomentumRange);
+        printf("\n set bits p %d %d %f %f  \n \n",TestBit(kMomentumRange), TestBit(kPtRange), pmin, pmax);
+       }
     virtual void SetPtRange(Float_t ptmin=0, Float_t ptmax=1.e10)
-       {fPtMin = ptmin; fPtMax = ptmax;}
+       {fPtMin = ptmin; fPtMax = ptmax; SetBit(kPtRange);
+       printf("\n set bits pt %d %d %f %f \n \n",TestBit(kMomentumRange), TestBit(kPtRange), ptmin, ptmax);
+       }
     virtual void SetPhiRange(Float_t phimin=-180., Float_t phimax=180)
        {fPhiMin = TMath::Pi()*phimin/180;
-       fPhiMax = TMath::Pi()*phimax/180;}
+       fPhiMax = TMath::Pi()*phimax/180; SetBit(kPhiRange);}
     virtual void SetYRange(Float_t ymin=-100, Float_t ymax=100)
-       {fYMin=ymin; fYMax=ymax;}
+       {fYMin=ymin; fYMax=ymax; SetBit(kYRange);}
     virtual void SetVRange(Float_t vxmin, Float_t vxmax,
                           Float_t vymin, Float_t vymax,
                           Float_t vzmin, Float_t vzmax)
        {
            fVMin[0]=vxmin; fVMin[1]=vymin; fVMin[2]=vzmin;
            fVMax[0]=vxmax; fVMax[1]=vymax; fVMax[2]=vzmax;
+           SetBit(kVertexRange);
        }
     virtual void SetNumberParticles(Int_t npart=100) {fNpart=npart;}
     virtual Int_t NumberParticles() {return fNpart;}
     virtual void SetThetaRange(Float_t thetamin=0, Float_t thetamax=180)
        {fThetaMin = TMath::Pi()*thetamin/180;
-       fThetaMax = TMath::Pi()*thetamax/180;}
+       fThetaMax = TMath::Pi()*thetamax/180; SetBit(kThetaRange);}
     virtual void Generate()=0;
     virtual void SetParentWeight(Float_t wgt) {fParentWeight=wgt;}
     virtual void SetChildWeight(Float_t wgt)  {fChildWeight=wgt;}