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