]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSsimulationFastPointsV0.cxx
Release version of ITS code
[u/mrichter/AliRoot.git] / ITS / AliITSsimulationFastPointsV0.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 */
19
20 #include <TParticle.h>
21 #include <TRandom.h>
22
23
24 #include "AliITS.h"
25 #include "AliITSsimulationFastPointsV0.h"
26 #include "AliITSstatistics.h"
27
28 ClassImp(AliITSsimulationFastPointsV0)
29
30 AliITSsimulationFastPointsV0::AliITSsimulationFastPointsV0()
31 {
32   //constructor
33   fSx = new AliITSstatistics(2);
34   fSz = new AliITSstatistics(2);
35 }
36
37 //----------------------------------------------------------
38 AliITSsimulationFastPointsV0::~AliITSsimulationFastPointsV0()
39 {
40   //destructor
41   delete fSx;
42   delete fSz;
43
44 }
45
46 //-------------------------------------------------------------
47 void AliITSsimulationFastPointsV0::CreateFastRecPoints(AliITSmodule *mod,Int_t module,TRandom *rndm){
48   // Fast points simulator for all of the ITS.
49   Int_t   nhit,h,trk,ifirst;
50   Float_t x,y,z,t,e;// local coordinate (cm) and time of flight, and dedx.
51   Float_t x1,y1,z1;
52   AliITShit *hit;
53
54   fSx->Reset(); // Start out with things clearly zeroed
55   fSz->Reset(); // Start out with things clearly zeroed
56   e = 0.; // Start out with things clearly zeroed
57   Double_t weight=1.;
58   nhit = mod->GetNhits();
59   ifirst = 1;
60   for(h=0;h<nhit;h++){
61     hit = mod->GetHit(h);
62     hit->GetPositionL(x,y,z,t);
63     if(ifirst) {x1=x;y1=y;z1=z;}
64     e += hit->GetIonization();
65     trk = hit->GetTrack();
66     fSx->AddValue((Double_t)x,weight);
67     fSz->AddValue((Double_t)z,weight);
68     ifirst = 0;
69     if(hit->StatusExiting()||  // leaving volume
70        hit->StatusDisappeared()|| // interacted/decayed...
71        hit->StatusStop() // dropped below E cuts.
72        ){ // exiting track, write out RecPoint.
73       //      if(fSz->GetRMS()>1.E-1) {
74       //        TParticle *part = hit->GetParticle();
75       //        printf("idpart %d energy %f \n",part->GetPdgCode(),part->Energy());
76       //        printf("diffx=%e diffy=%e diffz=%e\n",x-x1,y-y1,z-z1);
77       //      }
78       switch (mod->GetLayer()){
79       case 1: case 2:  // SPDs
80         AddSPD(e,mod,trk);
81         break;
82       case 3: case 4:  // SDDs
83         AddSDD(e,mod,trk);
84         break;
85       case 5: case 6:  // SSDs
86         AddSSD(e,mod,trk);
87         break;
88       } // end switch
89       fSx->Reset();
90       fSz->Reset();
91       e = 0.;
92       ifirst = 1;
93       continue;
94     }// end if
95   } // end for h
96 }
97 //_______________________________________________________________________
98 void AliITSsimulationFastPointsV0::AddSPD(Float_t &e,
99                                          AliITSmodule *mod,Int_t trackNumber){
100   const Float_t kmicronTocm = 1.0e-4;
101   //  const Float_t kdEdXtoQ = ;
102   const Float_t kRMSx = 12.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
103   const Float_t kRMSz = 70.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
104   Float_t a1,a2; // general float.
105   AliITSRecPoint rpSPD;
106
107   rpSPD.fTracks[0]=trackNumber;
108   rpSPD.fTracks[1]=0;
109   rpSPD.fTracks[2]=0;
110   rpSPD.SetX(fSx->GetMean());
111   rpSPD.SetZ(fSz->GetMean());
112   rpSPD.SetdEdX(0.0);
113   rpSPD.SetQ(1.0);
114   a1 = fSx->GetRMS(); a1 *= a1; a1 += kRMSx*kRMSx;
115   //  if(a1>1.E5) printf("addSPD: layer=%d track #%d dedx=%e sigmaX2= %e ",
116   //                mod->GetLayer(),trackNumber,e,a1);
117   rpSPD.SetSigmaX2(a1);
118   a2 = fSz->GetRMS(); a2 *= a2; a2 += kRMSz*kRMSz;
119   //  if(a1>1.E5) printf(" sigmaZ2= %e\n",a2);
120   rpSPD.SetSigmaZ2(a2);
121   rpSPD.SetProbability(1.0);
122
123   (mod->GetITS())->AddRecPoint(rpSPD);
124 }
125 //_______________________________________________________________________
126 void AliITSsimulationFastPointsV0::AddSDD(Float_t &e,
127                                          AliITSmodule *mod,Int_t trackNumber){
128
129   const Float_t kmicronTocm = 1.0e-4;
130   const Float_t kdEdXtoQ = 2.778e+8; 
131   const Float_t kRMSx = 38.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
132   const Float_t kRMSz = 28.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
133   Float_t a1,a2; // general float.
134   AliITSRecPoint rpSDD;
135
136   rpSDD.fTracks[0]=trackNumber;
137   rpSDD.fTracks[1]=0;
138   rpSDD.fTracks[2]=0;
139   rpSDD.SetX(fSx->GetMean());
140   rpSDD.SetZ(fSz->GetMean());
141   rpSDD.SetdEdX(e);
142   rpSDD.SetQ(kdEdXtoQ*e);
143   a1 = fSx->GetRMS(); a1 *= a1; a1 += kRMSx*kRMSx;
144   //  if(a1>1.E5) printf("addSDD: layer=%d track #%d dedx=%e sigmaX2= %e ",
145   //                mod->GetLayer(),trackNumber,e,a1);
146   rpSDD.SetSigmaX2(a1);
147   a2 = fSz->GetRMS(); a2 *= a2; a2 += kRMSz*kRMSz;
148   //  if(a1>1.E5) printf(" sigmaZ2= %e\n",a2);
149   rpSDD.SetSigmaZ2(a2);
150   rpSDD.SetProbability(1.0);
151
152   (mod->GetITS())->AddRecPoint(rpSDD);
153 }
154 //_______________________________________________________________________
155 void AliITSsimulationFastPointsV0::AddSSD(Float_t &e,
156                                          AliITSmodule *mod,Int_t trackNumber){
157
158   const Float_t kmicronTocm = 1.0e-4;
159   const Float_t kdEdXtoQ = 2.778e+8;
160   const Float_t kRMSx = 20.0*kmicronTocm;  // microns->cm ITS TDR Table 1.3
161   const Float_t kRMSz = 830.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
162   Float_t a1,a2; // general float.
163   AliITSRecPoint rpSSD;
164
165   rpSSD.fTracks[0]=trackNumber;
166   rpSSD.fTracks[1]=0;
167   rpSSD.fTracks[2]=0;
168   rpSSD.SetX(fSx->GetMean());
169   rpSSD.SetZ(fSz->GetMean());
170   rpSSD.SetdEdX(e);
171   rpSSD.SetQ(kdEdXtoQ*e);
172   a1 = fSx->GetRMS(); a1 *= a1; a1 += kRMSx*kRMSx;
173   //  if(a1>1.E5) printf("addSSD: layer=%d track #%d dedx=%e sigmaX2= %e ",
174   //                mod->GetLayer(),trackNumber,e,a1);
175   rpSSD.SetSigmaX2(a1);
176   a2 = fSz->GetRMS(); a2 *= a2; a2 += kRMSz*kRMSz;
177   //  if(a1>1.E5) printf(" sigmaZ2= %e RMSx=%e RMSz=%e\n",a2,fSx->GetRMS(),fSz->GetRMS());
178   rpSSD.SetSigmaZ2(a2);
179   rpSSD.SetProbability(1.0);
180
181   (mod->GetITS())->AddRecPoint(rpSSD);
182 }
183 //_______________________________________________________________________
184