ROOT logo
/**************************************************************************
 * 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$ */

//-------------------------------------------------------------------------
//    Lego generator in Phi - Z bins
//    Uses geantino rays to check the material distributions and detector's
//    geometry
//    Author: A.Morsch 
//-------------------------------------------------------------------------

#include "AliLegoGeneratorPhiZ.h"
#include "AliRun.h"
#include "AliMC.h"
#include "AliLog.h"

ClassImp(AliLegoGeneratorPhiZ)


//___________________________________________
void AliLegoGeneratorPhiZ::Generate()
{
// Create a geantino with kinematics corresponding to the current bins
// Here: Coor1 =  Z 
//       Coor2 =  phi.
   
  //
  // Rootinos are 0
   const Int_t kMpart = 0;
   Float_t orig[3], pmom[3];
   Float_t t, cosp, sinp;
   if (fCoor1Bin==-1) fCoor1Bin=fNCoor1;
   // Prepare for next step
   if(fCoor1Bin>=fNCoor1-1)
     if(fCoor2Bin>=fNCoor2-1) {
       AliWarning("End of Lego Generation");
       return;
     } else { 
       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);

   Float_t phi   = fCurCoor2*TMath::Pi()/180.;
   
   cosp      = TMath::Cos(phi);
   sinp      = TMath::Sin(phi);
   
   pmom[0] = cosp;
   pmom[1] = sinp;
   pmom[2] = 0.;
   
   // --- Where to start
   orig[0] = orig[1] = orig[2] = 0;
   orig[2] = fCurCoor1;
   
   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;
   }
   
   Float_t polar[3]={0.,0.,0.};
   Int_t ntr;
   gAlice->GetMCApp()->PushTrack(1, -1, kMpart, pmom, orig, polar, 0, kPPrimary, ntr);
   
}
 AliLegoGeneratorPhiZ.cxx:1
 AliLegoGeneratorPhiZ.cxx:2
 AliLegoGeneratorPhiZ.cxx:3
 AliLegoGeneratorPhiZ.cxx:4
 AliLegoGeneratorPhiZ.cxx:5
 AliLegoGeneratorPhiZ.cxx:6
 AliLegoGeneratorPhiZ.cxx:7
 AliLegoGeneratorPhiZ.cxx:8
 AliLegoGeneratorPhiZ.cxx:9
 AliLegoGeneratorPhiZ.cxx:10
 AliLegoGeneratorPhiZ.cxx:11
 AliLegoGeneratorPhiZ.cxx:12
 AliLegoGeneratorPhiZ.cxx:13
 AliLegoGeneratorPhiZ.cxx:14
 AliLegoGeneratorPhiZ.cxx:15
 AliLegoGeneratorPhiZ.cxx:16
 AliLegoGeneratorPhiZ.cxx:17
 AliLegoGeneratorPhiZ.cxx:18
 AliLegoGeneratorPhiZ.cxx:19
 AliLegoGeneratorPhiZ.cxx:20
 AliLegoGeneratorPhiZ.cxx:21
 AliLegoGeneratorPhiZ.cxx:22
 AliLegoGeneratorPhiZ.cxx:23
 AliLegoGeneratorPhiZ.cxx:24
 AliLegoGeneratorPhiZ.cxx:25
 AliLegoGeneratorPhiZ.cxx:26
 AliLegoGeneratorPhiZ.cxx:27
 AliLegoGeneratorPhiZ.cxx:28
 AliLegoGeneratorPhiZ.cxx:29
 AliLegoGeneratorPhiZ.cxx:30
 AliLegoGeneratorPhiZ.cxx:31
 AliLegoGeneratorPhiZ.cxx:32
 AliLegoGeneratorPhiZ.cxx:33
 AliLegoGeneratorPhiZ.cxx:34
 AliLegoGeneratorPhiZ.cxx:35
 AliLegoGeneratorPhiZ.cxx:36
 AliLegoGeneratorPhiZ.cxx:37
 AliLegoGeneratorPhiZ.cxx:38
 AliLegoGeneratorPhiZ.cxx:39
 AliLegoGeneratorPhiZ.cxx:40
 AliLegoGeneratorPhiZ.cxx:41
 AliLegoGeneratorPhiZ.cxx:42
 AliLegoGeneratorPhiZ.cxx:43
 AliLegoGeneratorPhiZ.cxx:44
 AliLegoGeneratorPhiZ.cxx:45
 AliLegoGeneratorPhiZ.cxx:46
 AliLegoGeneratorPhiZ.cxx:47
 AliLegoGeneratorPhiZ.cxx:48
 AliLegoGeneratorPhiZ.cxx:49
 AliLegoGeneratorPhiZ.cxx:50
 AliLegoGeneratorPhiZ.cxx:51
 AliLegoGeneratorPhiZ.cxx:52
 AliLegoGeneratorPhiZ.cxx:53
 AliLegoGeneratorPhiZ.cxx:54
 AliLegoGeneratorPhiZ.cxx:55
 AliLegoGeneratorPhiZ.cxx:56
 AliLegoGeneratorPhiZ.cxx:57
 AliLegoGeneratorPhiZ.cxx:58
 AliLegoGeneratorPhiZ.cxx:59
 AliLegoGeneratorPhiZ.cxx:60
 AliLegoGeneratorPhiZ.cxx:61
 AliLegoGeneratorPhiZ.cxx:62
 AliLegoGeneratorPhiZ.cxx:63
 AliLegoGeneratorPhiZ.cxx:64
 AliLegoGeneratorPhiZ.cxx:65
 AliLegoGeneratorPhiZ.cxx:66
 AliLegoGeneratorPhiZ.cxx:67
 AliLegoGeneratorPhiZ.cxx:68
 AliLegoGeneratorPhiZ.cxx:69
 AliLegoGeneratorPhiZ.cxx:70
 AliLegoGeneratorPhiZ.cxx:71
 AliLegoGeneratorPhiZ.cxx:72
 AliLegoGeneratorPhiZ.cxx:73
 AliLegoGeneratorPhiZ.cxx:74
 AliLegoGeneratorPhiZ.cxx:75
 AliLegoGeneratorPhiZ.cxx:76
 AliLegoGeneratorPhiZ.cxx:77
 AliLegoGeneratorPhiZ.cxx:78
 AliLegoGeneratorPhiZ.cxx:79
 AliLegoGeneratorPhiZ.cxx:80
 AliLegoGeneratorPhiZ.cxx:81
 AliLegoGeneratorPhiZ.cxx:82
 AliLegoGeneratorPhiZ.cxx:83
 AliLegoGeneratorPhiZ.cxx:84
 AliLegoGeneratorPhiZ.cxx:85