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