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