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