]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSsimulationFastPoints.cxx
Added new plots
[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 /* $Id$ */
17
18 #include <TRandom.h>
19
20 #include "AliITS.h"
21 #include "AliITShit.h"
22 #include "AliITSRecPoint.h"
23 #include "AliITSmodule.h"
24 #include "AliITSgeom.h"
25 #include "AliRun.h"
26 #include "AliITSsimulationFastPoints.h"
27
28
29 ClassImp(AliITSsimulationFastPoints)
30
31 AliITSsimulationFastPoints::AliITSsimulationFastPoints()
32 {
33   //constructor
34   fSigmaRPhi[0] = fSigmaRPhi[1] = 12e-4;
35   fSigmaRPhi[2] = fSigmaRPhi[3] = 38e-4;
36   fSigmaRPhi[4] = fSigmaRPhi[5] = 20e-4;
37   fSigmaZ[0] = fSigmaZ[1] = 120e-4;        // resolution for 425 micron pixels
38   fSigmaZ[2] = fSigmaZ[3] = 28e-4;
39   fSigmaZ[4] = fSigmaZ[5] = 830e-4;
40   fSigmaDe[0] = fSigmaDe[1] = 0.72e-6;
41   fSigmaDe[2] = fSigmaDe[3] = 0.90e-6;
42   fSigmaDe[4] = fSigmaDe[5] =  5e-6;
43   fThrDe[0] = fThrDe[1] = 7.2e-6;
44   fThrDe[2] = fThrDe[3] = 2.70e-6;
45   fThrDe[4] = fThrDe[5] = 10e-6;
46 }
47
48 //-------------------------------------------------------------
49 void AliITSsimulationFastPoints::CreateFastRecPoints(Int_t module){
50     // Fast points simulator
51     AliITS *aliITS  = (AliITS*)gAlice->GetModule("ITS");
52
53     CreateFastRecPoints((AliITSmodule *)(aliITS->GetModule(module)),
54                         module,gRandom);
55 }
56 //-------------------------------------------------------------
57 void AliITSsimulationFastPoints::CreateFastRecPoints(AliITSmodule *mod,
58                                                      Int_t module,
59                                                      TRandom *random){
60     // Fast points simulator 
61     AliITS *aliITS  = (AliITS*)gAlice->GetModule("ITS");
62     AliITSgeom *gm = aliITS->GetITSgeom();
63
64     const Float_t kdEdXtoQ = 2.778e+8; 
65
66     Int_t ihit,flag,numofhits;
67     Float_t locals[3];
68     Float_t globals[3];
69     Double_t sigmarphi=0., sigmaz=0., sigmade=0., thrde=0.;
70     Float_t deltaXl,deltaZl,deltaDe;
71
72     Int_t hitlay, hitlad, hitdet, hitstatus;
73     Float_t hitpx, hitpy, hitpz, hitdestep;
74
75     Int_t   hitstatus1, hittrack1;
76     Float_t hitx1, hity1, hitz1;
77     Float_t hitdestep1;
78     Float_t xMg,yMg,zMg;
79
80     numofhits = mod->GetNhits();
81     //printf("numofhits %d \n",numofhits);
82     for(ihit=0;ihit<numofhits;ihit++){
83         AliITShit *hit=mod->GetHit(ihit);
84         hit->GetPositionG(hitx1,hity1,hitz1);
85         hitstatus1 = hit->GetTrackStatus();
86         hitdestep1 = hit->GetIonization();
87         hittrack1 = hit->GetTrack();
88
89         mod->MedianHit(module,hitx1,hity1,hitz1,hitstatus1,xMg,yMg,zMg,flag);
90         if (flag!=1) {
91             hitdestep = hit->GetIonization();
92
93             if (hitdestep > 0) {
94                 hit->GetDetectorID(hitlay,hitlad,hitdet);
95                 hit->GetMomentumG(hitpx,hitpy,hitpz);            
96                 hitstatus = hitstatus1;
97                 // Transform to the module local frame
98                 globals[0] = xMg; 
99                 globals[1] = yMg;
100                 globals[2] = zMg;
101                 gm->GtoL(hitlay,hitlad,hitdet,globals,locals);
102                 // Retrieve sigma values for position and energy, and energy
103                 // threshold
104                 sigmarphi = SigmaRPhi(hitlay);
105                 sigmaz = SigmaZ(hitlay);
106                 sigmade = SigmaDe(hitlay);
107                 thrde = ThrDe(hitlay);
108                 deltaXl = random->Gaus(0,sigmarphi);
109                 deltaZl = random->Gaus(0,sigmaz);
110                 deltaDe = random->Gaus(0,sigmade);
111
112                 // Apply energy threshold and trasform back to global reference
113                 // system
114
115                 if ( (hitdestep+deltaDe) > thrde ){
116                     locals[0] += deltaXl;
117                     locals[2] += deltaZl;
118                     AliITSRecPoint rp;
119                     rp.fTracks[0]=hit->GetTrack();
120                     //              rp.fTracks[0]=mod->GetHitTrackIndex(ihit);
121                     rp.fTracks[1]=-3;
122                     rp.fTracks[2]=-3;
123                     rp.SetX(locals[0]);
124                     rp.SetZ(locals[2]);
125                     rp.SetdEdX(hitdestep+deltaDe);
126                     rp.SetQ(kdEdXtoQ*(hitdestep+deltaDe));  // number of e
127                     rp.SetSigmaX2(sigmarphi*sigmarphi);
128                     rp.SetSigmaZ2(sigmaz*sigmaz);
129                     aliITS->AddRecPoint(rp);
130                 } // end if ( (hitdestep+deltaDe)
131             } // end if (hitdestep > 0)
132         } // end if (flag!=1)
133     } // end for ihit
134 }
135 //_______________________________________________________________________
136 void AliITSsimulationFastPoints::SetSigmaRPhi(Double_t  srphi[6])
137 {
138   // set sigmas in rphi
139
140     Int_t i;
141     for (i=0; i<6; i++) {
142         fSigmaRPhi[i]=srphi[i];
143     }
144 }
145 //_______________________________________________________________________
146 void AliITSsimulationFastPoints::SetSigmaZ(Double_t  sz[6])
147 {
148   // set sigmas in z
149
150     Int_t i;
151     for (i=0; i<6; i++) {
152         fSigmaZ[i]=sz[i];
153     }
154 }
155 //_______________________________________________________________________
156 void AliITSsimulationFastPoints::SetSigmaDe(Double_t  sde[6])
157 {
158   // set sigmas in energy
159
160     Int_t i;
161     for (i=0; i<6; i++) {
162         fSigmaDe[i]=sde[i];
163     }
164 }
165 //_______________________________________________________________________
166 void AliITSsimulationFastPoints::SetThrDe(Double_t  thrde[6])
167 {
168   // set energy thersholds
169
170     Int_t i;
171     for (i=0; i<6; i++) {
172         fThrDe[i]=thrde[i];
173     }
174 }
175