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