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