]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCLaser.cxx
Coverity fixes.
[u/mrichter/AliRoot.git] / TPC / AliTPCLaser.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 ///////////////////////////////////////////////////////////////////////////////
18 //                                                                           //
19 //  Laser for the TPChamber version 2 -- detailed TPC and slow simulation    //
20 //                                                                           //
21 ///////////////////////////////////////////////////////////////////////////////
22
23 #include <TLorentzVector.h>
24 #include "AliMC.h"
25
26
27 #include "AliTPCLaser.h"
28
29
30 ClassImp(AliTPCLaser)
31  
32 //_____________________________________________________________________________
33 AliTPCLaser::AliTPCLaser(const char *name, const char *title) :
34   AliTPCv2(name, title),
35   fNelPerCollision(10),
36   fLaserPID(13), // muons
37   fCollisionsPerCm(20)
38 {
39
40 }
41 //______________________________________________________________
42 void AliTPCLaser::StepManager()
43 {
44   // laser tracks are particles with PID fLaserPID (default PID=13) 
45   // stopped in the the TPC inner containment vessel (14) 
46
47   if (gMC->TrackPid() != fLaserPID) {
48     // in this way we can prevent delta-electrons
49     gMC->StopTrack();
50     return;
51   }
52   
53   Int_t copy;
54   Int_t vol[2];
55   vol[0] = gMC->CurrentVolID(copy);
56   
57   if (gMC->TrackPid() == fLaserPID
58       && vol[0] == 14) {// 14 = TIIN (inner containment vessel)
59     gMC->StopTrack();
60     return;
61   }
62   
63   TLorentzVector p;
64   Float_t hits[5]={0,0,0,0,0};
65   gMC->TrackPosition(p);
66   hits[0]=p[0];
67   hits[1]=p[1];
68   hits[2]=p[2];
69   hits[3]=fNelPerCollision;
70   hits[4]=gMC->TrackTime();
71
72   Int_t index[3];  
73   vol[0]=fTPCParam->Transform0to1(hits,index);
74   AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
75   
76   Double_t rnd = gMC->GetRandom()->Rndm();  
77   gMC->SetMaxStep(-TMath::Log(rnd)/fCollisionsPerCm);
78 }