]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDHit.cxx
0. General code clean-up, including messages, and the like.
[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
bf000c32 122//____________________________________________________________________
123const char*
124AliFMDHit::GetName() const
125{
126 static TString n;
127 n = Form("FMD%d%c[%2d,%3d]", fDetector,fRing,fSector,fStrip);
128 return n.Data();
129}
130
131//____________________________________________________________________
132const char*
133AliFMDHit::GetTitle() const
134{
135 static TString t;
136 TDatabasePDG* pdgDB = TDatabasePDG::Instance();
137 TParticlePDG* pdg = pdgDB->GetParticle(fPdg);
138 t = Form("%s (%d): %f MeV / %f cm", (pdg ? pdg->GetName() : "?"),
139 fTrack, fEdep, fLength);
140 return t.Data();
141}
142
54240c8d 143//____________________________________________________________________
144Float_t
145AliFMDHit::P() const
146{
147 // Get the momentum of the particle of the particle that made this
148 // hit.
149 return TMath::Sqrt(fPx * fPx + fPy * fPy + fPz * fPz);
150}
151
152//____________________________________________________________________
153Float_t
154AliFMDHit::M() const
155{
156 // Get the mass of the particle that made this hit.
157 TDatabasePDG* pdgDB = TDatabasePDG::Instance();
158 TParticlePDG* pdg = pdgDB->GetParticle(fPdg);
159 return (pdg ? pdg->Mass() : -1);
160}
161
162//____________________________________________________________________
163Float_t
164AliFMDHit::Q() const
165{
166 // Get the charge of the particle that made this hit.
167 TDatabasePDG* pdgDB = TDatabasePDG::Instance();
168 TParticlePDG* pdg = pdgDB->GetParticle(fPdg);
169 return (pdg ? pdg->Charge() : 0);
170}
171
172
4347b38f 173//____________________________________________________________________
174void
54240c8d 175AliFMDHit::Print(Option_t* option) const
4347b38f 176{
177 // Print Hit to standard out
7c09877a 178 cout << "AliFMDHit: FMD"
179 << fDetector << fRing << "["
180 << setw(3) << fSector << ","
181 << setw(3) << fStrip << "] = "
182 << fEdep << endl;
54240c8d 183 TString opt(option);
184 if (opt.Contains("D", TString::kIgnoreCase)) {
185 TDatabasePDG* pdgDB = TDatabasePDG::Instance();
186 TParticlePDG* pdg = pdgDB->GetParticle(fPdg);
187 cout << "\tPDG:\t" << fPdg << " " << (pdg ? pdg->GetName() : "?") << "\n"
188 << "\tP:\t(" << fPx << "," << fPy << "," << fPz << ") "<<P() << "\n"
189 << "\tX:\t" << fX << "," << fY << "," << fZ << "\n"
088f8e79 190 << "\tTrack #:\t" << fTrack << "\tLength:\t"
191 << fLength << "cm\t" << (IsStop() ? "stopped" : "") << std::endl;
54240c8d 192 }
4347b38f 193}
194
195//____________________________________________________________________
196//
197// EOF
198//