X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PHOS%2FAliPHOSPID.cxx;h=8f403718e023dc8169fe91da11499296b86546e4;hb=3c9441f123110b61cc01fdd191446e7ff63f2b39;hp=4d64c1d1109b67ac416a6a3a6a8901d93891da61;hpb=73d30fc89c31dc9f7947ee5a0e2fa62083139293;p=u%2Fmrichter%2FAliRoot.git diff --git a/PHOS/AliPHOSPID.cxx b/PHOS/AliPHOSPID.cxx index 4d64c1d1109..8f403718e02 100644 --- a/PHOS/AliPHOSPID.cxx +++ b/PHOS/AliPHOSPID.cxx @@ -27,42 +27,110 @@ // --- ROOT system --- +#include "TBranch.h" +#include "TClonesArray.h" +#include "TTree.h" // --- Standard library --- // --- AliRoot header files --- #include "AliConfig.h" +#include "AliLog.h" #include "AliPHOSPID.h" -#include "AliPHOSGetter.h" ClassImp(AliPHOSPID) //____________________________________________________________________________ - AliPHOSPID::AliPHOSPID():TTask("","") +AliPHOSPID::AliPHOSPID(): + TObject(), + fGeom(NULL), + fESD(0x0), + fEMCRecPoints(NULL), + fCPVRecPoints(NULL), + fTrackSegments(NULL), + fRecParticles(NULL), + fEnergyCorrectionOn(kTRUE) { // ctor - fEventFolderName = "" ; - fFirstEvent = 0 ; - fLastEvent = -1 ; } //____________________________________________________________________________ -AliPHOSPID::AliPHOSPID(const TString alirunFileName, const TString eventFolderName): - TTask("PHOS"+AliConfig::Instance()->GetPIDTaskName(), alirunFileName), - fEventFolderName(eventFolderName) +AliPHOSPID::AliPHOSPID(AliPHOSGeometry *geom): + TObject(), + fGeom(geom), + fESD(0x0), + fEMCRecPoints(NULL), + fCPVRecPoints(NULL), + fTrackSegments(NULL), + fRecParticles(NULL), + fEnergyCorrectionOn(kTRUE) { // ctor - fFirstEvent = 0 ; - fLastEvent = -1 ; + fEMCRecPoints = new TObjArray(100) ; + fCPVRecPoints = new TObjArray(100) ; + fRecParticles = new TClonesArray("AliPHOSRecParticle",100) ; + fRecParticles->SetName("RECPARTICLES"); + +} + +//____________________________________________________________________________ +AliPHOSPID::AliPHOSPID(const AliPHOSPID & pid) : + TObject(pid), + fGeom(pid.fGeom), + fESD(pid.fESD), + fEMCRecPoints(pid.fEMCRecPoints), + fCPVRecPoints(pid.fCPVRecPoints), + fTrackSegments(pid.fTrackSegments), + fRecParticles(pid.fRecParticles), + fEnergyCorrectionOn(pid.fEnergyCorrectionOn) +{ + // Copy constructor } //____________________________________________________________________________ AliPHOSPID::~AliPHOSPID() { // dtor - //Remove this from the parental task before destroying - if(AliPHOSGetter::Instance()->PhosLoader()) - AliPHOSGetter::Instance()->PhosLoader()->CleanPIDTask(); + if (fEMCRecPoints) { + fEMCRecPoints->Delete(); + delete fEMCRecPoints; + } + if (fCPVRecPoints) { + fCPVRecPoints->Delete(); + delete fCPVRecPoints; + } + if (fRecParticles) { + fRecParticles->Delete(); + delete fRecParticles; + } } +//____________________________________________________________________________ +void AliPHOSPID::SetInput(TTree *clustersTree, TClonesArray *trackSegments) +{ + // Read the clusters tree and creates the + // arrays with the EMC and CPV + // clusters. + // and set the corresponding branch addresses + + fTrackSegments = trackSegments; + + TBranch *emcbranch = clustersTree->GetBranch("PHOSEmcRP"); + if (!emcbranch) { + AliError("can't get the branch with the PHOS EMC clusters !"); + return; + } + emcbranch->SetAddress(&fEMCRecPoints); + fEMCRecPoints->Delete(); + emcbranch->GetEntry(0); + + TBranch *cpvbranch = clustersTree->GetBranch("PHOSCpvRP"); + if (!cpvbranch) { + AliError("can't get the branch with the PHOS CPV clusters !"); + return; + } + cpvbranch->SetAddress(&fCPVRecPoints); + fCPVRecPoints->Delete(); + cpvbranch->GetEntry(0); +}