o add lookup tables
[u/mrichter/AliRoot.git] / TPC / Upgrade / AliToyMCEventGenerator.cxx
CommitLineData
526ddf0e 1#include <iostream>
a1a695e5 2
526ddf0e 3#include <TDatabasePDG.h>
4#include <TRandom.h>
5#include <TH2F.h>
a1a695e5 6#include <TGeoGlobalMagField.h>
32438f4e 7#include <TSpline.h>
cd8ed0ac 8#include <TObjString.h>
a1a695e5 9
b0c26b55 10#include <AliLog.h>
a1a695e5 11#include <AliTPCROC.h>
12#include <AliTrackPointArray.h>
526ddf0e 13#include <AliTrackerBase.h>
14#include <AliCDBManager.h>
15#include <AliTPCParam.h>
16#include <AliGeomManager.h>
17#include <AliTPCcalibDB.h>
526ddf0e 18#include <AliTPCclusterMI.h>
a1a695e5 19#include <AliTPCSpaceCharge3D.h>
32438f4e 20#include <AliTPCROC.h>
a1a695e5 21
22#include "AliToyMCEvent.h"
23#include "AliToyMCTrack.h"
24
25#include "AliToyMCEventGenerator.h"
26
de0014b7 27ClassImp(AliToyMCEventGenerator);
526ddf0e 28
29
de0014b7 30AliToyMCEventGenerator::AliToyMCEventGenerator()
526ddf0e 31 :TObject()
32 ,fTPCParam(0x0)
a1a695e5 33 ,fEvent(0x0)
34 ,fSpaceCharge(0x0)
cd8ed0ac 35 ,fSpaceChargeFile("$ALICE_ROOT/TPC/Calib/maps/SC_NeCO2_eps5_50kHz_precal.root")
a1a695e5 36 ,fOutputFileName("toyMC.root")
37 ,fOutFile(0x0)
38 ,fOutTree(0x0)
d92b8630 39 ,fUseStepCorrection(kFALSE)
d1cf83f5 40 ,fUseMaterialBudget(kFALSE)
526ddf0e 41{
526ddf0e 42 fTPCParam = AliTPCcalibDB::Instance()->GetParameters();
43 fTPCParam->ReadGeoMatrices();
44}
45//________________________________________________________________
de0014b7 46AliToyMCEventGenerator::AliToyMCEventGenerator(const AliToyMCEventGenerator &gen)
526ddf0e 47 :TObject(gen)
a1a695e5 48 ,fTPCParam(gen.fTPCParam)
49 ,fEvent(0x0)
526ddf0e 50 ,fSpaceCharge(gen.fSpaceCharge)
cd8ed0ac 51 ,fSpaceChargeFile(gen.fSpaceChargeFile)
a1a695e5 52 ,fOutputFileName(gen.fOutputFileName)
53 ,fOutFile(0x0)
54 ,fOutTree(0x0)
d92b8630 55 ,fUseStepCorrection(gen.fUseStepCorrection)
d1cf83f5 56 ,fUseMaterialBudget(gen.fUseMaterialBudget)
526ddf0e 57{
58 //
59}
60//________________________________________________________________
de0014b7 61AliToyMCEventGenerator::~AliToyMCEventGenerator()
526ddf0e 62{
63 delete fSpaceCharge;
526ddf0e 64}
32438f4e 65
526ddf0e 66//________________________________________________________________
a1a695e5 67Bool_t AliToyMCEventGenerator::DistortTrack(AliToyMCTrack &trackIn, Double_t t0)
68{
69 //
70 //
71 //
72
526ddf0e 73 if(!fTPCParam) {
74 fTPCParam = AliTPCcalibDB::Instance()->GetParameters();
75 fTPCParam->ReadGeoMatrices();
526ddf0e 76 }
32438f4e 77
1e62e876 78 MakeITSClusters(trackIn/*,t0*/);
79 MakeTPCClusters(trackIn, t0);
80 MakeTRDClusters(trackIn/*,t0*/);
81
82 return 1;
83}
84//________________________________________________________________
85void AliToyMCEventGenerator::MakeITSClusters(AliToyMCTrack &trackIn/*, Double_t t0*/)
86{
87 //Upgrade ITS parameters
88 const Int_t nITSLayers = 7;
89 const Double_t ITSRadii[nITSLayers] = {2.2, 2.8, 3.6, 20.0, 22.0, 41.0, 43.0};
90 const Double_t lengthITS[nITSLayers] = {22.4, 24.2, 26.8, 78.0, 83.6, 142.4, 148.6};
91
92 const Double_t kMaxSnp = 0.85;
93 const Double_t kMaxZ0 = fTPCParam->GetZLength();
94 const Double_t kMass = TDatabasePDG::Instance()->GetParticle("pi+")->Mass();
95
96 AliToyMCTrack track(trackIn);
97 Double_t xyz[3] = {0.,0.,0.};
98
99 if (!AliTrackerBase::PropagateTrackTo(&track,ITSRadii[0],kMass,5,kTRUE,kMaxSnp,0,kFALSE,fUseMaterialBudget)) {
100 AliError(Form("Propagation to %.2f failed\n",ITSRadii[0]));
101 return;
102 }
103
104 for(Int_t iLayer = 0; iLayer<nITSLayers; iLayer++){
105
106 if (!AliTrackerBase::PropagateTrackTo(&track,ITSRadii[iLayer],kMass,1,kTRUE,kMaxSnp,0,kFALSE,fUseMaterialBudget)) {
107 AliError(Form("Propagation to %.2f failed\n",ITSRadii[iLayer]));
108 continue;
109 }
110 track.GetXYZ(xyz);
111
112 if (TMath::Abs(track.GetZ())>kMaxZ0) continue;
113 if (TMath::Abs(track.GetZ())>lengthITS[iLayer]/2) continue;
114
115 AliCluster* tempCl = new AliCluster();
116
117 tempCl->SetX(xyz[0]);
118 tempCl->SetY(xyz[1]);
119 tempCl->SetZ(xyz[2]);
120
121 Double_t sigmaY = 0.0004;
122 Double_t sigmaZ = 0.0004;
123
124 tempCl->SetSigmaY2(sigmaY*sigmaY);
125 tempCl->SetSigmaZ2(sigmaZ*sigmaZ);
126
127 trackIn.AddITSPoint(*tempCl);
128
129 }
130
131}
132//________________________________________________________________
133void AliToyMCEventGenerator::MakeTRDClusters(AliToyMCTrack &trackIn/*, Double_t t0*/)
134
135{
136 //Uses current TRD parameters
137 const Int_t nTRDLayers = 6;
138 const Double_t distToMid = 3.2 + 30./2; //dist to middle of drift region (radiator + half drift region)
139 const Double_t TRDRadii[nTRDLayers] = {294.5 + distToMid, 307.1 + distToMid, 319.7 + distToMid, 332.3 + distToMid, 344.9 + distToMid, 357.5 + distToMid};
140 const Double_t lengthTRD[nTRDLayers] = {604.0, 634.0, 656.0, 686.0, 700.0, 700.0};
141
142
143 const Double_t kMaxSnp = 0.85;
144 const Double_t kMaxZ0 = fTPCParam->GetZLength();
145 const Double_t kMass = TDatabasePDG::Instance()->GetParticle("pi+")->Mass();
146
147 AliToyMCTrack track(trackIn);
148 Double_t xyz[3] = {0.,0.,0.};
149
150 if (!AliTrackerBase::PropagateTrackTo(&track,TRDRadii[0],kMass,5,kTRUE,kMaxSnp,0,kFALSE,fUseMaterialBudget)) {
151 AliError(Form("Propagation to %.2f failed\n",TRDRadii[0]));
152 return;
153 }
154
155 for(Int_t iLayer = 0; iLayer<nTRDLayers; iLayer++){
156
157 if (!AliTrackerBase::PropagateTrackTo(&track,TRDRadii[iLayer],kMass,1,kTRUE,kMaxSnp,0,kFALSE,fUseMaterialBudget)) {
158 AliError(Form("Propagation to %.2f failed\n",TRDRadii[iLayer]));
159 continue;
160 }
161 track.GetXYZ(xyz);
162
163 if (TMath::Abs(track.GetZ())>kMaxZ0) continue;
164 if (TMath::Abs(track.GetZ())>lengthTRD[iLayer]/2) continue;
165
166 AliCluster* tempCl = new AliCluster();
167
168 tempCl->SetX(xyz[0]);
169 tempCl->SetY(xyz[1]);
170 tempCl->SetZ(xyz[2]);
171
172 Double_t sigmaY = 0.06;
173 Double_t sigmaZ = 0.2;
174
175 tempCl->SetSigmaY2(sigmaY*sigmaY);
176 tempCl->SetSigmaZ2(sigmaZ*sigmaZ);
177
178 trackIn.AddTRDPoint(*tempCl);
179
180 }
181
182}
183//________________________________________________________________
184void AliToyMCEventGenerator::MakeTPCClusters(AliToyMCTrack &trackIn, Double_t t0)
185{
186
32438f4e 187 // make it big enough to hold all points
188 // store real number of generated points in the unique id
189 const Int_t nMaxPoints=3000;
190 AliTrackPointArray pointArray0(nMaxPoints); //undistorted
191 AliTrackPointArray pointArray1(nMaxPoints); //distorted
1e62e876 192
32438f4e 193 //Create space point of undistorted and distorted clusters along the propagated track trajectory
194 CreateSpacePoints(trackIn,pointArray0,pointArray1);
195 //Convert the space points into clusters in the local frame
196 //for undistorted and distorted clusters using the same function
197 ConvertTrackPointsToLocalClusters(pointArray0,trackIn,t0,0);
198 ConvertTrackPointsToLocalClusters(pointArray1,trackIn,t0,1);
526ddf0e 199
526ddf0e 200
1e62e876 201}
32438f4e 202//________________________________________________________________
203void AliToyMCEventGenerator::CreateSpacePoints(AliToyMCTrack &trackIn,
204 AliTrackPointArray &arrUdist,
205 AliTrackPointArray &arrDist)
206{
207 //
208 // sample the track from the inner to the outer wall of the TPC
209 // a graph is filled in local coordinates for later
210 //
211
212 const Double_t kMaxSnp = 0.85;
213 const Double_t kMaxZ0 = fTPCParam->GetZLength();
214 const Double_t kMass = TDatabasePDG::Instance()->GetParticle("pi+")->Mass();
215
216 const Double_t iFCRadius = 83.5; //radius constants found in AliTPCCorrection.cxx
217 const Double_t oFCRadius = 254.5;
218
219 AliToyMCTrack track(trackIn);
220 //!!! TODO: make this adjustable perhaps
221 const Double_t stepSize=0.1;
222 Double_t xyz[3] = {0.,0.,0.};
223 Float_t xyzf[3] = {0.,0.,0.};
224
a1a695e5 225 //!!! when does the propagation not work, how often does it happen?
d1cf83f5 226 if (!AliTrackerBase::PropagateTrackTo(&track,iFCRadius,kMass,5,kTRUE,kMaxSnp,0,kFALSE,fUseMaterialBudget)) {
b0c26b55 227 AliError(Form("Propagation to IFC: %.2f failed\n",iFCRadius));
32438f4e 228 return;
b0c26b55 229 }
32438f4e 230
526ddf0e 231 Int_t npoints=0;
b0c26b55 232
32438f4e 233 for (Double_t radius=iFCRadius; radius<oFCRadius; radius+=stepSize){
234
b0c26b55 235 //!!! changed from return 0 to continue -> Please check
d1cf83f5 236 if (!AliTrackerBase::PropagateTrackTo(&track,radius,kMass,1,kTRUE,kMaxSnp,0,kFALSE,fUseMaterialBudget)) {
32438f4e 237 AliError(Form("Propagation to %.2f failed\n",radius));
b0c26b55 238 continue;
239 }
526ddf0e 240 track.GetXYZ(xyz);
32438f4e 241
b0c26b55 242 //!!! Why is this smeared
05da1b4e 243// xyz[0]+=gRandom->Gaus(0,0.000005);
244// xyz[1]+=gRandom->Gaus(0,0.000005);
245// xyz[2]+=gRandom->Gaus(0,0.000005);
32438f4e 246
247 xyzf[0]=Float_t(xyz[0]);
248 xyzf[1]=Float_t(xyz[1]);
249 xyzf[2]=Float_t(xyz[2]);
250
526ddf0e 251 if (TMath::Abs(track.GetZ())>kMaxZ0) continue;
32438f4e 252 // if (TMath::Abs(track.GetX())<iFCRadius) continue;
253 // if (TMath::Abs(track.GetX())>oFCRadius) continue;
254
255
256 AliTrackPoint pUdist; // undistorted space point
257 AliTrackPoint pDist; // distorted space point
258 // Set undistorted point
259 SetPoint(xyzf,pUdist);
260 arrUdist.AddPoint(npoints, &pUdist);
261 Int_t sector=pUdist.GetVolumeID();
32438f4e 262
263 // set distorted point
526ddf0e 264 Float_t distPoint[3]={xyz[0],xyz[1],xyz[2]};
d92b8630 265 Float_t dxyz[3]={0.,0.,0.};
266 if (!fUseStepCorrection){
267 fSpaceCharge->DistortPoint(distPoint, sector);
268 } else {
269 fSpaceCharge->GetCorrectionIntegralDz(distPoint,sector,dxyz,5);
270 distPoint[0]-=dxyz[0];
271 distPoint[1]-=dxyz[1];
272 distPoint[2]-=dxyz[2];
273 }
32438f4e 274 SetPoint(distPoint, pDist);
275 arrDist.AddPoint(npoints, &pDist);
32438f4e 276
277 ++npoints;
526ddf0e 278 }
32438f4e 279
280 arrUdist.SetUniqueID(npoints);
281 arrDist.SetUniqueID(npoints);
282}
526ddf0e 283
32438f4e 284//________________________________________________________________
285void AliToyMCEventGenerator::SetPoint(Float_t xyz[3], AliTrackPoint &point)
286{
287 //
288 // make AliTrackPoint out of AliTPCclusterMI
289 //
290
291 //covariance at the local frame
292 //assume 1mm distortion in y and z
293 Int_t i[3]={0,0,0};
294 const Double_t kSigmaY=0.1;
295 const Double_t kSigmaZ=0.1;
296 Float_t cov[6]={0,0,0, kSigmaY*kSigmaY,0,kSigmaZ*kSigmaZ};
297
298 const Float_t alpha = -TMath::ATan2(xyz[1],xyz[0]);
299 const Float_t sin = TMath::Sin(alpha), cos = TMath::Cos(alpha);
300
301 Float_t newcov[6];
302 newcov[0] = cov[0]*cos*cos + 2*cov[1]*sin*cos + cov[3]*sin*sin;
303 newcov[1] = cov[1]*(cos*cos-sin*sin) + (cov[3]-cov[0])*sin*cos;
304 newcov[2] = cov[2]*cos + cov[4]*sin;
305 newcov[3] = cov[0]*sin*sin - 2*cov[1]*sin*cos + cov[3]*cos*cos;
306 newcov[4] = cov[4]*cos - cov[2]*sin;
307 newcov[5] = cov[5];
308
309 // voluem ID to add later ....
310 point.SetXYZ(xyz);
311 point.SetCov(newcov);
d92b8630 312 // abuse volume ID for the sector number
32438f4e 313 point.SetVolumeID(fTPCParam->Transform0to1(xyz,i));
b0c26b55 314
32438f4e 315 // TODO: Add sampled dE/dx (use SetCharge)
316}
b0c26b55 317
32438f4e 318//________________________________________________________________
319void AliToyMCEventGenerator::ConvertTrackPointsToLocalClusters(AliTrackPointArray &arrPoints,
320 AliToyMCTrack &tr, Double_t t0, Int_t type)
321{
322 //
323 //
324 //
526ddf0e 325
526ddf0e 326
32438f4e 327 const Int_t npoints=Int_t(arrPoints.GetUniqueID());
328 Int_t secOld=-1;
329
330 // create an array for graphs which are used for local interpolation
331 // we need a new graph if the sector changed since then the local frame will also change
332 TObjArray arrGraphsXY(72);
333 arrGraphsXY.SetOwner();
334 TObjArray arrGraphsXZ(72);
335 arrGraphsXZ.SetOwner();
336 AliTrackPoint p;
337 //create initial graph
338 TGraph *grXY=0x0;
339 TGraph *grXZ=0x0;
340 //row -> sector mapping
341 Int_t rowMap[159];
342 for (Int_t irow=0; irow<159; ++irow) rowMap[irow]=-1;
343
344 // 1. Step
345 // Make from the list of global space points graphs in the local frame
346 // one graph per sector is needed
347 for (Int_t ipoint=0; ipoint<npoints; ++ipoint){
348 arrPoints.GetPoint(p,ipoint);
349 Float_t xyz[3] = {p.GetX(),p.GetY(),p.GetZ()};
350 Int_t index[3] = {0,0,0};
351 Int_t row = fTPCParam->GetPadRow(xyz,index);
352 // rotate space point to local frame
353 // the angle is given by the VolumeID which was set in CrateSpacePoints
354 const Int_t sec=p.GetVolumeID();
355 if (row<0 || (sec<36 && row>62) || row>95 ) continue;
356 Double_t angle=((sec%18)*20.+10.)/TMath::RadToDeg();
357 AliTrackPoint pRot=p.Rotate(angle);
358 const Int_t secrow=row+(sec>35)*63;
359 if (rowMap[secrow]==-1) rowMap[secrow]=sec;
360 // check if we need a new graph (sector change)
361 if (secOld!=sec){
362 grXY=new TGraph;
363 grXZ=new TGraph;
364 arrGraphsXY.AddAt(grXY,sec);
365 arrGraphsXZ.AddAt(grXZ,sec);
366 }
b0c26b55 367
32438f4e 368 //add coordinates in local frame for later interpolation
369 grXY->SetPoint(grXY->GetN(), pRot.GetX(), pRot.GetY());
370 grXZ->SetPoint(grXZ->GetN(), pRot.GetX(), pRot.GetZ());
371 secOld=sec;
372 }
b0c26b55 373
32438f4e 374 // 2. Step
375 // create in the center of each row a space point by using the graph to interpolate
376 // the the center of the row. This is done in xy and xz
377 TSpline3 *splXY=0x0;
378 TSpline3 *splXZ=0x0;
379 AliTPCclusterMI tempCl;
380 secOld=-1;
381 for (Int_t irow=0; irow<159; ++irow ){
382 const Int_t sec = rowMap[irow];
383 if (sec==-1) continue;
384 const Int_t secrow = irow<63?irow:irow-63;
385 Double_t localX = fTPCParam->GetPadRowRadii(sec,secrow);
386 // get graph for the current row
387 if (sec!=secOld){
388 delete splXY;
389 splXY=0x0;
390 delete splXZ;
391 splXZ=0x0;
392
393 grXY=(TGraph*)arrGraphsXY.At(sec);
394 grXZ=(TGraph*)arrGraphsXZ.At(sec);
395 if (!grXY) continue;
b0c26b55 396
05da1b4e 397// if(grXY->GetN()>1 && grXZ->GetN()>1) { //causes segmentation violation if N==1
398// splXY=new TSpline3("splXY",grXY);
399// splXZ=new TSpline3("splXZ",grXZ);
400// }
401// else {
544076ea 402 //TODO: make a cluster also in the sector w only one space point?
05da1b4e 403// continue;
544076ea 404 // Double_t tempX=0., tempY = 0., tempZ = 0.;
405
406 // grXY->GetPoint(0,tempX,localY);
407 // grXZ->GetPoint(0,tempX,localZ);
05da1b4e 408// }
544076ea 409
32438f4e 410 }
411 secOld=sec;
b0c26b55 412
32438f4e 413 // check we are in an active area
05da1b4e 414// if (splXY->FindX(localX)<1 || splXZ->FindX(localX)<1) continue;
415 if ( localX<grXY->GetX()[0] || localX>grXY->GetX()[grXY->GetN()-1] || localX<grXZ->GetX()[0] || localX>grXZ->GetX()[grXZ->GetN()-1]) continue;
b0c26b55 416
32438f4e 417 //get interpolated value at the center for the pad row
418 // using splines
05da1b4e 419// const Double_t localY=splXY->Eval(localX/*,0x0,"S"*/);
420// const Double_t localZ=splXZ->Eval(localX/*,0x0,"S"*/);
421 const Double_t localY=grXY->Eval(localX/*,0x0,"S"*/);
422 const Double_t localZ=grXZ->Eval(localX/*,0x0,"S"*/);
32438f4e 423 Float_t xyz[3]={localX,localY,localZ};
526ddf0e 424
32438f4e 425 if (!SetupCluster(tempCl,xyz,sec,t0)) continue;
d1cf83f5 426 tempCl.SetLabel(tr.GetUniqueID(), 0);
32438f4e 427
428 if (type==0) tr.AddSpacePoint(tempCl);
429 else tr.AddDistortedSpacePoint(tempCl);
430// printf("SetupCluster %3d: (%.2f, %.2f, %.2f), %d, %.2f\n",irow,xyz[0],xyz[1],xyz[2],sec,t0);
431 }
526ddf0e 432
32438f4e 433 delete splXY;
434 splXY=0x0;
435 delete splXZ;
436 splXZ=0x0;
437
438}
526ddf0e 439
32438f4e 440//________________________________________________________________
441Bool_t AliToyMCEventGenerator::SetupCluster(AliTPCclusterMI &tempCl, Float_t xyz[3], Int_t sec, Double_t t0)
442{
443 //
444 //
445 //
526ddf0e 446
32438f4e 447 const Double_t kSigmaY = 0.1;
448 const Double_t kSigmaZ = 0.1;
449 const Double_t kMaxZ0 = fTPCParam->GetZLength();
450 //TODO: Get this from the OCDB at some point?
451 const Double_t kDriftVel = fTPCParam->GetDriftV();
526ddf0e 452
32438f4e 453 tempCl.SetX(xyz[0]);
454 tempCl.SetY(xyz[1]);
455 tempCl.SetZ(xyz[2]);
526ddf0e 456
32438f4e 457 tempCl.SetSigmaY2(kSigmaY*kSigmaY);
458 tempCl.SetSigmaZ2(kSigmaZ*kSigmaZ);
459
460 // transform from the local coordinates to the coordinates expressed in pad coordinates
461 Int_t index[3] = {0,sec,0};
462 fTPCParam->Transform2to3(xyz,index);
463 fTPCParam->Transform3to4(xyz,index);
464 fTPCParam->Transform4to8(xyz,index);
465
466 const Int_t row = index[2];
467 const Int_t nPads = fTPCParam->GetNPads(sec, row);
468 // pad is fractional, but it needs to be shifted from the center
469 // to the edge of the row
470 const Float_t pad = xyz[1] + nPads/2;
471
472 tempCl.SetRow(row);
473 tempCl.SetPad(pad);
474 Float_t timeBin=Float_t(t0 + (kMaxZ0-TMath::Abs(tempCl.GetZ()))/kDriftVel);
475 tempCl.SetTimeBin(timeBin); // set time as t0 + drift time from dist z
476 tempCl.SetDetector(sec);
477
478 //check if we are in the active area
479 if (pad<0 || pad>=nPads) return kFALSE;
480
481 return kTRUE;
526ddf0e 482}
32438f4e 483
a1a695e5 484//________________________________________________________________
485Bool_t AliToyMCEventGenerator::ConnectOutputFile()
486{
487 //
488 // Create the output file name and tree and connect the event
489 //
490
491 fOutFile = new TFile(fOutputFileName.Data(),"recreate");
492
493 if (!fOutFile || !fOutFile->IsOpen()){
494 delete fOutFile;
495 fOutFile=0x0;
496 return kFALSE;
497 }
498
499 fOutTree = new TTree("toyMCtree","Tree with toyMC simulation");
500 fOutTree->Branch("event","AliToyMCEvent",&fEvent);
501
502 return kTRUE;
503}
504
505//________________________________________________________________
506Bool_t AliToyMCEventGenerator::CloseOutputFile()
507{
508 //
509 // close the output file
510 //
511 if (!fOutFile) return kFALSE;
512 fOutFile->Write();
513 fOutFile->Close();
514 delete fOutFile;
515 fOutFile=0x0;
516
517 return kTRUE;
518}
519
520//________________________________________________________________
521void AliToyMCEventGenerator::FillTree()
522{
523 // fill the tree
524 if (fOutTree) fOutTree->Fill();
525}
526
cd8ed0ac 527//________________________________________________________________
528void AliToyMCEventGenerator::SetSpaceCharge(EEpsilon epsilon, EGasType gasType/*=kNeCO2_9010*/, ECollRate collRate/*=k50kHz*/)
529{
530 //
531 // Set the space charge conditions
532 //
533 fSpaceChargeFile="$ALICE_ROOT/TPC/Calib/maps/SC";
534 switch (gasType) {
535 case kNeCO2_9010:
536 fSpaceChargeFile.Append("_NeCO2");
537 break;
538 }
539 switch (epsilon) {
540 case kEps5:
541 fSpaceChargeFile.Append("_eps5");
542 break;
543 case kEps10:
544 fSpaceChargeFile.Append("_eps10");
545 break;
546 case kEps20:
547 fSpaceChargeFile.Append("_eps20");
548 break;
549 }
550 switch (collRate) {
551 case k50kHz:
552 fSpaceChargeFile.Append("_50kHz");
553 break;
554 }
555 fSpaceChargeFile.Append("_precal.root");
556}
557
558//________________________________________________________________
559void AliToyMCEventGenerator::InitSpaceCharge()
560{
561 //
562 // init the space charge conditions
563 // this should be called after the tree was connected
564 //
565
566 AliInfo(Form("Using space charge map file: '%s'",fSpaceChargeFile.Data()));
567
568 TFile f(fSpaceChargeFile.Data());
569 fSpaceCharge=(AliTPCSpaceCharge3D*)f.Get("map");
570
571 if (fOutTree){
572 AliInfo("Attaching space charge map file name to the tree");
573 fOutTree->GetUserInfo()->Add(new TObjString(fSpaceChargeFile.Data()));
574 }
575}