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 **************************************************************************/
19 //*-- Author: Boris Polichtchouk, IHEP
20 //////////////////////////////////////////////////////////////////////////////
21 // Clusterization class for IHEP reconstruction.
22 // Performs clusterization (collects neighbouring active cells)
23 // It differs from AliPHOSClusterizerv1 in neighbour definition only
25 // --- ROOT system ---
26 #include "TBenchmark.h"
29 // --- Standard library ---
31 // --- AliRoot header files ---
32 #include "AliPHOSClusterizerv2.h"
33 #include "AliPHOSGetter.h"
35 #include "AliPHOSEvalRecPoint.h"
36 #include "AliPHOSRecCpvManager.h"
37 #include "AliPHOSRecEmcManager.h"
39 ClassImp(AliPHOSClusterizerv2)
41 AliPHOSClusterizerv2::AliPHOSClusterizerv2() : AliPHOSClusterizerv1()
44 AliPHOSClusterizerv2::AliPHOSClusterizerv2(const char * headerFile, const char * name, const Bool_t toSplit):
45 AliPHOSClusterizerv1(headerFile,name,toSplit)
48 void AliPHOSClusterizerv2::GetNumberOfClustersFound(int* numb) const
50 // Returns the number of found EMC and CPV rec.points
52 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
53 numb[0] = gime->EmcRecPoints()->GetEntries();
54 numb[1] = gime->CpvRecPoints()->GetEntries();
57 void AliPHOSClusterizerv2::Exec(Option_t* option)
61 if(strstr(option,"tim"))
62 gBenchmark->Start("PHOSClusterizer");
64 if(strstr(option,"print"))
67 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
69 TFolder* storage = dynamic_cast<TFolder*>(gROOT->FindObjectAny("Folders/Run/Event/RecData/RecPoints/PHOS"));
70 TFolder* wPoolF = storage->AddFolder("SmP","SmartRecPoints for PHOS");
72 TObjArray* wPool = new TObjArray(400);
73 wPool->SetName("SmartPoints");
77 Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
80 for(ievent = 0; ievent<nevents; ievent++) {
82 gAlice->GetEvent(ievent) ;
83 gAlice->SetEvent(ievent) ;
85 gime->Event(ievent,"D") ;
86 // if(!ReadDigits(ievent)) //reads digits for event fEvent
89 Info("Exec", "MakeClusters invoked..") ;
91 Info("Exec", "MakeClusters done.") ;
94 //SmartRecPoints will communicate with wPool.
96 AliPHOSEvalRecPoint* rp=0;
100 AliPHOSRecCpvManager* recCpv = new AliPHOSRecCpvManager();
103 Int_t iPoint; //loop variable
105 for(iPoint=0; iPoint<gime->CpvRecPoints()->GetEntriesFast(); iPoint++) {
106 rp = new AliPHOSEvalRecPoint(iPoint,AliPHOSEvalRecPoint::cpv);
110 AliPHOSEvalRecPoint pt;
111 pt.UpdateWorkingPool();
113 TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
114 Int_t nOldCpv = cpvRecPoints->GetEntries();
115 cpvRecPoints->Delete();
116 cpvRecPoints->Compress();
118 Int_t i; //loop variable
120 for(i=0; i<wPool->GetEntries(); i++)
121 cpvRecPoints->Add(wPool->At(i));
126 wPoolF->Remove(recCpv);
129 Info("Exec", " %d", gime->CpvRecPoints()->GetEntries() ) ;
130 Info("Exec", " %d cpvRecPoints", cpvRecPoints->GetEntries() ) ;
133 // Now Emc reconstruction
135 AliPHOSRecEmcManager* recEmc = new AliPHOSRecEmcManager();
138 for(iPoint=0; iPoint<gime->EmcRecPoints()->GetEntriesFast(); iPoint++) {
139 rp = new AliPHOSEvalRecPoint(iPoint,(Bool_t)AliPHOSEvalRecPoint::emc);
143 pt.UpdateWorkingPool();
145 TObjArray * emcRecPoints = gime->EmcRecPoints() ;
146 Int_t nOldEmc = emcRecPoints->GetEntries();
147 emcRecPoints->Delete();
148 emcRecPoints->Compress();
150 for(i=0; i<wPool->GetEntries(); i++)
151 emcRecPoints->Add(wPool->At(i));
156 wPoolF->Remove(recEmc);
160 message = " %d OLD cpvRecPoints\n" ;
162 message += " %d cpvRecPoints\n" ;
164 message += " %d OLD emcRecPoints " ;
166 message += " %d emcRecPoints\n" ;
168 Info("Exec", message.Data(),
170 gime->CpvRecPoints()->GetEntries(),cpvRecPoints->GetEntries(),
172 gime->EmcRecPoints()->GetEntries(), emcRecPoints->GetEntries() ) ;
174 WriteRecPoints(ievent);
177 } // loop over events
179 if(strstr(option,"tim")) {
180 gBenchmark->Stop("PHOSClusterizer");
181 Info("Exec","took %f seconds for Clusterizing", gBenchmark->GetCpuTime("PHOSClusterizer") ) ;
184 //---------------------------------------------------------------------------------
185 Int_t AliPHOSClusterizerv2::AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) const
187 // Points are neighbours if they have common edge.
188 // Points with common vertex are NOT neighbours.
189 // This treatment of neighbourship is the part of
190 // IHEP algorithm of clusterization.
192 // Gives the neighbourness of two digits = 0 are not neighbour but continue searching
194 // = 2 are not neighbour but do not continue searching
195 // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster
196 // which is compared to a digit (d2) not yet in a cluster
198 const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry();
203 geom->AbsToRelNumbering(d1->GetId(), relid1) ;
206 geom->AbsToRelNumbering(d2->GetId(), relid2) ;
208 if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module
209 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
210 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
212 if ( ( (coldiff < 1) && (rowdiff <= 1) ) || ( ( coldiff <= 1 ) && ( rowdiff < 1 ) ) ){
216 if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1))
217 rv = 2; // Difference in row numbers is too large to look further
223 if( (relid1[0] < relid2[0]) || (relid1[1] < relid2[1]) )