Adding checkpoints (T.Kuhr)
[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"
88cb7938 64#include "AliEMCALTowerRecPoint.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)
131 fLastEvent = gime->MaxEvent() - 1 ;
132 else
fb43ada4 133 fLastEvent = TMath::Min(fFirstEvent, gime->MaxEvent());
12c4dd95 134 Int_t nEvents = fLastEvent - fFirstEvent + 1;
483b0559 135
12c4dd95 136 Int_t ievent ;
12c4dd95 137 for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
05a92d59 138 gime->Event(ievent,"D") ;
139
88cb7938 140 GetCalibrationParameters() ;
483b0559 141
fdebddeb 142 fNumberOfECAClusters = 0;
05a92d59 143
483b0559 144 MakeClusters() ;
ed611565 145
483b0559 146 if(fToUnfold)
147 MakeUnfolding() ;
148
9e5d2067 149 WriteRecPoints() ;
483b0559 150
151 if(strstr(option,"deb"))
152 PrintRecPoints(option) ;
153
fdebddeb 154 //increment the total number of recpoints per run
88cb7938 155 fRecPointsInRun += gime->ECARecPoints()->GetEntriesFast() ;
88cb7938 156 }
483b0559 157
88cb7938 158 Unload();
159
483b0559 160 if(strstr(option,"tim")){
161 gBenchmark->Stop("EMCALClusterizer");
fdebddeb 162 printf("Exec took %f seconds for Clusterizing %f seconds per event",
4fbfb21c 163 gBenchmark->GetCpuTime("EMCALClusterizer"), gBenchmark->GetCpuTime("EMCALClusterizer")/nEvents ) ;
483b0559 164 }
483b0559 165}
166
167//____________________________________________________________________________
a0636361 168Bool_t AliEMCALClusterizerv1::FindFit(AliEMCALTowerRecPoint * emcRP, AliEMCALDigit ** maxAt, Float_t * maxAtEnergy,
483b0559 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
88cb7938 175 AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
483b0559 176 TClonesArray * digits = gime->Digits() ;
177
483b0559 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
483b0559 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++){
a0636361 200 digit = maxAt[iDigit];
483b0559 201
fdebddeb 202 Int_t relid[3] ;
483b0559 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){
9859bfc0 213 Error("FindFit", "EMCAL Unfolding Unable to set initial value for fit procedure : x = %f", x ) ;
483b0559 214 return kFALSE;
215 }
216 gMinuit->mnparm(index, "z", z, 0.1, 0, 0, ierflg) ;
217 index++ ;
218 if(ierflg != 0){
9859bfc0 219 Error("FindFit", "EMCAL Unfolding Unable to set initial value for fit procedure : z = %f", z) ;
483b0559 220 return kFALSE;
221 }
222 gMinuit->mnparm(index, "Energy", energy , 0.05*energy, 0., 4.*energy, ierflg) ;
223 index++ ;
224 if(ierflg != 0){
9859bfc0 225 Error("FindFit", "EMCAL Unfolding Unable to set initial value for fit procedure : energy = %f", energy) ;
483b0559 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
9859bfc0 243 Error("FindFit", "EMCAL Unfolding Fit not converged, cluster abandoned " ) ;
483b0559 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//____________________________________________________________________________
259void AliEMCALClusterizerv1::GetCalibrationParameters()
260{
fdebddeb 261 // Gets the parameters for the calibration from the digitizer
88cb7938 262 AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
483b0559 263
88cb7938 264 if ( !gime->Digitizer() )
265 gime->LoadDigitizer();
fdebddeb 266 AliEMCALDigitizer * dig = gime->Digitizer();
ed611565 267
88cb7938 268 fADCchannelECA = dig->GetECAchannel() ;
269 fADCpedestalECA = dig->GetECApedestal();
483b0559 270}
05a92d59 271
483b0559 272//____________________________________________________________________________
273void 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
88cb7938 278 AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle(), fEventFolderName.Data());
483b0559 279
88cb7938 280 AliEMCALGeometry * geom = gime->EMCALGeometry() ;
05a92d59 281
483b0559 282 fNTowers = geom->GetNZ() * geom->GetNPhi() ;
483b0559 283 if(!gMinuit)
284 gMinuit = new TMinuit(100) ;
285
88cb7938 286 if ( !gime->Clusterizer() )
287 gime->PostClusterizer(this);
483b0559 288}
289
290//____________________________________________________________________________
839828a6 291void AliEMCALClusterizerv1::InitParameters()
fdebddeb 292{
293 // Initializes the parameters for the Clusterizer
294 fNumberOfECAClusters = 0;
88cb7938 295 fECAClusteringThreshold = 0.0045; // must be adjusted according to the noise leve set by digitizer
88cb7938 296 fECALocMaxCut = 0.03 ;
88cb7938 297 fECAW0 = 4.5 ;
839828a6 298 fTimeGate = 1.e-8 ;
839828a6 299 fToUnfold = kFALSE ;
fdebddeb 300 fRecPointsInRun = 0 ;
839828a6 301}
302
303//____________________________________________________________________________
483b0559 304Int_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
88cb7938 313 AliEMCALGeometry * geom = AliEMCALGetter::Instance()->EMCALGeometry() ;
483b0559 314
315 Int_t rv = 0 ;
316
fdebddeb 317 Int_t relid1[3] ;
483b0559 318 geom->AbsToRelNumbering(d1->GetId(), relid1) ;
319
fdebddeb 320 Int_t relid2[3] ;
483b0559 321 geom->AbsToRelNumbering(d2->GetId(), relid2) ;
ed611565 322
fdebddeb 323 if ( (relid1[0] == relid2[0])){ // inside the same EMCAL Arm
324 Int_t rowdiff = TMath::Abs( relid1[1] - relid2[1] ) ;
325 Int_t coldiff = TMath::Abs( relid1[2] - relid2[2] ) ;
483b0559 326
327 if (( coldiff <= 1 ) && ( rowdiff <= 1 )){
fdebddeb 328 if(TMath::Abs(d1->GetTime() - d2->GetTime() ) < fTimeGate)
329 rv = 1 ;
483b0559 330 }
331 else {
fdebddeb 332 if((relid2[1] > relid1[1]) && (relid2[2] > relid1[2]+1))
483b0559 333 rv = 2; // Difference in row numbers is too large to look further
334 }
335
336 }
337 else {
338
fdebddeb 339 if(relid1[0] < relid2[0])
ed611565 340 rv=0 ;
483b0559 341 }
483b0559 342
ed611565 343 if (gDebug == 2 )
fdebddeb 344 printf("AreNeighbours: neighbours=%d, id1=%d, relid1=%d,%d,%d \n id2=%d, relid2=%d,%d,%d ",
345 rv, d1->GetId(), relid1[0], relid1[1], relid1[2],
346 d2->GetId(), relid2[0], relid2[1], relid2[2]) ;
ed611565 347
483b0559 348 return rv ;
349}
350
88cb7938 351//____________________________________________________________________________
352void AliEMCALClusterizerv1::Unload()
353{
fdebddeb 354 // Unloads the Digits and RecPoints
88cb7938 355 AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
356 gime->EmcalLoader()->UnloadDigits() ;
357 gime->EmcalLoader()->UnloadRecPoints() ;
358}
483b0559 359
483b0559 360//____________________________________________________________________________
9e5d2067 361void AliEMCALClusterizerv1::WriteRecPoints()
483b0559 362{
363
364 // Creates new branches with given title
365 // fills and writes into TreeR.
366
88cb7938 367 AliEMCALGetter *gime = AliEMCALGetter::Instance() ;
ed611565 368
88cb7938 369 TObjArray * aECARecPoints = gime->ECARecPoints() ;
ed611565 370
05a92d59 371 TClonesArray * digits = gime->Digits() ;
88cb7938 372 TTree * treeR = gime->TreeR(); ;
05a92d59 373
05a92d59 374 Int_t index ;
ed611565 375
ed611565 376 //Evaluate position, dispersion and other RecPoint properties for EC section
88cb7938 377 for(index = 0; index < aECARecPoints->GetEntries(); index++)
378 (dynamic_cast<AliEMCALTowerRecPoint *>(aECARecPoints->At(index)))->EvalAll(fECAW0,digits) ;
ed611565 379
88cb7938 380 aECARecPoints->Sort() ;
483b0559 381
88cb7938 382 for(index = 0; index < aECARecPoints->GetEntries(); index++)
383 (dynamic_cast<AliEMCALTowerRecPoint *>(aECARecPoints->At(index)))->SetIndexInList(index) ;
483b0559 384
88cb7938 385 aECARecPoints->Expand(aECARecPoints->GetEntriesFast()) ;
ed611565 386
483b0559 387 Int_t bufferSize = 32000 ;
9859bfc0 388 Int_t splitlevel = 0 ;
ed611565 389
390 //EC section branch
88cb7938 391 TBranch * branchECA = treeR->Branch("EMCALECARP","TObjArray",&aECARecPoints,bufferSize,splitlevel);
392 branchECA->SetTitle(BranchName());
ed611565 393
88cb7938 394 branchECA->Fill() ;
483b0559 395
88cb7938 396 gime->WriteRecPoints("OVERWRITE");
397 gime->WriteClusterizer("OVERWRITE");
483b0559 398}
399
400//____________________________________________________________________________
401void AliEMCALClusterizerv1::MakeClusters()
402{
403 // Steering method to construct the clusters stored in a list of Reconstructed Points
404 // A cluster is defined as a list of neighbour digits
05a92d59 405
88cb7938 406 AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
ed611565 407
408 AliEMCALGeometry * geom = gime->EMCALGeometry() ;
409
88cb7938 410 TObjArray * aECARecPoints = gime->ECARecPoints() ;
ed611565 411
88cb7938 412 aECARecPoints->Delete() ;
ed611565 413
05a92d59 414 TClonesArray * digits = gime->Digits() ;
ed611565 415
416 TIter next(digits) ;
417 AliEMCALDigit * digit ;
fdebddeb 418 Int_t ndigECA=0 ;
ed611565 419
88cb7938 420 // count the number of digits in ECA section
ed611565 421 while ( (digit = dynamic_cast<AliEMCALDigit *>(next())) ) { // scan over the list of digits
88cb7938 422 if (geom->IsInECA(digit->GetId()))
423 ndigECA++ ;
ed611565 424 else {
425 Error("MakeClusters", "id = %d is a wrong ID!", digit->GetId()) ;
426 abort() ;
427 }
428 }
483b0559 429 TClonesArray * digitsC = dynamic_cast<TClonesArray*>(digits->Clone()) ;
483b0559 430 // Clusterization starts
431
432 TIter nextdigit(digitsC) ;
483b0559 433
434 while ( (digit = dynamic_cast<AliEMCALDigit *>(nextdigit())) ) { // scan over the list of digitsC
435 AliEMCALRecPoint * clu = 0 ;
436
fdebddeb 437 TArrayI clusterECAdigitslist(50);
ed611565 438
fdebddeb 439 Bool_t inECA = kFALSE;
440 if( geom->IsInECA(digit->GetId()) ) {
441 inECA = kTRUE ;
442 }
ed611565 443 if (gDebug == 2) {
88cb7938 444 if (inECA)
fdebddeb 445 printf("MakeClusters: id = %d, ene = %f , thre = %f",
446 digit->GetId(),Calibrate(digit->GetAmp()), fECAClusteringThreshold) ;
ed611565 447 }
fdebddeb 448 if (inECA && (Calibrate(digit->GetAmp()) > fECAClusteringThreshold ) ){
ed611565 449
fdebddeb 450 Int_t iDigitInECACluster = 0;
451 // Find the seed
88cb7938 452 if( geom->IsInECA(digit->GetId()) ) {
483b0559 453 // start a new Tower RecPoint
88cb7938 454 if(fNumberOfECAClusters >= aECARecPoints->GetSize())
455 aECARecPoints->Expand(2*fNumberOfECAClusters+1) ;
37b680d1 456 AliEMCALTowerRecPoint * rp = new AliEMCALTowerRecPoint("") ;
88cb7938 457 rp->SetECA() ;
458 aECARecPoints->AddAt(rp, fNumberOfECAClusters) ;
459 clu = dynamic_cast<AliEMCALTowerRecPoint *>(aECARecPoints->At(fNumberOfECAClusters)) ;
460 fNumberOfECAClusters++ ;
fdebddeb 461 clu->AddDigit(*digit, Calibrate(digit->GetAmp())) ;
88cb7938 462 clusterECAdigitslist[iDigitInECACluster] = digit->GetIndexInList() ;
463 iDigitInECACluster++ ;
483b0559 464 digitsC->Remove(digit) ;
ed611565 465 if (gDebug == 2 )
fdebddeb 466 printf("MakeClusters: OK id = %d, ene = %f , thre = %f ", digit->GetId(),Calibrate(digit->GetAmp()), fECAClusteringThreshold) ;
483b0559 467
fdebddeb 468 }
483b0559 469 nextdigit.Reset() ;
470
471 AliEMCALDigit * digitN ;
ed611565 472 Int_t index = 0 ;
473
fdebddeb 474 // Do the Clustering
ed611565 475
88cb7938 476 while (index < iDigitInECACluster){ // scan over digits already in cluster
477 digit = (AliEMCALDigit*)digits->At(clusterECAdigitslist[index]) ;
483b0559 478 index++ ;
479 while ( (digitN = (AliEMCALDigit *)nextdigit()) ) { // scan over the reduced list of digits
fdebddeb 480 Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!!
483b0559 481 switch (ineb ) {
482 case 0 : // not a neighbour
483 break ;
484 case 1 : // are neighbours
fdebddeb 485 clu->AddDigit(*digitN, Calibrate( digitN->GetAmp()) ) ;
88cb7938 486 clusterECAdigitslist[iDigitInECACluster] = digitN->GetIndexInList() ;
487 iDigitInECACluster++ ;
483b0559 488 digitsC->Remove(digitN) ;
489 break ;
490 case 2 : // too far from each other
ed611565 491 goto endofloop1;
483b0559 492 } // switch
493
494 } // while digitN
495
ed611565 496 endofloop1: ;
483b0559 497 nextdigit.Reset() ;
88cb7938 498 } // loop over ECA cluster
9859bfc0 499 } // energy theshold
500 } // while digit
483b0559 501 delete digitsC ;
483b0559 502}
503
504//____________________________________________________________________________
fdebddeb 505void AliEMCALClusterizerv1::MakeUnfolding() const
483b0559 506{
507 Fatal("AliEMCALClusterizerv1::MakeUnfolding", "--> Unfolding not implemented") ;
9859bfc0 508
483b0559 509}
510
511//____________________________________________________________________________
512Double_t AliEMCALClusterizerv1::ShowerShape(Double_t r)
513{
514 // Shape of the shower (see EMCAL TDR)
515 // If you change this function, change also the gradient evaluation in ChiSquare()
516
517 Double_t r4 = r*r*r*r ;
518 Double_t r295 = TMath::Power(r, 2.95) ;
519 Double_t shape = TMath::Exp( -r4 * (1. / (2.32 + 0.26 * r4) + 0.0316 / (1 + 0.0652 * r295) ) ) ;
520 return shape ;
521}
522
523//____________________________________________________________________________
9e5d2067 524void AliEMCALClusterizerv1::UnfoldCluster(AliEMCALTowerRecPoint * /*iniTower*/,
525 Int_t /*nMax*/,
526 AliEMCALDigit ** /*maxAt*/,
fdebddeb 527 Float_t * /*maxAtEnergy*/) const
483b0559 528{
529 // Performs the unfolding of a cluster with nMax overlapping showers
483b0559 530
9859bfc0 531 Fatal("UnfoldCluster", "--> Unfolding not implemented") ;
173558f2 532
483b0559 533}
534
535//_____________________________________________________________________________
9e5d2067 536void AliEMCALClusterizerv1::UnfoldingChiSquare(Int_t & /*nPar*/, Double_t * /*Grad*/,
537 Double_t & /*fret*/,
538 Double_t * /*x*/, Int_t /*iflag*/)
483b0559 539{
540 // Calculates the Chi square for the cluster unfolding minimization
541 // Number of parameters, Gradient, Chi squared, parameters, what to do
483b0559 542
9859bfc0 543 ::Fatal("UnfoldingChiSquare","Unfolding not implemented") ;
483b0559 544}
483b0559 545//____________________________________________________________________________
9e5d2067 546void AliEMCALClusterizerv1::Print(Option_t * /*option*/)const
483b0559 547{
548 // Print clusterizer parameters
549
9859bfc0 550 TString message("\n") ;
551
483b0559 552 if( strcmp(GetName(), "") !=0 ){
553
554 // Print parameters
555
fdebddeb 556 TString taskName(GetName()) ;
483b0559 557 taskName.ReplaceAll(Version(), "") ;
9859bfc0 558
fdebddeb 559 printf("--------------- ");
560 printf(taskName.Data()) ;
561 printf(" ");
562 printf(GetTitle()) ;
563 printf("-----------\n");
564 printf("Clusterizing digits from the file: ");
565 printf(taskName.Data());
566 printf("\n Branch: ");
567 printf(GetName());
568 printf("\n ECA Local Maximum cut = %f", fECALocMaxCut);
b481a360 569 printf("\n ECA Logarithmic weight = %f", fECAW0);
483b0559 570 if(fToUnfold)
fdebddeb 571 printf("\nUnfolding on\n");
483b0559 572 else
fdebddeb 573 printf("\nUnfolding off\n");
483b0559 574
fdebddeb 575 printf("------------------------------------------------------------------");
483b0559 576 }
577 else
fdebddeb 578 printf("AliEMCALClusterizerv1 not initialized ") ;
483b0559 579}
173558f2 580
483b0559 581//____________________________________________________________________________
582void AliEMCALClusterizerv1::PrintRecPoints(Option_t * option)
583{
b481a360 584 // Prints list of RecPoints produced at the current pass of AliEMCALClusterizer
585
88cb7938 586 TObjArray * aECARecPoints = AliEMCALGetter::Instance()->ECARecPoints() ;
fdebddeb 587 printf("PrintRecPoints: Clusterization result:") ;
ed611565 588
589 printf("event # %d\n", gAlice->GetEvNumber() ) ;
fdebddeb 590 printf(" Found %d ECA Rec Points\n ",
591 aECARecPoints->GetEntriesFast()) ;
483b0559 592
88cb7938 593 fRecPointsInRun += aECARecPoints->GetEntriesFast() ;
11f9c5ff 594
483b0559 595 if(strstr(option,"all")) {
fdebddeb 596 Int_t index =0;
ed611565 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
88cb7938 601 for (index = 0 ; index < aECARecPoints->GetEntries() ; index++) {
602 AliEMCALTowerRecPoint * rp = dynamic_cast<AliEMCALTowerRecPoint * >(aECARecPoints->At(index)) ;
483b0559 603 TVector3 globalpos;
604 rp->GetGlobalPosition(globalpos);
ed611565 605 TVector3 localpos;
606 rp->GetLocalPosition(localpos);
483b0559 607 Float_t lambda[2];
608 rp->GetElipsAxis(lambda);
609 Int_t * primaries;
610 Int_t nprimaries;
611 primaries = rp->GetPrimaries(nprimaries);
ed611565 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) ;
9859bfc0 616 for (Int_t iprimary=0; iprimary<nprimaries; iprimary++) {
ed611565 617 printf("%d ", primaries[iprimary] ) ;
9859bfc0 618 }
483b0559 619 }
ed611565 620 printf("\n-----------------------------------------------------------------------\n");
483b0559 621 }
622}