From a83bd548d61ec58e38c8e21e17914ed178cb10ad Mon Sep 17 00:00:00 2001 From: schutz Date: Wed, 8 Jan 2003 17:21:43 +0000 Subject: [PATCH] reconstructed particle class created bt AliEMCALPID --- EMCAL/AliEMCALRecParticle.cxx | 119 ++++++++++++++++++++++++++++++++++ EMCAL/AliEMCALRecParticle.h | 49 ++++++++++++++ 2 files changed, 168 insertions(+) create mode 100644 EMCAL/AliEMCALRecParticle.cxx create mode 100644 EMCAL/AliEMCALRecParticle.h diff --git a/EMCAL/AliEMCALRecParticle.cxx b/EMCAL/AliEMCALRecParticle.cxx new file mode 100644 index 00000000000..b181c43fa07 --- /dev/null +++ b/EMCAL/AliEMCALRecParticle.cxx @@ -0,0 +1,119 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ +/* $Id$ */ +//_________________________________________________________________________ +// A Reconstructed Particle in EMCAL +// To become a general class of AliRoot ? +// Why should I put meaningless comments +// just to satisfy +// the code checker +// +//*-- Author: Yves Schutz (SUBATECH) + + +// --- ROOT system --- + +// --- Standard library --- + + +// --- AliRoot header files --- +#include "AliHeader.h" +#include "AliEMCALRecParticle.h" +#include "AliEMCALGetter.h" +#include "TParticle.h" + +ClassImp(AliEMCALRecParticle) + + +//____________________________________________________________________________ + AliEMCALRecParticle::AliEMCALRecParticle(const AliEMCALRecParticle & rp) +{ + // copy ctor + + fEMCALTrackSegment = rp.fEMCALTrackSegment ; + fDebug = kFALSE ; + fType = rp.fType ; + fIndexInList = rp.fIndexInList ; + + fPdgCode = rp.fPdgCode; + fStatusCode = rp.fStatusCode; + fMother[0] = rp.fMother[0]; + fMother[1] = rp.fMother[1]; + fDaughter[0] = rp.fDaughter[0]; + fDaughter[1] = rp.fDaughter[1]; + fWeight = rp.fWeight; + fCalcMass = rp.fCalcMass; + fPx = rp.fPx; + fPy = rp.fPy; + fPz = rp.fPz; + fE = rp.fE; + fVx = rp.fVx; + fVy = rp.fVy; + fVz = rp.fVz; + fVt = rp.fVt; + fPolarTheta = rp.fPolarTheta; + fPolarPhi = rp.fPolarPhi; + fParticlePDG = rp.fParticlePDG; + +} + +//____________________________________________________________________________ +const Int_t AliEMCALRecParticle::GetNPrimaries() const +{ + AliHeader *h = gAlice->GetHeader(); + return h->GetNprimary(); + // return gAlice->GetNtrack(); +} + +//____________________________________________________________________________ +const Int_t AliEMCALRecParticle::GetNPrimariesToRecParticles() const +{ + + Int_t rv = 0 ; + AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; + Int_t emcRPindex = ( dynamic_cast(gime->TrackSegments()->At(GetEMCALTSIndex())) )->GetECIndex(); + (dynamic_cast(gime->ECALRecPoints()->At(emcRPindex)))->GetPrimaries(rv) ; + return rv ; +} + +//____________________________________________________________________________ +const TParticle * AliEMCALRecParticle::GetPrimary(Int_t index) const +{ + if ( index > GetNPrimariesToRecParticles() ) { + if (fDebug) + Warning("GetPrimary", "%d is larger that the number of primaries %d", index, GetNPrimaries()) ; + } else { + Int_t dummy ; + AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; + Int_t emcRPindex = ( dynamic_cast(gime->TrackSegments()->At(GetEMCALTSIndex())) )->GetECIndex(); + Int_t *list = static_cast(gime->ECALRecPoints()->At(emcRPindex))->GetPrimaries(dummy) ; + Int_t primaryindex ; + if(index4999999){ + if (fDebug) + printf("No method to extract primaries from background!\n") ; + return 0 ; + } + return gime->Primary(primaryindex) ; + } + return 0 ; +} + diff --git a/EMCAL/AliEMCALRecParticle.h b/EMCAL/AliEMCALRecParticle.h new file mode 100644 index 00000000000..32911f1c038 --- /dev/null +++ b/EMCAL/AliEMCALRecParticle.h @@ -0,0 +1,49 @@ +#ifndef ALIEMCALRECPARTICLE_H +#define ALIEMCALRECPARTICLE_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//_________________________________________________________________________ +// A Reconstructed Particle in EMCAL +// To become a general class of AliRoot ? +// why not +//*-- Author: Yves Schutz (SUBATECH) + +// --- ROOT system --- + +// --- Standard library --- + +// --- AliRoot header files --- + +#include "AliEMCALFastRecParticle.h" +class TParticle ; + +class AliEMCALRecParticle : public AliEMCALFastRecParticle { + + public: + + AliEMCALRecParticle() { fEMCALTrackSegment = 0 ; fDebug = kFALSE ; } + AliEMCALRecParticle(const AliEMCALRecParticle & rp) ; // ctor + virtual ~AliEMCALRecParticle(){ } + + Int_t GetEMCALTSIndex()const { return fEMCALTrackSegment ; } + virtual const Int_t GetNPrimariesToRecParticles() const ; + virtual const Int_t GetNPrimaries() const ; + virtual const TParticle * GetPrimary(Int_t index) const ; + void SetDebug() { fDebug = kTRUE ; } + void UnsetDebug() { fDebug = kFALSE ; } + void SetTrackSegment(Int_t index){fEMCALTrackSegment = index; } + + typedef TClonesArray RecParticlesList ; + + private: + + Int_t fEMCALTrackSegment ; // pointer to the associated track segment in EMCAL + Bool_t fDebug ; + + ClassDef(AliEMCALRecParticle,2) // Reconstructed Particle +}; + +#endif // AliEMCALRECPARTICLE_H -- 2.43.0