Break segmentation cured
[u/mrichter/AliRoot.git] / PHOS / AliPHOSRecParticle.cxx
CommitLineData
6ad0bfa0 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
6ad0bfa0 18//_________________________________________________________________________
b2a60966 19// A Reconstructed Particle in PHOS
20// To become a general class of AliRoot ?
21//
22//*-- Author: Yves Schutz (SUBATECH)
23
6ad0bfa0 24
25// --- ROOT system ---
26
27// --- Standard library ---
28
ed4205d8 29#include <assert.h>
30
6ad0bfa0 31// --- AliRoot header files ---
32
33#include "AliPHOSRecParticle.h"
15605d3c 34#include "TPad.h"
83974468 35#include "AliPHOSIndexToObject.h"
6ad0bfa0 36
37ClassImp(AliPHOSRecParticle)
38
39
40//____________________________________________________________________________
41 AliPHOSRecParticle::AliPHOSRecParticle(AliPHOSTrackSegment * ts)
42{
43 // ctor
44
83974468 45 fPHOSTrackSegment = ts->GetIndexInList() ;
46 fIndexInList = -1 ;
bd46e694 47 Float_t kenergy = ts->GetEnergy() ;
6ad0bfa0 48 TVector3 momdir = ts->GetMomentumDirection() ;
bd46e694 49 fPx = kenergy * momdir.X() ;
50 fPy = kenergy * momdir.Y() ;
51 fPz = kenergy * momdir.Z() ;
2aad621e 52 fType = kUNDEFINED;
bd46e694 53 fE = kenergy ; // !!! all particles have mass = 0
6ad0bfa0 54}
55
56//____________________________________________________________________________
a73f33f0 57 AliPHOSRecParticle::AliPHOSRecParticle(const AliPHOSRecParticle & rp)
58{
b2a60966 59 // copy ctor
60
83974468 61 fPHOSTrackSegment = rp.fPHOSTrackSegment ;
a73f33f0 62 fType = rp.fType ;
83974468 63 fIndexInList = rp.fIndexInList ;
b2a60966 64
cafda784 65 fPdgCode = rp.fPdgCode;
66 fStatusCode = rp.fStatusCode;
67 fMother[0] = rp.fMother[0];
68 fMother[1] = rp.fMother[1];
69 fDaughter[0] = rp.fDaughter[0];
70 fDaughter[1] = rp.fDaughter[1];
71 fWeight = rp.fWeight;
72 fCalcMass = rp.fCalcMass;
73 fPx = rp.fPx;
74 fPy = rp.fPy;
75 fPz = rp.fPz;
76 fE = rp.fE;
77 fVx = rp.fVx;
78 fVy = rp.fVy;
79 fVz = rp.fVz;
80 fVt = rp.fVt;
81 fPolarTheta = rp.fPolarTheta;
82 fPolarPhi = rp.fPolarPhi;
83 fParticlePDG = rp.fParticlePDG;
a73f33f0 84}
85
86//____________________________________________________________________________
b2a60966 87Int_t * AliPHOSRecParticle::GetPrimaries(Int_t & number)
88{
89 // Retrieves all the primary particles at the origine of this reconstructed particle
90
83974468 91 AliPHOSTrackSegment * ts = GetPHOSTrackSegment() ;
92
b2a60966 93 Int_t emcnumber = 0 ;
83974468 94 Int_t * emclist = ts->GetPrimariesEmc(emcnumber) ;
b2a60966 95
83974468 96 Int_t ppsdlnumber = 0 ;
97 Int_t * ppsdllist = ts->GetPrimariesPpsdLow(ppsdlnumber) ;
b2a60966 98
99 Int_t ppsdunumber = 0 ;
83974468 100 Int_t * ppsdulist = ts->GetPrimariesPpsdUp(ppsdunumber) ;
b2a60966 101
102 number = emcnumber + ppsdlnumber + ppsdunumber ;
103 Int_t * list = new Int_t[number] ;
104
105 Int_t index ;
106 for ( index = 0 ; index < emcnumber ; index++)
107 list[index] = emclist[index] ;
108
109 Int_t jndex ;
110 for ( jndex = 0 ; jndex < ppsdlnumber ; jndex++) {
111 assert(index < number) ;
112 list[index] = ppsdllist[jndex] ;
113 index++ ;
114 }
115
116 for ( jndex = 0 ; jndex < ppsdunumber ; jndex++) {
117 assert(index < number) ;
118 list[index] = ppsdulist[jndex] ;
119 index++ ;
120 }
121
b2a60966 122 delete emclist ;
123 delete ppsdllist ;
124 delete ppsdulist ;
125
126 return list ;
127}
83974468 128
129//____________________________________________________________________________
130AliPHOSTrackSegment * AliPHOSRecParticle::GetPHOSTrackSegment() const
131{
132 // Retrieves the PHOS track segment at the origine of this reconstructed particle
133
134 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
135 return please->GimeTrackSegment( fPHOSTrackSegment ) ;
136
137}
138
139
140