]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSsimulationFastPoints.cxx
Remove Process_t
[u/mrichter/AliRoot.git] / ITS / AliITSsimulationFastPoints.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.1.2.6  2000/10/29 18:29:51  barbera
19 Z resolution of pixel changed according with the default lenght of 425 microns
20
21 Revision 1.1.2.5  2000/10/02 16:03:20  barbera
22 Forward declarations added
23
24 Revision 1.4  2000/09/22 12:43:59  nilsen
25 Default track number set to -3 and not 0.
26
27 */
28 #include <TRandom.h>
29
30 #include "AliITS.h"
31 #include "AliITShit.h"
32 #include "AliITSRecPoint.h"
33 #include "AliITSmodule.h"
34 #include "AliITSgeom.h"
35 #include "AliRun.h"
36 #include "AliITSsimulationFastPoints.h"
37
38
39 ClassImp(AliITSsimulationFastPoints)
40
41 AliITSsimulationFastPoints::AliITSsimulationFastPoints()
42 {
43   //constructor
44   fSigmaRPhi[0] = fSigmaRPhi[1] = 12e-4;
45   fSigmaRPhi[2] = fSigmaRPhi[3] = 38e-4;
46   fSigmaRPhi[4] = fSigmaRPhi[5] = 20e-4;
47   fSigmaZ[0] = fSigmaZ[1] = 120e-4;        // resolution for 425 micron pixels
48   fSigmaZ[2] = fSigmaZ[3] = 28e-4;
49   fSigmaZ[4] = fSigmaZ[5] = 830e-4;
50   fSigmaDe[0] = fSigmaDe[1] = 0.72e-6;
51   fSigmaDe[2] = fSigmaDe[3] = 0.90e-6;
52   fSigmaDe[4] = fSigmaDe[5] =  5e-6;
53   fThrDe[0] = fThrDe[1] = 7.2e-6;
54   fThrDe[2] = fThrDe[3] = 2.70e-6;
55   fThrDe[4] = fThrDe[5] = 10e-6;
56 }
57
58 //-------------------------------------------------------------
59 void AliITSsimulationFastPoints::CreateFastRecPoints(AliITSmodule *mod, Int_t module, TRandom *random){
60   // Fast points simulator 
61
62    AliITS *aliITS  = (AliITS*)gAlice->GetModule("ITS");
63    AliITSgeom *gm = aliITS->GetITSgeom();
64
65    const Float_t kdEdXtoQ = 2.778e+8; 
66
67    Int_t ihit,flag,numofhits;
68    Float_t xg,yg,zg,xl,yl,zl;
69    Float_t px,py,pz;
70    //Double_t p, theta, pt, ps;
71    Float_t locals[3];
72    Float_t globals[3];
73    //Float_t xg1,yg1,zg1;
74    Double_t sigmarphi=0., sigmaz=0., sigmade=0., thrde=0.;
75    Float_t deltaXl,deltaZl,deltaDe;
76
77    Int_t hitlay, hitlad, hitdet, hitstatus, hittrack;
78    Float_t hitx, hity, hitz, hitpx, hitpy, hitpz, hitdestep;
79    
80
81    Int_t   hitstatus1, hittrack1;
82    Float_t hitx1, hity1, hitz1;
83    Float_t hitdestep1;
84
85    Float_t xMg,yMg,zMg;
86    //Float_t dx,dy,dz,ds;
87
88
89    numofhits = mod->GetNhits();
90    printf("numofhits %d \n",numofhits);
91    flag = 1;
92    for(ihit=0;ihit<numofhits;ihit++){
93      AliITShit *hit=mod->GetHit(ihit);
94      hit->GetPositionG(hitx1,hity1,hitz1);
95      hitstatus1 = hit->GetTrackStatus();
96      hitdestep1 = hit->GetIonization();
97
98      hittrack1 = hit->GetTrack();
99
100      mod->MedianHit(module,hitx1,hity1,hitz1,hitstatus1,xMg,yMg,zMg,flag);
101      if (flag!=1) {
102        hitx      = xMg;
103        hity      = yMg;
104        hitz      = zMg;
105        hit->GetDetectorID(hitlay,hitlad,hitdet);
106        hit->GetMomentumG(hitpx,hitpy,hitpz);            
107        hitdestep = hit->GetIonization();
108        hitstatus = hitstatus1;
109        hittrack  = hit->GetTrack();
110
111        if (hitdestep > 0) {
112            xg = hitx;
113            yg = hity;
114            zg = hitz;
115            // Transform to the module local frame
116            globals[0] = hitx;
117            globals[1] = hity;
118            globals[2] = hitz;
119            gm->GtoL(hitlay,hitlad,hitdet,globals,locals);
120            xl = locals[0];
121            yl = locals[1];
122            zl = locals[2];
123            px = hitpx;
124            py = hitpy;
125            pz = hitpz;
126            /*
127            // Calculate transverse momentum and pseudorapidity
128            // to allow pt and eta dependence in sigma values
129            // of the spatial resolution
130            p  = TMath::Sqrt((px*px)+(py*py)+(pz*pz));
131            theta = TMath::ACos(pz/p);
132            pt = p * TMath::Sin(theta);
133            ps = -TMath::Log(TMath::Tan(theta/2));
134            */
135
136            // Retrieve sigma values for position and energy, and energy
137            // threshold 
138            
139            sigmarphi = SigmaRPhi(hitlay);
140            sigmaz = SigmaZ(hitlay);
141            sigmade = SigmaDe(hitlay);
142            thrde = ThrDe(hitlay);
143            // Randomize position and deposited energy
144            Int_t k=3*(Int_t)((hitlay-1)/2);
145
146            deltaXl = (float)(random[k].Gaus(0,sigmarphi));
147            deltaZl = (float)(random[k+1].Gaus(0,sigmaz));
148            deltaDe = (float)(random[k+2].Gaus(0,sigmade));
149            // Apply energy threshold and trasform back to global reference 
150            // system
151
152            if ( (hitdestep+deltaDe) > thrde ){
153                locals[0] = xl + deltaXl;
154                locals[1] = yl;
155                locals[2] = zl + deltaZl;
156                AliITSRecPoint rp;
157                rp.fTracks[0]=hittrack;
158                rp.fTracks[1]=-3;
159                rp.fTracks[2]=-3;
160                rp.SetX(locals[0]);
161                rp.SetZ(locals[2]);
162                rp.SetdEdX(hitdestep+deltaDe);
163                rp.SetQ(kdEdXtoQ*(hitdestep+deltaDe));  // number of e
164                rp.SetSigmaX2(sigmarphi*sigmarphi);
165                rp.SetSigmaZ2(sigmaz*sigmaz);
166                aliITS->AddRecPoint(rp);
167                /*
168                gm->LtoG(hitlay,hitlad,hitdet,locals,globals);
169                xg1 = globals[0];
170                yg1 = globals[1];
171                zg1 = globals[2];
172                dx = TMath::Abs(xg1-hitx);
173                dy = TMath::Abs(yg1-hity);
174                dz = TMath::Abs(zg1-hitz);
175                ds = TMath::Abs(deltaDe);
176                */
177            } // if ( (hitdestep+deltaDe)
178            else flag=1;
179        } // if (hitdestep > 0)
180        else flag=1;
181      } // if (flag!=1)
182    }   
183
184 }
185 //_______________________________________________________________________
186 void AliITSsimulationFastPoints::SetSigmaRPhi(Double_t  srphi[6])
187 {
188   // set sigmas in rphi
189
190     Int_t i;
191     for (i=0; i<6; i++) {
192         fSigmaRPhi[i]=srphi[i];
193     }
194 }
195 //_______________________________________________________________________
196 void AliITSsimulationFastPoints::SetSigmaZ(Double_t  sz[6])
197 {
198   // set sigmas in z
199
200     Int_t i;
201     for (i=0; i<6; i++) {
202         fSigmaZ[i]=sz[i];
203     }
204 }
205 //_______________________________________________________________________
206 void AliITSsimulationFastPoints::SetSigmaDe(Double_t  sde[6])
207 {
208   // set sigmas in energy
209
210     Int_t i;
211     for (i=0; i<6; i++) {
212         fSigmaDe[i]=sde[i];
213     }
214 }
215 //_______________________________________________________________________
216 void AliITSsimulationFastPoints::SetThrDe(Double_t  thrde[6])
217 {
218   // set energy thersholds
219
220     Int_t i;
221     for (i=0; i<6; i++) {
222         fThrDe[i]=thrde[i];
223     }
224 }
225