]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSDebugHit.cxx
Coverity fixes 19592, 19591, 19587, 19586, 19582
[u/mrichter/AliRoot.git] / PHOS / AliPHOSDebugHit.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)
23
24 // --- ROOT system ---
25
26 // --- Standard library ---
27 #include <stdio.h>
28 #include <string.h>
29 #include <stdlib.h>
30 #include <strstream.h>
31
32 // --- AliRoot header files ---
33 #include "AliPHOSHit.h"
34 #include "AliRun.h"
35 #include "AliConst.h"
36
37
38 ClassImp(AliPHOSHit)
39
40 //____________________________________________________________________________
41 AliPHOSHit::AliPHOSHit(const AliPHOSHit & hit) 
42 {
43    // copy ctor
44    
45   fId      = hit.fId ; 
46   fELOS    = hit.fELOS ;
47   fPrimary = hit.fPrimary ; 
48   fTrack   = hit.fTrack ; 
49   fMomentum= hit.fMomentum ;
50   fX       = hit.fX ; 
51   fY       = hit.fY ; 
52   fZ       = hit.fZ ; 
53   fPid     = hit.fPid ;
54  
55
56
57 //____________________________________________________________________________
58 AliPHOSHit::AliPHOSHit(Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits, Int_t pid, TLorentzVector p, Float_t *xy): AliHit(shunt, track)
59 {
60   //
61   // Create a CPV hit object
62   //
63
64   fId         = id ;
65   fELOS       = hits[3] ;
66   fPrimary    = primary ;
67   fPid        = pid ; 
68   fMomentum  = p;
69   fX         = xy[0];  //position of particle first entering cristall/pad
70   fY         = xy[1];
71   fZ         = xy[2];  
72 }
73
74 //____________________________________________________________________________
75 Bool_t AliPHOSHit::operator==(AliPHOSHit const &rValue) const
76
77   // Two hits are identical if they have the same Id and originate from the same primary 
78
79   Bool_t rv = kFALSE ; 
80
81   if ( (fId == rValue.GetId()) && ( fPrimary == rValue.GetPrimary() ) && (fPid*rValue.fPid == 0) )
82     rv = kTRUE;
83   
84   return rv;
85 }
86
87 //____________________________________________________________________________
88 AliPHOSHit AliPHOSHit::operator+(const AliPHOSHit &rValue)
89 {
90   // Add the energy of the hit
91   
92   fELOS += rValue.GetEnergy() ;
93     
94   if((fPid == 0) && (rValue.fPid != 0)){
95     fPid = rValue.fPid ;
96     fX    = rValue.fX ;
97     fY    = rValue.fY ;
98     fZ    = rValue.fZ ;
99    }     
100
101    return *this;
102
103 }
104
105 //____________________________________________________________________________
106 ostream& operator << (ostream& out, const AliPHOSHit& hit) 
107 {
108   // Print out Id and energy 
109   
110   out << "AliPHOSHit = " << hit.GetId() << " " << hit.GetEnergy() << endl ;
111   return out ;
112 }
113
114
115