X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PHOS%2FAliPHOSPID.cxx;h=c6eaaaf7e52fc2e57a8909bc092069133d104784;hb=dddc33c571b008eccdc8f659de11ae42fc5a5509;hp=22320cda3aedcf2f589fad76064f3a59eca14471;hpb=88cb7938ca21d4a80991d4e7aa564008c29340f7;p=u%2Fmrichter%2FAliRoot.git diff --git a/PHOS/AliPHOSPID.cxx b/PHOS/AliPHOSPID.cxx index 22320cda3ae..c6eaaaf7e52 100644 --- a/PHOS/AliPHOSPID.cxx +++ b/PHOS/AliPHOSPID.cxx @@ -27,37 +27,107 @@ // --- ROOT system --- -#include "TGeometry.h" -#include "TDirectory.h" -#include "TFile.h" +#include "TBranch.h" +#include "TClonesArray.h" #include "TTree.h" - + // --- Standard library --- // --- AliRoot header files --- -#include "AliRun.h" +#include "AliConfig.h" +#include "AliLog.h" #include "AliPHOSPID.h" ClassImp(AliPHOSPID) //____________________________________________________________________________ - AliPHOSPID::AliPHOSPID():TTask("","") +AliPHOSPID::AliPHOSPID(): + TObject(), + fGeom(NULL), + fESD(0x0), + fEMCRecPoints(NULL), + fCPVRecPoints(NULL), + fTrackSegments(NULL), + fRecParticles(NULL) { // ctor - fEventFolderName = "" ; } //____________________________________________________________________________ -AliPHOSPID::AliPHOSPID(const TString alirunFileName, const TString eventFolderName) -:TTask("PHOS"+AliConfig::fgkPIDTaskName, alirunFileName), fEventFolderName(eventFolderName) +AliPHOSPID::AliPHOSPID(AliPHOSGeometry *geom): + TObject(), + fGeom(geom), + fESD(0x0), + fEMCRecPoints(NULL), + fCPVRecPoints(NULL), + fTrackSegments(NULL), + fRecParticles(NULL) { // ctor + 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) +{ + // Copy constructor } //____________________________________________________________________________ AliPHOSPID::~AliPHOSPID() { // dtor + 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); +}