LCOV - code coverage report
Current view: top level - EMCAL/EMCALbase - AliEMCALHit.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 60 73 82.2 %
Date: 2016-06-14 17:26:59 Functions: 10 11 90.9 %

          Line data    Source code
       1             :  /**************************************************************************
       2             :  * Copyright(c) 1998-1999, 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             : 
      18             : //_________________________________________________________________________
      19             : //  Hits class for EMCAL    
      20             : //  A hit in EMCAL is the sum of all hits in a tower
      21             : //  from a single entering particle             
      22             : //*-- Author: Sahal Yacoob (LBL / UCT)
      23             : // Based on AliPHOSHit
      24             : 
      25             : // --- Standard library ---
      26             : #include <Riostream.h>
      27             : 
      28             : // --- ROOT system ---
      29             : 
      30             : // --- AliRoot header files ---
      31             : #include "AliEMCALHit.h"
      32             : 
      33             : using std::endl;
      34          42 : ClassImp(AliEMCALHit)
      35             : 
      36             : //______________________________________________________________________
      37         191 : AliEMCALHit::AliEMCALHit()
      38         191 :   : fId(0),
      39         191 :     fELOS(0.),
      40         191 :     fPrimary(0),
      41         191 :     fPx(0.),
      42         191 :     fPy(0.),
      43         191 :     fPz(0.),
      44         191 :     fPe(0.),
      45         191 :     fIparent(0),
      46         191 :     fIenergy(0.),
      47         191 :     fTime(0.)
      48         955 : {
      49             :     // Default ctor
      50         382 : }
      51             : 
      52             : //______________________________________________________________________
      53             : AliEMCALHit::AliEMCALHit(const AliEMCALHit & hit) 
      54      129394 :   : AliHit(hit),
      55      129394 :     fId(hit.fId),
      56      129394 :     fELOS(hit.fELOS),
      57      129394 :     fPrimary(hit.fPrimary),
      58      129394 :     fPx(hit.fPx),
      59      129394 :     fPy(hit.fPy),
      60      129394 :     fPz(hit.fPz),
      61      129394 :     fPe(hit.fPe),
      62      129394 :     fIparent(hit.fIparent),
      63      129394 :     fIenergy(hit.fIenergy),
      64      129394 :     fTime(hit.fTime)
      65      646970 : {
      66             :     // copy ctor
      67      258788 : }
      68             : //_____________________________________________________________________
      69             : AliEMCALHit& AliEMCALHit::operator = (const AliEMCALHit &source)
      70             : { // assignment operator; use copy ctor
      71      129102 :   if (&source == this) return *this;
      72             : 
      73       64551 :   new (this) AliEMCALHit(source);
      74       64551 :   return *this;
      75       64551 : }
      76             : //______________________________________________________________________
      77             : AliEMCALHit::AliEMCALHit(Int_t shunt, Int_t primary, Int_t track,Int_t iparent, Float_t ienergy, Int_t id,
      78             :                          Float_t *hits,Float_t *p)
      79       64843 :   : AliHit(shunt, track),
      80       64843 :     fId(id),
      81       64843 :     fELOS(0.),
      82       64843 :     fPrimary(primary),
      83       64843 :     fPx(0.),
      84       64843 :     fPy(0.),
      85       64843 :     fPz(0.),
      86       64843 :     fPe(0.),
      87       64843 :     fIparent(iparent),
      88       64843 :     fIenergy(ienergy),
      89       64843 :     fTime(0.)
      90      324215 : {
      91             :     //
      92             :     // Create an EMCAL  hit object
      93             :     //
      94       64843 :     fX          = hits[0];
      95       64843 :     fY          = hits[1];
      96       64843 :     fZ          = hits[2];
      97       64843 :     fTime       = hits[3] ;
      98       64843 :     fELOS       = hits[4];
      99       64843 :     fPx          = p[0];
     100       64843 :     fPy          = p[1];
     101       64843 :     fPz          = p[2];
     102       64843 :     fPe          = p[3];
     103      129686 : }
     104             : 
     105             : //______________________________________________________________________
     106             : Bool_t AliEMCALHit::operator==(AliEMCALHit const &rValue) const{ 
     107             :     // Two hits are identical if they have the same Id and originat
     108             :     // from the same enterring Particle 
     109             :     Bool_t rv = kFALSE;
     110             : 
     111     2359157 :     if ( (fId == rValue.GetId()) && ( fIparent == rValue.GetIparent()))
     112       64551 :         rv = kTRUE;
     113             : 
     114     1147287 :     return rv;
     115             : }
     116             : //______________________________________________________________________
     117             : AliEMCALHit AliEMCALHit::operator+(const AliEMCALHit &rValue){
     118             :     // Add the energy of the hit
     119             : 
     120      129102 :     fELOS += rValue.GetEnergy() ;
     121             :  
     122       64551 :     if(rValue.GetTime() < fTime)
     123         202 :       fTime = rValue.GetTime() ;
     124             :  
     125       64551 :     return *this;
     126             : 
     127             : }
     128             : //______________________________________________________________________
     129             : ostream& operator << (ostream& out,AliEMCALHit& hit){
     130             :     // Print out Id and energy
     131             : 
     132           0 :     out << "AliEMCALHit:";
     133           0 :     out << "id=" <<  hit.GetId();
     134           0 :     out << ", Eloss=" <<  hit.GetEnergy();
     135           0 :     out << ", Time=" << hit.GetTime();
     136           0 :     out << "GeV , Track no.=" << hit.GetPrimary();
     137           0 :     out << ", (xyz)=(" << hit.X()<< ","<< hit.Y()<< ","<<hit.Z()<<") cm";
     138           0 :     out << ", fTrack=" << hit.GetTrack();
     139           0 :     out << ", P=(" << hit.GetPx() << "," << hit.GetPy() << "," << hit.GetPz()
     140           0 :                   << "," <<hit.GetPe() << ") GeV"  ;
     141           0 :     out << ", Enterring particle ID" << hit.GetIparent();
     142           0 :     out << ", Enterring particle initial energy = " << hit.GetIenergy() << " GeV" ;
     143           0 :     out << endl;
     144             : 
     145           0 :     return out;
     146             : }

Generated by: LCOV version 1.11