]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSsimulationFastPointsV0.cxx
changes to be compliant with Eff C++ rules
[u/mrichter/AliRoot.git] / ITS / AliITSsimulationFastPointsV0.cxx
CommitLineData
e8189707 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. *
7d62fb64 14 ***********************************************************************/
e8189707 15
803d1ab0 16/* $Id$ */
7d62fb64 17/////////////////////////////////////////////////////////
18// fast simulation V0 //
19// //
20// //
21/////////////////////////////////////////////////////////
e8189707 22
e8189707 23#include "AliITS.h"
517784f0 24#include "AliITShit.h"
25#include "AliITSRecPoint.h"
26#include "AliITSmodule.h"
e8189707 27#include "AliITSsimulationFastPointsV0.h"
28#include "AliITSstatistics.h"
29
30ClassImp(AliITSsimulationFastPointsV0)
31
7537d03c 32AliITSsimulationFastPointsV0::AliITSsimulationFastPointsV0():
33fNrecp(0),
34fSx(0),
35fSz(0){
9de0700b 36 // default constructor
9de0700b 37}
7537d03c 38AliITSsimulationFastPointsV0::AliITSsimulationFastPointsV0(const char *dataType):
39fNrecp(0),
40fSx(0),
41fSz(0){
e8189707 42 //constructor
d0df5576 43 Info("AliITSsimulationFastPointsV0","Standard constructor %s",dataType);
e8189707 44 fSx = new AliITSstatistics(2);
45 fSz = new AliITSstatistics(2);
46}
7d62fb64 47//______________________________________________________________________
7537d03c 48AliITSsimulationFastPointsV0::AliITSsimulationFastPointsV0(const AliITSsimulationFastPointsV0 & rec):AliITSsimulation(rec),
49fNrecp(rec.fNrecp),
50fSx(rec.fSx),
51fSz(rec.fSz){
7d62fb64 52 // Copy constructor.
53
7d62fb64 54}
55//______________________________________________________________________
7537d03c 56AliITSsimulationFastPointsV0& AliITSsimulationFastPointsV0::operator=(const AliITSsimulationFastPointsV0& /*source*/){
57 // Assignment operator
58 Error("operator=","Assignment operator not allowed");
59 return *this;
7d62fb64 60}
e8189707 61
62//----------------------------------------------------------
63AliITSsimulationFastPointsV0::~AliITSsimulationFastPointsV0()
64{
65 //destructor
9de0700b 66 if(fSx) delete fSx;
67 if(fSz) delete fSz;
e8189707 68
69}
70
71//-------------------------------------------------------------
7d62fb64 72void AliITSsimulationFastPointsV0::CreateFastRecPoints(AliITSmodule *mod,Int_t module,TRandom *rndm, TClonesArray* recp) {
e8189707 73 // Fast points simulator for all of the ITS.
7d62fb64 74
e8189707 75 Int_t nhit,h,trk,ifirst;
76 Float_t x,y,z,t,e;// local coordinate (cm) and time of flight, and dedx.
77 Float_t x1,y1,z1;
78 AliITShit *hit;
79
ac74f489 80 if(rndm!=0) module=0; // fix unsued parameter warnings.
e8189707 81 fSx->Reset(); // Start out with things clearly zeroed
82 fSz->Reset(); // Start out with things clearly zeroed
83 e = 0.; // Start out with things clearly zeroed
84 Double_t weight=1.;
85 nhit = mod->GetNhits();
86 ifirst = 1;
87 for(h=0;h<nhit;h++){
88 hit = mod->GetHit(h);
89 hit->GetPositionL(x,y,z,t);
90 if(ifirst) {x1=x;y1=y;z1=z;}
91 e += hit->GetIonization();
92 trk = hit->GetTrack();
93 fSx->AddValue((Double_t)x,weight);
94 fSz->AddValue((Double_t)z,weight);
95 ifirst = 0;
96 if(hit->StatusExiting()|| // leaving volume
97 hit->StatusDisappeared()|| // interacted/decayed...
98 hit->StatusStop() // dropped below E cuts.
99 ){ // exiting track, write out RecPoint.
100 // if(fSz->GetRMS()>1.E-1) {
101 // TParticle *part = hit->GetParticle();
102 // printf("idpart %d energy %f \n",part->GetPdgCode(),part->Energy());
103 // printf("diffx=%e diffy=%e diffz=%e\n",x-x1,y-y1,z-z1);
104 // }
105 switch (mod->GetLayer()){
106 case 1: case 2: // SPDs
7d62fb64 107 AddSPD(e,mod,trk,recp);
e8189707 108 break;
109 case 3: case 4: // SDDs
7d62fb64 110 AddSDD(e,mod,trk,recp);
e8189707 111 break;
112 case 5: case 6: // SSDs
7d62fb64 113 AddSSD(e,mod,trk,recp);
e8189707 114 break;
115 } // end switch
116 fSx->Reset();
117 fSz->Reset();
118 e = 0.;
119 ifirst = 1;
120 continue;
121 }// end if
122 } // end for h
123}
124//_______________________________________________________________________
125void AliITSsimulationFastPointsV0::AddSPD(Float_t &e,
00a7cc50 126 AliITSmodule* mod,Int_t trackNumber,TClonesArray* recp){
d2f55a22 127 //
7d62fb64 128 TClonesArray &pt=*recp;
e8189707 129 const Float_t kmicronTocm = 1.0e-4;
130 // const Float_t kdEdXtoQ = ;
131 const Float_t kRMSx = 12.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
132 const Float_t kRMSz = 70.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
133 Float_t a1,a2; // general float.
00a7cc50 134
135 AliITSgeom* gm = mod->GetITS()->GetITSgeom();
136
137 AliITSRecPoint rpSPD(gm);
e8189707 138
00a7cc50 139 rpSPD.SetLabel(trackNumber,0);
140 rpSPD.SetLabel(-3,1);
141 rpSPD.SetLabel(-3,2);
142 rpSPD.SetXZ(mod->GetIndex(),fSx->GetMean(),fSz->GetMean());
ac74f489 143 rpSPD.SetdEdX(e);
e8189707 144 rpSPD.SetQ(1.0);
145 a1 = fSx->GetRMS(); a1 *= a1; a1 += kRMSx*kRMSx;
146 // if(a1>1.E5) printf("addSPD: layer=%d track #%d dedx=%e sigmaX2= %e ",
147 // mod->GetLayer(),trackNumber,e,a1);
00a7cc50 148 rpSPD.SetSigmaDetLocX2(a1);
e8189707 149 a2 = fSz->GetRMS(); a2 *= a2; a2 += kRMSz*kRMSz;
150 // if(a1>1.E5) printf(" sigmaZ2= %e\n",a2);
151 rpSPD.SetSigmaZ2(a2);
00a7cc50 152 rpSPD.SetDetectorIndex(mod->GetIndex());
153 rpSPD.SetLayer(mod->GetLayer());
7d62fb64 154 //(mod->GetITS())->AddRecPoint(rpSPD);
155 new (pt[fNrecp]) AliITSRecPoint(rpSPD);
156 fNrecp++;
e8189707 157}
158//_______________________________________________________________________
159void AliITSsimulationFastPointsV0::AddSDD(Float_t &e,
00a7cc50 160 AliITSmodule* mod,Int_t trackNumber,TClonesArray* recp){
d2f55a22 161 //
7d62fb64 162 TClonesArray &pt=*recp;
e8189707 163 const Float_t kmicronTocm = 1.0e-4;
164 const Float_t kdEdXtoQ = 2.778e+8;
165 const Float_t kRMSx = 38.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
166 const Float_t kRMSz = 28.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
167 Float_t a1,a2; // general float.
00a7cc50 168 AliITSgeom* gm = mod->GetITS()->GetITSgeom();
169
170 AliITSRecPoint rpSDD(gm);
e8189707 171
00a7cc50 172 rpSDD.SetLabel(trackNumber,0);
173 rpSDD.SetLabel(-3,1);
174 rpSDD.SetLabel(-3,2);
175 rpSDD.SetXZ(mod->GetIndex(),fSx->GetMean(),fSz->GetMean());
e8189707 176 rpSDD.SetdEdX(e);
177 rpSDD.SetQ(kdEdXtoQ*e);
178 a1 = fSx->GetRMS(); a1 *= a1; a1 += kRMSx*kRMSx;
179 // if(a1>1.E5) printf("addSDD: layer=%d track #%d dedx=%e sigmaX2= %e ",
180 // mod->GetLayer(),trackNumber,e,a1);
00a7cc50 181 rpSDD.SetSigmaDetLocX2(a1);
e8189707 182 a2 = fSz->GetRMS(); a2 *= a2; a2 += kRMSz*kRMSz;
183 // if(a1>1.E5) printf(" sigmaZ2= %e\n",a2);
184 rpSDD.SetSigmaZ2(a2);
00a7cc50 185 rpSDD.SetDetectorIndex(mod->GetIndex());
186 rpSDD.SetLayer(mod->GetLayer());
7d62fb64 187 new (pt[fNrecp]) AliITSRecPoint(rpSDD);
188 fNrecp++;
189
e8189707 190}
191//_______________________________________________________________________
192void AliITSsimulationFastPointsV0::AddSSD(Float_t &e,
00a7cc50 193 AliITSmodule* mod,Int_t trackNumber,TClonesArray* recp){
d2f55a22 194 //
7d62fb64 195 TClonesArray &pt=*recp;
e8189707 196 const Float_t kmicronTocm = 1.0e-4;
197 const Float_t kdEdXtoQ = 2.778e+8;
198 const Float_t kRMSx = 20.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
199 const Float_t kRMSz = 830.0*kmicronTocm; // microns->cm ITS TDR Table 1.3
200 Float_t a1,a2; // general float.
e8189707 201
00a7cc50 202 AliITSgeom* gm = mod->GetITS()->GetITSgeom();
203
204 AliITSRecPoint rpSSD(gm);
205
206 rpSSD.SetLabel(trackNumber,0);
207 rpSSD.SetLabel(-3,1);
208 rpSSD.SetLabel(-3,2);
209 rpSSD.SetXZ(mod->GetIndex(),fSx->GetMean(),fSz->GetMean());
e8189707 210 rpSSD.SetdEdX(e);
211 rpSSD.SetQ(kdEdXtoQ*e);
212 a1 = fSx->GetRMS(); a1 *= a1; a1 += kRMSx*kRMSx;
213 // if(a1>1.E5) printf("addSSD: layer=%d track #%d dedx=%e sigmaX2= %e ",
214 // mod->GetLayer(),trackNumber,e,a1);
00a7cc50 215 rpSSD.SetSigmaDetLocX2(a1);
e8189707 216 a2 = fSz->GetRMS(); a2 *= a2; a2 += kRMSz*kRMSz;
217 // if(a1>1.E5) printf(" sigmaZ2= %e RMSx=%e RMSz=%e\n",a2,fSx->GetRMS(),fSz->GetRMS());
218 rpSSD.SetSigmaZ2(a2);
00a7cc50 219 rpSSD.SetDetectorIndex(mod->GetIndex());
220 rpSSD.SetLayer(mod->GetLayer());
7d62fb64 221 new (pt[fNrecp]) AliITSRecPoint(rpSSD);
222 fNrecp++;
223
224
e8189707 225}
226//_______________________________________________________________________
227