+/**************************************************************************
+ * 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. *
+ **************************************************************************/
+
+/* $Id$ */
+
+// Realisation of AliGenerator that generates particles with
+// vertices on a user defined grid.
+// The vertex positions can be smeared.
+// Momentum vectors are defined through the methods provided by AliGenerator.
+// Author: andreas.morsch@cern.ch
+
#include "AliGenScan.h"
-#include <stdlib.h>
-#include "AliRun.h"
+
ClassImp(AliGenScan)
AliGenScan::AliGenScan()
- :AliGenerator(-1)
+ :AliGenerator(-1),
+ fXCmin(0),
+ fXCmax(0),
+ fNx(1),
+ fYCmin(0),
+ fYCmax(0),
+ fNy(1),
+ fZmin(0),
+ fZmax(0),
+ fNz(1),
+ fIpart(0)
{
-//
- fXmin=0;
- fXmax=0;
- fNx=1;
- fYmin=0;
- fYmax=0;
- fNy=1;
- fZmin=0;
- fZmax=0;
- fNz=1;
+// Constructor
//
// Read all particles
fNpart=-1;
}
AliGenScan::AliGenScan(Int_t npart)
- :AliGenerator(npart)
+ :AliGenerator(npart),
+ fXCmin(0),
+ fXCmax(0),
+ fNx(1),
+ fYCmin(0),
+ fYCmax(0),
+ fNy(1),
+ fZmin(0),
+ fZmax(0),
+ fNz(1),
+ fIpart(0)
{
- fXmin=0;
- fXmax=0;
- fNx=1;
- fYmin=0;
- fYmax=0;
- fNy=1;
- fZmin=0;
- fZmax=0;
- fNz=1;
+// Constructor
+ fName = "Scan";
+ fTitle = "Generator for particles on a grid";
}
//____________________________________________________________
AliGenScan::~AliGenScan()
-{}
+{
+// Destructor
+}
void AliGenScan::SetRange(Int_t nx, Float_t xmin, Float_t xmax,
Int_t ny, Float_t ymin, Float_t ymax,
Int_t nz, Float_t zmin, Float_t zmax)
{
- fXmin=xmin;
- fXmax=xmax;
+// Define the grid
+ fXCmin=xmin;
+ fXCmax=xmax;
fNx=nx;
- fYmin=ymin;
- fYmax=ymax;
+ fYCmin=ymin;
+ fYCmax=ymax;
fNy=ny;
fZmin=zmin;
fZmax=zmax;
//
// Generate one trigger
//
- AliMC* pMC = AliMC::GetMC();
Float_t polar[3]= {0,0,0};
//
Float_t dx,dy,dz;
//
- if (fNy > 0) {
- dx=(fXmax-fXmin)/fNx;
+ if (fNx > 0) {
+ dx=(fXCmax-fXCmin)/fNx;
} else {
dx=1e10;
}
if (fNy > 0) {
- dy=(fYmax-fYmin)/fNy;
+ dy=(fYCmax-fYCmin)/fNy;
} else {
dy=1e10;
}
for (Int_t ix=0; ix<fNx; ix++) {
for (Int_t iy=0; iy<fNy; iy++) {
for (Int_t iz=0; iz<fNz; iz++){
- pMC->Rndm(random,6);
- origin[0]=fXmin+ix*dx+2*(random[0]-0.5)*fOsigma[0];
- origin[1]=fYmin+iy*dy+2*(random[1]-0.5)*fOsigma[1];
+ Rndm(random,6);
+ origin[0]=fXCmin+ix*dx+2*(random[0]-0.5)*fOsigma[0];
+ origin[1]=fYCmin+iy*dy+2*(random[1]-0.5)*fOsigma[1];
origin[2]=fZmin+iz*dz+2*(random[2]-0.5)*fOsigma[2];
pmom=fPMin+random[3]*(fPMax-fPMin);
theta=fThetaMin+random[4]*(fThetaMax-fThetaMin);
p[0] = pmom*TMath::Cos(phi)*TMath::Sin(theta);
p[1] = pmom*TMath::Sin(phi)*TMath::Sin(theta);
p[2] = pmom*TMath::Cos(theta);
- gAlice->SetTrack(1,-1,fIpart,p,origin,polar,0,"Primary",nt);
+ PushTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt);
}
}
}