Moving the functions used to initialize TF1 and TF2 to the pivate part of the class
[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
88cb7938 16/* $Id$ */
b9d0a01d 17
e8189707 18#include <TRandom.h>
b0f5e3fc 19
b0f5e3fc 20#include "AliITS.h"
517784f0 21#include "AliITShit.h"
22#include "AliITSRecPoint.h"
23#include "AliITSmodule.h"
24#include "AliITSgeom.h"
e8189707 25#include "AliRun.h"
b0f5e3fc 26#include "AliITSsimulationFastPoints.h"
e8189707 27
b0f5e3fc 28
29ClassImp(AliITSsimulationFastPoints)
30
31AliITSsimulationFastPoints::AliITSsimulationFastPoints()
32{
33 //constructor
e8189707 34 fSigmaRPhi[0] = fSigmaRPhi[1] = 12e-4;
35 fSigmaRPhi[2] = fSigmaRPhi[3] = 38e-4;
36 fSigmaRPhi[4] = fSigmaRPhi[5] = 20e-4;
21d3c626 37 fSigmaZ[0] = fSigmaZ[1] = 120e-4; // resolution for 425 micron pixels
e8189707 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;
b0f5e3fc 46}
47
e8189707 48//-------------------------------------------------------------
785086f0 49void AliITSsimulationFastPoints::CreateFastRecPoints(Int_t module){
50 // Fast points simulator
51 AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS");
b0f5e3fc 52
785086f0 53 CreateFastRecPoints((AliITSmodule *)(aliITS->GetModule(module)),
54 module,gRandom);
55}
56//-------------------------------------------------------------
57void 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;
4465d468 119 rp.fTracks[0]=hit->GetTrack();
120 // rp.fTracks[0]=mod->GetHitTrackIndex(ihit);
785086f0 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
b0f5e3fc 134}
e8189707 135//_______________________________________________________________________
136void AliITSsimulationFastPoints::SetSigmaRPhi(Double_t srphi[6])
137{
138 // set sigmas in rphi
b0f5e3fc 139
e8189707 140 Int_t i;
141 for (i=0; i<6; i++) {
142 fSigmaRPhi[i]=srphi[i];
143 }
b0f5e3fc 144}
145//_______________________________________________________________________
e8189707 146void 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 }
b0f5e3fc 154}
155//_______________________________________________________________________
e8189707 156void 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 }
b0f5e3fc 164}
165//_______________________________________________________________________
e8189707 166void 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 }
b0f5e3fc 174}
e8189707 175