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 "AliPHOSQualAssDataMaker.h"
37 #include "AliPHOSDigit.h"
39 ClassImp(AliPHOSClusterizerv2)
41 //____________________________________________________________________________
42 AliPHOSClusterizerv2::AliPHOSClusterizerv2() : AliPHOSClusterizerv1()
45 //____________________________________________________________________________
46 AliPHOSClusterizerv2::AliPHOSClusterizerv2(AliPHOSGeometry *geom):
47 AliPHOSClusterizerv1(geom)
50 //____________________________________________________________________________
51 void AliPHOSClusterizerv2::GetNumberOfClustersFound(int* numb) const
53 // Returns the number of found EMC and CPV rec.points
55 numb[0] = fEMCRecPoints->GetEntries();
56 numb[1] = fCPVRecPoints->GetEntries();
59 //____________________________________________________________________________
60 void AliPHOSClusterizerv2::Digits2Clusters(Option_t* option)
64 if(strstr(option,"tim"))
65 gBenchmark->Start("PHOSClusterizer");
67 if(strstr(option,"print"))
70 // AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
72 // TFolder* wPoolF = gime->PhosLoader()->GetDetectorDataFolder();
74 // TObjArray* wPool = new TObjArray(400);
75 // wPool->SetName("SmartPoints");
76 // wPoolF->Add(wPool);
79 // Int_t nevents = gime->MaxEvent() ;
82 // for(ievent = 0; ievent<nevents; ievent++) {
84 // gime->Event(ievent,"D") ;
86 // AliInfo(Form("MakeClusters invoked..")) ;
88 // AliInfo(Form("MakeClusters done.")) ;
91 // //SmartRecPoints will communicate with wPool.
93 // AliPHOSEvalRecPoint* rp=0;
95 // // CPV reconstruction
97 // AliPHOSRecCpvManager* recCpv = new AliPHOSRecCpvManager();
98 // wPoolF->Add(recCpv);
100 // Int_t iPoint; //loop variable
102 // for(iPoint=0; iPoint<gime->CpvRecPoints()->GetEntriesFast(); iPoint++) {
103 // rp = new AliPHOSEvalRecPoint(iPoint, kTRUE);
107 // AliPHOSEvalRecPoint pt;
108 // pt.UpdateWorkingPool();
110 // TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
111 // Int_t nOldCpv = cpvRecPoints->GetEntries();
112 // cpvRecPoints->Delete();
113 // cpvRecPoints->Compress();
115 // Int_t i; //loop variable
117 // for(i=0; i<wPool->GetEntries(); i++)
118 // cpvRecPoints->Add(wPool->At(i));
121 // wPool->Compress();
123 // wPoolF->Remove(recCpv);
126 // AliInfo(Form(" %d", gime->CpvRecPoints()->GetEntries() )) ;
127 // AliInfo(Form(" %d cpvRecPoints", cpvRecPoints->GetEntries() )) ;
130 // // Now Emc reconstruction
132 // AliPHOSRecEmcManager* recEmc = new AliPHOSRecEmcManager();
133 // wPoolF->Add(recEmc);
135 // for(iPoint=0; iPoint<gime->EmcRecPoints()->GetEntriesFast(); iPoint++) {
136 // rp = new AliPHOSEvalRecPoint(iPoint, kFALSE);
140 // pt.UpdateWorkingPool();
142 // TObjArray * emcRecPoints = gime->EmcRecPoints() ;
143 // Int_t nOldEmc = emcRecPoints->GetEntries();
144 // emcRecPoints->Delete();
145 // emcRecPoints->Compress();
147 // for(i=0; i<wPool->GetEntries(); i++)
148 // emcRecPoints->Add(wPool->At(i));
151 // wPool->Compress();
153 // wPoolF->Remove(recEmc);
157 // message = " %d OLD cpvRecPoints\n" ;
158 // message += " %d\n" ;
159 // message += " %d cpvRecPoints\n" ;
161 // message += " %d OLD emcRecPoints " ;
162 // message += " %d\n" ;
163 // message += " %d emcRecPoints\n" ;
165 // AliInfo(Form("%s", message.Data(),
167 // gime->CpvRecPoints()->GetEntries(),cpvRecPoints->GetEntries(),
169 // gime->EmcRecPoints()->GetEntries(), emcRecPoints->GetEntries() ));
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) ;
180 // } // loop over events
182 // if(strstr(option,"tim")) {
183 // gBenchmark->Stop("PHOSClusterizer");
184 // AliInfo(Form("took %f seconds for Clusterizing", gBenchmark->GetCpuTime("PHOSClusterizer") )) ;
188 //____________________________________________________________________________
189 Int_t AliPHOSClusterizerv2::AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) const
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.
196 // Gives the neighbourness of two digits = 0 are not neighbour but continue searching
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
205 fGeom->AbsToRelNumbering(d1->GetId(), relid1) ;
208 fGeom->AbsToRelNumbering(d2->GetId(), relid2) ;
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] ) ;
214 if ( ( (coldiff < 1) && (rowdiff <= 1) ) || ( ( coldiff <= 1 ) && ( rowdiff < 1 ) ) ){
218 if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1))
219 rv = 2; // Difference in row numbers is too large to look further
225 if( (relid1[0] < relid2[0]) || (relid1[1] < relid2[1]) )