2 #include "TBenchmark.h"
5 // --- Standard library ---
7 // --- AliRoot header files ---
8 #include "AliPHOSClusterizerv2.h"
9 #include "AliPHOSGetter.h"
11 #include "AliPHOSEvalRecPoint.h"
12 #include "AliPHOSRecCpvManager.h"
13 #include "AliPHOSRecEmcManager.h"
15 ClassImp(AliPHOSClusterizerv2)
17 AliPHOSClusterizerv2::AliPHOSClusterizerv2() : AliPHOSClusterizerv1()
20 AliPHOSClusterizerv2::AliPHOSClusterizerv2(const char * headerFile, const char * name, const Bool_t toSplit):
21 AliPHOSClusterizerv1(headerFile,name,toSplit)
24 void AliPHOSClusterizerv2::GetNumberOfClustersFound(int* numb) const
27 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
28 numb[0] = gime->EmcRecPoints()->GetEntries();
29 numb[1] = gime->CpvRecPoints()->GetEntries();
32 void AliPHOSClusterizerv2::Exec(Option_t* option)
35 if(strstr(option,"tim"))
36 gBenchmark->Start("PHOSClusterizer");
38 if(strstr(option,"print"))
41 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
43 TFolder* storage = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData/RecPoints/PHOS"));
44 TFolder* wPoolF = storage->AddFolder("SmP","SmartRecPoints for PHOS");
46 TObjArray* wPool = new TObjArray(400);
47 wPool->SetName("SmartPoints");
51 Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
54 for(ievent = 0; ievent<nevents; ievent++) {
56 gAlice->GetEvent(ievent) ;
57 gAlice->SetEvent(ievent) ;
59 gime->Event(ievent,"D") ;
60 // if(!ReadDigits(ievent)) //reads digits for event fEvent
63 Info("Exec", "MakeClusters invoked..") ;
65 Info("Exec", "MakeClusters done.") ;
68 //SmartRecPoints will communicate with wPool.
70 AliPHOSEvalRecPoint* rp=0;
74 AliPHOSRecCpvManager* recCpv = new AliPHOSRecCpvManager();
77 Int_t iPoint; //loop variable
79 for(iPoint=0; iPoint<gime->CpvRecPoints()->GetEntriesFast(); iPoint++) {
80 rp = new AliPHOSEvalRecPoint(iPoint,AliPHOSEvalRecPoint::cpv);
84 AliPHOSEvalRecPoint pt;
85 pt.UpdateWorkingPool();
87 TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
88 Int_t nOldCpv = cpvRecPoints->GetEntries();
89 cpvRecPoints->Delete();
90 cpvRecPoints->Compress();
92 Int_t i; //loop variable
94 for(i=0; i<wPool->GetEntries(); i++)
95 cpvRecPoints->Add(wPool->At(i));
100 wPoolF->Remove(recCpv);
103 Info("Exec", " %d", gime->CpvRecPoints()->GetEntries() ) ;
104 Info("Exec", " %d cpvRecPoints", cpvRecPoints->GetEntries() ) ;
107 // Now Emc reconstruction
109 AliPHOSRecEmcManager* recEmc = new AliPHOSRecEmcManager();
112 for(iPoint=0; iPoint<gime->EmcRecPoints()->GetEntriesFast(); iPoint++) {
113 rp = new AliPHOSEvalRecPoint(iPoint,(Bool_t)AliPHOSEvalRecPoint::emc);
117 pt.UpdateWorkingPool();
119 TObjArray * emcRecPoints = gime->EmcRecPoints() ;
120 Int_t nOldEmc = emcRecPoints->GetEntries();
121 emcRecPoints->Delete();
122 emcRecPoints->Compress();
124 for(i=0; i<wPool->GetEntries(); i++)
125 emcRecPoints->Add(wPool->At(i));
130 wPoolF->Remove(recEmc);
134 message = " %d OLD cpvRecPoints\n" ;
136 message += " %d cpvRecPoints\n" ;
138 message += " %d OLD emcRecPoints " ;
140 message += " %d emcRecPoints\n" ;
142 Info("Exec", message.Data(),
144 gime->CpvRecPoints()->GetEntries(),cpvRecPoints->GetEntries(),
146 gime->EmcRecPoints()->GetEntries(), emcRecPoints->GetEntries() ) ;
148 WriteRecPoints(ievent);
151 } // loop over events
153 if(strstr(option,"tim")) {
154 gBenchmark->Stop("PHOSClusterizer");
155 Info("Exec","took %f seconds for Clusterizing", gBenchmark->GetCpuTime("PHOSClusterizer") ) ;
158 //---------------------------------------------------------------------------------
159 Int_t AliPHOSClusterizerv2::AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) const
161 // Points are neighbours if they have common edge.
162 // Points with common vertex are NOT neighbours.
163 // This treatment of neighbourship is the part of
164 // IHEP algorithm of clusterization.
166 // Gives the neighbourness of two digits = 0 are not neighbour but continue searching
168 // = 2 are not neighbour but do not continue searching
169 // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster
170 // which is compared to a digit (d2) not yet in a cluster
172 const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry();
177 geom->AbsToRelNumbering(d1->GetId(), relid1) ;
180 geom->AbsToRelNumbering(d2->GetId(), relid2) ;
182 if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module
183 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
184 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
186 if ( ( (coldiff < 1) && (rowdiff <= 1) ) || ( ( coldiff <= 1 ) && ( rowdiff < 1 ) ) ){
190 if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1))
191 rv = 2; // Difference in row numbers is too large to look further
197 if( (relid1[0] < relid2[0]) || (relid1[1] < relid2[1]) )