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