2 #include "TBenchmark.h"
5 // --- Standard library ---
9 // --- AliRoot header files ---
10 #include "AliPHOSClusterizerv2.h"
11 #include "AliPHOSGetter.h"
13 #include "AliPHOSEvalRecPoint.h"
14 #include "AliPHOSRecCpvManager.h"
15 #include "AliPHOSRecEmcManager.h"
17 ClassImp(AliPHOSClusterizerv2)
19 AliPHOSClusterizerv2::AliPHOSClusterizerv2() : AliPHOSClusterizerv1()
22 AliPHOSClusterizerv2::AliPHOSClusterizerv2(const char* File, const char* name):
23 AliPHOSClusterizerv1(File,name)
26 void AliPHOSClusterizerv2::GetNumberOfClustersFound(int* numb) const
29 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
30 numb[0] = gime->EmcRecPoints()->GetEntries();
31 numb[1] = gime->CpvRecPoints()->GetEntries();
34 void AliPHOSClusterizerv2::Exec(Option_t* option)
37 if(strstr(option,"tim"))
38 gBenchmark->Start("PHOSClusterizer");
40 if(strstr(option,"print"))
43 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
45 TFolder* aliceF = (TFolder*)gROOT->FindObjectAny("YSAlice");
46 TFolder* storage = (TFolder*)aliceF->FindObject("WhiteBoard/RecPoints/PHOS");
47 TFolder* wPoolF = storage->AddFolder("SmP","SmartRecPoints for PHOS");
49 TObjArray* wPool = new TObjArray(400);
50 wPool->SetName("SmartPoints");
54 Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
57 for(ievent = 0; ievent<nevents; ievent++) {
59 gAlice->GetEvent(ievent) ;
60 gAlice->SetEvent(ievent) ;
62 gime->Event(ievent,"D") ;
63 // if(!ReadDigits(ievent)) //reads digits for event fEvent
66 cout<<" MakeClusters invoked..";
71 //SmartRecPoints will communicate with wPool.
73 AliPHOSEvalRecPoint* rp=0;
77 AliPHOSRecCpvManager* recCpv = new AliPHOSRecCpvManager();
80 Int_t iPoint; //loop variable
82 for(iPoint=0; iPoint<gime->CpvRecPoints()->GetEntriesFast(); iPoint++) {
83 rp = new AliPHOSEvalRecPoint(iPoint,AliPHOSEvalRecPoint::cpv);
87 AliPHOSEvalRecPoint pt;
88 pt.UpdateWorkingPool();
90 TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
91 Int_t nOldCpv = cpvRecPoints->GetEntries();
92 cpvRecPoints->Delete();
93 cpvRecPoints->Compress();
95 Int_t i; //loop variable
97 for(i=0; i<wPool->GetEntries(); i++)
98 cpvRecPoints->Add(wPool->At(i));
103 wPoolF->Remove(recCpv);
106 cout<<" "<<gime->CpvRecPoints()->GetEntries()<<endl;
107 cout<<" "<<cpvRecPoints->GetEntries()<<" cpvRecPoints."<<endl<<endl;
110 // Now Emc reconstruction
112 AliPHOSRecEmcManager* recEmc = new AliPHOSRecEmcManager();
115 for(iPoint=0; iPoint<gime->EmcRecPoints()->GetEntriesFast(); iPoint++) {
116 rp = new AliPHOSEvalRecPoint(iPoint,(Bool_t)AliPHOSEvalRecPoint::emc);
120 pt.UpdateWorkingPool();
122 TObjArray * emcRecPoints = gime->EmcRecPoints() ;
123 Int_t nOldEmc = emcRecPoints->GetEntries();
124 emcRecPoints->Delete();
125 emcRecPoints->Compress();
127 for(i=0; i<wPool->GetEntries(); i++)
128 emcRecPoints->Add(wPool->At(i));
133 wPoolF->Remove(recEmc);
136 cout<<" "<<nOldCpv<<" OLD cpvRecPoints."<<endl;
137 cout<<" "<<gime->CpvRecPoints()->GetEntries()<<endl;
138 cout<<" "<<cpvRecPoints->GetEntries()<<" cpvRecPoints."<<endl<<endl;
140 cout<<" "<<nOldEmc<<" OLD emcRecPoints."<<endl;
141 cout<<" "<<gime->EmcRecPoints()->GetEntries()<<endl;
142 cout<<" "<<emcRecPoints->GetEntries()<<" emcRecPoints."<<endl<<endl;
144 WriteRecPoints(ievent);
147 } // loop over events
149 if(strstr(option,"tim")) {
150 gBenchmark->Stop("PHOSClusterizer");
151 cout << "AliPHOSClusterizer:" << endl ;
152 cout << " took " << gBenchmark->GetCpuTime("PHOSClusterizer") << " seconds for Clusterizing " << endl;
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]) )
202 // //Do NOT clusterize upper PPSD // YVK 30.09.2001
203 // if( IsInPpsd(d1) && IsInPpsd(d2) &&
205 // relid1[1] < geom->GetNumberOfPadsPhi()*geom->GetNumberOfPadsPhi() ) rv = 2 ;