Minor changes, mostly for debugging
[u/mrichter/AliRoot.git] / FMD / AliFMDHit.cxx
index 09ab2b139c4982a2263aeed6f898d7c9b00ef3c2..41bfc7b1c06a2c83aeab01e2fb53d1d7798831f5 100644 (file)
@@ -24,6 +24,9 @@
 #include "AliFMDHit.h"         // ALIFMDHIT_H
 #include "AliLog.h"            // ALILOG_H
 #include "Riostream.h"         // ROOT_Riostream
+#include <TDatabasePDG.h>
+#include <TMath.h>
+#include <TString.h>
 
 //____________________________________________________________________
 ClassImp(AliFMDHit)
@@ -102,9 +105,39 @@ AliFMDHit::AliFMDHit(Int_t    shunt,
   fZ = z;
 }
 
+//____________________________________________________________________
+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 
   cout << "AliFMDHit: FMD" 
@@ -112,6 +145,15 @@ AliFMDHit::Print(Option_t* /* option */) const
        << 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 << std::endl;
+  }
 }
 
 //____________________________________________________________________