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