bug fix in the vertex selection
[u/mrichter/AliRoot.git] / PHOS / AliPHOSPID.cxx
CommitLineData
6ad0bfa0 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
b2a60966 16/* $Id$ */
17
6ad0bfa0 18//_________________________________________________________________________
b2a60966 19// Algorithm class for the identification of particles detected in PHOS
2f04ed65 20// base class of identified particle
21// Why should I put meaningless comments
22// just to satisfy
23// the code checker
24
b2a60966 25//
7acf6008 26//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko
b2a60966 27
6ad0bfa0 28
29// --- ROOT system ---
7fb9892d 30#include "TBranch.h"
31#include "TClonesArray.h"
32#include "TTree.h"
e957fea8 33
6ad0bfa0 34// --- Standard library ---
6ad0bfa0 35
6ad0bfa0 36// --- AliRoot header files ---
e957fea8 37#include "AliConfig.h"
7fb9892d 38#include "AliLog.h"
26d4b141 39#include "AliPHOSPID.h"
6ad0bfa0 40
26d4b141 41ClassImp(AliPHOSPID)
6ad0bfa0 42
43//____________________________________________________________________________
0378398c 44AliPHOSPID::AliPHOSPID():
9a2cdbdf 45 TObject(),
46 fGeom(NULL),
47 fESD(0x0),
48 fEMCRecPoints(NULL),
49 fCPVRecPoints(NULL),
50 fTrackSegments(NULL),
71994f35 51 fRecParticles(NULL),
52 fEnergyCorrectionOn(kTRUE)
6ad0bfa0 53{
54 // ctor
55}
7b7c1533 56
8d0f3f77 57
7acf6008 58//____________________________________________________________________________
9a2cdbdf 59AliPHOSPID::AliPHOSPID(AliPHOSGeometry *geom):
60 TObject(),
61 fGeom(geom),
62 fESD(0x0),
63 fEMCRecPoints(NULL),
64 fCPVRecPoints(NULL),
65 fTrackSegments(NULL),
71994f35 66 fRecParticles(NULL),
67 fEnergyCorrectionOn(kTRUE)
7acf6008 68{
69 // ctor
dcab1c7e 70 fEMCRecPoints = new TObjArray(100) ;
71 fCPVRecPoints = new TObjArray(100) ;
9a2cdbdf 72 fRecParticles = new TClonesArray("AliPHOSRecParticle",100) ;
73 fRecParticles->SetName("RECPARTICLES");
74
b2820c13 75}
76
77//____________________________________________________________________________
e2429969 78AliPHOSPID::AliPHOSPID(const AliPHOSPID & pid) :
9a2cdbdf 79 TObject(pid),
80 fGeom(pid.fGeom),
ddd1a39c 81 fESD(pid.fESD),
9a2cdbdf 82 fEMCRecPoints(pid.fEMCRecPoints),
83 fCPVRecPoints(pid.fCPVRecPoints),
84 fTrackSegments(pid.fTrackSegments),
71994f35 85 fRecParticles(pid.fRecParticles),
86 fEnergyCorrectionOn(pid.fEnergyCorrectionOn)
e2429969 87{
88 // Copy constructor
89}
9a2cdbdf 90
e2429969 91//____________________________________________________________________________
26d4b141 92AliPHOSPID::~AliPHOSPID()
6ad0bfa0 93{
94 // dtor
9a2cdbdf 95 if (fEMCRecPoints) {
96 fEMCRecPoints->Delete();
97 delete fEMCRecPoints;
98 }
99 if (fCPVRecPoints) {
100 fCPVRecPoints->Delete();
101 delete fCPVRecPoints;
102 }
6483babc 103 if (fRecParticles) {
104 fRecParticles->Delete();
105 delete fRecParticles;
106 }
8d0f3f77 107}
88cb7938 108
9a2cdbdf 109//____________________________________________________________________________
110void AliPHOSPID::SetInput(TTree *clustersTree, TClonesArray *trackSegments)
111{
112 // Read the clusters tree and creates the
113 // arrays with the EMC and CPV
114 // clusters.
115 // and set the corresponding branch addresses
116
117 fTrackSegments = trackSegments;
118
119 TBranch *emcbranch = clustersTree->GetBranch("PHOSEmcRP");
120 if (!emcbranch) {
121 AliError("can't get the branch with the PHOS EMC clusters !");
122 return;
123 }
9a2cdbdf 124 emcbranch->SetAddress(&fEMCRecPoints);
dcab1c7e 125 fEMCRecPoints->Delete();
9a2cdbdf 126 emcbranch->GetEntry(0);
127
128 TBranch *cpvbranch = clustersTree->GetBranch("PHOSCpvRP");
129 if (!cpvbranch) {
130 AliError("can't get the branch with the PHOS CPV clusters !");
131 return;
132 }
9a2cdbdf 133 cpvbranch->SetAddress(&fCPVRecPoints);
dcab1c7e 134 fCPVRecPoints->Delete();
9a2cdbdf 135 cpvbranch->GetEntry(0);
136}