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