]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSsimulationFastPoints.cxx
Cleaned up version
[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$
4465d468 18Revision 1.10 2002/06/10 17:30:24 nilsen
19A new CreateFastRecPoints has been made and the old one made compatible.
20
785086f0 21Revision 1.9 2001/10/01 19:36:03 nilsen
22fixed a compilation warning about unused variable.
23
84f9ba63 24Revision 1.8 2001/07/27 08:06:49 hristov
25Use global gRandom generator (M.Ivanov)
26
4c57765b 27Revision 1.7 2001/05/11 09:15:21 barbera
28Corrected to make fast point creation working with PPR geometry
29
34980f24 30Revision 1.6 2000/10/29 18:30:14 barbera
31Z resolution of pixel changed according with the default lenght of 425 microns
32
21d3c626 33Revision 1.1.2.6 2000/10/29 18:29:51 barbera
34Z resolution of pixel changed according with the default lenght of 425 microns
35
1ca7869b 36Revision 1.1.2.5 2000/10/02 16:03:20 barbera
37Forward declarations added
38
39Revision 1.4 2000/09/22 12:43:59 nilsen
40Default track number set to -3 and not 0.
41
b0f5e3fc 42*/
e8189707 43#include <TRandom.h>
b0f5e3fc 44
b0f5e3fc 45#include "AliITS.h"
517784f0 46#include "AliITShit.h"
47#include "AliITSRecPoint.h"
48#include "AliITSmodule.h"
49#include "AliITSgeom.h"
e8189707 50#include "AliRun.h"
b0f5e3fc 51#include "AliITSsimulationFastPoints.h"
e8189707 52
b0f5e3fc 53
54ClassImp(AliITSsimulationFastPoints)
55
56AliITSsimulationFastPoints::AliITSsimulationFastPoints()
57{
58 //constructor
e8189707 59 fSigmaRPhi[0] = fSigmaRPhi[1] = 12e-4;
60 fSigmaRPhi[2] = fSigmaRPhi[3] = 38e-4;
61 fSigmaRPhi[4] = fSigmaRPhi[5] = 20e-4;
21d3c626 62 fSigmaZ[0] = fSigmaZ[1] = 120e-4; // resolution for 425 micron pixels
e8189707 63 fSigmaZ[2] = fSigmaZ[3] = 28e-4;
64 fSigmaZ[4] = fSigmaZ[5] = 830e-4;
65 fSigmaDe[0] = fSigmaDe[1] = 0.72e-6;
66 fSigmaDe[2] = fSigmaDe[3] = 0.90e-6;
67 fSigmaDe[4] = fSigmaDe[5] = 5e-6;
68 fThrDe[0] = fThrDe[1] = 7.2e-6;
69 fThrDe[2] = fThrDe[3] = 2.70e-6;
70 fThrDe[4] = fThrDe[5] = 10e-6;
b0f5e3fc 71}
72
e8189707 73//-------------------------------------------------------------
785086f0 74void AliITSsimulationFastPoints::CreateFastRecPoints(Int_t module){
75 // Fast points simulator
76 AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS");
b0f5e3fc 77
785086f0 78 CreateFastRecPoints((AliITSmodule *)(aliITS->GetModule(module)),
79 module,gRandom);
80}
81//-------------------------------------------------------------
82void AliITSsimulationFastPoints::CreateFastRecPoints(AliITSmodule *mod,
83 Int_t module,
84 TRandom *random){
85 // Fast points simulator
86 AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS");
87 AliITSgeom *gm = aliITS->GetITSgeom();
88
89 const Float_t kdEdXtoQ = 2.778e+8;
90
91 Int_t ihit,flag,numofhits;
92 Float_t locals[3];
93 Float_t globals[3];
94 Double_t sigmarphi=0., sigmaz=0., sigmade=0., thrde=0.;
95 Float_t deltaXl,deltaZl,deltaDe;
96
97 Int_t hitlay, hitlad, hitdet, hitstatus;
98 Float_t hitpx, hitpy, hitpz, hitdestep;
99
100 Int_t hitstatus1, hittrack1;
101 Float_t hitx1, hity1, hitz1;
102 Float_t hitdestep1;
103 Float_t xMg,yMg,zMg;
104
105 numofhits = mod->GetNhits();
106 //printf("numofhits %d \n",numofhits);
107 for(ihit=0;ihit<numofhits;ihit++){
108 AliITShit *hit=mod->GetHit(ihit);
109 hit->GetPositionG(hitx1,hity1,hitz1);
110 hitstatus1 = hit->GetTrackStatus();
111 hitdestep1 = hit->GetIonization();
112 hittrack1 = hit->GetTrack();
113
114 mod->MedianHit(module,hitx1,hity1,hitz1,hitstatus1,xMg,yMg,zMg,flag);
115 if (flag!=1) {
116 hitdestep = hit->GetIonization();
117
118 if (hitdestep > 0) {
119 hit->GetDetectorID(hitlay,hitlad,hitdet);
120 hit->GetMomentumG(hitpx,hitpy,hitpz);
121 hitstatus = hitstatus1;
122 // Transform to the module local frame
123 globals[0] = xMg;
124 globals[1] = yMg;
125 globals[2] = zMg;
126 gm->GtoL(hitlay,hitlad,hitdet,globals,locals);
127 // Retrieve sigma values for position and energy, and energy
128 // threshold
129 sigmarphi = SigmaRPhi(hitlay);
130 sigmaz = SigmaZ(hitlay);
131 sigmade = SigmaDe(hitlay);
132 thrde = ThrDe(hitlay);
133 deltaXl = random->Gaus(0,sigmarphi);
134 deltaZl = random->Gaus(0,sigmaz);
135 deltaDe = random->Gaus(0,sigmade);
136
137 // Apply energy threshold and trasform back to global reference
138 // system
139
140 if ( (hitdestep+deltaDe) > thrde ){
141 locals[0] += deltaXl;
142 locals[2] += deltaZl;
143 AliITSRecPoint rp;
4465d468 144 rp.fTracks[0]=hit->GetTrack();
145 // rp.fTracks[0]=mod->GetHitTrackIndex(ihit);
785086f0 146 rp.fTracks[1]=-3;
147 rp.fTracks[2]=-3;
148 rp.SetX(locals[0]);
149 rp.SetZ(locals[2]);
150 rp.SetdEdX(hitdestep+deltaDe);
151 rp.SetQ(kdEdXtoQ*(hitdestep+deltaDe)); // number of e
152 rp.SetSigmaX2(sigmarphi*sigmarphi);
153 rp.SetSigmaZ2(sigmaz*sigmaz);
154 aliITS->AddRecPoint(rp);
155 } // end if ( (hitdestep+deltaDe)
156 } // end if (hitdestep > 0)
157 } // end if (flag!=1)
158 } // end for ihit
b0f5e3fc 159}
e8189707 160//_______________________________________________________________________
161void AliITSsimulationFastPoints::SetSigmaRPhi(Double_t srphi[6])
162{
163 // set sigmas in rphi
b0f5e3fc 164
e8189707 165 Int_t i;
166 for (i=0; i<6; i++) {
167 fSigmaRPhi[i]=srphi[i];
168 }
b0f5e3fc 169}
170//_______________________________________________________________________
e8189707 171void AliITSsimulationFastPoints::SetSigmaZ(Double_t sz[6])
172{
173 // set sigmas in z
174
175 Int_t i;
176 for (i=0; i<6; i++) {
177 fSigmaZ[i]=sz[i];
178 }
b0f5e3fc 179}
180//_______________________________________________________________________
e8189707 181void AliITSsimulationFastPoints::SetSigmaDe(Double_t sde[6])
182{
183 // set sigmas in energy
184
185 Int_t i;
186 for (i=0; i<6; i++) {
187 fSigmaDe[i]=sde[i];
188 }
b0f5e3fc 189}
190//_______________________________________________________________________
e8189707 191void AliITSsimulationFastPoints::SetThrDe(Double_t thrde[6])
192{
193 // set energy thersholds
194
195 Int_t i;
196 for (i=0; i<6; i++) {
197 fThrDe[i]=thrde[i];
198 }
b0f5e3fc 199}
e8189707 200