Coverity fixes
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUHit.cxx
CommitLineData
451f5018 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#include "AliITSU.h"
17#include "AliITSUGeomTGeo.h"
18#include "AliITSUHit.h"
19
20ClassImp(AliITSUHit)
21
22////////////////////////////////////////////////////////////////////////
23//
24// At the moment the same functionality/data-members as parent AliITShit
25// except the geometry transformation uses AliITSgeomTGeoUp
26//
27////////////////////////////////////////////////////////////////////////
28
29//----------------------------------------------------------------------
30AliITSUHit::AliITSUHit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,Float_t tof,
31 TLorentzVector &x,TLorentzVector &x0,TLorentzVector &p)
32: AliITShit(shunt,track,vol,edep,tof,x,x0,p)
33{
34 // ct-r
35}
36
37//______________________________________________________________________
38AliITSUHit::AliITSUHit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits)
39 : AliITShit(shunt, track, vol, hits)
40{
41 // c-tor
42}
43
44//______________________________________________________________________
45AliITSUHit::AliITSUHit(const AliITSUHit &h)
46: AliITShit(h)
47{
48 // cp c-tor
49}
50
51//______________________________________________________________________
52AliITSUHit& AliITSUHit::operator=(const AliITSUHit &h)
53{
54 // The standard = operator
55 if(this == &h) return *this;
56 AliITShit::operator=(h);
57 return *this;
58}
59
60//______________________________________________________________________
61void AliITSUHit::GetPositionL(Float_t &x,Float_t &y,Float_t &z,Float_t &tof)
62{
63 // Returns the position and time of flight of this hit in the local
64 // coordinates of this module, and in the units of the Monte Carlo.
65 //
66 AliITSUGeomTGeo *gm = ((AliITSU*)gAlice->GetDetector("ITS"))->GetITSGeomTGeo();
67 if (!gm) AliFatal("NULL pointer to the geometry!");
68 double g[3]={fX,fY,fZ},l[3];
69 gm->GetMatrixSens(fModule)->MasterToLocal(g,l);
70 x = l[0];
71 y = l[1];
72 z = l[2];
73 tof = fTof;
74 //
75}
76
77//______________________________________________________________________
78void AliITSUHit::GetPositionL0(Double_t &x,Double_t &y,Double_t &z,Double_t &tof)
79{
80 // Returns the initial position and time of flight of this hit
81 // in the local coordinates of this module, and in the units of the
82 AliITSUGeomTGeo *gm = ((AliITSU*)gAlice->GetDetector("ITS"))->GetITSGeomTGeo();
83 if (!gm) AliFatal("NULL pointer to the geometry!");
84 double g[3]={fx0,fy0,fz0},l[3];
85 gm->GetMatrixSens(fModule)->MasterToLocal(g,l);
86 x = l[0];
87 y = l[1];
88 z = l[2];
89 tof = ft0;
90}
91
02d6eccc 92//______________________________________________________________________
451f5018 93void AliITSUHit::GetDetectorID(Int_t &layer,Int_t &ladder,Int_t &det) const
94{
95 // Returns the layer ladder and detector number lables for this
96 // ITS module. Note: indices start from 0!
97 AliITSUGeomTGeo *gm = ((AliITSU*)gAlice->GetDetector("ITS"))->GetITSGeomTGeo();
98 if (!gm) AliFatal("NULL pointer to the geometry!");
99 gm->GetModuleId(fModule,layer,ladder,det);
100}
02d6eccc 101
102//______________________________________________________________________
103Int_t AliITSUHit::GetLayer() const
104{
105 // Returns the layer. Note: indices start from 0!
106 AliITSUGeomTGeo *gm = ((AliITSU*)gAlice->GetDetector("ITS"))->GetITSGeomTGeo();
107 if (!gm) AliFatal("NULL pointer to the geometry!");
108 return gm->GetLayer(fModule);
109}
110
111//______________________________________________________________________
112Int_t AliITSUHit::GetLadder() const
113{
114 // Returns the ladder of TS module. Note: indices start from 0!
115 AliITSUGeomTGeo *gm = ((AliITSU*)gAlice->GetDetector("ITS"))->GetITSGeomTGeo();
116 if (!gm) AliFatal("NULL pointer to the geometry!");
117 return gm->GetLadder(fModule);
118}
119
120//______________________________________________________________________
121Int_t AliITSUHit::GetDetector() const
122{
123 // Returns the detector within the ladder. Note: indices start from 0!
124 AliITSUGeomTGeo *gm = ((AliITSU*)gAlice->GetDetector("ITS"))->GetITSGeomTGeo();
125 if (!gm) AliFatal("NULL pointer to the geometry!");
126 return gm->GetModIdInLadder(fModule);
127}
ee58ce21 128
129//______________________________________________________________________
d8e94def 130void AliITSUHit::Print(Option_t */*option*/) const
ee58ce21 131{
132 // print itself
133 printf("Mod%4d Tr:%5d DE:%.2e TOF: %.3e| P:%.3f %.3f %.3f |>%.4f %.4f %.4f >%.4f %.4f %.4f\n",
134 fModule,fTrack,fDestep,fTof,fPx,fPy,fPz, fx0,fy0,fz0,fX,fY,fZ);
135
136}