]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSHit.cxx
Minor changes to the Digitizer procedure
[u/mrichter/AliRoot.git] / PHOS / AliPHOSHit.cxx
CommitLineData
49cd54c0 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
b2a60966 16/* $Id$ */
17
49cd54c0 18//_________________________________________________________________________
b2a60966 19// Hits class for PHOS
20// A hit in PHOS is the sum of all hits in a single crystal
baef0810 21//*--
b2a60966 22//*-- Author: Maxime Volkov (RRC KI) & Yves Schutz (SUBATECH)
49cd54c0 23
24// --- ROOT system ---
25
26// --- Standard library ---
de9ec31b 27#include <stdio.h>
28#include <string.h>
29#include <stdlib.h>
30#include <strstream.h>
49cd54c0 31
32// --- AliRoot header files ---
33#include "AliPHOSHit.h"
34#include "AliRun.h"
35#include "AliConst.h"
1c75044c 36#include "AliPHOSGetter.h"
37#include "AliPHOSGeometry.h"
38
49cd54c0 39
40
41ClassImp(AliPHOSHit)
42
31aa6d6c 43//____________________________________________________________________________
44AliPHOSHit::AliPHOSHit(const AliPHOSHit & hit)
45{
46 // copy ctor
47
1c75044c 48 fX = hit.fX ;
49 fY = hit.fY ;
50 fZ = hit.fZ ;
31aa6d6c 51 fId = hit.fId ;
52 fELOS = hit.fELOS ;
53 fPrimary = hit.fPrimary ;
54 fTrack = hit.fTrack ;
b37750a6 55
31aa6d6c 56
57}
58
49cd54c0 59//____________________________________________________________________________
b37750a6 60AliPHOSHit::AliPHOSHit(Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits): AliHit(shunt, track)
fb689dbe 61{
037cc66d 62 //
63 // Create a CPV hit object
64 //
65
66 fId = id ;
1c75044c 67 fX = hits[0] ;
68 fY = hits[1] ;
69 fZ = hits[2] ;
037cc66d 70 fELOS = hits[3] ;
71 fPrimary = primary ;
fb689dbe 72}
1c75044c 73//____________________________________________________________________________
74Float_t AliPHOSHit::X() const
75{
76 TVector3 pos ;
77 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
78 ((AliPHOSGeometry *) gime->PHOSGeometry()) ->RelPosInAlice(GetId(), pos);
79 return pos.X();
80}
81//____________________________________________________________________________
82Float_t AliPHOSHit::Y() const
83{
84 TVector3 pos ;
85 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
86 ((AliPHOSGeometry *) gime->PHOSGeometry()) ->RelPosInAlice(GetId(), pos);
87 return pos.Y();
88}
89//____________________________________________________________________________
90Float_t AliPHOSHit::Z() const
91{
92 TVector3 pos ;
93 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
94 ((AliPHOSGeometry *) gime->PHOSGeometry()) ->RelPosInAlice(GetId(), pos);
95 return pos.Z() ;
96}
97
fb689dbe 98
49cd54c0 99//____________________________________________________________________________
100Bool_t AliPHOSHit::operator==(AliPHOSHit const &rValue) const
101{
037cc66d 102 // Two hits are identical if they have the same Id and originate from the same primary
b2a60966 103
ff4c968a 104 Bool_t rv = kFALSE ;
105
b37750a6 106 if ( (fId == rValue.GetId()) && ( fPrimary == rValue.GetPrimary() ) )
ff4c968a 107 rv = kTRUE;
49cd54c0 108
ff4c968a 109 return rv;
49cd54c0 110}
111
112//____________________________________________________________________________
7854a24a 113AliPHOSHit AliPHOSHit::operator+(const AliPHOSHit &rValue)
49cd54c0 114{
b2a60966 115 // Add the energy of the hit
49cd54c0 116
7854a24a 117 fELOS += rValue.GetEnergy() ;
ff4c968a 118
7854a24a 119 return *this;
49cd54c0 120
121}
122
123//____________________________________________________________________________
124ostream& operator << (ostream& out, const AliPHOSHit& hit)
125{
b2a60966 126 // Print out Id and energy
127
49cd54c0 128 out << "AliPHOSHit = " << hit.GetId() << " " << hit.GetEnergy() << endl ;
129 return out ;
130}
131
132
133