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