X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PHOS%2FAliPHOSPID.cxx;h=d1bf115ed8ccec7d0897a564b7d60c7c8ae565d2;hb=38caa7781c55d54756404c911d0a6bf392883314;hp=7a9f60cf7e3a5106845335a67b2c12d5998696d6;hpb=fbf811ecb8a88febb884f8fd2283dd1ca8bb0258;p=u%2Fmrichter%2FAliRoot.git diff --git a/PHOS/AliPHOSPID.cxx b/PHOS/AliPHOSPID.cxx index 7a9f60cf7e3..d1bf115ed8c 100644 --- a/PHOS/AliPHOSPID.cxx +++ b/PHOS/AliPHOSPID.cxx @@ -27,82 +27,98 @@ // --- ROOT system --- -#include "TGeometry.h" -#include "TDirectory.h" -#include "TFile.h" -#include "TTree.h" - -// --- Standard library --- -#include -#include +// --- Standard library --- // --- AliRoot header files --- -#include "AliRun.h" +#include "AliConfig.h" #include "AliPHOSPID.h" -#include "AliHeader.h" +#include "AliPHOSGetter.h" ClassImp(AliPHOSPID) //____________________________________________________________________________ - AliPHOSPID::AliPHOSPID():TTask("","") +AliPHOSPID::AliPHOSPID(): + TObject(), + fGeom(NULL), + fESD(0x0), + fEMCRecPoints(NULL), + fCPVRecPoints(NULL), + fTrackSegments(NULL), + fRecParticles(NULL) { // ctor - fSplitFile= 0 ; - } //____________________________________________________________________________ -AliPHOSPID::AliPHOSPID(const char* headerFile, const char * name, const Bool_t toSplit):TTask(name, headerFile) +AliPHOSPID::AliPHOSPID(AliPHOSGeometry *geom): + TObject(), + fGeom(geom), + fESD(0x0), + fEMCRecPoints(NULL), + fCPVRecPoints(NULL), + fTrackSegments(NULL), + fRecParticles(NULL) { // ctor + fRecParticles = new TClonesArray("AliPHOSRecParticle",100) ; + fRecParticles->SetName("RECPARTICLES"); - fToSplit = toSplit ; - fSplitFile= 0 ; +} + +//____________________________________________________________________________ +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 - - fSplitFile = 0 ; + if (fEMCRecPoints) { + fEMCRecPoints->Delete(); + delete fEMCRecPoints; + } + if (fCPVRecPoints) { + fCPVRecPoints->Delete(); + delete fCPVRecPoints; + } } -// //____________________________________________________________________________ -// void AliPHOSPID::SetSplitFile(const TString splitFileName) const -// { -// // Diverts the Digits in a file separate from the hits file - - -// TDirectory * cwd = gDirectory ; -// TFile * splitFile = gAlice->InitTreeFile("R",splitFileName.Data()); -// splitFile->cd() ; -// gAlice->Write(0, TObject::kOverwrite); - -// TTree *treeE = gAlice->TreeE(); -// if (!treeE) { -// cerr << "ERROR: AliPHOSPID::SetSplitFile -> No TreeE found "<SetBranchAddress("Header", &header); -// treeE->SetBranchStatus("*",1); -// TTree *treeENew = treeE->CloneTree(); -// treeENew->Write(0, TObject::kOverwrite); - -// // copy AliceGeom -// TGeometry *AliceGeom = static_cast(cwd->Get("AliceGeom")); -// if (!AliceGeom) { -// cerr << "ERROR: AliPHOSPID::SetSplitFile -> AliceGeom was not found in the input file "<Write(0, TObject::kOverwrite) ; - -// gAlice->MakeTree("R",splitFile); -// cwd->cd() ; -// cout << "INFO: AliPHOSPID::SetSPlitMode -> RecParticles will be stored in " << splitFileName.Data() << endl ; -// } +//____________________________________________________________________________ +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; + } + fEMCRecPoints = new TObjArray(100) ; + emcbranch->SetAddress(&fEMCRecPoints); + emcbranch->GetEntry(0); + + TBranch *cpvbranch = clustersTree->GetBranch("PHOSCpvRP"); + if (!cpvbranch) { + AliError("can't get the branch with the PHOS CPV clusters !"); + return; + } + fCPVRecPoints = new TObjArray(100) ; + cpvbranch->SetAddress(&fCPVRecPoints); + cpvbranch->GetEntry(0); +}