]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDHit.cxx
Removing AliITSgeom dependencies from the old ITS clusterer V2 and the corresponding...
[u/mrichter/AliRoot.git] / FMD / AliFMDHit.cxx
index 4b7826a79c9fa1e108d5889028d5d1db716e8da5..2d883f33a0ac96baa7c1109825001eb4d10a77ac 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-
 /* $Id$ */
-
-//////////////////////////////////////////////////////////////////////////////
+/** @file    AliFMDHit.cxx
+    @author  Christian Holm Christensen <cholm@nbi.dk>
+    @date    Mon Mar 27 12:41:58 2006
+    @brief   Hit in the FMD
+    @ingroup FMD_sim
+*/
+//____________________________________________________________________
 //
 //  Hits in the FMD 
+//  Contains information on:
+//     Position of hit
+//     Momentum of track
+//     PID of track
+//     Energy loss of track
+//     Track #
+//     Track path length
+//     Track stopping status. 
+//  Latest changes by Christian Holm Christensen
 //
-// Latest changes by Christian Holm Christensen
-//
-//////////////////////////////////////////////////////////////////////////////
-#ifndef ALIFMDHIT_H
-# include "AliFMDHit.h"
-#endif
-#ifndef ALILOG_H
-# include "AliLog.h"
-#endif
-#ifndef __IOSTREAM__
-# include <iostream>
-#endif
-#ifndef __IOMANIP__
-# include <iomanip>
-#endif
+
+#include "Riostream.h"         // ROOT_Riostream
+#include <TDatabasePDG.h>
+#include <TMath.h>
+#include <TString.h>
+
+#include "AliFMDHit.h"         // ALIFMDHIT_H
+// #include "AliLog.h"         // ALILOG_H
 
 //____________________________________________________________________
-ClassImp(AliFMDHit);
+ClassImp(AliFMDHit)
+#if 0
+  ; // This is here to keep Emacs for indenting the next line
+#endif
 
 
 //____________________________________________________________________
@@ -50,8 +59,11 @@ AliFMDHit::AliFMDHit()
     fPz(0),
     fPdg(0),
     fEdep(0), 
-    fTime(0)
+    fTime(0), 
+    fLength(0), 
+    fStop(0)
 {
+  // Default CTOR
   fX = fY = fZ = 0;
 }
   
@@ -71,7 +83,9 @@ AliFMDHit::AliFMDHit(Int_t    shunt,
                     Float_t  pz,
                     Float_t  edep,
                     Int_t    pdg,
-                    Float_t  t)
+                    Float_t  t, 
+                    Float_t  l, 
+                    Bool_t   stop)
   : AliHit(shunt, track),
     fDetector(detector), 
     fRing(ring), 
@@ -82,7 +96,9 @@ AliFMDHit::AliFMDHit(Int_t    shunt,
     fPz(pz),
     fPdg(pdg),
     fEdep(edep), 
-    fTime(t)
+    fTime(t), 
+    fLength(l), 
+    fStop(stop)
 {
   // Normal FMD hit ctor
   // 
@@ -109,16 +125,79 @@ AliFMDHit::AliFMDHit(Int_t    shunt,
   fZ = z;
 }
 
+//____________________________________________________________________
+const char*
+AliFMDHit::GetName() const 
+{ 
+  // Get the name 
+  static TString n;
+  n = Form("FMD%d%c[%2d,%3d]", fDetector,fRing,fSector,fStrip);
+  return n.Data();
+}
+
+//____________________________________________________________________
+const char*
+AliFMDHit::GetTitle() const 
+{ 
+  // Get the title 
+  static TString t;
+  TDatabasePDG* pdgDB = TDatabasePDG::Instance();
+  TParticlePDG* pdg   = pdgDB->GetParticle(fPdg);
+  t = Form("%s (%d): %f MeV / %f cm", (pdg ? pdg->GetName() : "?"), 
+          fTrack, fEdep, fLength);
+  return t.Data();
+}
+
+//____________________________________________________________________
+Float_t
+AliFMDHit::P() const 
+{
+  // Get the momentum of the particle of the particle that made this
+  // hit. 
+  return TMath::Sqrt(fPx * fPx + fPy * fPy + fPz * fPz);
+}
+
+//____________________________________________________________________
+Float_t
+AliFMDHit::M() const 
+{
+  // Get the mass of the particle that made this hit. 
+  TDatabasePDG* pdgDB = TDatabasePDG::Instance();
+  TParticlePDG* pdg   = pdgDB->GetParticle(fPdg);
+  return (pdg ? pdg->Mass() : -1);
+}
+
+//____________________________________________________________________
+Float_t
+AliFMDHit::Q() const
+{
+  // Get the charge of the particle that made this hit. 
+  TDatabasePDG* pdgDB = TDatabasePDG::Instance();
+  TParticlePDG* pdg   = pdgDB->GetParticle(fPdg);
+  return (pdg ? pdg->Charge() : 0);
+}
+
+
 //____________________________________________________________________
 void
-AliFMDHit::Print(Option_t* /* option */) const 
+AliFMDHit::Print(Option_t* option) const 
 {
   // Print Hit to standard out 
-  std::cout << "AliFMDHit: FMD" 
-           << fDetector << fRing << "[" 
-           << std::setw(3) << fSector << ","
-           << std::setw(3) << fStrip << "] = " 
-           << fEdep << std::endl;
+  cout << "AliFMDHit: FMD" 
+       << fDetector << fRing << "[" 
+       << setw(3) << fSector << ","
+       << setw(3) << fStrip << "] = " 
+       << fEdep << endl;
+  TString opt(option);
+  if (opt.Contains("D", TString::kIgnoreCase)) {
+    TDatabasePDG* pdgDB = TDatabasePDG::Instance();
+    TParticlePDG* pdg   = pdgDB->GetParticle(fPdg);
+    cout << "\tPDG:\t" << fPdg << " " << (pdg ? pdg->GetName() : "?") << "\n"
+        << "\tP:\t(" << fPx << "," << fPy << "," << fPz << ") "<<P() << "\n" 
+        << "\tX:\t" << fX << "," << fY << "," << fZ << "\n" 
+        << "\tTrack #:\t" << fTrack << "\tLength:\t" 
+        << fLength << "cm\t" << (IsStop() ? "stopped" : "") << std::endl;
+  }
 }
 
 //____________________________________________________________________