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 x - y - z bins
//    Uses geantino rays to check the material distributions and detector's
//    geometry
//    Author: A.Morsch 
//-------------------------------------------------------------------------

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

ClassImp(AliLegoGeneratorXYZ)


//___________________________________________
    

AliLegoGeneratorXYZ::AliLegoGeneratorXYZ()
{
// Default Constructor
    fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.;
    fDir2[0]=0.; fDir2[1]=1.; fDir2[2]=0.;    
    fDir3[0]=0.; fDir3[1]=0.; fDir3[2]=1.;    
}

AliLegoGeneratorXYZ::AliLegoGeneratorXYZ(char* axis)
{
// Constructor
    if (!strcmp(axis,"x") || !strcmp(axis,"X")) 
    {
	fDir1[0]=0.; fDir1[1]=1.; fDir1[2]=0.;
	fDir2[0]=0.; fDir2[1]=0.; fDir2[2]=1.;    
	fDir3[0]=1.; fDir3[1]=0.; fDir3[2]=0.;    
    }
    else if (!strcmp(axis,"y") || !strcmp(axis,"Y")) 
    {
	fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.;
	fDir2[0]=0.; fDir2[1]=0.; fDir2[2]=1;    
	fDir3[0]=0.; fDir3[1]=1.; fDir3[2]=0.;    
    }
    else if (!strcmp(axis,"z") || !strcmp(axis,"Z")) 
    {
	fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.;
	fDir2[0]=0.; fDir2[1]=1.; fDir2[2]=0.;    
	fDir3[0]=0.; fDir3[1]=0.; fDir3[2]=1.;    
    }
    else 
    {
	fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.;
	fDir2[0]=0.; fDir2[1]=1.; fDir2[2]=0.;    
	fDir3[0]=0.; fDir3[1]=0.; fDir3[2]=1.;    
    }
}


AliLegoGeneratorXYZ::AliLegoGeneratorXYZ(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) : 
    AliLegoGenerator(nc1, c1min, c1max, nc2, c2min, c2max,
		     rmin, rmax, zmax)
{
//  Constructor
    fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.;
    fDir2[0]=0.; fDir2[1]=1.; fDir2[2]=0.;    
    fDir3[0]=0.; fDir3[1]=0.; fDir3[2]=1.;    
}


//___________________________________________
void AliLegoGeneratorXYZ::Generate()
{
// Create a geantino with kinematics corresponding to the current bins
// Here: Coor1 =  x 
//       Coor2 =  z
   
  //
  // Rootinos are 0
   const Int_t kMpart = 0;
   Float_t orig[3], pmom[3];
   
   // 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 Coordinate 2 bin:%d",fCoor2Bin));
       fCoor1Bin=0;
     } else fCoor1Bin++;

   
   fCurCoor1 = (fCoor1Min+(fCoor1Bin+0.5)*(fCoor1Max-fCoor1Min)/fNCoor1);
   fCurCoor2 = (fCoor2Min+(fCoor2Bin+0.5)*(fCoor2Max-fCoor2Min)/fNCoor2);

