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