]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSHit.cxx
Modif by Yuri on the hit calculation
[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//*--
9688c1dd 22//*-- Author: Maxime Volkov (RRC KI) & Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & 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"
0adeb7eb 38#include "AliPHOS.h"
1c75044c 39
49cd54c0 40ClassImp(AliPHOSHit)
9688c1dd 41
42 //____________________________________________________________________________
43 AliPHOSHit::AliPHOSHit(const AliPHOSHit & hit)
31aa6d6c 44{
9688c1dd 45 // copy ctor
1c75044c 46 fX = hit.fX ;
47 fY = hit.fY ;
48 fZ = hit.fZ ;
31aa6d6c 49 fId = hit.fId ;
50 fELOS = hit.fELOS ;
51 fPrimary = hit.fPrimary ;
52 fTrack = hit.fTrack ;
9688c1dd 53 fTime = hit.fTime ;
54
31aa6d6c 55}
56
49cd54c0 57//____________________________________________________________________________
b37750a6 58AliPHOSHit::AliPHOSHit(Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits): AliHit(shunt, track)
fb689dbe 59{
037cc66d 60 //
61 // Create a CPV hit object
62 //
9688c1dd 63
1c75044c 64 fX = hits[0] ;
65 fY = hits[1] ;
66 fZ = hits[2] ;
9688c1dd 67 fTime = hits[3] ;
68 fId = id ;
69 fELOS = hits[4] ;
037cc66d 70 fPrimary = primary ;
fb689dbe 71}
1c75044c 72//____________________________________________________________________________
73Float_t AliPHOSHit::X() const
74{
9688c1dd 75 // if(fX < -1000.){
1c75044c 76 TVector3 pos ;
0adeb7eb 77 AliPHOS * phos = static_cast<AliPHOS*> (gAlice->GetDetector("PHOS")) ;
78 phos->GetGeometry() ->RelPosInAlice(GetId(), pos) ;
79 return pos.X() ;
9688c1dd 80 // fX = pos.X() ;
81 // fY = pos.Y() ;
82 // fZ = pos.Z() ;
83 // }
84 // return fX;
1c75044c 85}
86//____________________________________________________________________________
87Float_t AliPHOSHit::Y() const
88{
9688c1dd 89 // if(fY < -1000.){
1c75044c 90 TVector3 pos ;
0adeb7eb 91 AliPHOS * phos = static_cast<AliPHOS*> (gAlice->GetDetector("PHOS")) ;
92 phos->GetGeometry() ->RelPosInAlice(GetId(), pos) ;
9688c1dd 93 return pos.Y();
94 // fX = pos.X() ;
95 // fY = pos.Y() ;
96 // fZ = pos.Z() ;
97 // }
98 // return fY;
1c75044c 99}
100//____________________________________________________________________________
101Float_t AliPHOSHit::Z() const
102{
9688c1dd 103 // if(fY < -1000.){
1c75044c 104 TVector3 pos ;
0adeb7eb 105 AliPHOS * phos = static_cast<AliPHOS*> (gAlice->GetDetector("PHOS")) ;
106 phos->GetGeometry() ->RelPosInAlice(GetId(), pos) ;
1c75044c 107 return pos.Z() ;
9688c1dd 108 // fX = pos.X() ;
109 // fY = pos.Y() ;
110 // fZ = pos.Z() ;
111 // }
112 // return fZ;
1c75044c 113}
49cd54c0 114//____________________________________________________________________________
115Bool_t AliPHOSHit::operator==(AliPHOSHit const &rValue) const
116{
037cc66d 117 // Two hits are identical if they have the same Id and originate from the same primary
b2a60966 118
ff4c968a 119 Bool_t rv = kFALSE ;
120
b37750a6 121 if ( (fId == rValue.GetId()) && ( fPrimary == rValue.GetPrimary() ) )
ff4c968a 122 rv = kTRUE;
49cd54c0 123
ff4c968a 124 return rv;
49cd54c0 125}
126
127//____________________________________________________________________________
7854a24a 128AliPHOSHit AliPHOSHit::operator+(const AliPHOSHit &rValue)
49cd54c0 129{
b2a60966 130 // Add the energy of the hit
49cd54c0 131
7854a24a 132 fELOS += rValue.GetEnergy() ;
9688c1dd 133
134 if(rValue.GetTime() < fTime)
135 fTime = rValue.GetTime() ;
ff4c968a 136
7854a24a 137 return *this;
49cd54c0 138
139}
140
141//____________________________________________________________________________
142ostream& operator << (ostream& out, const AliPHOSHit& hit)
143{
b2a60966 144 // Print out Id and energy
145
9688c1dd 146 out << "AliPHOSHit = " << hit.GetId() << " " << hit.GetEnergy() << " " << hit.GetTime() << endl ;
49cd54c0 147 return out ;
148}
149
150
151