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