]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSClusterizerv1.cxx
Timing added to reconstruction
[u/mrichter/AliRoot.git] / PHOS / AliPHOSClusterizerv1.cxx
CommitLineData
d15a28e7 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
b2a60966 16/* $Id$ */
17
d72dfbc3 18/* $Log:
19 1 October 2000. Yuri Kharlov:
20 AreNeighbours()
21 PPSD upper layer is considered if number of layers>1
22
23 18 October 2000. Yuri Kharlov:
24 AliPHOSClusterizerv1()
25 CPV clusterizing parameters added
26
27 MakeClusters()
28 After first PPSD digit remove EMC digits only once
29*/
9a1398dd 30//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (SUBATECH & Kurchatov Institute)
d15a28e7 31//////////////////////////////////////////////////////////////////////////////
9a1398dd 32// Clusterization class. Performs clusterization (collects neighbouring active cells) and
a4e98857 33// unfolds the clusters having several local maxima.
34// Results are stored in TreeR#, branches PHOSEmcRP (EMC recPoints),
9a1398dd 35// PHOSCpvRP (CPV RecPoints) and AliPHOSClusterizer (Clusterizer with all
f035f6ce 36// parameters including input digits branch title, thresholds etc.)
a4e98857 37// This TTask is normally called from Reconstructioner, but can as well be used in
38// standalone mode.
39// Use Case:
40// root [0] AliPHOSClusterizerv1 * cl = new AliPHOSClusterizerv1("galice.root")
41// Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated
9a1398dd 42// //reads gAlice from header file "..."
a4e98857 43// root [1] cl->ExecuteTask()
9a1398dd 44// //finds RecPoints in all events stored in galice.root
a4e98857 45// root [2] cl->SetDigitsBranch("digits2")
f035f6ce 46// //sets another title for Digitis (input) branch
a4e98857 47// root [3] cl->SetRecPointsBranch("recp2")
f035f6ce 48// //sets another title four output branches
a4e98857 49// root [4] cl->SetEmcLocalMaxCut(0.03)
9a1398dd 50// //set clusterization parameters
a4e98857 51// root [5] cl->ExecuteTask("deb all time")
9a1398dd 52// //once more finds RecPoints options are
53// // deb - print number of found rec points
54// // deb all - print number of found RecPoints and some their characteristics
55// // time - print benchmarking results
ed4205d8 56
d15a28e7 57// --- ROOT system ---
58
9a1398dd 59#include "TROOT.h"
60#include "TFile.h"
61#include "TFolder.h"
d15a28e7 62#include "TMath.h"
9a1398dd 63#include "TMinuit.h"
64#include "TTree.h"
65#include "TSystem.h"
66#include "TBenchmark.h"
d15a28e7 67
68// --- Standard library ---
69
de9ec31b 70#include <iostream.h>
9a1398dd 71#include <iomanip.h>
d15a28e7 72
73// --- AliRoot header files ---
74
75#include "AliPHOSClusterizerv1.h"
9a1398dd 76#include "AliPHOSCpvRecPoint.h"
d15a28e7 77#include "AliPHOSDigit.h"
9a1398dd 78#include "AliPHOSDigitizer.h"
d15a28e7 79#include "AliPHOSEmcRecPoint.h"
9a1398dd 80#include "AliPHOS.h"
7b7c1533 81#include "AliPHOSGetter.h"
9a1398dd 82#include "AliRun.h"
d15a28e7 83
84ClassImp(AliPHOSClusterizerv1)
f035f6ce 85
d15a28e7 86//____________________________________________________________________________
7b7c1533 87 AliPHOSClusterizerv1::AliPHOSClusterizerv1() : AliPHOSClusterizer()
d15a28e7 88{
f035f6ce 89 // default ctor (to be used mainly by Streamer)
f035f6ce 90
9a1398dd 91 fNumberOfCpvClusters = 0 ;
d15a28e7 92 fNumberOfEmcClusters = 0 ;
f035f6ce 93
9a1398dd 94 fCpvClusteringThreshold = 0.0;
c3c187e5 95 fEmcClusteringThreshold = 0.2;
9a1398dd 96
97 fEmcLocMaxCut = 0.03 ;
98 fCpvLocMaxCut = 0.03 ;
99
100 fW0 = 4.5 ;
101 fW0CPV = 4.0 ;
9a1398dd 102
9688c1dd 103 fEmcTimeGate = 1.e-8 ;
104
105 fToUnfold = kTRUE ;
106
7b7c1533 107 fHeaderFileName = "" ;
108 fDigitsBranchTitle = "" ;
9688c1dd 109 fRecPointsInRun = 0 ;
9a1398dd 110}
7b7c1533 111
9a1398dd 112//____________________________________________________________________________
7b7c1533 113AliPHOSClusterizerv1::AliPHOSClusterizerv1(const char* headerFile,const char* name)
114:AliPHOSClusterizer(headerFile, name)
9a1398dd 115{
a4e98857 116 // ctor with the indication of the file where header Tree and digits Tree are stored
9a1398dd 117
7b7c1533 118
9a1398dd 119 fNumberOfCpvClusters = 0 ;
120 fNumberOfEmcClusters = 0 ;
f035f6ce 121
ed4205d8 122 fCpvClusteringThreshold = 0.0;
9a1398dd 123 fEmcClusteringThreshold = 0.2;
9a1398dd 124
125 fEmcLocMaxCut = 0.03 ;
126 fCpvLocMaxCut = 0.03 ;
127
d15a28e7 128 fW0 = 4.5 ;
c3c187e5 129 fW0CPV = 4.0 ;
9688c1dd 130
131 fEmcTimeGate = 1.e-8 ;
9a1398dd 132
2bd5457f 133 fToUnfold = kTRUE ;
9a1398dd 134
7b7c1533 135 fHeaderFileName = GetTitle() ;
136 fDigitsBranchTitle = GetName() ;
9688c1dd 137
138 TString clusterizerName( GetName()) ;
139 clusterizerName.Append(":") ;
140 clusterizerName.Append(Version()) ;
141 SetName(clusterizerName) ;
2b60655b 142 fRecPointsInRun = 0 ;
143
2bd5457f 144 Init() ;
9a1398dd 145
146}
9688c1dd 147//____________________________________________________________________________
148 AliPHOSClusterizerv1::~AliPHOSClusterizerv1()
149{
150}
9a1398dd 151//____________________________________________________________________________
a4e98857 152void AliPHOSClusterizerv1::Exec(Option_t * option)
153{
7b7c1533 154 // Steering method
9a1398dd 155
7b7c1533 156 if( strcmp(GetName(), "")== 0 )
157 Init() ;
9a1398dd 158
159 if(strstr(option,"tim"))
7d493c2c 160 gBenchmark->Start("PHOSClusterizer");
9a1398dd 161
7b7c1533 162 if(strstr(option,"print"))
163 Print("") ;
164
127e12ac 165 gAlice->GetEvent(0) ;
9688c1dd 166
167 //check, if the branch with name of this" already exits?
7b7c1533 168 TObjArray * lob = (TObjArray*)gAlice->TreeR()->GetListOfBranches() ;
169 TIter next(lob) ;
170 TBranch * branch = 0 ;
171 Bool_t phosemcfound = kFALSE, phoscpvfound = kFALSE, clusterizerfound = kFALSE ;
7b7c1533 172
9688c1dd 173 TString branchname = GetName() ;
174 branchname.Remove(branchname.Index(Version())-1) ;
175
7b7c1533 176 while ( (branch = (TBranch*)next()) && (!phosemcfound || !phoscpvfound || !clusterizerfound) ) {
9688c1dd 177 if ( (strcmp(branch->GetName(), "PHOSEmcRP")==0) && (strcmp(branch->GetTitle(), branchname.Data())==0) )
7b7c1533 178 phosemcfound = kTRUE ;
179
9688c1dd 180 else if ( (strcmp(branch->GetName(), "PHOSCpvRP")==0) && (strcmp(branch->GetTitle(), branchname.Data())==0) )
7b7c1533 181 phoscpvfound = kTRUE ;
182
9688c1dd 183 else if ((strcmp(branch->GetName(), "AliPHOSClusterizer")==0) && (strcmp(branch->GetTitle(), GetName())==0) )
7b7c1533 184 clusterizerfound = kTRUE ;
185 }
186
187 if ( phoscpvfound || phosemcfound || clusterizerfound ) {
188 cerr << "WARNING: AliPHOSClusterizer::Exec -> Emc(Cpv)RecPoints and/or Clusterizer branch with name "
9688c1dd 189 << branchname.Data() << " already exits" << endl ;
7b7c1533 190 return ;
191 }
192
127e12ac 193 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
7b7c1533 194 Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
195 Int_t ievent ;
196
197 for(ievent = 0; ievent < nevents; ievent++){
01a599c9 198
127e12ac 199
9688c1dd 200 fPedestal = gime->Digitizer(branchname)->GetPedestal() ;
201 fSlope = gime->Digitizer(branchname)->GetSlope() ;
127e12ac 202
203
204 fNumberOfEmcClusters = 0 ;
205 fNumberOfCpvClusters = 0 ;
206
207 gime->Event(ievent,"D") ;
9688c1dd 208
209 // if(!ReadDigits(ievent)) continue; //reads digits for event ievent
210
9a1398dd 211 MakeClusters() ;
212
9688c1dd 213 if(fToUnfold) MakeUnfolding() ;
7b7c1533 214
215 WriteRecPoints(ievent) ;
216
9688c1dd 217 if(strstr(option,"deb")) PrintRecPoints(option) ;
9a1398dd 218 }
219
220 if(strstr(option,"tim")){
221 gBenchmark->Stop("PHOSClusterizer");
222 cout << "AliPHOSClusterizer:" << endl ;
223 cout << " took " << gBenchmark->GetCpuTime("PHOSClusterizer") << " seconds for Clusterizing "
7b7c1533 224 << gBenchmark->GetCpuTime("PHOSClusterizer")/nevents << " seconds per event " << endl ;
9a1398dd 225 cout << endl ;
226 }
227
9a1398dd 228}
229
230//____________________________________________________________________________
231Bool_t AliPHOSClusterizerv1::FindFit(AliPHOSEmcRecPoint * emcRP, int * maxAt, Float_t * maxAtEnergy,
d1de15f5 232 Int_t nPar, Float_t * fitparameters) const
9a1398dd 233{
234 // Calls TMinuit to fit the energy distribution of a cluster with several maxima
a4e98857 235 // The initial values for fitting procedure are set equal to the positions of local maxima.
f035f6ce 236 // Cluster will be fitted as a superposition of nPar/3 electromagnetic showers
9a1398dd 237
7b7c1533 238 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
239 TClonesArray * digits = gime->Digits() ;
240
241
9a1398dd 242 gMinuit->mncler(); // Reset Minuit's list of paramters
243 gMinuit->SetPrintLevel(-1) ; // No Printout
244 gMinuit->SetFCN(AliPHOSClusterizerv1::UnfoldingChiSquare) ;
245 // To set the address of the minimization function
246
247 TList * toMinuit = new TList();
248 toMinuit->AddAt(emcRP,0) ;
7b7c1533 249 toMinuit->AddAt(digits,1) ;
9a1398dd 250
251 gMinuit->SetObjectFit(toMinuit) ; // To tranfer pointer to UnfoldingChiSquare
252
253 // filling initial values for fit parameters
254 AliPHOSDigit * digit ;
255
256 Int_t ierflg = 0;
257 Int_t index = 0 ;
258 Int_t nDigits = (Int_t) nPar / 3 ;
259
260 Int_t iDigit ;
261
7b7c1533 262 const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
9a1398dd 263
264 for(iDigit = 0; iDigit < nDigits; iDigit++){
265 digit = (AliPHOSDigit *) maxAt[iDigit];
266
267 Int_t relid[4] ;
7b7c1533 268 Float_t x = 0.;
269 Float_t z = 0.;
270 geom->AbsToRelNumbering(digit->GetId(), relid) ;
271 geom->RelPosInModule(relid, x, z) ;
9a1398dd 272
273 Float_t energy = maxAtEnergy[iDigit] ;
274
275 gMinuit->mnparm(index, "x", x, 0.1, 0, 0, ierflg) ;
276 index++ ;
277 if(ierflg != 0){
278 cout << "PHOS Unfolding> Unable to set initial value for fit procedure : x = " << x << endl ;
279 return kFALSE;
280 }
281 gMinuit->mnparm(index, "z", z, 0.1, 0, 0, ierflg) ;
282 index++ ;
283 if(ierflg != 0){
284 cout << "PHOS Unfolding> Unable to set initial value for fit procedure : z = " << z << endl ;
285 return kFALSE;
286 }
287 gMinuit->mnparm(index, "Energy", energy , 0.05*energy, 0., 4.*energy, ierflg) ;
288 index++ ;
289 if(ierflg != 0){
290 cout << "PHOS Unfolding> Unable to set initial value for fit procedure : energy = " << energy << endl ;
291 return kFALSE;
292 }
293 }
294
295 Double_t p0 = 0.1 ; // "Tolerance" Evaluation stops when EDM = 0.0001*p0 ; The number of function call slightly
296 // depends on it.
297 Double_t p1 = 1.0 ;
298 Double_t p2 = 0.0 ;
299
300 gMinuit->mnexcm("SET STR", &p2, 0, ierflg) ; // force TMinuit to reduce function calls
301 gMinuit->mnexcm("SET GRA", &p1, 1, ierflg) ; // force TMinuit to use my gradient
302 gMinuit->SetMaxIterations(5);
303 gMinuit->mnexcm("SET NOW", &p2 , 0, ierflg) ; // No Warnings
304
305 gMinuit->mnexcm("MIGRAD", &p0, 0, ierflg) ; // minimize
306
307 if(ierflg == 4){ // Minimum not found
308 cout << "PHOS Unfolding> Fit not converged, cluster abandoned "<< endl ;
309 return kFALSE ;
310 }
311 for(index = 0; index < nPar; index++){
312 Double_t err ;
313 Double_t val ;
314 gMinuit->GetParameter(index, val, err) ; // Returns value and error of parameter index
315 fitparameters[index] = val ;
316 }
317
318 delete toMinuit ;
319 return kTRUE;
c3c187e5 320
d15a28e7 321}
322
323//____________________________________________________________________________
a4e98857 324void AliPHOSClusterizerv1::Init()
325{
2bd5457f 326 // Make all memory allocations which can not be done in default constructor.
327 // Attach the Clusterizer task to the list of PHOS tasks
7b7c1533 328
329 if ( strcmp(GetTitle(), "") == 0 )
330 SetTitle("galice.root") ;
2bd5457f 331
9688c1dd 332 TString branchname = GetName() ;
333 branchname.Remove(branchname.Index(Version())-1) ;
9a1398dd 334
9688c1dd 335 AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), branchname) ;
7b7c1533 336 if ( gime == 0 ) {
337 cerr << "ERROR: AliPHOSClusterizerv1::Init -> Could not obtain the Getter object !" << endl ;
338 return ;
339 }
340
341 if(!gMinuit)
342 gMinuit = new TMinuit(100) ;
343
127e12ac 344 gime->PostClusterizer(this) ;
7b7c1533 345 // create a folder on the white board //YSAlice/WhiteBoard/RecPoints/PHOS/recpointsName
9688c1dd 346 gime->PostRecPoints(branchname ) ;
127e12ac 347
9688c1dd 348 gime->PostDigits(branchname) ;
349 gime->PostDigitizer(branchname) ;
7b7c1533 350
9a1398dd 351}
7b7c1533 352
9a1398dd 353//____________________________________________________________________________
354Int_t AliPHOSClusterizerv1::AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)const
d15a28e7 355{
b2a60966 356 // Gives the neighbourness of two digits = 0 are not neighbour but continue searching
357 // = 1 are neighbour
358 // = 2 are not neighbour but do not continue searching
a4e98857 359 // neighbours are defined as digits having at least a common vertex
b2a60966 360 // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster
361 // which is compared to a digit (d2) not yet in a cluster
362
7b7c1533 363 const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ;
364
d15a28e7 365 Int_t rv = 0 ;
366
d15a28e7 367 Int_t relid1[4] ;
7b7c1533 368 geom->AbsToRelNumbering(d1->GetId(), relid1) ;
d15a28e7 369
370 Int_t relid2[4] ;
7b7c1533 371 geom->AbsToRelNumbering(d2->GetId(), relid2) ;
d15a28e7 372
9688c1dd 373 if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module
92862013 374 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
375 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
d15a28e7 376
92862013 377 if (( coldiff <= 1 ) && ( rowdiff <= 1 )){
9688c1dd 378 if((relid1[1] != 0) || (TMath::Abs(d1->GetTime() - d2->GetTime() ) < fEmcTimeGate))
d15a28e7 379 rv = 1 ;
380 }
381 else {
382 if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1))
383 rv = 2; // Difference in row numbers is too large to look further
384 }
385
386 }
387 else {
388
9688c1dd 389 if( (relid1[0] < relid2[0]) || (relid1[1] != relid2[1]) )
d15a28e7 390 rv=2 ;
391
392 }
d72dfbc3 393
d15a28e7 394 return rv ;
395}
396
d15a28e7 397
398//____________________________________________________________________________
9a1398dd 399Bool_t AliPHOSClusterizerv1::IsInEmc(AliPHOSDigit * digit) const
d15a28e7 400{
b2a60966 401 // Tells if (true) or not (false) the digit is in a PHOS-EMC module
402
9f616d61 403 Bool_t rv = kFALSE ;
7b7c1533 404 const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ;
d15a28e7 405
d15a28e7 406 Int_t relid[4] ;
7b7c1533 407 geom->AbsToRelNumbering(digit->GetId(), relid) ;
d15a28e7 408
ed4205d8 409 if ( relid[1] == 0 ) rv = kTRUE;
410
411 return rv ;
412}
413
ed4205d8 414//____________________________________________________________________________
9a1398dd 415Bool_t AliPHOSClusterizerv1::IsInCpv(AliPHOSDigit * digit) const
ed4205d8 416{
fad3e5b9 417 // Tells if (true) or not (false) the digit is in a PHOS-CPV module
ed4205d8 418
419 Bool_t rv = kFALSE ;
7b7c1533 420 const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ;
ed4205d8 421
422 Int_t relid[4] ;
7b7c1533 423 geom->AbsToRelNumbering(digit->GetId(), relid) ;
ed4205d8 424
9688c1dd 425 if ( relid[1] != 0 ) rv = kTRUE;
d15a28e7 426
427 return rv ;
428}
9a1398dd 429
430//____________________________________________________________________________
7b7c1533 431void AliPHOSClusterizerv1::WriteRecPoints(Int_t event)
a4e98857 432{
7b7c1533 433
434 // Creates new branches with given title
a4e98857 435 // fills and writes into TreeR.
9688c1dd 436
437 TString branchName(GetName() ) ;
438 branchName.Remove(branchName.Index(Version())-1) ;
439
7b7c1533 440 AliPHOSGetter *gime = AliPHOSGetter::GetInstance() ;
127e12ac 441 TObjArray * emcRecPoints = gime->EmcRecPoints(branchName) ;
442 TObjArray * cpvRecPoints = gime->CpvRecPoints(branchName) ;
443 TClonesArray * digits = gime->Digits(branchName) ;
7b7c1533 444
9a1398dd 445 Int_t index ;
01a599c9 446 //Evaluate position, dispersion and other RecPoint properties...
7b7c1533 447 for(index = 0; index < emcRecPoints->GetEntries(); index++)
448 ((AliPHOSEmcRecPoint *)emcRecPoints->At(index))->EvalAll(fW0,digits) ;
9a1398dd 449
7b7c1533 450 emcRecPoints->Sort() ;
9a1398dd 451
7b7c1533 452 for(index = 0; index < emcRecPoints->GetEntries(); index++)
453 ((AliPHOSEmcRecPoint *)emcRecPoints->At(index))->SetIndexInList(index) ;
9a1398dd 454
7b7c1533 455 emcRecPoints->Expand(emcRecPoints->GetEntriesFast()) ;
761e34c0 456
9a1398dd 457 //Now the same for CPV
7b7c1533 458 for(index = 0; index < cpvRecPoints->GetEntries(); index++)
459 ((AliPHOSRecPoint *)cpvRecPoints->At(index))->EvalAll(fW0CPV,digits) ;
9a1398dd 460
7b7c1533 461 cpvRecPoints->Sort() ;
9a1398dd 462
7b7c1533 463 for(index = 0; index < cpvRecPoints->GetEntries(); index++)
464 ((AliPHOSRecPoint *)cpvRecPoints->At(index))->SetIndexInList(index) ;
9a1398dd 465
7b7c1533 466 cpvRecPoints->Expand(cpvRecPoints->GetEntriesFast()) ;
9a1398dd 467
9a1398dd 468 //Make branches in TreeR for RecPoints and Clusterizer
469 char * filename = 0;
470 if(gSystem->Getenv("CONFIG_SPLIT_FILE")!=0){ //generating file name
471 filename = new char[strlen(gAlice->GetBaseFile())+20] ;
472 sprintf(filename,"%s/PHOS.Reco.root",gAlice->GetBaseFile()) ;
473 }
474
475 //Make new branches
476 TDirectory *cwd = gDirectory;
477
7b7c1533 478
9a1398dd 479 Int_t bufferSize = 32000 ;
480 Int_t splitlevel = 0 ;
01a599c9 481
482 //First EMC
7b7c1533 483 TBranch * emcBranch = gAlice->TreeR()->Branch("PHOSEmcRP","TObjArray",&emcRecPoints,bufferSize,splitlevel);
484 emcBranch->SetTitle(branchName);
9a1398dd 485 if (filename) {
486 emcBranch->SetFile(filename);
487 TIter next( emcBranch->GetListOfBranches());
761e34c0 488 TBranch * sb ;
489 while ((sb=(TBranch*)next())) {
490 sb->SetFile(filename);
9a1398dd 491 }
01a599c9 492
9a1398dd 493 cwd->cd();
494 }
495
496 //Now CPV branch
7b7c1533 497 TBranch * cpvBranch = gAlice->TreeR()->Branch("PHOSCpvRP","TObjArray",&cpvRecPoints,bufferSize,splitlevel);
498 cpvBranch->SetTitle(branchName);
9a1398dd 499 if (filename) {
500 cpvBranch->SetFile(filename);
501 TIter next( cpvBranch->GetListOfBranches());
761e34c0 502 TBranch * sb;
503 while ((sb=(TBranch*)next())) {
504 sb->SetFile(filename);
9a1398dd 505 }
506 cwd->cd();
507 }
508
509 //And Finally clusterizer branch
127e12ac 510 AliPHOSClusterizerv1 * cl = (AliPHOSClusterizerv1*)gime->Clusterizer(branchName) ;
7b7c1533 511 TBranch * clusterizerBranch = gAlice->TreeR()->Branch("AliPHOSClusterizer","AliPHOSClusterizerv1",
9a1398dd 512 &cl,bufferSize,splitlevel);
7b7c1533 513 clusterizerBranch->SetTitle(branchName);
9a1398dd 514 if (filename) {
515 clusterizerBranch->SetFile(filename);
516 TIter next( clusterizerBranch->GetListOfBranches());
761e34c0 517 TBranch * sb ;
518 while ((sb=(TBranch*)next())) {
519 sb->SetFile(filename);
9a1398dd 520 }
521 cwd->cd();
522 }
01a599c9 523 emcBranch ->Fill() ;
524 cpvBranch ->Fill() ;
761e34c0 525 clusterizerBranch->Fill() ;
eec3ac52 526
9a1398dd 527 gAlice->TreeR()->Write(0,kOverwrite) ;
528
529}
530
531//____________________________________________________________________________
532void AliPHOSClusterizerv1::MakeClusters()
533{
534 // Steering method to construct the clusters stored in a list of Reconstructed Points
535 // A cluster is defined as a list of neighbour digits
127e12ac 536 TString branchName(GetName()) ;
537 branchName.Remove(branchName.Index(Version())-1) ;
d15a28e7 538
7b7c1533 539 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
540
127e12ac 541 TObjArray * emcRecPoints = gime->EmcRecPoints(branchName) ;
542 TObjArray * cpvRecPoints = gime->CpvRecPoints(branchName) ;
7d493c2c 543 emcRecPoints->Delete() ;
544 cpvRecPoints->Delete() ;
7b7c1533 545
127e12ac 546 TClonesArray * digits = gime->Digits(branchName) ;
7b7c1533 547 TClonesArray * digitsC = (TClonesArray*)digits->Clone() ;
548
549
d15a28e7 550 // Clusterization starts
9a1398dd 551
7b7c1533 552 TIter nextdigit(digitsC) ;
d15a28e7 553 AliPHOSDigit * digit ;
92862013 554 Bool_t notremoved = kTRUE ;
6ad0bfa0 555
7b7c1533 556 while ( (digit = (AliPHOSDigit *)nextdigit()) ) { // scan over the list of digitsC
9a1398dd 557 AliPHOSRecPoint * clu = 0 ;
c161df70 558
d1de15f5 559 TArrayI clusterdigitslist(1500) ;
d15a28e7 560 Int_t index ;
f2bc1b87 561
b73f246d 562 if (( IsInEmc (digit) && Calibrate(digit->GetAmp()) > fEmcClusteringThreshold ) ||
b73f246d 563 ( IsInCpv (digit) && Calibrate(digit->GetAmp()) > fCpvClusteringThreshold ) ) {
f2bc1b87 564
d15a28e7 565 Int_t iDigitInCluster = 0 ;
7b7c1533 566
6ad0bfa0 567 if ( IsInEmc(digit) ) {
83974468 568 // start a new EMC RecPoint
7b7c1533 569 if(fNumberOfEmcClusters >= emcRecPoints->GetSize())
570 emcRecPoints->Expand(2*fNumberOfEmcClusters+1) ;
571
572 emcRecPoints->AddAt(new AliPHOSEmcRecPoint(), fNumberOfEmcClusters) ;
573 clu = (AliPHOSEmcRecPoint *) emcRecPoints->At(fNumberOfEmcClusters) ;
7f5d510c 574 fNumberOfEmcClusters++ ;
9f616d61 575 clu->AddDigit(*digit, Calibrate(digit->GetAmp())) ;
9a1398dd 576 clusterdigitslist[iDigitInCluster] = digit->GetIndexInList() ;
9f616d61 577 iDigitInCluster++ ;
7b7c1533 578 digitsC->Remove(digit) ;
ca77b032 579
d72dfbc3 580 } else {
83974468 581
9688c1dd 582 // start a new CPV cluster
7b7c1533 583 if(fNumberOfCpvClusters >= cpvRecPoints->GetSize())
584 cpvRecPoints->Expand(2*fNumberOfCpvClusters+1);
585
9688c1dd 586 cpvRecPoints->AddAt(new AliPHOSCpvRecPoint(), fNumberOfCpvClusters) ;
fad3e5b9 587
9688c1dd 588 clu = (AliPHOSCpvRecPoint *) cpvRecPoints->At(fNumberOfCpvClusters) ;
7b7c1533 589 fNumberOfCpvClusters++ ;
6ad0bfa0 590 clu->AddDigit(*digit, Calibrate(digit->GetAmp()) ) ;
9a1398dd 591 clusterdigitslist[iDigitInCluster] = digit->GetIndexInList() ;
9f616d61 592 iDigitInCluster++ ;
7b7c1533 593 digitsC->Remove(digit) ;
d15a28e7 594 nextdigit.Reset() ;
595
7b7c1533 596 // Here we remove remaining EMC digits, which cannot make a cluster
fad3e5b9 597
92862013 598 if( notremoved ) {
9f616d61 599 while( ( digit = (AliPHOSDigit *)nextdigit() ) ) {
9f616d61 600 if( IsInEmc(digit) )
7b7c1533 601 digitsC->Remove(digit) ;
d15a28e7 602 else
603 break ;
d72dfbc3 604 }
605 notremoved = kFALSE ;
606 }
d15a28e7 607
608 } // else
609
610 nextdigit.Reset() ;
fad3e5b9 611
d15a28e7 612 AliPHOSDigit * digitN ;
613 index = 0 ;
9f616d61 614 while (index < iDigitInCluster){ // scan over digits already in cluster
7b7c1533 615 digit = (AliPHOSDigit*)digits->At(clusterdigitslist[index]) ;
9f616d61 616 index++ ;
d15a28e7 617 while ( (digitN = (AliPHOSDigit *)nextdigit()) ) { // scan over the reduced list of digits
d72dfbc3 618 Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!!
d15a28e7 619 switch (ineb ) {
9f616d61 620 case 0 : // not a neighbour
d72dfbc3 621 break ;
9f616d61 622 case 1 : // are neighbours
83974468 623 clu->AddDigit(*digitN, Calibrate( digitN->GetAmp() ) ) ;
9a1398dd 624 clusterdigitslist[iDigitInCluster] = digitN->GetIndexInList() ;
9f616d61 625 iDigitInCluster++ ;
7b7c1533 626 digitsC->Remove(digitN) ;
d15a28e7 627 break ;
9f616d61 628 case 2 : // too far from each other
d15a28e7 629 goto endofloop;
630 } // switch
631
632 } // while digitN
fad3e5b9 633
d15a28e7 634 endofloop: ;
635 nextdigit.Reset() ;
636
637 } // loop over cluster
ad8cfaf4 638
ad8cfaf4 639 } // energy theshold
ad8cfaf4 640
31aa6d6c 641
d15a28e7 642 } // while digit
643
7b7c1533 644 delete digitsC ;
9688c1dd 645
9a1398dd 646}
647
648//____________________________________________________________________________
a4e98857 649void AliPHOSClusterizerv1::MakeUnfolding()
650{
651 // Unfolds clusters using the shape of an ElectroMagnetic shower
9688c1dd 652 // Performs unfolding of all EMC/CPV clusters
9a1398dd 653
7b7c1533 654 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
655
656 const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
657 TObjArray * emcRecPoints = gime->EmcRecPoints() ;
658 TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
659 TClonesArray * digits = gime->Digits() ;
660
a4e98857 661 // Unfold first EMC clusters
9a1398dd 662 if(fNumberOfEmcClusters > 0){
663
7b7c1533 664 Int_t nModulesToUnfold = geom->GetNModules() ;
9a1398dd 665
666 Int_t numberofNotUnfolded = fNumberOfEmcClusters ;
667 Int_t index ;
668 for(index = 0 ; index < numberofNotUnfolded ; index++){
669
7b7c1533 670 AliPHOSEmcRecPoint * emcRecPoint = (AliPHOSEmcRecPoint *) emcRecPoints->At(index) ;
9a1398dd 671 if(emcRecPoint->GetPHOSMod()> nModulesToUnfold)
672 break ;
673
674 Int_t nMultipl = emcRecPoint->GetMultiplicity() ;
675 Int_t * maxAt = new Int_t[nMultipl] ;
676 Float_t * maxAtEnergy = new Float_t[nMultipl] ;
7b7c1533 677 Int_t nMax = emcRecPoint->GetNumberOfLocalMax(maxAt, maxAtEnergy,fEmcLocMaxCut,digits) ;
9a1398dd 678
679 if( nMax > 1 ) { // if cluster is very flat (no pronounced maximum) then nMax = 0
680 UnfoldCluster(emcRecPoint, nMax, maxAt, maxAtEnergy) ;
7b7c1533 681 emcRecPoints->Remove(emcRecPoint);
682 emcRecPoints->Compress() ;
9a1398dd 683 index-- ;
684 fNumberOfEmcClusters -- ;
685 numberofNotUnfolded-- ;
686 }
687
688 delete[] maxAt ;
689 delete[] maxAtEnergy ;
690 }
691 }
a4e98857 692 // Unfolding of EMC clusters finished
9a1398dd 693
694
a4e98857 695 // Unfold now CPV clusters
9a1398dd 696 if(fNumberOfCpvClusters > 0){
697
9688c1dd 698 Int_t nModulesToUnfold = geom->GetNModules() ;
9a1398dd 699
700 Int_t numberofCpvNotUnfolded = fNumberOfCpvClusters ;
701 Int_t index ;
702 for(index = 0 ; index < numberofCpvNotUnfolded ; index++){
703
7b7c1533 704 AliPHOSRecPoint * recPoint = (AliPHOSRecPoint *) cpvRecPoints->At(index) ;
9a1398dd 705
706 if(recPoint->GetPHOSMod()> nModulesToUnfold)
707 break ;
708
709 AliPHOSEmcRecPoint * emcRecPoint = (AliPHOSEmcRecPoint*) recPoint ;
710
711 Int_t nMultipl = emcRecPoint->GetMultiplicity() ;
712 Int_t * maxAt = new Int_t[nMultipl] ;
713 Float_t * maxAtEnergy = new Float_t[nMultipl] ;
7b7c1533 714 Int_t nMax = emcRecPoint->GetNumberOfLocalMax(maxAt, maxAtEnergy,fCpvLocMaxCut,digits) ;
9a1398dd 715
716 if( nMax > 1 ) { // if cluster is very flat (no pronounced maximum) then nMax = 0
717 UnfoldCluster(emcRecPoint, nMax, maxAt, maxAtEnergy) ;
7b7c1533 718 cpvRecPoints->Remove(emcRecPoint);
719 cpvRecPoints->Compress() ;
9a1398dd 720 index-- ;
721 numberofCpvNotUnfolded-- ;
722 fNumberOfCpvClusters-- ;
723 }
724
725 delete[] maxAt ;
726 delete[] maxAtEnergy ;
727 }
728 }
729 //Unfolding of Cpv clusters finished
730
731}
732
9a1398dd 733//____________________________________________________________________________
734Double_t AliPHOSClusterizerv1::ShowerShape(Double_t r)
735{
736 // Shape of the shower (see PHOS TDR)
a4e98857 737 // If you change this function, change also the gradient evaluation in ChiSquare()
9a1398dd 738
739 Double_t r4 = r*r*r*r ;
740 Double_t r295 = TMath::Power(r, 2.95) ;
741 Double_t shape = TMath::Exp( -r4 * (1. / (2.32 + 0.26 * r4) + 0.0316 / (1 + 0.0652 * r295) ) ) ;
742 return shape ;
743}
744
745//____________________________________________________________________________
746void AliPHOSClusterizerv1::UnfoldCluster(AliPHOSEmcRecPoint * iniEmc,
747 Int_t nMax,
748 int * maxAt,
749 Float_t * maxAtEnergy)
750{
751 // Performs the unfolding of a cluster with nMax overlapping showers
752
7b7c1533 753 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
754 const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
755 TClonesArray * digits = gime->Digits() ;
756 TObjArray * emcRecPoints = gime->EmcRecPoints() ;
757 TObjArray * cpvRecPoints = gime->CpvRecPoints() ;
758
9a1398dd 759 Int_t nPar = 3 * nMax ;
760 Float_t * fitparameters = new Float_t[nPar] ;
761
762 Bool_t rv = FindFit(iniEmc, maxAt, maxAtEnergy, nPar, fitparameters) ;
763 if( !rv ) {
764 // Fit failed, return and remove cluster
765 delete[] fitparameters ;
766 return ;
767 }
768
769 // create ufolded rec points and fill them with new energy lists
770 // First calculate energy deposited in each sell in accordance with fit (without fluctuations): efit[]
771 // and later correct this number in acordance with actual energy deposition
772
773 Int_t nDigits = iniEmc->GetMultiplicity() ;
774 Float_t * efit = new Float_t[nDigits] ;
7b7c1533 775 Float_t xDigit=0.,zDigit=0.,distance=0. ;
776 Float_t xpar=0.,zpar=0.,epar=0. ;
9a1398dd 777 Int_t relid[4] ;
7b7c1533 778 AliPHOSDigit * digit = 0 ;
9a1398dd 779 Int_t * emcDigits = iniEmc->GetDigitsList() ;
780
781 Int_t iparam ;
782 Int_t iDigit ;
783 for(iDigit = 0 ; iDigit < nDigits ; iDigit ++){
7b7c1533 784 digit = (AliPHOSDigit*) digits->At(emcDigits[iDigit] ) ;
785 geom->AbsToRelNumbering(digit->GetId(), relid) ;
786 geom->RelPosInModule(relid, xDigit, zDigit) ;
9a1398dd 787 efit[iDigit] = 0;
788
789 iparam = 0 ;
790 while(iparam < nPar ){
791 xpar = fitparameters[iparam] ;
792 zpar = fitparameters[iparam+1] ;
793 epar = fitparameters[iparam+2] ;
794 iparam += 3 ;
795 distance = (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) ;
796 distance = TMath::Sqrt(distance) ;
797 efit[iDigit] += epar * ShowerShape(distance) ;
798 }
799 }
800
801
802 // Now create new RecPoints and fill energy lists with efit corrected to fluctuations
803 // so that energy deposited in each cell is distributed betwin new clusters proportionally
804 // to its contribution to efit
805
806 Float_t * emcEnergies = iniEmc->GetEnergiesList() ;
807 Float_t ratio ;
808
809 iparam = 0 ;
810 while(iparam < nPar ){
811 xpar = fitparameters[iparam] ;
812 zpar = fitparameters[iparam+1] ;
813 epar = fitparameters[iparam+2] ;
814 iparam += 3 ;
815
7b7c1533 816 AliPHOSEmcRecPoint * emcRP = 0 ;
9a1398dd 817
818 if(iniEmc->IsEmc()){ //create new entries in fEmcRecPoints...
819
7b7c1533 820 if(fNumberOfEmcClusters >= emcRecPoints->GetSize())
821 emcRecPoints->Expand(2*fNumberOfEmcClusters) ;
9a1398dd 822
7b7c1533 823 (*emcRecPoints)[fNumberOfEmcClusters] = new AliPHOSEmcRecPoint() ;
824 emcRP = (AliPHOSEmcRecPoint *) emcRecPoints->At(fNumberOfEmcClusters);
9a1398dd 825 fNumberOfEmcClusters++ ;
826 }
827 else{//create new entries in fCpvRecPoints
7b7c1533 828 if(fNumberOfCpvClusters >= cpvRecPoints->GetSize())
829 cpvRecPoints->Expand(2*fNumberOfCpvClusters) ;
9a1398dd 830
7b7c1533 831 (*cpvRecPoints)[fNumberOfCpvClusters] = new AliPHOSCpvRecPoint() ;
832 emcRP = (AliPHOSEmcRecPoint *) cpvRecPoints->At(fNumberOfCpvClusters);
9a1398dd 833 fNumberOfCpvClusters++ ;
834 }
835
836 Float_t eDigit ;
837 for(iDigit = 0 ; iDigit < nDigits ; iDigit ++){
7b7c1533 838 digit = (AliPHOSDigit*) digits->At( emcDigits[iDigit] ) ;
839 geom->AbsToRelNumbering(digit->GetId(), relid) ;
840 geom->RelPosInModule(relid, xDigit, zDigit) ;
9a1398dd 841 distance = (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) ;
842 distance = TMath::Sqrt(distance) ;
843 ratio = epar * ShowerShape(distance) / efit[iDigit] ;
844 eDigit = emcEnergies[iDigit] * ratio ;
845 emcRP->AddDigit( *digit, eDigit ) ;
846 }
847 }
848
849 delete[] fitparameters ;
850 delete[] efit ;
851
852}
853
854//_____________________________________________________________________________
855void AliPHOSClusterizerv1::UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Double_t & fret, Double_t * x, Int_t iflag)
856{
a4e98857 857 // Calculates the Chi square for the cluster unfolding minimization
9a1398dd 858 // Number of parameters, Gradient, Chi squared, parameters, what to do
859
860
861 TList * toMinuit = (TList*) gMinuit->GetObjectFit() ;
862
863 AliPHOSEmcRecPoint * emcRP = (AliPHOSEmcRecPoint*) toMinuit->At(0) ;
864 TClonesArray * digits = (TClonesArray*)toMinuit->At(1) ;
865
866
867
868 // AliPHOSEmcRecPoint * emcRP = (AliPHOSEmcRecPoint *) gMinuit->GetObjectFit() ; // EmcRecPoint to fit
869
870 Int_t * emcDigits = emcRP->GetDigitsList() ;
871
7b7c1533 872 Int_t nOdigits = emcRP->GetDigitsMultiplicity() ;
9a1398dd 873
874 Float_t * emcEnergies = emcRP->GetEnergiesList() ;
875
01a599c9 876 const AliPHOSGeometry * geom = AliPHOSGetter::GetInstance()->PHOSGeometry() ;
9a1398dd 877 fret = 0. ;
878 Int_t iparam ;
879
880 if(iflag == 2)
881 for(iparam = 0 ; iparam < nPar ; iparam++)
882 Grad[iparam] = 0 ; // Will evaluate gradient
883
884 Double_t efit ;
885
886 AliPHOSDigit * digit ;
887 Int_t iDigit ;
888
7b7c1533 889 for( iDigit = 0 ; iDigit < nOdigits ; iDigit++) {
9a1398dd 890
891 digit = (AliPHOSDigit*) digits->At( emcDigits[iDigit] ) ;
892
893 Int_t relid[4] ;
894 Float_t xDigit ;
895 Float_t zDigit ;
896
897 geom->AbsToRelNumbering(digit->GetId(), relid) ;
898
899 geom->RelPosInModule(relid, xDigit, zDigit) ;
900
901 if(iflag == 2){ // calculate gradient
902 Int_t iParam = 0 ;
903 efit = 0 ;
904 while(iParam < nPar ){
905 Double_t distance = (xDigit - x[iParam]) * (xDigit - x[iParam]) ;
906 iParam++ ;
907 distance += (zDigit - x[iParam]) * (zDigit - x[iParam]) ;
908 distance = TMath::Sqrt( distance ) ;
909 iParam++ ;
910 efit += x[iParam] * ShowerShape(distance) ;
911 iParam++ ;
912 }
913 Double_t sum = 2. * (efit - emcEnergies[iDigit]) / emcEnergies[iDigit] ; // Here we assume, that sigma = sqrt(E)
914 iParam = 0 ;
915 while(iParam < nPar ){
916 Double_t xpar = x[iParam] ;
917 Double_t zpar = x[iParam+1] ;
918 Double_t epar = x[iParam+2] ;
919 Double_t dr = TMath::Sqrt( (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) );
920 Double_t shape = sum * ShowerShape(dr) ;
921 Double_t r4 = dr*dr*dr*dr ;
922 Double_t r295 = TMath::Power(dr,2.95) ;
923 Double_t deriv =-4. * dr*dr * ( 2.32 / ( (2.32 + 0.26 * r4) * (2.32 + 0.26 * r4) ) +
924 0.0316 * (1. + 0.0171 * r295) / ( ( 1. + 0.0652 * r295) * (1. + 0.0652 * r295) ) ) ;
925
926 Grad[iParam] += epar * shape * deriv * (xpar - xDigit) ; // Derivative over x
927 iParam++ ;
928 Grad[iParam] += epar * shape * deriv * (zpar - zDigit) ; // Derivative over z
929 iParam++ ;
930 Grad[iParam] += shape ; // Derivative over energy
931 iParam++ ;
932 }
933 }
934 efit = 0;
935 iparam = 0 ;
936
937 while(iparam < nPar ){
938 Double_t xpar = x[iparam] ;
939 Double_t zpar = x[iparam+1] ;
940 Double_t epar = x[iparam+2] ;
941 iparam += 3 ;
942 Double_t distance = (xDigit - xpar) * (xDigit - xpar) + (zDigit - zpar) * (zDigit - zpar) ;
943 distance = TMath::Sqrt(distance) ;
944 efit += epar * ShowerShape(distance) ;
945 }
946
947 fret += (efit-emcEnergies[iDigit])*(efit-emcEnergies[iDigit])/emcEnergies[iDigit] ;
948 // Here we assume, that sigma = sqrt(E)
949 }
83974468 950
d15a28e7 951}
952
953//____________________________________________________________________________
9a1398dd 954void AliPHOSClusterizerv1::Print(Option_t * option)const
d15a28e7 955{
d1de15f5 956 // Print clusterizer parameters
957
7b7c1533 958 if( strcmp(GetName(), "") !=0 ){
9a1398dd 959
960 // Print parameters
7b7c1533 961
962 TString taskName(GetName()) ;
963 taskName.ReplaceAll(Version(), "") ;
964
965 cout << "---------------"<< taskName.Data() << " " << GetTitle()<< "-----------" << endl
9a1398dd 966 << "Clusterizing digits from the file: " << fHeaderFileName.Data() << endl
967 << " Branch: " << fDigitsBranchTitle.Data() << endl
968 << endl
969 << " EMC Clustering threshold = " << fEmcClusteringThreshold << endl
970 << " EMC Local Maximum cut = " << fEmcLocMaxCut << endl
971 << " EMC Logarothmic weight = " << fW0 << endl
972 << endl
973 << " CPV Clustering threshold = " << fCpvClusteringThreshold << endl
974 << " CPV Local Maximum cut = " << fCpvLocMaxCut << endl
975 << " CPV Logarothmic weight = " << fW0CPV << endl
9688c1dd 976 << endl ;
9a1398dd 977 if(fToUnfold)
978 cout << " Unfolding on " << endl ;
979 else
980 cout << " Unfolding off " << endl ;
981
982 cout << "------------------------------------------------------------------" <<endl ;
983 }
984 else
985 cout << " AliPHOSClusterizerv1 not initialized " << endl ;
986}
987//____________________________________________________________________________
a4e98857 988void AliPHOSClusterizerv1::PrintRecPoints(Option_t * option)
989{
990 // Prints list of RecPoints produced at the current pass of AliPHOSClusterizer
9a1398dd 991
7b7c1533 992 TObjArray * emcRecPoints = AliPHOSGetter::GetInstance()->EmcRecPoints() ;
993 TObjArray * cpvRecPoints = AliPHOSGetter::GetInstance()->CpvRecPoints() ;
994
01a599c9 995 cout << "AliPHOSClusterizerv1: : event "<<gAlice->GetEvNumber() << endl ;
7b7c1533 996 cout << " Found "<< emcRecPoints->GetEntriesFast() << " EMC Rec Points and "
997 << cpvRecPoints->GetEntriesFast() << " CPV RecPoints" << endl ;
9a1398dd 998
2b60655b 999 fRecPointsInRun += emcRecPoints->GetEntriesFast() ;
1000 fRecPointsInRun += cpvRecPoints->GetEntriesFast() ;
1001
9a1398dd 1002 if(strstr(option,"all")) {
1003 cout << "EMC clusters " << endl ;
9688c1dd 1004 cout << " Index Ene(MeV) Multi Module X Y Z Lambda 1 Lambda 2 # of prim Primaries list " << endl;
9a1398dd 1005
1006 Int_t index ;
7b7c1533 1007 for (index = 0 ; index < emcRecPoints->GetEntries() ; index++) {
1008 AliPHOSEmcRecPoint * rp = (AliPHOSEmcRecPoint * )emcRecPoints->At(index) ;
9a1398dd 1009 TVector3 locpos;
1010 rp->GetLocalPosition(locpos);
9a1398dd 1011 Float_t lambda[2];
1012 rp->GetElipsAxis(lambda);
9a1398dd 1013 Int_t * primaries;
1014 Int_t nprimaries;
1015 primaries = rp->GetPrimaries(nprimaries);
9a1398dd 1016
9688c1dd 1017 cout << setw(4) << rp->GetIndexInList() << " "
1018 << setw(7) << setprecision(3) << rp->GetEnergy() << " "
1019 << setw(3) << rp->GetMultiplicity() << " "
1020 << setw(1) << rp->GetPHOSMod() << " "
1021 << setw(6) << setprecision(2) << locpos.X() << " "
1022 << setw(6) << setprecision(2) << locpos.Y() << " "
1023 << setw(6) << setprecision(2) << locpos.Z() << " "
1024 << setw(4) << setprecision(2) << lambda[0] << " "
1025 << setw(4) << setprecision(2) << lambda[1] << " "
1026 << setw(2) << nprimaries << " " ;
1027
9a1398dd 1028 for (Int_t iprimary=0; iprimary<nprimaries; iprimary++)
9688c1dd 1029 cout << setw(4) << primaries[iprimary] << " " ;
1030 cout << endl ;
9a1398dd 1031 }
9a1398dd 1032
9688c1dd 1033 //Now plot CPV recPoints
9a1398dd 1034 cout << "EMC clusters " << endl ;
1035 cout << " Index "
1036 << " Multi "
1037 << " Module "
9a1398dd 1038 << " X "
1039 << " Y "
1040 << " Z "
1041 << " # of prim "
1042 << " Primaries list " << endl;
1043
7b7c1533 1044 for (index = 0 ; index < cpvRecPoints->GetEntries() ; index++) {
1045 AliPHOSRecPoint * rp = (AliPHOSRecPoint * )cpvRecPoints->At(index) ;
9a1398dd 1046 cout << setw(6) << rp->GetIndexInList() << " ";
9688c1dd 1047 cout << setw(6) << rp->GetPHOSMod() << " CPV ";
9a1398dd 1048
1049 TVector3 locpos;
1050 rp->GetLocalPosition(locpos);
9688c1dd 1051 cout << setw(6) << locpos.X() << " ";
1052 cout << setw(6) << locpos.Y() << " ";
1053 cout << setw(6) << locpos.Z() << " ";
9a1398dd 1054
1055 Int_t * primaries;
9688c1dd 1056 Int_t nprimaries ;
9a1398dd 1057 primaries = rp->GetPrimaries(nprimaries);
9688c1dd 1058 cout << setw(6) << nprimaries << " ";
9a1398dd 1059
1060 for (Int_t iprimary=0; iprimary<nprimaries; iprimary++)
1061 cout << setw(4) << primaries[iprimary] << " ";
1062 cout << endl;
1063 }
1064
1065
9688c1dd 1066 cout << "-----------------------------------------------------------------------"<<endl ;
9a1398dd 1067 }
d15a28e7 1068}
9a1398dd 1069