]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALClusterizerv1.cxx
Jet Finder - hard coded geom parameters removed
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALClusterizerv1.cxx
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
16 /* $Id$ */
17
18 //*-- Author: Yves Schutz (SUBATECH)  & Dmitri Peressounko (SUBATECH & Kurchatov Institute)
19 //  August 2002 Yves Schutz: clone PHOS as closely as possible and intoduction
20 //                           of new  IO (à la PHOS)
21 //////////////////////////////////////////////////////////////////////////////
22 //  Clusterization class. Performs clusterization (collects neighbouring active cells) and 
23 //  unfolds the clusters having several local maxima.  
24 //  Results are stored in TreeR#, branches EMCALTowerRP (EMC recPoints),
25 //  EMCALPreShoRP (CPV RecPoints) and AliEMCALClusterizer (Clusterizer with all 
26 //  parameters including input digits branch title, thresholds etc.)
27 //  This TTask is normally called from Reconstructioner, but can as well be used in 
28 //  standalone mode.
29 // Use Case:
30 //  root [0] AliEMCALClusterizerv1 * cl = new AliEMCALClusterizerv1("galice.root")  
31 //  Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated
32 //               //reads gAlice from header file "..."                      
33 //  root [1] cl->ExecuteTask()  
34 //               //finds RecPoints in all events stored in galice.root
35 //  root [2] cl->SetDigitsBranch("digits2") 
36 //               //sets another title for Digitis (input) branch
37 //  root [3] cl->SetRecPointsBranch("recp2")  
38 //               //sets another title four output branches
39 //  root [4] cl->SetTowerLocalMaxCut(0.03)  
40 //               //set clusterization parameters
41 //  root [5] cl->ExecuteTask("deb all time")  
42 //               //once more finds RecPoints options are 
43 //               // deb - print number of found rec points
44 //               // deb all - print number of found RecPoints and some their characteristics 
45 //               // time - print benchmarking results
46
47 // --- ROOT system ---
48
49 #include "TROOT.h" 
50 #include "TFile.h" 
51 #include "TFolder.h" 
52 #include "TMath.h" 
53 #include "TMinuit.h"
54 #include "TTree.h" 
55 #include "TSystem.h" 
56 #include "TBenchmark.h"
57
58 // --- Standard library ---
59
60
61 // --- AliRoot header files ---
62 #include "AliEMCALGetter.h"
63 #include "AliEMCALClusterizerv1.h"
64 #include "AliEMCALTowerRecPoint.h"
65 #include "AliEMCALDigit.h"
66 #include "AliEMCALDigitizer.h"
67 #include "AliEMCAL.h"
68 #include "AliEMCALGeometry.h"
69
70 ClassImp(AliEMCALClusterizerv1)
71   
72 //____________________________________________________________________________
73   AliEMCALClusterizerv1::AliEMCALClusterizerv1() : AliEMCALClusterizer()
74 {
75   // default ctor (to be used mainly by Streamer)
76   
77   InitParameters() ; 
78   fDefaultInit = kTRUE ; 
79 }
80
81 //____________________________________________________________________________
82 AliEMCALClusterizerv1::AliEMCALClusterizerv1(const TString alirunFileName, const TString eventFolderName)
83 :AliEMCALClusterizer(alirunFileName, eventFolderName)
84 {
85   // ctor with the indication of the file where header Tree and digits Tree are stored
86   
87   InitParameters() ; 
88   Init() ;
89   fDefaultInit = kFALSE ; 
90
91 }
92
93 //____________________________________________________________________________
94   AliEMCALClusterizerv1::~AliEMCALClusterizerv1()
95 {
96   // dtor
97   
98 }
99
100 //____________________________________________________________________________
101 const TString AliEMCALClusterizerv1::BranchName() const 
102
103    return GetName();
104
105 }
106
107 //____________________________________________________________________________
108 Float_t  AliEMCALClusterizerv1::Calibrate(Int_t amp) const
109 {
110   //To be replased later by the method, reading individual parameters from the database 
111   return -fADCpedestalECA + amp * fADCchannelECA ; 
112 }
113
114 //____________________________________________________________________________
115 void AliEMCALClusterizerv1::Exec(Option_t * option)
116 {
117   // Steering method to perform clusterization for events
118   // in the range from fFirstEvent to fLastEvent.
119   // This range is optionally set by SetEventRange().
120   // if fLastEvent=-1 (by default), then process events until the end.
121
122   if(strstr(option,"tim"))
123     gBenchmark->Start("EMCALClusterizer"); 
124   
125   if(strstr(option,"print"))
126     Print("") ; 
127
128   AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
129
130   if (fLastEvent == -1) 
131     fLastEvent = gime->MaxEvent() - 1 ;
132   else 
133     fLastEvent = TMath::Min(fLastEvent,gime->MaxEvent());
134   Int_t nEvents   = fLastEvent - fFirstEvent + 1;
135
136   Int_t ievent ;
137
138   for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
139     gime->Event(ievent,"D") ;
140
141     GetCalibrationParameters() ;
142
143     fNumberOfECAClusters = 0;
144            
145     MakeClusters() ;
146
147     if(fToUnfold)
148       MakeUnfolding() ;
149
150     WriteRecPoints() ;
151
152     if(strstr(option,"deb"))  
153       PrintRecPoints(option) ;
154
155     //increment the total number of recpoints per run   
156     fRecPointsInRun += gime->ECARecPoints()->GetEntriesFast() ;  
157   }
158   
159   Unload();
160
161   if(strstr(option,"tim")){
162     gBenchmark->Stop("EMCALClusterizer");
163     printf("Exec took %f seconds for Clusterizing %f seconds per event", 
164          gBenchmark->GetCpuTime("EMCALClusterizer"), gBenchmark->GetCpuTime("EMCALClusterizer")/nEvents ) ;
165   }
166 }
167
168 //____________________________________________________________________________
169 Bool_t AliEMCALClusterizerv1::FindFit(AliEMCALTowerRecPoint * emcRP, AliEMCALDigit ** maxAt, Float_t * maxAtEnergy,
170                                     Int_t nPar, Float_t * fitparameters) const
171
172   // Calls TMinuit to fit the energy distribution of a cluster with several maxima 
173   // The initial values for fitting procedure are set equal to the positions of local maxima.
174   // Cluster will be fitted as a superposition of nPar/3 electromagnetic showers
175
176   AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
177   TClonesArray * digits = gime->Digits() ; 
178   
179   gMinuit->mncler();                     // Reset Minuit's list of paramters
180   gMinuit->SetPrintLevel(-1) ;           // No Printout
181   gMinuit->SetFCN(AliEMCALClusterizerv1::UnfoldingChiSquare) ;  
182                                          // To set the address of the minimization function 
183   TList * toMinuit = new TList();
184   toMinuit->AddAt(emcRP,0) ;
185   toMinuit->AddAt(digits,1) ;
186   
187   gMinuit->SetObjectFit(toMinuit) ;         // To tranfer pointer to UnfoldingChiSquare
188
189   // filling initial values for fit parameters
190   AliEMCALDigit * digit ;
191
192   Int_t ierflg  = 0; 
193   Int_t index   = 0 ;
194   Int_t nDigits = (Int_t) nPar / 3 ;
195
196   Int_t iDigit ;
197
198   AliEMCALGeometry * geom = gime->EMCALGeometry() ; 
199
200   for(iDigit = 0; iDigit < nDigits; iDigit++){
201     digit = maxAt[iDigit]; 
202
203     Int_t relid[3] ;
204     Float_t x = 0.;
205     Float_t z = 0.;
206     geom->AbsToRelNumbering(digit->GetId(), relid) ;
207     geom->PosInAlice(relid, x, z) ;
208
209     Float_t energy = maxAtEnergy[iDigit] ;
210
211     gMinuit->mnparm(index, "x",  x, 0.1, 0, 0, ierflg) ;
212     index++ ;   
213     if(ierflg != 0){ 
214       Error("FindFit", "EMCAL Unfolding  Unable to set initial value for fit procedure : x = %f",  x ) ;
215       return kFALSE;
216     }
217     gMinuit->mnparm(index, "z",  z, 0.1, 0, 0, ierflg) ;
218     index++ ;   
219     if(ierflg != 0){
220        Error("FindFit", "EMCAL Unfolding  Unable to set initial value for fit procedure : z = %f", z) ;
221       return kFALSE;
222     }
223     gMinuit->mnparm(index, "Energy",  energy , 0.05*energy, 0., 4.*energy, ierflg) ;
224     index++ ;   
225     if(ierflg != 0){
226      Error("FindFit", "EMCAL Unfolding  Unable to set initial value for fit procedure : energy = %f", energy) ;      
227       return kFALSE;
228     }
229   }
230
231   Double_t p0 = 0.1 ; // "Tolerance" Evaluation stops when EDM = 0.0001*p0 ; The number of function call slightly
232                       //  depends on it. 
233   Double_t p1 = 1.0 ;
234   Double_t p2 = 0.0 ;
235
236   gMinuit->mnexcm("SET STR", &p2, 0, ierflg) ;   // force TMinuit to reduce function calls  
237   gMinuit->mnexcm("SET GRA", &p1, 1, ierflg) ;   // force TMinuit to use my gradient  
238   gMinuit->SetMaxIterations(5);
239   gMinuit->mnexcm("SET NOW", &p2 , 0, ierflg) ;  // No Warnings
240
241   gMinuit->mnexcm("MIGRAD", &p0, 0, ierflg) ;    // minimize 
242
243   if(ierflg == 4){  // Minimum not found   
244     Error("FindFit", "EMCAL Unfolding  Fit not converged, cluster abandoned " ) ;      
245     return kFALSE ;
246   }            
247   for(index = 0; index < nPar; index++){
248     Double_t err ;
249     Double_t val ;
250     gMinuit->GetParameter(index, val, err) ;    // Returns value and error of parameter index
251     fitparameters[index] = val ;
252    }
253
254   delete toMinuit ;
255   return kTRUE;
256
257 }
258
259 //____________________________________________________________________________
260 void AliEMCALClusterizerv1::GetCalibrationParameters() 
261 {
262   // Gets the parameters for the calibration from the digitizer
263   AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
264
265   if ( !gime->Digitizer() ) 
266     gime->LoadDigitizer();
267   AliEMCALDigitizer * dig = gime->Digitizer();  
268
269   fADCchannelECA   = dig->GetECAchannel() ;
270   fADCpedestalECA  = dig->GetECApedestal();
271 }
272
273 //____________________________________________________________________________
274 void AliEMCALClusterizerv1::Init()
275 {
276   // Make all memory allocations which can not be done in default constructor.
277   // Attach the Clusterizer task to the list of EMCAL tasks
278   
279   AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName.Data());
280
281   AliEMCALGeometry * geom = gime->EMCALGeometry() ;
282
283   fNTowers = geom->GetNZ() *  geom->GetNPhi() ;
284   if(!gMinuit) 
285     gMinuit = new TMinuit(100) ;
286
287  if ( !gime->Clusterizer() ) 
288     gime->PostClusterizer(this); 
289 }
290
291 //____________________________________________________________________________
292 void AliEMCALClusterizerv1::InitParameters()
293
294   // Initializes the parameters for the Clusterizer
295   fNumberOfECAClusters = 0;
296   fECAClusteringThreshold   = 0.0045;  // must be adjusted according to the noise leve set by digitizer
297   fECALocMaxCut = 0.03 ;
298   fECAW0     = 4.5 ;
299   fTimeGate = 1.e-8 ; 
300   fToUnfold = kFALSE ;
301   fRecPointsInRun  = 0 ;
302 }
303
304 //____________________________________________________________________________
305 Int_t AliEMCALClusterizerv1::AreNeighbours(AliEMCALDigit * d1, AliEMCALDigit * d2)const
306 {
307   // Gives the neighbourness of two digits = 0 are not neighbour but continue searching 
308   //                                       = 1 are neighbour
309   //                                       = 2 are not neighbour but do not continue searching
310   // neighbours are defined as digits having at least a common vertex 
311   // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster 
312   //                                      which is compared to a digit (d2)  not yet in a cluster  
313
314    AliEMCALGeometry * geom = AliEMCALGetter::Instance()->EMCALGeometry() ;
315
316   Int_t rv = 0 ; 
317
318   Int_t relid1[3] ; 
319   geom->AbsToRelNumbering(d1->GetId(), relid1) ; 
320
321   Int_t relid2[3] ; 
322   geom->AbsToRelNumbering(d2->GetId(), relid2) ; 
323   
324   if ( (relid1[0] == relid2[0])){ // inside the same EMCAL Arm 
325     Int_t rowdiff = TMath::Abs( relid1[1] - relid2[1] ) ;  
326     Int_t coldiff = TMath::Abs( relid1[2] - relid2[2] ) ;  
327     
328     if (( coldiff <= 1 )  && ( rowdiff <= 1 )){
329       if(TMath::Abs(d1->GetTime() - d2->GetTime() ) < fTimeGate)
330         rv = 1 ; 
331     }
332     else {
333       if((relid2[1] > relid1[1]) && (relid2[2] > relid1[2]+1)) 
334         rv = 2; //  Difference in row numbers is too large to look further 
335     }
336
337   } 
338   else {
339     
340     if(relid1[0] < relid2[0])  
341       rv=0 ;
342   }
343
344   if (gDebug == 2 ) 
345     printf("AreNeighbours: neighbours=%d, id1=%d, relid1=%d,%d,%d \n id2=%d, relid2=%d,%d,%d ", 
346          rv, d1->GetId(), relid1[0], relid1[1], relid1[2],
347          d2->GetId(), relid2[0], relid2[1], relid2[2]) ;   
348   
349   return rv ; 
350 }
351
352 //____________________________________________________________________________
353 void AliEMCALClusterizerv1::Unload() 
354 {
355   // Unloads the Digits and RecPoints
356   AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
357   gime->EmcalLoader()->UnloadDigits() ; 
358   gime->EmcalLoader()->UnloadRecPoints() ; 
359 }
360  
361 //____________________________________________________________________________
362 void AliEMCALClusterizerv1::WriteRecPoints()
363 {
364
365   // Creates new branches with given title
366   // fills and writes into TreeR.
367
368   AliEMCALGetter *gime = AliEMCALGetter::Instance() ; 
369
370   TObjArray * aECARecPoints = gime->ECARecPoints() ; 
371
372   TClonesArray * digits = gime->Digits() ; 
373   TTree * treeR = gime->TreeR(); ; 
374   
375   Int_t index ;
376
377   //Evaluate position, dispersion and other RecPoint properties for EC section
378   for(index = 0; index < aECARecPoints->GetEntries(); index++)
379     (dynamic_cast<AliEMCALTowerRecPoint *>(aECARecPoints->At(index)))->EvalAll(fECAW0,digits) ;
380   
381   aECARecPoints->Sort() ;
382
383   for(index = 0; index < aECARecPoints->GetEntries(); index++)
384     (dynamic_cast<AliEMCALTowerRecPoint *>(aECARecPoints->At(index)))->SetIndexInList(index) ;
385
386   aECARecPoints->Expand(aECARecPoints->GetEntriesFast()) ; 
387   
388   Int_t bufferSize = 32000 ;    
389   Int_t splitlevel = 0 ; 
390
391   //EC section branch
392   TBranch * branchECA = treeR->Branch("EMCALECARP","TObjArray",&aECARecPoints,bufferSize,splitlevel);
393   branchECA->SetTitle(BranchName());
394
395   branchECA->Fill() ;
396
397   gime->WriteRecPoints("OVERWRITE");
398   gime->WriteClusterizer("OVERWRITE");
399 }
400
401 //____________________________________________________________________________
402 void AliEMCALClusterizerv1::MakeClusters()
403 {
404   // Steering method to construct the clusters stored in a list of Reconstructed Points
405   // A cluster is defined as a list of neighbour digits
406     
407   AliEMCALGetter * gime = AliEMCALGetter::Instance() ; 
408
409   AliEMCALGeometry * geom = gime->EMCALGeometry() ; 
410
411   TObjArray * aECARecPoints  = gime->ECARecPoints() ; 
412
413   aECARecPoints->Delete() ;
414
415   TClonesArray * digits = gime->Digits() ; 
416
417   TIter next(digits) ; 
418   AliEMCALDigit * digit ; 
419   Int_t ndigECA=0 ; 
420
421   // count the number of digits in ECA section
422   while ( (digit = dynamic_cast<AliEMCALDigit *>(next())) ) { // scan over the list of digits 
423     if (geom->IsInECA(digit->GetId())) 
424       ndigECA++ ; 
425     else {
426       Error("MakeClusters", "id = %d is a wrong ID!", digit->GetId()) ; 
427       abort() ;
428     }
429   }
430   TClonesArray * digitsC =  dynamic_cast<TClonesArray*>(digits->Clone()) ;
431   // Clusterization starts  
432   
433   TIter nextdigit(digitsC) ; 
434   
435   while ( (digit = dynamic_cast<AliEMCALDigit *>(nextdigit())) ) { // scan over the list of digitsC
436     AliEMCALRecPoint * clu = 0 ; 
437     
438     TArrayI clusterECAdigitslist(50);   
439  
440     Bool_t inECA = kFALSE;
441     if( geom->IsInECA(digit->GetId()) ) {
442        inECA = kTRUE ;
443      }    
444     if (gDebug == 2) { 
445       if (inECA)
446         printf("MakeClusters: id = %d, ene = %f , thre = %f", 
447              digit->GetId(),Calibrate(digit->GetAmp()), fECAClusteringThreshold) ;  
448     }
449     if (inECA && (Calibrate(digit->GetAmp()) > fECAClusteringThreshold  ) ){
450
451     Int_t iDigitInECACluster = 0;
452       // Find the seed
453       if( geom->IsInECA(digit->GetId()) ) {   
454         // start a new Tower RecPoint
455         if(fNumberOfECAClusters >= aECARecPoints->GetSize()) 
456           aECARecPoints->Expand(2*fNumberOfECAClusters+1) ;
457         AliEMCALTowerRecPoint * rp = new  AliEMCALTowerRecPoint("") ; 
458         rp->SetECA() ; 
459         aECARecPoints->AddAt(rp, fNumberOfECAClusters) ;
460         clu = dynamic_cast<AliEMCALTowerRecPoint *>(aECARecPoints->At(fNumberOfECAClusters)) ; 
461         fNumberOfECAClusters++ ; 
462         clu->AddDigit(*digit, Calibrate(digit->GetAmp())) ; 
463         clusterECAdigitslist[iDigitInECACluster] = digit->GetIndexInList() ;    
464         iDigitInECACluster++ ; 
465         digitsC->Remove(digit) ; 
466         if (gDebug == 2 ) 
467           printf("MakeClusters: OK id = %d, ene = %f , thre = %f ", digit->GetId(),Calibrate(digit->GetAmp()), fECAClusteringThreshold) ;  
468         
469       }    
470       nextdigit.Reset() ;
471       
472       AliEMCALDigit * digitN ; 
473       Int_t index = 0 ;
474
475       // Do the Clustering
476
477       while (index < iDigitInECACluster){ // scan over digits already in cluster 
478         digit =  (AliEMCALDigit*)digits->At(clusterECAdigitslist[index])  ;      
479         index++ ; 
480         while ( (digitN = (AliEMCALDigit *)nextdigit()) ) { // scan over the reduced list of digits 
481           Int_t ineb = AreNeighbours(digit, digitN);       // call (digit,digitN) in THAT oder !!!!! 
482          switch (ineb ) {
483           case 0 :   // not a neighbour
484             break ;
485           case 1 :   // are neighbours 
486             clu->AddDigit(*digitN, Calibrate( digitN->GetAmp()) ) ;
487             clusterECAdigitslist[iDigitInECACluster] = digitN->GetIndexInList() ; 
488             iDigitInECACluster++ ; 
489             digitsC->Remove(digitN) ;
490             break ;
491           case 2 :   // too far from each other
492             goto endofloop1;   
493           } // switch
494           
495         } // while digitN
496         
497       endofloop1: ;
498         nextdigit.Reset() ; 
499       } // loop over ECA cluster
500     } // energy theshold     
501   } // while digit  
502   delete digitsC ;
503 }
504
505 //____________________________________________________________________________
506 void AliEMCALClusterizerv1::MakeUnfolding() const
507 {
508   Fatal("AliEMCALClusterizerv1::MakeUnfolding", "--> Unfolding not implemented") ;
509  
510 }
511
512 //____________________________________________________________________________
513 Double_t  AliEMCALClusterizerv1::ShowerShape(Double_t r)
514
515   // Shape of the shower (see EMCAL TDR)
516   // If you change this function, change also the gradient evaluation in ChiSquare()
517
518   Double_t r4    = r*r*r*r ;
519   Double_t r295  = TMath::Power(r, 2.95) ;
520   Double_t shape = TMath::Exp( -r4 * (1. / (2.32 + 0.26 * r4) + 0.0316 / (1 + 0.0652 * r295) ) ) ;
521   return shape ;
522 }
523
524 //____________________________________________________________________________
525 void  AliEMCALClusterizerv1::UnfoldCluster(AliEMCALTowerRecPoint * /*iniTower*/, 
526                                            Int_t /*nMax*/, 
527                                            AliEMCALDigit ** /*maxAt*/, 
528                                            Float_t * /*maxAtEnergy*/) const
529 {
530   // Performs the unfolding of a cluster with nMax overlapping showers 
531   
532   Fatal("UnfoldCluster", "--> Unfolding not implemented") ;
533
534 }
535
536 //_____________________________________________________________________________
537 void AliEMCALClusterizerv1::UnfoldingChiSquare(Int_t & /*nPar*/, Double_t * /*Grad*/,
538                                                Double_t & /*fret*/,
539                                                Double_t * /*x*/, Int_t /*iflag*/)
540 {
541   // Calculates the Chi square for the cluster unfolding minimization
542   // Number of parameters, Gradient, Chi squared, parameters, what to do
543   
544   ::Fatal("UnfoldingChiSquare","Unfolding not implemented") ;
545 }
546 //____________________________________________________________________________
547 void AliEMCALClusterizerv1::Print(Option_t * /*option*/)const
548 {
549   // Print clusterizer parameters
550
551   TString message("\n") ; 
552   
553   if( strcmp(GetName(), "") !=0 ){
554     
555     // Print parameters
556  
557     TString taskName(GetName()) ;
558     taskName.ReplaceAll(Version(), "") ;
559     
560     printf("--------------- "); 
561     printf(taskName.Data()) ; 
562     printf(" "); 
563     printf(GetTitle()) ; 
564     printf("-----------\n");  
565     printf("Clusterizing digits from the file: "); 
566     printf(taskName.Data());  
567     printf("\n                           Branch: "); 
568     printf(GetName()); 
569     printf("\n                       ECA Local Maximum cut    = %f", fECALocMaxCut); 
570     printf("\n                       ECA Logarothmic weight   = %f", fECAW0); 
571     if(fToUnfold)
572       printf("\nUnfolding on\n");
573     else
574       printf("\nUnfolding off\n");
575     
576     printf("------------------------------------------------------------------"); 
577   }
578   else
579     printf("AliEMCALClusterizerv1 not initialized ") ;
580 }
581
582 //____________________________________________________________________________
583 void AliEMCALClusterizerv1::PrintRecPoints(Option_t * option)
584 {
585   // Prints list of RecPoints produced at the current pass of AliEMCALClusterizer 
586   TObjArray * aECARecPoints = AliEMCALGetter::Instance()->ECARecPoints() ; 
587   printf("PrintRecPoints: Clusterization result:") ; 
588   
589   printf("event # %d\n", gAlice->GetEvNumber() ) ;
590   printf("           Found %d ECA Rec Points\n ", 
591          aECARecPoints->GetEntriesFast()) ; 
592
593   fRecPointsInRun +=  aECARecPoints->GetEntriesFast() ; 
594   
595   if(strstr(option,"all")) {
596     Int_t index =0;
597     printf("\n-----------------------------------------------------------------------\n") ;
598     printf("Clusters in ECAL section\n") ;
599     printf("Index    Ene(GeV) Multi Module     phi     r   theta    X    Y      Z   Dispersion Lambda 1   Lambda 2  # of prim  Primaries list\n") ;      
600     
601     for (index = 0 ; index < aECARecPoints->GetEntries() ; index++) {
602       AliEMCALTowerRecPoint * rp = dynamic_cast<AliEMCALTowerRecPoint * >(aECARecPoints->At(index)) ; 
603       TVector3  globalpos;  
604       rp->GetGlobalPosition(globalpos);
605       TVector3  localpos;  
606       rp->GetLocalPosition(localpos);
607       Float_t lambda[2]; 
608       rp->GetElipsAxis(lambda);
609       Int_t * primaries; 
610       Int_t nprimaries;
611       primaries = rp->GetPrimaries(nprimaries);
612       printf("\n%6d  %8.4f  %3d     %2d     %4.1f    %4.1f %4.1f  %4.1f %4.1f %4.1f    %4.1f   %4f  %4f    %2d     : ", 
613              rp->GetIndexInList(), rp->GetEnergy(), rp->GetMultiplicity(), rp->GetEMCALArm(), 
614              globalpos.X(), globalpos.Y(), globalpos.Z(), localpos.X(), localpos.Y(), localpos.Z(), 
615              rp->GetDispersion(), lambda[0], lambda[1], nprimaries) ; 
616       for (Int_t iprimary=0; iprimary<nprimaries; iprimary++) {
617         printf("%d ", primaries[iprimary] ) ; 
618       } 
619     }
620     printf("\n-----------------------------------------------------------------------\n");
621   }
622 }