* provided "as is" without express or implied warranty. *
**************************************************************************/
/* $Id$ */
+
+/* History of cvs commits:
+ *
+ * $Log$
+ * Revision 1.29 2007/08/28 12:55:08 policheh
+ * Loaders removed from the reconstruction code (C.Cheshkov)
+ *
+ * Revision 1.28 2007/08/07 14:12:03 kharlov
+ * Quality assurance added (Yves Schutz)
+ *
+ * Revision 1.27 2006/08/25 16:56:30 kharlov
+ * Compliance with Effective C++
+ *
+ * Revision 1.26 2006/08/25 16:00:53 kharlov
+ * Compliance with Effective C++AliPHOSHit.cxx
+ *
+ * Revision 1.25 2005/05/28 14:19:05 schutz
+ * Compilation warnings fixed by T.P.
+ *
+ */
+
//_________________________________________________________________________
// Algorithm Base class to construct PHOS track segments
// Associates EMC and PPSD clusters
// --- ROOT system ---
-#include "TGeometry.h"
-#include "TFile.h"
#include "TTree.h"
// --- Standard library ---
-#include <iostream.h>
-#include <stdlib.h>
// --- AliRoot header files ---
-#include "AliRun.h"
#include "AliPHOSTrackSegmentMaker.h"
-#include "AliHeader.h"
+#include "AliLog.h"
ClassImp( AliPHOSTrackSegmentMaker)
//____________________________________________________________________________
- AliPHOSTrackSegmentMaker:: AliPHOSTrackSegmentMaker() : TTask("","")
+AliPHOSTrackSegmentMaker:: AliPHOSTrackSegmentMaker() :
+ TObject(),
+ fESD(0),
+ fGeom(0),
+ fEMCRecPoints(0),
+ fCPVRecPoints(0)
{
- // ctor
- fSplitFile= 0 ;
-
+ // ctor
+ fEMCRecPoints = new TObjArray(100) ;
+ fCPVRecPoints = new TObjArray(100) ;
}
//____________________________________________________________________________
-AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(const char * headerFile, const char * name): TTask(name, headerFile)
+AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(AliPHOSGeometry *geom):
+ TObject(),
+ fESD(0),
+ fGeom(geom),
+ fEMCRecPoints(0),
+ fCPVRecPoints(0)
{
// ctor
- fSplitFile= 0 ;
+ fEMCRecPoints = new TObjArray(100) ;
+ fCPVRecPoints = new TObjArray(100) ;
}
+//____________________________________________________________________________
+AliPHOSTrackSegmentMaker::AliPHOSTrackSegmentMaker(const AliPHOSTrackSegmentMaker & tsmaker) :
+ TObject(tsmaker),
+ fESD(tsmaker.GetESD()),
+ fGeom(tsmaker.fGeom),
+ fEMCRecPoints(tsmaker.fEMCRecPoints),
+ fCPVRecPoints(tsmaker.fCPVRecPoints)
+{
+ //Copy constructor
+}
+
//____________________________________________________________________________
AliPHOSTrackSegmentMaker::~AliPHOSTrackSegmentMaker()
{
-
- fSplitFile = 0 ;
+ //Remove this from the parental task before destroying
+ if (fEMCRecPoints) {
+ fEMCRecPoints->Delete();
+ delete fEMCRecPoints;
+ }
+ if (fCPVRecPoints) {
+ fCPVRecPoints->Delete();
+ delete fCPVRecPoints;
+ }
}
//____________________________________________________________________________
-void AliPHOSTrackSegmentMaker::SetSplitFile(const TString splitFileName) const
+void AliPHOSTrackSegmentMaker::SetInput(TTree *clustersTree)
{
- // Diverts the TrackSegments in a file separate from the Digits file
-
+ // Read the clusters tree and set addresses to the
+ // arrays with the EMC and CPV clusters
- TDirectory * cwd = gDirectory ;
- TFile * splitFile = gAlice->InitTreeFile("R",splitFileName.Data());
- splitFile->cd() ;
- gAlice->Write(0, TObject::kOverwrite);
+ 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);
- TTree *treeE = gAlice->TreeE();
- if (!treeE) {
- cerr << "ERROR: AliPHOSTrackSegmentMaker::SetSplitFile -> No TreeE found "<<endl;
- abort() ;
- }
-
- // copy TreeE
- AliHeader *header = new AliHeader();
- treeE->SetBranchAddress("Header", &header);
- treeE->SetBranchStatus("*",1);
- TTree *treeENew = treeE->CloneTree();
- treeENew->Write(0, TObject::kOverwrite);
-
- // copy AliceGeom
- TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
- if (!AliceGeom) {
- cerr << "ERROR: AliPHOSTrackSegmentMaker::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
- abort() ;
+ TBranch *cpvbranch = clustersTree->GetBranch("PHOSCpvRP");
+ if (!cpvbranch) {
+ AliError("can't get the branch with the PHOS CPV clusters !");
+ return;
}
- AliceGeom->Write(0, TObject::kOverwrite);
-
- gAlice->MakeTree("R",splitFile);
- cwd->cd() ;
- cout << "INFO: AliPHOSTrackSegmentMaker::SetSPlitMode -> TrackSegments will be stored in " << splitFileName.Data() << endl ;
+ cpvbranch->SetAddress(&fCPVRecPoints);
+ fCPVRecPoints->Delete();
+ cpvbranch->GetEntry(0);
}