LCOV - code coverage report
Current view: top level - FMD/FMDsim - AliFMDHit.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 35 69 50.7 %
Date: 2016-06-14 17:26:59 Functions: 5 11 45.5 %

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

Generated by: LCOV version 1.11