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