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