Added README to PHOS/macros/Trigger/OCDB, explaining the content.
[u/mrichter/AliRoot.git] / PHOS / AliPHOSClusterizer.cxx
CommitLineData
d15a28e7 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
16//_________________________________________________________________________
b2a60966 17// Base class for the clusterization algorithm (pure abstract)
baef0810 18//*--
b2a60966 19//*-- Author: Yves Schutz SUBATECH
d15a28e7 20//////////////////////////////////////////////////////////////////////////////
21
9a2cdbdf 22#include <TClonesArray.h>
23#include <TTree.h>
d15a28e7 24
d15a28e7 25#include "AliPHOSClusterizer.h"
9a2cdbdf 26#include "AliPHOSDigit.h"
d76c31f4 27#include "AliLog.h"
75e8b893 28
d15a28e7 29ClassImp(AliPHOSClusterizer)
30
e68222ce 31AliPHOSCalibData * AliPHOSClusterizer::fgCalibData = 0 ;
32
d15a28e7 33//____________________________________________________________________________
0378398c 34AliPHOSClusterizer::AliPHOSClusterizer():
9a2cdbdf 35 fGeom(NULL),
9a2cdbdf 36 fDigitsArr(0),
37 fTreeR(0),
38 fEMCRecPoints(0),
39 fCPVRecPoints(0)
9a1398dd 40{
9a2cdbdf 41 // ctor
8d8258f6 42 fDigitsArr = new TClonesArray("AliPHOSDigit",100);
43 fEMCRecPoints = new TObjArray(100) ;
44 fEMCRecPoints ->SetName("EMCRECPOINTS") ;
45 fCPVRecPoints = new TObjArray(100) ;
46 fCPVRecPoints ->SetName("CPVRECPOINTS") ;
9a1398dd 47}
8d0f3f77 48
9a1398dd 49//____________________________________________________________________________
9a2cdbdf 50AliPHOSClusterizer::AliPHOSClusterizer(AliPHOSGeometry *geom):
51 fGeom(geom),
9a2cdbdf 52 fDigitsArr(0),
53 fTreeR(0),
54 fEMCRecPoints(0),
55 fCPVRecPoints(0)
d15a28e7 56{
57 // ctor
8d8258f6 58 fDigitsArr = new TClonesArray("AliPHOSDigit",100);
59 fEMCRecPoints = new TObjArray(100) ;
60 fEMCRecPoints ->SetName("EMCRECPOINTS") ;
61 fCPVRecPoints = new TObjArray(100) ;
62 fCPVRecPoints ->SetName("CPVRECPOINTS") ;
d15a28e7 63}
64
65//____________________________________________________________________________
66AliPHOSClusterizer::~AliPHOSClusterizer()
67{
68 // dtor
9a2cdbdf 69 if (fDigitsArr) {
70 fDigitsArr->Delete();
71 delete fDigitsArr;
72 }
73 if (fEMCRecPoints) {
74 fEMCRecPoints->Delete();
75 delete fEMCRecPoints;
76 }
77 if (fCPVRecPoints) {
78 fCPVRecPoints->Delete();
79 delete fCPVRecPoints;
80 }
8d0f3f77 81}
82
9a2cdbdf 83//____________________________________________________________________________
84void AliPHOSClusterizer::SetInput(TTree * digitsTree)
85{
86 // Get the tree with digits and sets
87 // the input array with digits for PHOS
88 TBranch *branch = digitsTree->GetBranch("PHOS");
89 if (!branch) {
90 AliError("can't get the branch with the PHOS digits !");
91 return;
92 }
8d8258f6 93 fDigitsArr->Clear();
9a2cdbdf 94 branch->SetAddress(&fDigitsArr);
95 branch->GetEntry(0);
96}
97
98//____________________________________________________________________________
99void AliPHOSClusterizer::SetOutput(TTree * clustersTree)
100{
101 // Set the output clusters tree,
102 // creates the arrays for EMC and CPV,
103 // and set the corresponding branch addresses
104 fTreeR = clustersTree;
8d0f3f77 105
9a2cdbdf 106 AliDebug(9, "Making array for EMC clusters");
9a2cdbdf 107 Int_t split = 0;
108 Int_t bufsize = 32000;
109 fTreeR->Branch("PHOSEmcRP", "TObjArray", &fEMCRecPoints, bufsize, split);
110
111 AliDebug(9, "Making array for CPV clusters");
9a2cdbdf 112 fTreeR->Branch("PHOSCpvRP", "TObjArray", &fCPVRecPoints, bufsize, split);
113}