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