* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
-$Log$
-Revision 1.16 2000/05/26 08:35:03 fca
-Move the check on z after z has been retrieved
+/* $Id$ */
-Revision 1.15 2000/05/16 13:10:40 fca
-New method IsNewTrack and fix for a problem in Father-Daughter relations
-
-Revision 1.14 2000/04/27 10:38:21 fca
-Correct termination of Lego Run and introduce Lego getter in AliRun
-
-Revision 1.13 2000/04/26 10:17:31 fca
-Changes in Lego for G4 compatibility
-
-Revision 1.12 2000/04/07 11:12:33 fca
-G4 compatibility changes
-
-Revision 1.11 2000/03/22 13:42:26 fca
-SetGenerator does not replace an existing generator, ResetGenerator does
-
-Revision 1.10 2000/02/23 16:25:22 fca
-AliVMC and AliGeant3 classes introduced
-ReadEuclid moved from AliRun to AliModule
-
-Revision 1.9 1999/12/03 10:54:01 fca
-Fix lego summary
-
-Revision 1.8 1999/10/01 09:54:33 fca
-Correct logics for Lego StepManager
-
-Revision 1.7 1999/09/29 09:24:29 fca
-Introduction of the Copyright and cvs Log
-
-*/
+//------------------------------------------------------------------------
+// Generic Lego generator code
+// Uses geantino rays to check the material distributions and detector's
+// geometry
+// Author: A.Morsch
+//------------------------------------------------------------------------
#include "AliLegoGenerator.h"
#include "AliRun.h"
+#include "AliMC.h"
+#include "AliLog.h"
ClassImp(AliLegoGenerator)
-//___________________________________________
-AliLegoGenerator::AliLegoGenerator(Int_t ntheta, Float_t themin,
- Float_t themax, Int_t nphi,
- Float_t phimin, Float_t phimax,
- Float_t rmin, Float_t rmax, Float_t zmax) :
- AliGenerator(0), fRadMin(rmin), fRadMax(rmax), fZMax(zmax), fNtheta(ntheta),
- fNphi(nphi), fThetaBin(ntheta), fPhiBin(-1), fCurTheta(0), fCurPhi(0)
-
+//_______________________________________________________________________
+AliLegoGenerator::AliLegoGenerator():
+ fRadMin(0),
+ fRadMax(0),
+ fZMax(0),
+ fNCoor1(0),
+ fNCoor2(0),
+ fCoor1Min(0),
+ fCoor1Max(0),
+ fCoor2Min(0),
+ fCoor2Max(0),
+ fCoor1Bin(-1),
+ fCoor2Bin(-1),
+ fCurCoor1(0),
+ fCurCoor2(0)
{
- SetPhiRange(phimin,phimax);
- SetThetaRange(themin,themax);
+ //
+ // Default Constructor
+ //
SetName("Lego");
}
+//_______________________________________________________________________
+AliLegoGenerator::AliLegoGenerator(Int_t nc1, Float_t c1min,
+ Float_t c1max, Int_t nc2,
+ Float_t c2min, Float_t c2max,
+ Float_t rmin, Float_t rmax, Float_t zmax):
+ AliGenerator(0),
+ fRadMin(rmin),
+ fRadMax(rmax),
+ fZMax(zmax),
+ fNCoor1(nc1),
+ fNCoor2(nc2),
+ fCoor1Min(0),
+ fCoor1Max(0),
+ fCoor2Min(0),
+ fCoor2Max(0),
+ fCoor1Bin(nc1),
+ fCoor2Bin(-1),
+ fCurCoor1(0),
+ fCurCoor2(0)
+{
+ //
+ // Standard generator for Lego rays
+ //
+ SetName("Lego");
+ SetCoor1Range(nc1, c1min, c1max);
+ SetCoor2Range(nc2, c2min, c2max);
+}
-//___________________________________________
+//_______________________________________________________________________
void AliLegoGenerator::Generate()
{
-// Create a geantino with kinematics corresponding to the current
-// bins in theta and phi.
-
+ // Create a geantino with kinematics corresponding to the current bins
+ // Here: Coor1 = theta
+ // Coor2 = phi.
+
//
// Rootinos are 0
const Int_t kMpart = 0;
Float_t orig[3], pmom[3];
Float_t t, cost, sint, cosp, sinp;
-
+ if (fCoor1Bin==-1) fCoor1Bin=fNCoor1;
// Prepare for next step
- if(fThetaBin>=fNtheta-1)
- if(fPhiBin>=fNphi-1) {
- Warning("Generate","End of Lego Generation");
+ if(fCoor1Bin>=fNCoor1-1)
+ if(fCoor2Bin>=fNCoor2-1) {
+ AliWarning("End of Lego Generation");
return;
} else {
- fPhiBin++;
- printf("Generating rays in phi bin:%d\n",fPhiBin);
- fThetaBin=0;
- } else fThetaBin++;
-
- fCurTheta = (fThetaMin+(fThetaBin+0.5)*(fThetaMax-fThetaMin)/fNtheta);
- fCurPhi = (fPhiMin+(fPhiBin+0.5)*(fPhiMax-fPhiMin)/fNphi);
- cost = TMath::Cos(fCurTheta);
- sint = TMath::Sin(fCurTheta);
- cosp = TMath::Cos(fCurPhi);
- sinp = TMath::Sin(fCurPhi);
+ fCoor2Bin++;
+ AliDebug(1, Form("Generating rays in phi bin:%d",fCoor2Bin));
+ fCoor1Bin=0;
+ } else fCoor1Bin++;
+
+ fCurCoor1 = (fCoor1Min+(fCoor1Bin+0.5)*(fCoor1Max-fCoor1Min)/fNCoor1);
+ fCurCoor2 = (fCoor2Min+(fCoor2Bin+0.5)*(fCoor2Max-fCoor2Min)/fNCoor2);
+ cost = TMath::Cos(fCurCoor1 * TMath::Pi()/180.);
+ sint = TMath::Sin(fCurCoor1 * TMath::Pi()/180.);
+ cosp = TMath::Cos(fCurCoor2 * TMath::Pi()/180.);
+ sinp = TMath::Sin(fCurCoor2 * TMath::Pi()/180.);
pmom[0] = cosp*sint;
pmom[1] = sinp*sint;
orig[0] = orig[1] = orig[2] = 0;
Float_t dalicz = 3000;
if (fRadMin > 0) {
- t = PropagateCylinder(orig,pmom,fRadMin,dalicz);
- orig[0] = pmom[0]*t;
- orig[1] = pmom[1]*t;
- orig[2] = pmom[2]*t;
- if (TMath::Abs(orig[2]) > fZMax) return;
+ t = PropagateCylinder(orig,pmom,fRadMin,dalicz);
+ orig[0] = pmom[0]*t;
+ orig[1] = pmom[1]*t;
+ orig[2] = pmom[2]*t;
+ if (TMath::Abs(orig[2]) > fZMax) return;
}
Float_t polar[3]={0.,0.,0.};
Int_t ntr;
- gAlice->SetTrack(1, 0, kMpart, pmom, orig, polar, 0, "LEGO ray", ntr);
-
+ gAlice->GetMCApp()->PushTrack(1, -1, kMpart, pmom, orig, polar, 0, kPPrimary, ntr);
+
}
-//___________________________________________
-Float_t AliLegoGenerator::PropagateCylinder(Float_t *x, Float_t *v, Float_t r, Float_t z)
+//_______________________________________________________________________
+Float_t AliLegoGenerator::PropagateCylinder(Float_t *x, Float_t *v, Float_t r,
+ Float_t z)
{
-// Propagate to cylinder from inside
-
+ //
+ // Propagate to cylinder from inside
+ //
Double_t hnorm, sz, t, t1, t2, t3, sr;
Double_t d[3];
const Float_t kSmall = 1e-8;
t2 = x[0]*d[0] + x[1]*d[1];
t3 = x[0]*x[0] + x[1]*x[1];
// ---> It should be positive, but there may be numerical problems
- sr = (t2 +TMath::Sqrt(TMath::Max(t2*t2-(t3-r*r)*t1,0.)))/t1;
+ sr = (-t2 +TMath::Sqrt(TMath::Max(t2*t2-(t3-r*r)*t1,0.)))/t1;
// ---> Find minimum distance between planes and cylinder
t = TMath::Min(sz,sr);
}
return t;
}
+