1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //////////////////////////////////////////////////////////////////////////////
19 // Clusterization class for IHEP reconstruction.
20 // Performs clusterization (collects neighbouring active cells)
21 // It differs from AliPHOSClusterizerv1 in neighbour definition only
22 //*-- Author: Boris Polichtchouk, IHEP
24 // --- ROOT system ---
25 #include "TBenchmark.h"
27 // --- Standard library ---
29 // --- AliRoot header files ---
31 #include "AliPHOSClusterizerv2.h"
32 #include "AliPHOSEvalRecPoint.h"
33 #include "AliPHOSRecCpvManager.h"
34 #include "AliPHOSRecEmcManager.h"
35 #include "AliPHOSGeometry.h"
36 #include "AliPHOSDigit.h"
38 ClassImp(AliPHOSClusterizerv2)
40 //____________________________________________________________________________
41 AliPHOSClusterizerv2::AliPHOSClusterizerv2() : AliPHOSClusterizerv1()
44 //____________________________________________________________________________
45 AliPHOSClusterizerv2::AliPHOSClusterizerv2(AliPHOSGeometry *geom):
46 AliPHOSClusterizerv1(geom)
49 //____________________________________________________________________________
50 void AliPHOSClusterizerv2::GetNumberOfClustersFound(int* numb) const
52 // Returns the number of found EMC and CPV rec.points
54 numb[0] = fEMCRecPoints->GetEntries();
55 numb[1] = fCPVRecPoints->GetEntries();
58 //____________________________________________________________________________
59 void AliPHOSClusterizerv2::Digits2Clusters(Option_t* option)
63 if(strstr(option,"tim"))
64 gBenchmark->Start("PHOSClusterizer");
66 if(strstr(option,"print"))
69 // AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
71 // TFolder* wPoolF = gime->PhosLoader()->GetDetectorDataFolder();
73 // TObjArray* wPool = new TObjArray(400);
74 // wPool->SetName("SmartPoints");
75 // wPoolF->Add(wPool);
78 // Int_t nevents = gime->MaxEvent() ;
81 // for(ievent = 0; ievent<nevents; ievent++) {
83 // gime->Event(ievent,"D") ;
85 // AliInfo(Form("MakeClusters invoked..")) ;
87 // AliInfo(Form("MakeClusters done.")) ;
90 // //SmartRecPoints will communicate with wPool.
92 // AliPHOSEvalRecPoint* rp=0;
94 // // CPV reconstruction
96 // AliPHOSRecCpvManager* recCpv = new AliPHOSRecCpvManager();
97 // wPoolF->Add(recCpv);
99 // Int_t iPoint; //loop variable
101 // for(iPoint=0; iPoint<gime->CpvRecPoints()->GetEntriesFast(); iPoint++) {
102 // rp = new AliPHOSEvalRecPoint(iPoint, kTRUE);
106 // AliPHOSEvalRecPoint pt;
107 // pt.UpdateWorkingPool();
109 // TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
110 // Int_t nOldCpv = cpvRecPoints->GetEntries();
111 // cpvRecPoints->Delete();
112 // cpvRecPoints->Compress();
114 // Int_t i; //loop variable
116 // for(i=0; i<wPool->GetEntries(); i++)
117 // cpvRecPoints->Add(wPool->At(i));
120 // wPool->Compress();
122 // wPoolF->Remove(recCpv);
125 // AliInfo(Form(" %d", gime->CpvRecPoints()->GetEntries() )) ;
126 // AliInfo(Form(" %d cpvRecPoints", cpvRecPoints->GetEntries() )) ;
129 // // Now Emc reconstruction
131 // AliPHOSRecEmcManager* recEmc = new AliPHOSRecEmcManager();
132 // wPoolF->Add(recEmc);
134 // for(iPoint=0; iPoint<gime->EmcRecPoints()->GetEntriesFast(); iPoint++) {
135 // rp = new AliPHOSEvalRecPoint(iPoint, kFALSE);
139 // pt.UpdateWorkingPool();
141 // TObjArray * emcRecPoints = gime->EmcRecPoints() ;
142 // Int_t nOldEmc = emcRecPoints->GetEntries();
143 // emcRecPoints->Delete();
144 // emcRecPoints->Compress();
146 // for(i=0; i<wPool->GetEntries(); i++)
147 // emcRecPoints->Add(wPool->At(i));
150 // wPool->Compress();
152 // wPoolF->Remove(recEmc);
156 // message = " %d OLD cpvRecPoints\n" ;
157 // message += " %d\n" ;
158 // message += " %d cpvRecPoints\n" ;
160 // message += " %d OLD emcRecPoints " ;
161 // message += " %d\n" ;
162 // message += " %d emcRecPoints\n" ;
164 // AliInfo(Form("%s", message.Data(),
166 // gime->CpvRecPoints()->GetEntries(),cpvRecPoints->GetEntries(),
168 // gime->EmcRecPoints()->GetEntries(), emcRecPoints->GetEntries() ));
174 // } // loop over events
176 // if(strstr(option,"tim")) {
177 // gBenchmark->Stop("PHOSClusterizer");
178 // AliInfo(Form("took %f seconds for Clusterizing", gBenchmark->GetCpuTime("PHOSClusterizer") )) ;
182 //____________________________________________________________________________
183 Int_t AliPHOSClusterizerv2::AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) const
185 // Points are neighbours if they have common edge.
186 // Points with common vertex are NOT neighbours.
187 // This treatment of neighbourship is the part of
188 // IHEP algorithm of clusterization.
190 // Gives the neighbourness of two digits = 0 are not neighbour but continue searching
192 // = 2 are not neighbour but do not continue searching
193 // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster
194 // which is compared to a digit (d2) not yet in a cluster
199 fGeom->AbsToRelNumbering(d1->GetId(), relid1) ;
202 fGeom->AbsToRelNumbering(d2->GetId(), relid2) ;
204 if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module
205 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
206 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
208 if ( ( (coldiff < 1) && (rowdiff <= 1) ) || ( ( coldiff <= 1 ) && ( rowdiff < 1 ) ) ){
212 if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1))
213 rv = 2; // Difference in row numbers is too large to look further
219 if( (relid1[0] < relid2[0]) || (relid1[1] < relid2[1]) )