// Origin and direction
   Int_t i;
   for (i=0; i<3; i++) {
       pmom[i]=fDir3[i];
       orig[i]=fCurCoor1*fDir1[i]+fCurCoor2*fDir2[i];
   }
   
   Float_t dalicz = 3000;
   if (fRadMin > 0) {
       Float_t 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);
   
}




 AliLegoGeneratorXYZ.cxx:1
 AliLegoGeneratorXYZ.cxx:2
 AliLegoGeneratorXYZ.cxx:3
 AliLegoGeneratorXYZ.cxx:4
 AliLegoGeneratorXYZ.cxx:5
 AliLegoGeneratorXYZ.cxx:6
 AliLegoGeneratorXYZ.cxx:7
 AliLegoGeneratorXYZ.cxx:8
 AliLegoGeneratorXYZ.cxx:9
 AliLegoGeneratorXYZ.cxx:10
 AliLegoGeneratorXYZ.cxx:11
 AliLegoGeneratorXYZ.cxx:12
 AliLegoGeneratorXYZ.cxx:13
 AliLegoGeneratorXYZ.cxx:14
 AliLegoGeneratorXYZ.cxx:15
 AliLegoGeneratorXYZ.cxx:16
 AliLegoGeneratorXYZ.cxx:17
 AliLegoGeneratorXYZ.cxx:18
 AliLegoGeneratorXYZ.cxx:19
 AliLegoGeneratorXYZ.cxx:20
 AliLegoGeneratorXYZ.cxx:21
 AliLegoGeneratorXYZ.cxx:22
 AliLegoGeneratorXYZ.cxx:23
 AliLegoGeneratorXYZ.cxx:24
 AliLegoGeneratorXYZ.cxx:25
 AliLegoGeneratorXYZ.cxx:26
 AliLegoGeneratorXYZ.cxx:27
 AliLegoGeneratorXYZ.cxx:28
 AliLegoGeneratorXYZ.cxx:29
 AliLegoGeneratorXYZ.cxx:30
 AliLegoGeneratorXYZ.cxx:31
 AliLegoGeneratorXYZ.cxx:32
 AliLegoGeneratorXYZ.cxx:33
 AliLegoGeneratorXYZ.cxx:34
 AliLegoGeneratorXYZ.cxx:35
 AliLegoGeneratorXYZ.cxx:36
 AliLegoGeneratorXYZ.cxx:37
 AliLegoGeneratorXYZ.cxx:38
 AliLegoGeneratorXYZ.cxx:39
 AliLegoGeneratorXYZ.cxx:40
 AliLegoGeneratorXYZ.cxx:41
 AliLegoGeneratorXYZ.cxx:42
 AliLegoGeneratorXYZ.cxx:43
 AliLegoGeneratorXYZ.cxx:44
 AliLegoGeneratorXYZ.cxx:45
 AliLegoGeneratorXYZ.cxx:46
 AliLegoGeneratorXYZ.cxx:47
 AliLegoGeneratorXYZ.cxx:48
 AliLegoGeneratorXYZ.cxx:49
 AliLegoGeneratorXYZ.cxx:50
 AliLegoGeneratorXYZ.cxx:51
 AliLegoGeneratorXYZ.cxx:52
 AliLegoGeneratorXYZ.cxx:53
 AliLegoGeneratorXYZ.cxx:54
 AliLegoGeneratorXYZ.cxx:55
 AliLegoGeneratorXYZ.cxx:56
 AliLegoGeneratorXYZ.cxx:57
 AliLegoGeneratorXYZ.cxx:58
 AliLegoGeneratorXYZ.cxx:59
 AliLegoGeneratorXYZ.cxx:60
 AliLegoGeneratorXYZ.cxx:61
 AliLegoGeneratorXYZ.cxx:62
 AliLegoGeneratorXYZ.cxx:63
 AliLegoGeneratorXYZ.cxx:64
 AliLegoGeneratorXYZ.cxx:65
 AliLegoGeneratorXYZ.cxx:66
 AliLegoGeneratorXYZ.cxx:67
 AliLegoGeneratorXYZ.cxx:68
 AliLegoGeneratorXYZ.cxx:69
 AliLegoGeneratorXYZ.cxx:70
 AliLegoGeneratorXYZ.cxx:71
 AliLegoGeneratorXYZ.cxx:72
 AliLegoGeneratorXYZ.cxx:73
 AliLegoGeneratorXYZ.cxx:74
 AliLegoGeneratorXYZ.cxx:75
 AliLegoGeneratorXYZ.cxx:76
 AliLegoGeneratorXYZ.cxx:77
 AliLegoGeneratorXYZ.cxx:78
 AliLegoGeneratorXYZ.cxx:79
 AliLegoGeneratorXYZ.cxx:80
 AliLegoGeneratorXYZ.cxx:81
 AliLegoGeneratorXYZ.cxx:82
 AliLegoGeneratorXYZ.cxx:83
 AliLegoGeneratorXYZ.cxx:84
 AliLegoGeneratorXYZ.cxx:85
 AliLegoGeneratorXYZ.cxx:86
 AliLegoGeneratorXYZ.cxx:87
 AliLegoGeneratorXYZ.cxx:88
 AliLegoGeneratorXYZ.cxx:89
 AliLegoGeneratorXYZ.cxx:90
 AliLegoGeneratorXYZ.cxx:91
 AliLegoGeneratorXYZ.cxx:92
 AliLegoGeneratorXYZ.cxx:93
 AliLegoGeneratorXYZ.cxx:94
 AliLegoGeneratorXYZ.cxx:95
 AliLegoGeneratorXYZ.cxx:96
 AliLegoGeneratorXYZ.cxx:97
 AliLegoGeneratorXYZ.cxx:98
 AliLegoGeneratorXYZ.cxx:99
 AliLegoGeneratorXYZ.cxx:100
 AliLegoGeneratorXYZ.cxx:101
 AliLegoGeneratorXYZ.cxx:102
 AliLegoGeneratorXYZ.cxx:103
 AliLegoGeneratorXYZ.cxx:104
 AliLegoGeneratorXYZ.cxx:105
 AliLegoGeneratorXYZ.cxx:106
 AliLegoGeneratorXYZ.cxx:107
 AliLegoGeneratorXYZ.cxx:108
 AliLegoGeneratorXYZ.cxx:109
 AliLegoGeneratorXYZ.cxx:110
 AliLegoGeneratorXYZ.cxx:111
 AliLegoGeneratorXYZ.cxx:112
 AliLegoGeneratorXYZ.cxx:113
 AliLegoGeneratorXYZ.cxx:114
 AliLegoGeneratorXYZ.cxx:115
 AliLegoGeneratorXYZ.cxx:116
 AliLegoGeneratorXYZ.cxx:117
 AliLegoGeneratorXYZ.cxx:118
 AliLegoGeneratorXYZ.cxx:119
 AliLegoGeneratorXYZ.cxx:120
 AliLegoGeneratorXYZ.cxx:121
 AliLegoGeneratorXYZ.cxx:122
 AliLegoGeneratorXYZ.cxx:123
 AliLegoGeneratorXYZ.cxx:124
 AliLegoGeneratorXYZ.cxx:125
 AliLegoGeneratorXYZ.cxx:126
 AliLegoGeneratorXYZ.cxx:127
 AliLegoGeneratorXYZ.cxx:128
 AliLegoGeneratorXYZ.cxx:129
 AliLegoGeneratorXYZ.cxx:130
 AliLegoGeneratorXYZ.cxx:131
 AliLegoGeneratorXYZ.cxx:132
 AliLegoGeneratorXYZ.cxx:133
 AliLegoGeneratorXYZ.cxx:134
 AliLegoGeneratorXYZ.cxx:135
 AliLegoGeneratorXYZ.cxx:136
 AliLegoGeneratorXYZ.cxx:137
 AliLegoGeneratorXYZ.cxx:138
 AliLegoGeneratorXYZ.cxx:139