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 * headerFile, const char * name, const Bool_t toSplit):
23 AliPHOSClusterizerv1(headerFile,name,toSplit)
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* storage = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData/RecPoints/PHOS"));
46 TFolder* wPoolF = storage->AddFolder("SmP","SmartRecPoints for PHOS");
48 TObjArray* wPool = new TObjArray(400);
49 wPool->SetName("SmartPoints");
53 Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
56 for(ievent = 0; ievent<nevents; ievent++) {
58 gAlice->GetEvent(ievent) ;
59 gAlice->SetEvent(ievent) ;
61 gime->Event(ievent,"D") ;
62 // if(!ReadDigits(ievent)) //reads digits for event fEvent
65 cout<<" MakeClusters invoked..";
70 //SmartRecPoints will communicate with wPool.
72 AliPHOSEvalRecPoint* rp=0;
76 AliPHOSRecCpvManager* recCpv = new AliPHOSRecCpvManager();
79 Int_t iPoint; //loop variable
81 for(iPoint=0; iPoint<gime->CpvRecPoints()->GetEntriesFast(); iPoint++) {
82 rp = new AliPHOSEvalRecPoint(iPoint,AliPHOSEvalRecPoint::cpv);
86 AliPHOSEvalRecPoint pt;
87 pt.UpdateWorkingPool();
89 TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
90 Int_t nOldCpv = cpvRecPoints->GetEntries();
91 cpvRecPoints->Delete();
92 cpvRecPoints->Compress();
94 Int_t i; //loop variable
96 for(i=0; i<wPool->GetEntries(); i++)
97 cpvRecPoints->Add(wPool->At(i));
102 wPoolF->Remove(recCpv);
105 cout<<" "<<gime->CpvRecPoints()->GetEntries()<<endl;
106 cout<<" "<<cpvRecPoints->GetEntries()<<" cpvRecPoints."<<endl<<endl;
109 // Now Emc reconstruction
111 AliPHOSRecEmcManager* recEmc = new AliPHOSRecEmcManager();
114 for(iPoint=0; iPoint<gime->EmcRecPoints()->GetEntriesFast(); iPoint++) {
115 rp = new AliPHOSEvalRecPoint(iPoint,(Bool_t)AliPHOSEvalRecPoint::emc);
119 pt.UpdateWorkingPool();
121 TObjArray * emcRecPoints = gime->EmcRecPoints() ;
122 Int_t nOldEmc = emcRecPoints->GetEntries();
123 emcRecPoints->Delete();
124 emcRecPoints->Compress();
126 for(i=0; i<wPool->GetEntries(); i++)
127 emcRecPoints->Add(wPool->At(i));
132 wPoolF->Remove(recEmc);
135 cout<<" "<<nOldCpv<<" OLD cpvRecPoints."<<endl;
136 cout<<" "<<gime->CpvRecPoints()->GetEntries()<<endl;
137 cout<<" "<<cpvRecPoints->GetEntries()<<" cpvRecPoints."<<endl<<endl;
139 cout<<" "<<nOldEmc<<" OLD emcRecPoints."<<endl;
140 cout<<" "<<gime->EmcRecPoints()->GetEntries()<<endl;
141 cout<<" "<<emcRecPoints->GetEntries()<<" emcRecPoints."<<endl<<endl;
143 WriteRecPoints(ievent);
146 } // loop over events
148 if(strstr(option,"tim")) {
149 gBenchmark->Stop("PHOSClusterizer");
150 cout << "AliPHOSClusterizer:" << endl ;
151 cout << " took " << gBenchmark->GetCpuTime("PHOSClusterizer") << " seconds for Clusterizing " << endl;
157 //---------------------------------------------------------------------------------
158 Int_t AliPHOSClusterizerv2::AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) const
160 // Points are neighbours if they have common edge.
161 // Points with common vertex are NOT neighbours.
162 // This treatment of neighbourship is the part of
163 // IHEP algorithm of clusterization.
165 // Gives the neighbourness of two digits = 0 are not neighbour but continue searching
167 // = 2 are not neighbour but do not continue searching
168 // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster
169 // which is compared to a digit (d2) not yet in a cluster
171 const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry();
176 geom->AbsToRelNumbering(d1->GetId(), relid1) ;
179 geom->AbsToRelNumbering(d2->GetId(), relid2) ;
181 if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module
182 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
183 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
185 if ( ( (coldiff < 1) && (rowdiff <= 1) ) || ( ( coldiff <= 1 ) && ( rowdiff < 1 ) ) ){
189 if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1))
190 rv = 2; // Difference in row numbers is too large to look further
196 if( (relid1[0] < relid2[0]) || (relid1[1] < relid2[1]) )