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