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