]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSRecParticle.cxx
Adaption to new fluka common blocks (E. Futo)
[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 **************************************************************************/
b2a60966 15/* $Id$ */
6ad0bfa0 16//_________________________________________________________________________
b2a60966 17// A Reconstructed Particle in PHOS
2f04ed65 18// To become a general class of AliRoot ?
19// Why should I put meaningless comments
20// just to satisfy
21// the code checker
b2a60966 22//
23//*-- Author: Yves Schutz (SUBATECH)
24
6ad0bfa0 25
26// --- ROOT system ---
27
28// --- Standard library ---
29
ed4205d8 30
6ad0bfa0 31// --- AliRoot header files ---
a278df55 32#include "AliHeader.h"
6ad0bfa0 33#include "AliPHOSRecParticle.h"
8f3968d8 34#include "AliPHOSGetter.h"
35#include "TParticle.h"
6ad0bfa0 36
37ClassImp(AliPHOSRecParticle)
38
39
a73f33f0 40//____________________________________________________________________________
41 AliPHOSRecParticle::AliPHOSRecParticle(const AliPHOSRecParticle & rp)
42{
b2a60966 43 // copy ctor
44
83974468 45 fPHOSTrackSegment = rp.fPHOSTrackSegment ;
51d189f4 46 fDebug = kFALSE ;
a73f33f0 47 fType = rp.fType ;
83974468 48 fIndexInList = rp.fIndexInList ;
b2a60966 49
cafda784 50 fPdgCode = rp.fPdgCode;
51 fStatusCode = rp.fStatusCode;
52 fMother[0] = rp.fMother[0];
53 fMother[1] = rp.fMother[1];
54 fDaughter[0] = rp.fDaughter[0];
55 fDaughter[1] = rp.fDaughter[1];
56 fWeight = rp.fWeight;
57 fCalcMass = rp.fCalcMass;
58 fPx = rp.fPx;
59 fPy = rp.fPy;
60 fPz = rp.fPz;
61 fE = rp.fE;
62 fVx = rp.fVx;
63 fVy = rp.fVy;
64 fVz = rp.fVz;
65 fVt = rp.fVt;
66 fPolarTheta = rp.fPolarTheta;
67 fPolarPhi = rp.fPolarPhi;
68 fParticlePDG = rp.fParticlePDG;
b2a60966 69
b2a60966 70}
83974468 71
8f3968d8 72//____________________________________________________________________________
73const Int_t AliPHOSRecParticle::GetNPrimaries() const
a278df55 74{
9374e655 75 // retrieve the total number of primaries
a278df55 76 AliHeader *h = gAlice->GetHeader();
77 return h->GetNprimary();
78 // return gAlice->GetNtrack();
79}
80
81//____________________________________________________________________________
82const Int_t AliPHOSRecParticle::GetNPrimariesToRecParticles() const
8f3968d8 83{
9374e655 84 // returns the number of primariies which contribute to the recparticle
8f3968d8 85 Int_t rv = 0 ;
86 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
b9ced515 87 Int_t emcRPindex = ((AliPHOSTrackSegment*)gime->TrackSegments()->At(GetPHOSTSIndex()))->GetEmcIndex();
88 ((AliPHOSEmcRecPoint*)gime->EmcRecPoints()->At(emcRPindex))->GetPrimaries(rv) ;
8f3968d8 89 return rv ;
90}
83974468 91
8f3968d8 92//____________________________________________________________________________
93const TParticle * AliPHOSRecParticle::GetPrimary(Int_t index) const
94{
9374e655 95 // retrieves the one of primaries which contribute to the recparticle
a278df55 96 if ( index > GetNPrimariesToRecParticles() ) {
51d189f4 97 if (fDebug)
21cd0c07 98 Warning("GetPrimary", "%d is larger that the number of primaries %d", index, GetNPrimaries()) ;
51d189f4 99 } else {
8f3968d8 100 Int_t dummy ;
b9ced515 101 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
102 Int_t emcRPindex = ((AliPHOSTrackSegment*)gime->TrackSegments()->At(GetPHOSTSIndex()))->GetEmcIndex();
9bd51fae 103 Int_t *list = static_cast<AliPHOSEmcRecPoint*>(gime->EmcRecPoints()->At(emcRPindex))->GetPrimaries(dummy) ;
104 Int_t primaryindex ;
105 if(index<dummy)
106 primaryindex = list[index] ;
107 else{
108 if (fDebug)
109 printf("No primary number %d in list \n",index) ;
110 return 0 ;
111 }
112 if(primaryindex>4999999){
113 if (fDebug)
114 printf("No method to extract primaries from background!\n") ;
115 return 0 ;
116 }
117 return gime->Primary(primaryindex) ;
51d189f4 118 }
8f3968d8 119 return 0 ;
120}
51d189f4 121