1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 /************************************************************************
17 * Abstract PID base class for Detector PID classes *
18 * Supplies detector PID classes with basic informations (i.e. Debug *
22 * Markus Fasel <M.Fasel@gsi.de> *
24 ************************************************************************/
25 #include <TParticle.h>
27 #include "AliESDtrack.h"
28 #include "AliMCParticle.h"
29 #include "AliMCEvent.h"
31 #include "AliHFEpidBase.h"
33 ClassImp(AliHFEpidBase)
35 //___________________________________________________________________
36 AliHFEpidBase::AliHFEpidBase(const Char_t *name):
42 // Default constructor
46 //___________________________________________________________________
47 AliHFEpidBase::AliHFEpidBase(const AliHFEpidBase &c):
58 //___________________________________________________________________
59 AliHFEpidBase &AliHFEpidBase::operator=(const AliHFEpidBase &ref){
61 // Assignment operator
70 //___________________________________________________________________
71 void AliHFEpidBase::Copy(TObject &ref) const {
72 AliHFEpidBase &target = dynamic_cast<AliHFEpidBase &>(ref);
74 target.fMCEvent = fMCEvent;
75 target.fDebugLevel = fDebugLevel;
80 //___________________________________________________________________
81 Int_t AliHFEpidBase::GetPdgCode(AliVParticle *track){
83 // returns the MC PDG code of the particle species
85 if(!fMCEvent) return 0;
86 AliMCParticle *mctrack = 0x0;
87 if(TString(track->IsA()->GetName()).CompareTo("AliESDtrack") == 0)
88 mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs((dynamic_cast<AliESDtrack *>(track))->GetLabel())));
89 else if(TString(track->IsA()->GetName()).CompareTo("AliMCParticle") == 0)
90 mctrack = dynamic_cast<AliMCParticle *>(track);
91 if(!mctrack) return 0;
92 return mctrack->Particle()->GetPdgCode();