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