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