Minor changes, mostly for debugging
[u/mrichter/AliRoot.git] / FMD / AliFMDHit.cxx
CommitLineData
4347b38f 1/**************************************************************************
2 * Copyright(c) 2004, 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/* $Id$ */
17
e802be3e 18//____________________________________________________________________
4347b38f 19//
20// Hits in the FMD
21//
22// Latest changes by Christian Holm Christensen
23//
e802be3e 24#include "AliFMDHit.h" // ALIFMDHIT_H
25#include "AliLog.h" // ALILOG_H
26#include "Riostream.h" // ROOT_Riostream
54240c8d 27#include <TDatabasePDG.h>
28#include <TMath.h>
29#include <TString.h>
4347b38f 30
31//____________________________________________________________________
925e6570 32ClassImp(AliFMDHit)
1a1fdef7 33#if 0
34 ; // This is here to keep Emacs for indenting the next line
35#endif
4347b38f 36
37
38//____________________________________________________________________
39AliFMDHit::AliFMDHit()
40 : fDetector(0),
41 fRing(0),
42 fSector(0),
43 fStrip('\0'),
44 fPx(0),
45 fPy(0),
46 fPz(0),
47 fPdg(0),
48 fEdep(0),
49 fTime(0)
50{
51 fX = fY = fZ = 0;
52}
53
54
55//____________________________________________________________________
56AliFMDHit::AliFMDHit(Int_t shunt,
57 Int_t track,
58 UShort_t detector,
59 Char_t ring,
60 UShort_t sector,
61 UShort_t strip,
62 Float_t x,
63 Float_t y,
64 Float_t z,
65 Float_t px,
66 Float_t py,
67 Float_t pz,
68 Float_t edep,
69 Int_t pdg,
70 Float_t t)
71 : AliHit(shunt, track),
72 fDetector(detector),
73 fRing(ring),
74 fSector(sector),
75 fStrip(strip),
76 fPx(px),
77 fPy(py),
78 fPz(pz),
79 fPdg(pdg),
80 fEdep(edep),
81 fTime(t)
82{
83 // Normal FMD hit ctor
84 //
85 // Parameters:
86 //
87 // shunt ???
88 // track Track #
89 // detector Detector # (1, 2, or 3)
90 // ring Ring ID ('I' or 'O')
91 // sector Sector # (For inner/outer rings: 0-19/0-39)
92 // strip Strip # (For inner/outer rings: 0-511/0-255)
93 // x Track's X-coordinate at hit
94 // y Track's Y-coordinate at hit
95 // z Track's Z-coordinate at hit
96 // px X-component of track's momentum
97 // py Y-component of track's momentum
98 // pz Z-component of track's momentum
99 // edep Energy deposited by track
100 // pdg Track's particle Id #
101 // t Time when the track hit
102 //
103 fX = x;
104 fY = y;
105 fZ = z;
106}
107
54240c8d 108//____________________________________________________________________
109Float_t
110AliFMDHit::P() const
111{
112 // Get the momentum of the particle of the particle that made this
113 // hit.
114 return TMath::Sqrt(fPx * fPx + fPy * fPy + fPz * fPz);
115}
116
117//____________________________________________________________________
118Float_t
119AliFMDHit::M() const
120{
121 // Get the mass of the particle that made this hit.
122 TDatabasePDG* pdgDB = TDatabasePDG::Instance();
123 TParticlePDG* pdg = pdgDB->GetParticle(fPdg);
124 return (pdg ? pdg->Mass() : -1);
125}
126
127//____________________________________________________________________
128Float_t
129AliFMDHit::Q() const
130{
131 // Get the charge of the particle that made this hit.
132 TDatabasePDG* pdgDB = TDatabasePDG::Instance();
133 TParticlePDG* pdg = pdgDB->GetParticle(fPdg);
134 return (pdg ? pdg->Charge() : 0);
135}
136
137
4347b38f 138//____________________________________________________________________
139void
54240c8d 140AliFMDHit::Print(Option_t* option) const
4347b38f 141{
142 // Print Hit to standard out
7c09877a 143 cout << "AliFMDHit: FMD"
144 << fDetector << fRing << "["
145 << setw(3) << fSector << ","
146 << setw(3) << fStrip << "] = "
147 << fEdep << endl;
54240c8d 148 TString opt(option);
149 if (opt.Contains("D", TString::kIgnoreCase)) {
150 TDatabasePDG* pdgDB = TDatabasePDG::Instance();
151 TParticlePDG* pdg = pdgDB->GetParticle(fPdg);
152 cout << "\tPDG:\t" << fPdg << " " << (pdg ? pdg->GetName() : "?") << "\n"
153 << "\tP:\t(" << fPx << "," << fPy << "," << fPz << ") "<<P() << "\n"
154 << "\tX:\t" << fX << "," << fY << "," << fZ << "\n"
155 << "\tTrack #:\t" << fTrack << std::endl;
156 }
4347b38f 157}
158
159//____________________________________________________________________
160//
161// EOF
162//