]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSClusterizerv2.cxx
Loaders removed from the reconstruction code (C.Cheshkov)
[u/mrichter/AliRoot.git] / PHOS / AliPHOSClusterizerv2.cxx
CommitLineData
0bc3b8ed 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 **************************************************************************/
0bc3b8ed 15
803d1ab0 16/* $Id$ */
17
0bc3b8ed 18//////////////////////////////////////////////////////////////////////////////
19// Clusterization class for IHEP reconstruction.
20// Performs clusterization (collects neighbouring active cells)
21// It differs from AliPHOSClusterizerv1 in neighbour definition only
803d1ab0 22//*-- Author: Boris Polichtchouk, IHEP
0bc3b8ed 23
cbd576a6 24// --- ROOT system ---
25#include "TBenchmark.h"
cbd576a6 26
27// --- Standard library ---
cbd576a6 28
29// --- AliRoot header files ---
351dd634 30#include "AliLog.h"
cbd576a6 31#include "AliPHOSClusterizerv2.h"
cbd576a6 32#include "AliPHOSEvalRecPoint.h"
33#include "AliPHOSRecCpvManager.h"
34#include "AliPHOSRecEmcManager.h"
e957fea8 35#include "AliPHOSGeometry.h"
ddd1a39c 36#include "AliPHOSQualAssDataMaker.h"
9a2cdbdf 37#include "AliPHOSDigit.h"
cbd576a6 38
39ClassImp(AliPHOSClusterizerv2)
40
88cb7938 41//____________________________________________________________________________
cbd576a6 42AliPHOSClusterizerv2::AliPHOSClusterizerv2() : AliPHOSClusterizerv1()
43{}
44
88cb7938 45//____________________________________________________________________________
9a2cdbdf 46AliPHOSClusterizerv2::AliPHOSClusterizerv2(AliPHOSGeometry *geom):
47AliPHOSClusterizerv1(geom)
88cb7938 48{}
49
50//____________________________________________________________________________
cbd576a6 51void AliPHOSClusterizerv2::GetNumberOfClustersFound(int* numb) const
52{
0bc3b8ed 53 // Returns the number of found EMC and CPV rec.points
cbd576a6 54
9a2cdbdf 55 numb[0] = fEMCRecPoints->GetEntries();
56 numb[1] = fCPVRecPoints->GetEntries();
cbd576a6 57}
58
88cb7938 59//____________________________________________________________________________
9a2cdbdf 60void AliPHOSClusterizerv2::Digits2Clusters(Option_t* option)
cbd576a6 61{
0bc3b8ed 62 // Steering method
cbd576a6 63
64 if(strstr(option,"tim"))
65 gBenchmark->Start("PHOSClusterizer");
66
67 if(strstr(option,"print"))
88cb7938 68 Print() ;
9a2cdbdf 69}
70// AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
cbd576a6 71
9a2cdbdf 72// TFolder* wPoolF = gime->PhosLoader()->GetDetectorDataFolder();
fbf811ec 73
9a2cdbdf 74// TObjArray* wPool = new TObjArray(400);
75// wPool->SetName("SmartPoints");
76// wPoolF->Add(wPool);
77// wPoolF->Add(this);
cbd576a6 78
9a2cdbdf 79// Int_t nevents = gime->MaxEvent() ;
80// Int_t ievent ;
cbd576a6 81
9a2cdbdf 82// for(ievent = 0; ievent<nevents; ievent++) {
cbd576a6 83
9a2cdbdf 84// gime->Event(ievent,"D") ;
cbd576a6 85
9a2cdbdf 86// AliInfo(Form("MakeClusters invoked..")) ;
87// MakeClusters() ;
88// AliInfo(Form("MakeClusters done.")) ;
cbd576a6 89
90
9a2cdbdf 91// //SmartRecPoints will communicate with wPool.
cbd576a6 92
9a2cdbdf 93// AliPHOSEvalRecPoint* rp=0;
cbd576a6 94
9a2cdbdf 95// // CPV reconstruction
cbd576a6 96
9a2cdbdf 97// AliPHOSRecCpvManager* recCpv = new AliPHOSRecCpvManager();
98// wPoolF->Add(recCpv);
cbd576a6 99
9a2cdbdf 100// Int_t iPoint; //loop variable
c9eeb00e 101
9a2cdbdf 102// for(iPoint=0; iPoint<gime->CpvRecPoints()->GetEntriesFast(); iPoint++) {
103// rp = new AliPHOSEvalRecPoint(iPoint, kTRUE);
104// rp->MakeJob();
105// }
cbd576a6 106
9a2cdbdf 107// AliPHOSEvalRecPoint pt;
108// pt.UpdateWorkingPool();
cbd576a6 109
9a2cdbdf 110// TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
111// Int_t nOldCpv = cpvRecPoints->GetEntries();
112// cpvRecPoints->Delete();
113// cpvRecPoints->Compress();
cbd576a6 114
9a2cdbdf 115// Int_t i; //loop variable
c9eeb00e 116
9a2cdbdf 117// for(i=0; i<wPool->GetEntries(); i++)
118// cpvRecPoints->Add(wPool->At(i));
cbd576a6 119
9a2cdbdf 120// wPool->Clear();
121// wPool->Compress();
cbd576a6 122
9a2cdbdf 123// wPoolF->Remove(recCpv);
124// delete recCpv;
cbd576a6 125
9a2cdbdf 126// AliInfo(Form(" %d", gime->CpvRecPoints()->GetEntries() )) ;
127// AliInfo(Form(" %d cpvRecPoints", cpvRecPoints->GetEntries() )) ;
cbd576a6 128
129
9a2cdbdf 130// // Now Emc reconstruction
cbd576a6 131
9a2cdbdf 132// AliPHOSRecEmcManager* recEmc = new AliPHOSRecEmcManager();
133// wPoolF->Add(recEmc);
cbd576a6 134
9a2cdbdf 135// for(iPoint=0; iPoint<gime->EmcRecPoints()->GetEntriesFast(); iPoint++) {
136// rp = new AliPHOSEvalRecPoint(iPoint, kFALSE);
137// rp->MakeJob();
138// }
cbd576a6 139
9a2cdbdf 140// pt.UpdateWorkingPool();
cbd576a6 141
9a2cdbdf 142// TObjArray * emcRecPoints = gime->EmcRecPoints() ;
143// Int_t nOldEmc = emcRecPoints->GetEntries();
144// emcRecPoints->Delete();
145// emcRecPoints->Compress();
cbd576a6 146
9a2cdbdf 147// for(i=0; i<wPool->GetEntries(); i++)
148// emcRecPoints->Add(wPool->At(i));
cbd576a6 149
9a2cdbdf 150// wPool->Clear();
151// wPool->Compress();
cbd576a6 152
9a2cdbdf 153// wPoolF->Remove(recEmc);
154// delete recEmc;
cbd576a6 155
9a2cdbdf 156// TString message ;
157// message = " %d OLD cpvRecPoints\n" ;
158// message += " %d\n" ;
159// message += " %d cpvRecPoints\n" ;
cbd576a6 160
9a2cdbdf 161// message += " %d OLD emcRecPoints " ;
162// message += " %d\n" ;
163// message += " %d emcRecPoints\n" ;
21cd0c07 164
9a2cdbdf 165// AliInfo(Form("%s", message.Data(),
166// nOldCpv,
167// gime->CpvRecPoints()->GetEntries(),cpvRecPoints->GetEntries(),
168// nOldEmc,
169// gime->EmcRecPoints()->GetEntries(), emcRecPoints->GetEntries() ));
ddd1a39c 170
9a2cdbdf 171// GetQualAssDataMaker()->Init(AliQualAss::kRECPOINTS) ;
172// GetQualAssDataMaker()->SetData(gime->EmcRecPoints()) ;
173// GetQualAssDataMaker()->Exec(AliQualAss::kRECPOINTS) ;
174// GetQualAssDataMaker()->SetData(gime->CpvRecPoints()) ;
175// GetQualAssDataMaker()->Exec(AliQualAss::kRECPOINTS) ;
cbd576a6 176
9a2cdbdf 177// WriteRecPoints();
cbd576a6 178
179
9a2cdbdf 180// } // loop over events
cbd576a6 181
9a2cdbdf 182// if(strstr(option,"tim")) {
183// gBenchmark->Stop("PHOSClusterizer");
184// AliInfo(Form("took %f seconds for Clusterizing", gBenchmark->GetCpuTime("PHOSClusterizer") )) ;
185// }
186// }
88cb7938 187
188//____________________________________________________________________________
cbd576a6 189Int_t AliPHOSClusterizerv2::AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) const
190{
191 // Points are neighbours if they have common edge.
192 // Points with common vertex are NOT neighbours.
193 // This treatment of neighbourship is the part of
194 // IHEP algorithm of clusterization.
195
196 // Gives the neighbourness of two digits = 0 are not neighbour but continue searching
197 // = 1 are neighbour
198 // = 2 are not neighbour but do not continue searching
199 // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster
200 // which is compared to a digit (d2) not yet in a cluster
201
cbd576a6 202 Int_t rv = 0 ;
203
204 Int_t relid1[4] ;
9a2cdbdf 205 fGeom->AbsToRelNumbering(d1->GetId(), relid1) ;
cbd576a6 206
207 Int_t relid2[4] ;
9a2cdbdf 208 fGeom->AbsToRelNumbering(d2->GetId(), relid2) ;
cbd576a6 209
210 if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module
211 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
212 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
213
214 if ( ( (coldiff < 1) && (rowdiff <= 1) ) || ( ( coldiff <= 1 ) && ( rowdiff < 1 ) ) ){
215 rv = 1 ;
216 }
217 else {
218 if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1))
219 rv = 2; // Difference in row numbers is too large to look further
220 }
221
222 }
223 else {
224
225 if( (relid1[0] < relid2[0]) || (relid1[1] < relid2[1]) )
226 rv=2 ;
227
228 }
229
cbd576a6 230 return rv ;
231
232}