Bug in title-name corrected
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALHit.cxx
CommitLineData
b13bbe81 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 EMCAL
20// A hit in EMCAL is the sum of all hits in a single crystal
21//
22//*-- Author: Sahal Yacoob (LBL / UCT)
23// Based on AliPHOSHit
24
25// --- Standard library ---
26#include <stdio.h>
27#include <string.h>
28#include <stdlib.h>
29#include <strstream.h>
30#include <iostream.h>
31
32// --- ROOT system ---
33#include <TLorentzVector.h>
34
35// --- AliRoot header files ---
36#include "AliEMCALHit.h"
37#include "AliRun.h"
38#include "AliConst.h"
39
40
41ClassImp(AliEMCALHit)
42
43//______________________________________________________________________
44AliEMCALHit::AliEMCALHit(){
45 // Default ctor
46
47 fId = 0;
48 fELOS = 0.0;
49 fPrimary = 0;
50 fTrack = 0;
51 fX = 0.0;
52 fY = 0.0;
53 fZ = 0.0;
61e0abb5 54 fPx = 0.0;
55 fPy = 0.0;
56 fPz = 0.0;
57 fPe = 0.0;
58 fIparent = 0;
59 fIenergy = 0.0;
b13bbe81 60}
61//______________________________________________________________________
62AliEMCALHit::AliEMCALHit(const AliEMCALHit & hit){
63 // copy ctor
64
65 fId = hit.fId ;
66 fELOS = hit.fELOS ;
67 fPrimary = hit.fPrimary ;
68 fTrack = hit.fTrack ;
69 fX = hit.fX;
70 fY = hit.fY;
71 fZ = hit.fZ;
61e0abb5 72 fPx = hit.fPx;
73 fPy = hit.fPy;
74 fPz = hit.fPz;
75 fPe = hit.fPe;
76 fIparent = hit.fIparent;
77 fIenergy = hit.fIenergy;
b13bbe81 78}
79//______________________________________________________________________
61e0abb5 80AliEMCALHit::AliEMCALHit(Int_t shunt, Int_t primary, Int_t track,Int_t iparent, Float_t ienergy, Int_t id,
81 Float_t *hits,Float_t *p):AliHit(shunt, track){
b13bbe81 82 //
83 // Create a CPV hit object
84 //
b13bbe81 85 fX = hits[0];
86 fY = hits[1];
87 fZ = hits[2];
88 fId = id;
89 fELOS = hits[3];
90 fPrimary = primary;
61e0abb5 91 fPx = p[0];
92 fPy = p[1];
93 fPz = p[2];
94 fPe = p[3];
95 fIparent = iparent;
96 fIenergy = ienergy;
b13bbe81 97}
98//______________________________________________________________________
99Bool_t AliEMCALHit::operator==(AliEMCALHit const &rValue) const{
100 // Two hits are identical if they have the same Id and originat
101 // from the same primary
102 Bool_t rv = kFALSE;
103
61e0abb5 104 if ( (fId == rValue.GetId()) && ( fPrimary == rValue.GetIparent()) )
b13bbe81 105 rv = kTRUE;
106
107 return rv;
108}
109//______________________________________________________________________
110AliEMCALHit AliEMCALHit::operator+(const AliEMCALHit &rValue){
111 // Add the energy of the hit
112
113 fELOS += rValue.GetEnergy() ;
114
115 return *this;
116
117}
118//______________________________________________________________________
119ostream& operator << (ostream& out,AliEMCALHit& hit){
120 // Print out Id and energy
121
122 out << "AliEMCALHit:";
123 out << "id=" << hit.GetId();
124 out << ", Eloss=" << hit.GetEnergy();
125 out << "GeV , Track no.=" << hit.GetPrimary();
126 out << ", (xyz)=(" << hit.X()<< ","<< hit.Y()<< ","<<hit.Z()<<") cm";
127 out << ", fTrack=" << hit.GetTrack();
61e0abb5 128 out << ", P=(" << hit.GetPx() << "," << hit.GetPy() << "," << hit.GetPz()
129 << "," <<hit.GetPe() << ") GeV" ;
130 out << ", Enterring particle ID" << hit.GetIparent();
131 out << ", Enterring particle initial energy = " << hit.GetIenergy() << " GeV" ;
b13bbe81 132 out << endl;
133
134 return out;
135}