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