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