]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliLegoGeneratorXYZ.cxx
Debug staff moved to AliRICH
[u/mrichter/AliRoot.git] / STEER / AliLegoGeneratorXYZ.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /*
17 $Log$
18 Revision 1.2  2000/11/30 07:12:49  alibrary
19 Introducing new Rndm and QA classes
20
21 Revision 1.1  2000/10/26 14:18:05  morsch
22 Add new AliLegoGenerator classes:
23 AliLegoGeneratorXYZ: carthesian binning
24 AliLegoGeneratorEta: eta-phi binning
25
26 */
27
28 #include "AliLegoGeneratorXYZ.h"
29 #include "AliRun.h"
30
31 ClassImp(AliLegoGeneratorXYZ)
32
33
34 //___________________________________________
35     
36
37 AliLegoGeneratorXYZ::AliLegoGeneratorXYZ()
38 {
39 // Default Constructor
40     fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.;
41     fDir2[0]=0.; fDir2[1]=1.; fDir2[2]=0.;    
42     fDir3[0]=0.; fDir3[1]=0.; fDir3[2]=1.;    
43 }
44
45 AliLegoGeneratorXYZ::AliLegoGeneratorXYZ(char* axis)
46 {
47 // Constructor
48     if (!strcmp(axis,"x") || !strcmp(axis,"X")) 
49     {
50         fDir1[0]=0.; fDir1[1]=1.; fDir1[2]=0.;
51         fDir2[0]=0.; fDir2[1]=0.; fDir2[2]=1.;    
52         fDir3[0]=1.; fDir3[1]=0.; fDir3[2]=0.;    
53     }
54     else if (!strcmp(axis,"y") || !strcmp(axis,"Y")) 
55     {
56         fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.;
57         fDir2[0]=0.; fDir2[1]=0.; fDir2[2]=1;    
58         fDir3[0]=0.; fDir3[1]=1.; fDir3[2]=0.;    
59     }
60     else if (!strcmp(axis,"z") || !strcmp(axis,"Z")) 
61     {
62         fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.;
63         fDir2[0]=0.; fDir2[1]=1.; fDir2[2]=0.;    
64         fDir3[0]=0.; fDir3[1]=0.; fDir3[2]=1.;    
65     }
66     else 
67     {
68         fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.;
69         fDir2[0]=0.; fDir2[1]=1.; fDir2[2]=0.;    
70         fDir3[0]=0.; fDir3[1]=0.; fDir3[2]=1.;    
71     }
72 }
73
74
75 AliLegoGeneratorXYZ::AliLegoGeneratorXYZ(Int_t nc1, Float_t c1min,
76                                          Float_t c1max, Int_t nc2, 
77                                          Float_t c2min, Float_t c2max,
78                                          Float_t rmin, Float_t rmax, Float_t zmax) : 
79     AliLegoGenerator(nc1, c1min, c1max, nc2, c2min, c2max,
80                      rmin, rmax, zmax)
81 {
82 //  Constructor
83     fDir1[0]=1.; fDir1[1]=0.; fDir1[2]=0.;
84     fDir2[0]=0.; fDir2[1]=1.; fDir2[2]=0.;    
85     fDir3[0]=0.; fDir3[1]=0.; fDir3[2]=1.;    
86 }
87
88
89 //___________________________________________
90 void AliLegoGeneratorXYZ::Generate()
91 {
92 // Create a geantino with kinematics corresponding to the current bins
93 // Here: Coor1 =  x 
94 //       Coor2 =  z
95    
96   //
97   // Rootinos are 0
98    const Int_t kMpart = 0;
99    Float_t orig[3], pmom[3];
100    
101    // Prepare for next step
102    if(fCoor1Bin>=fNCoor1-1)
103      if(fCoor2Bin>=fNCoor2-1) {
104        Warning("Generate","End of Lego Generation");
105        return;
106      } else { 
107        fCoor2Bin++;
108        printf("Generating rays in Coordinate 2 bin:%d\n",fCoor2Bin);
109        fCoor1Bin=0;
110      } else fCoor1Bin++;
111
112    
113    fCurCoor1 = (fCoor1Min+(fCoor1Bin+0.5)*(fCoor1Max-fCoor1Min)/fNCoor1);
114    fCurCoor2 = (fCoor2Min+(fCoor2Bin+0.5)*(fCoor2Max-fCoor2Min)/fNCoor2);
115
116 // Origin and direction
117    Int_t i;
118    for (i=0; i<3; i++) {
119        pmom[i]=fDir3[i];
120        orig[i]=fCurCoor1*fDir1[i]+fCurCoor2*fDir2[i];
121    }
122    
123    Float_t dalicz = 3000;
124    if (fRadMin > 0) {
125        Float_t t = PropagateCylinder(orig,pmom,fRadMin,dalicz);
126        orig[0] = pmom[0]*t;
127        orig[1] = pmom[1]*t;
128        orig[2] = pmom[2]*t;
129        if (TMath::Abs(orig[2]) > fZMax) return;
130    }
131    
132    Float_t polar[3]={0.,0.,0.};
133    Int_t ntr;
134    gAlice->SetTrack(1, -1, kMpart, pmom, orig, polar, 0, kPPrimary, ntr);
135    
136 }
137
138
139
140