]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALHit.cxx
New code for EMCAL (B.Nilsen)
[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;
54 fP = 0.0;
55}
56//______________________________________________________________________
57AliEMCALHit::AliEMCALHit(const AliEMCALHit & hit){
58 // copy ctor
59
60 fId = hit.fId ;
61 fELOS = hit.fELOS ;
62 fPrimary = hit.fPrimary ;
63 fTrack = hit.fTrack ;
64 fX = hit.fX;
65 fY = hit.fY;
66 fZ = hit.fZ;
67 fP = hit.fP;
68}
69//______________________________________________________________________
70AliEMCALHit::AliEMCALHit(Int_t shunt, Int_t primary, Int_t track,Int_t id,
71 Float_t *hits,TLorentzVector *p):AliHit(shunt, track){
72 //
73 // Create a CPV hit object
74 //
75
76 fX = hits[0];
77 fY = hits[1];
78 fZ = hits[2];
79 fId = id;
80 fELOS = hits[3];
81 fPrimary = primary;
82 fP = *p;
83}
84//______________________________________________________________________
85Bool_t AliEMCALHit::operator==(AliEMCALHit const &rValue) const{
86 // Two hits are identical if they have the same Id and originat
87 // from the same primary
88 Bool_t rv = kFALSE;
89
90 if ( (fId == rValue.GetId()) && ( fPrimary == rValue.GetPrimary()) )
91 rv = kTRUE;
92
93 return rv;
94}
95//______________________________________________________________________
96AliEMCALHit AliEMCALHit::operator+(const AliEMCALHit &rValue){
97 // Add the energy of the hit
98
99 fELOS += rValue.GetEnergy() ;
100
101 return *this;
102
103}
104//______________________________________________________________________
105ostream& operator << (ostream& out,AliEMCALHit& hit){
106 // Print out Id and energy
107
108 out << "AliEMCALHit:";
109 out << "id=" << hit.GetId();
110 out << ", Eloss=" << hit.GetEnergy();
111 out << "GeV , Track no.=" << hit.GetPrimary();
112 out << ", (xyz)=(" << hit.X()<< ","<< hit.Y()<< ","<<hit.Z()<<") cm";
113 out << ", fTrack=" << hit.GetTrack();
114 out << ", P=(" << hit.GetP().Px() << "," << hit.GetP().Py() <<","
115 << hit.GetP().Pz() << "," << hit.GetP().E();
116 out << endl;
117
118 return out;
119}