2 /**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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
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
48 // --- ROOT system ---
57 #include "TBenchmark.h"
59 // --- Standard library ---
62 // --- AliRoot header files ---
63 #include "AliRunLoader.h"
65 #include "AliEMCALLoader.h"
66 #include "AliEMCALClusterizerv1.h"
67 #include "AliEMCALRecPoint.h"
68 #include "AliEMCALDigit.h"
69 #include "AliEMCALDigitizer.h"
71 #include "AliEMCALGeometry.h"
73 ClassImp(AliEMCALClusterizerv1)
75 Int_t addOn[20][60][60];
77 //____________________________________________________________________________
78 AliEMCALClusterizerv1::AliEMCALClusterizerv1() : AliEMCALClusterizer()
80 // default ctor (to be used mainly by Streamer)
83 fDefaultInit = kTRUE ;
84 for(Int_t is=0;is<20;is++){
85 for(Int_t i=0;i<60;i++){
86 for(Int_t j=0;j<60;j++){
91 //PH cout<<"file to read 1"<<endl;
93 //PH cout<<"file read 1"<<endl;
96 //____________________________________________________________________________
97 AliEMCALClusterizerv1::AliEMCALClusterizerv1(const TString alirunFileName, const TString eventFolderName)
98 :AliEMCALClusterizer(alirunFileName, eventFolderName)
100 // ctor with the indication of the file where header Tree and digits Tree are stored
104 fDefaultInit = kFALSE ;
105 for(Int_t is=0;is<20;is++){
106 for(Int_t i=0;i<60;i++){
107 for(Int_t j=0;j<60;j++){
112 //PH cout<<"file to read 2"<<endl;
114 //PH cout<<"file read 2"<<endl;
118 //____________________________________________________________________________
119 AliEMCALClusterizerv1::~AliEMCALClusterizerv1()
125 //____________________________________________________________________________
126 const TString AliEMCALClusterizerv1::BranchName() const
132 //____________________________________________________________________________
133 Float_t AliEMCALClusterizerv1::Calibrate(Int_t amp) const
135 //To be replased later by the method, reading individual parameters from the database
136 return -fADCpedestalECA + amp * fADCchannelECA ;
139 //____________________________________________________________________________
140 void AliEMCALClusterizerv1::Exec(Option_t * option)
142 // Steering method to perform clusterization for events
143 // in the range from fFirstEvent to fLastEvent.
144 // This range is optionally set by SetEventRange().
145 // if fLastEvent=-1 (by default), then process events until the end.
147 if(strstr(option,"tim"))
148 gBenchmark->Start("EMCALClusterizer");
150 if(strstr(option,"print"))
153 //AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
154 AliRunLoader *rl = AliRunLoader::GetRunLoader();
155 AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
157 if (fLastEvent == -1)
158 fLastEvent = rl->GetNumberOfEvents() - 1;
159 Int_t nEvents = fLastEvent - fFirstEvent + 1;
162 rl->LoadDigits("EMCAL");
163 for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
164 rl->GetEvent(ievent);
165 GetCalibrationParameters() ;
167 fNumberOfECAClusters = 0;
176 if(strstr(option,"deb"))
177 PrintRecPoints(option) ;
179 //increment the total number of recpoints per run
180 fRecPointsInRun += emcalLoader->RecPoints()->GetEntriesFast() ;
185 if(strstr(option,"tim")){
186 gBenchmark->Stop("EMCALClusterizer");
187 printf("Exec took %f seconds for Clusterizing %f seconds per event",
188 gBenchmark->GetCpuTime("EMCALClusterizer"), gBenchmark->GetCpuTime("EMCALClusterizer")/nEvents ) ;
195 //____________________________________________________________________________
196 Bool_t AliEMCALClusterizerv1::FindFit(AliEMCALRecPoint * emcRP, AliEMCALDigit ** maxAt, Float_t * maxAtEnergy,
197 Int_t nPar, Float_t * fitparameters) const
199 // Calls TMinuit to fit the energy distribution of a cluster with several maxima
200 // The initial values for fitting procedure are set equal to the positions of local maxima.
201 // Cluster will be fitted as a superposition of nPar/3 electromagnetic showers
203 AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
204 TClonesArray *digits = emcalLoader->Digits();
206 AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
207 TClonesArray * digits = gime->Digits() ;
210 gMinuit->mncler(); // Reset Minuit's list of paramters
211 gMinuit->SetPrintLevel(-1) ; // No Printout
212 gMinuit->SetFCN(AliEMCALClusterizerv1::UnfoldingChiSquare) ;
213 // To set the address of the minimization function
214 TList * toMinuit = new TList();
215 toMinuit->AddAt(emcRP,0) ;
216 toMinuit->AddAt(digits,1) ;
218 gMinuit->SetObjectFit(toMinuit) ; // To tranfer pointer to UnfoldingChiSquare
220 // filling initial values for fit parameters
221 AliEMCALDigit * digit ;
225 Int_t nDigits = (Int_t) nPar / 3 ;
229 AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance(); //gime->EMCALGeometry() ;
231 for(iDigit = 0; iDigit < nDigits; iDigit++){
232 digit = maxAt[iDigit];
237 geom->AbsToRelNumbering(digit->GetId(), relid) ;
238 geom->PosInAlice(relid, x, z) ;
240 Float_t energy = maxAtEnergy[iDigit] ;
242 gMinuit->mnparm(index, "x", x, 0.1, 0, 0, ierflg) ;
245 Error("FindFit", "EMCAL Unfolding Unable to set initial value for fit procedure : x = %f", x ) ;
248 gMinuit->mnparm(index, "z", z, 0.1, 0, 0, ierflg) ;
251 Error("FindFit", "EMCAL Unfolding Unable to set initial value for fit procedure : z = %f", z) ;
254 gMinuit->mnparm(index, "Energy", energy , 0.05*energy, 0., 4.*energy, ierflg) ;
257 Error("FindFit", "EMCAL Unfolding Unable to set initial value for fit procedure : energy = %f", energy) ;
262 Double_t p0 = 0.1 ; // "Tolerance" Evaluation stops when EDM = 0.0001*p0 ; The number of function call slightly
267 gMinuit->mnexcm("SET STR", &p2, 0, ierflg) ; // force TMinuit to reduce function calls
268 gMinuit->mnexcm("SET GRA", &p1, 1, ierflg) ; // force TMinuit to use my gradient
269 gMinuit->SetMaxIterations(5);
270 gMinuit->mnexcm("SET NOW", &p2 , 0, ierflg) ; // No Warnings
272 gMinuit->mnexcm("MIGRAD", &p0, 0, ierflg) ; // minimize
274 if(ierflg == 4){ // Minimum not found
275 Error("FindFit", "EMCAL Unfolding Fit not converged, cluster abandoned " ) ;
278 for(index = 0; index < nPar; index++){
281 gMinuit->GetParameter(index, val, err) ; // Returns value and error of parameter index
282 fitparameters[index] = val ;
290 //____________________________________________________________________________
291 void AliEMCALClusterizerv1::GetCalibrationParameters()
293 // Gets the parameters for the calibration from the digitizer
294 //AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
295 AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
297 if ( !emcalLoader->Digitizer() )
298 emcalLoader->LoadDigitizer();
299 AliEMCALDigitizer * dig = dynamic_cast<AliEMCALDigitizer*>(emcalLoader->Digitizer());
301 fADCchannelECA = dig->GetECAchannel() ;
302 fADCpedestalECA = dig->GetECApedestal();
303 //PH cout<<"ChannelECA, peds "<<fADCchannelECA<<" "<<fADCpedestalECA<<endl;
306 //____________________________________________________________________________
307 void AliEMCALClusterizerv1::Init()
309 // Make all memory allocations which can not be done in default constructor.
310 // Attach the Clusterizer task to the list of EMCAL tasks
312 //AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance() ;
313 AliRunLoader *rl = AliRunLoader::GetRunLoader();
314 AliEMCALGeometry *geom = dynamic_cast<AliEMCAL*>(rl->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
315 AliInfo(Form("geom 0x%x",geom));
317 //Sub fNTowers = geom->GetNZ() * geom->GetNPhi() ;
320 gMinuit = new TMinuit(100) ;
321 //Sub if ( !gime->Clusterizer() )
322 //Sub gime->PostClusterizer(this);
326 //____________________________________________________________________________
327 void AliEMCALClusterizerv1::InitParameters()
329 // Initializes the parameters for the Clusterizer
330 fNumberOfECAClusters = 0;
332 fECAClusteringThreshold = 0.5; // value obtained from Alexei
333 fECALocMaxCut = 0.03;
338 fRecPointsInRun = 0 ;
342 //____________________________________________________________________________
343 Int_t AliEMCALClusterizerv1::AreNeighbours(AliEMCALDigit * d1, AliEMCALDigit * d2)const
345 // Gives the neighbourness of two digits = 0 are not neighbour but continue searching
347 // = 2 are not neighbour but do not continue searching
348 // neighbours are defined as digits having at least a common vertex
349 // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster
350 // which is compared to a digit (d2) not yet in a cluster
352 //AliEMCALGeometry * geom = AliEMCALGetter::Instance()->EMCALGeometry() ;
353 AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance() ;
358 //Sub geom->AbsToRelNumbering(d1->GetId(), relid1) ;
365 geom->GetCellIndex(d1->GetId(), nSupMod,nTower,nIphi,nIeta);
366 geom->GetCellPhiEtaIndexInSModule(nSupMod,nTower,nIphi,nIeta, iphi,ieta);
377 geom->GetCellIndex(d2->GetId(), nSupMod1,nTower1,nIphi1,nIeta1);
378 geom->GetCellPhiEtaIndexInSModule(nSupMod1, nTower1,nIphi1,nIeta1, iphi1,ieta1);
383 //Sub geom->AbsToRelNumbering(d2->GetId(), relid2) ;
386 Int_t rowdiff = TMath::Abs( relid1[0] - relid2[0] ) ;
387 Int_t coldiff = TMath::Abs( relid1[1] - relid2[1] ) ;
389 if (( coldiff <= 1 ) && ( rowdiff <= 1 )){
393 if((relid2[0] > relid1[0]) && (relid2[1] > relid1[1]+1))
394 rv = 2; // Difference in row numbers is too large to look further
398 if(rv==1)printf("AreNeighbours: neighbours=%d, id1=%d, relid1=%d,%d \n id2=%d, relid2=%d,%d \n",
399 rv, d1->GetId(), relid1[0], relid1[1],
400 d2->GetId(), relid2[0], relid2[1]) ;
405 //____________________________________________________________________________
406 void AliEMCALClusterizerv1::Unload()
408 // Unloads the Digits and RecPoints
409 AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
411 emcalLoader->UnloadDigits() ;
412 emcalLoader->UnloadRecPoints() ;
415 //____________________________________________________________________________
416 void AliEMCALClusterizerv1::WriteRecPoints()
419 // Creates new branches with given title
420 // fills and writes into TreeR.
422 AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
424 TObjArray * aECARecPoints = emcalLoader->RecPoints() ;
426 TClonesArray * digits = emcalLoader->Digits() ;
427 TTree * treeR = emcalLoader->TreeR();
429 emcalLoader->MakeRecPointsContainer();
430 treeR = emcalLoader->TreeR();
434 //Evaluate position, dispersion and other RecPoint properties for EC section
435 for(index = 0; index < aECARecPoints->GetEntries(); index++)
436 (dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(index)))->EvalAll(fECAW0,digits) ;
438 aECARecPoints->Sort() ;
440 for(index = 0; index < aECARecPoints->GetEntries(); index++)
441 (dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(index)))->SetIndexInList(index) ;
443 Int_t bufferSize = 32000 ;
444 Int_t splitlevel = 0 ;
448 TBranch * branchECA = 0;
449 if ((branchECA = treeR->GetBranch("EMCALECARP")))
450 branchECA->SetAddress(&aECARecPoints);
452 treeR->Branch("EMCALECARP","TObjArray",&aECARecPoints,bufferSize,splitlevel);
455 emcalLoader->WriteRecPoints("OVERWRITE");
456 //emcalLoader->WriteClusterizer("OVERWRITE");
457 emcalLoader->WriteReconstructioner("OVERWRITE");
460 //____________________________________________________________________________
461 void AliEMCALClusterizerv1::MakeClusters()
463 // Steering method to construct the clusters stored in a list of Reconstructed Points
464 // A cluster is defined as a list of neighbour digits
466 AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
468 TObjArray * aECARecPoints = emcalLoader->RecPoints() ;
470 AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance();
472 AliFatal("Did not get geometry from EMCALLoader");
474 aECARecPoints->Clear();
476 TClonesArray * digits = emcalLoader->Digits() ;
477 TClonesArray * digitsC = dynamic_cast<TClonesArray*>(digits->Clone()) ;
479 // Clusterization starts
480 TIter nextdigit(digitsC) ;
481 AliEMCALDigit * digit;
483 cout << "Outer Loop" << endl;
484 while ( (digit = dynamic_cast<AliEMCALDigit *>(nextdigit())) ) { // scan over the list of digitsC
485 AliEMCALRecPoint * clu = 0 ;
487 TArrayI clusterECAdigitslist(50000);
489 ////////////////////////temp solution, embedding///////////////////
490 int nSupMod=0, nTower=0, nIphi=0, nIeta=0;
492 geom->GetCellIndex(digit->GetId(), nSupMod,nTower,nIphi,nIeta);
493 geom->GetCellPhiEtaIndexInSModule(nSupMod,nTower,nIphi,nIeta, iphi,ieta);
495 //cout << "Some checking" << endl;
496 if (geom->CheckAbsCellId(digit->GetId()) && (Calibrate(digit->GetAmp()+addOn[nSupMod-1][ieta-1][iphi-1]) > fECAClusteringThreshold ) ){
497 //if(addOn[nSupMod-1][ieta-1][iphi-1]>0)cout<<"11 digit, add "<<ieta<<" "<<iphi<<" "<<addOn[nSupMod-1][ieta-1][iphi-1]<<" "<<digit->GetAmp()<<endl;
498 // cout<<"crossed the threshold "<<endl;
499 Int_t iDigitInECACluster = 0;
500 // start a new Tower RecPoint
501 if(fNumberOfECAClusters >= aECARecPoints->GetSize())
502 aECARecPoints->Expand(2*fNumberOfECAClusters+1) ;
503 AliEMCALRecPoint * rp = new AliEMCALRecPoint("") ;
505 aECARecPoints->AddAt(rp, fNumberOfECAClusters) ;
506 clu = dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(fNumberOfECAClusters)) ;
507 fNumberOfECAClusters++ ;
508 clu->AddDigit(*digit, Calibrate(digit->GetAmp()+addOn[nSupMod-1][ieta-1][iphi-1])) ;
509 clusterECAdigitslist[iDigitInECACluster] = digit->GetIndexInList() ;
510 iDigitInECACluster++ ;
511 // cout<<" 1st setp:cluno, digNo "<<fNumberOfECAClusters<<" "<<iDigitInECACluster<<endl;
512 digitsC->Remove(digit) ;
513 AliDebug(1,Form("MakeClusters: OK id = %d, ene = %f , thre = %f \n", digit->GetId(),Calibrate(digit->GetAmp()), fECAClusteringThreshold));
516 AliEMCALDigit * digitN ;
519 // Find the neighbours
520 while (index < iDigitInECACluster){ // scan over digits already in cluster
521 digit = (AliEMCALDigit*)digits->At(clusterECAdigitslist[index]);
523 while ( (digitN = (AliEMCALDigit *)nextdigit())) { // scan over the reduced list of digits
524 // cout<<"we have new digit "<<endl;
525 // check that the digit is above the min E Cut
526 geom->GetCellIndex(digitN->GetId(), nSupMod,nTower,nIphi,nIeta);
527 geom->GetCellPhiEtaIndexInSModule(nSupMod,nTower,nIphi,nIeta, iphi,ieta);
528 if( Calibrate(digitN->GetAmp()+addOn[nSupMod-1][ieta-1][iphi-1]) < fMinECut ) digitsC->Remove(digitN);
529 //cout<<" new digit above ECut "<<endl;
530 Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!!
531 // cout<<" new digit neighbour?? "<<ineb<<endl;
533 case 0 : // not a neighbour
535 case 1 : // are neighbours
536 //if(addOn[nSupMod-1][ieta-1][iphi-1]>0)cout<<"22 digit, add "<<nSupMod<<" "<<ieta<<" "<<iphi<<" "<<addOn[nSupMod-1][ieta-1][iphi-1]<<" "<<digit->GetAmp()<<endl;
537 clu->AddDigit(*digitN, Calibrate( digitN->GetAmp()+addOn[nSupMod-1][ieta-1][iphi-1]) ) ;
538 clusterECAdigitslist[iDigitInECACluster] = digitN->GetIndexInList() ;
539 iDigitInECACluster++ ;
540 // cout<<"when neighbour: cluno, digNo "<<digit->GetId()<<" "<<fNumberOfECAClusters<<" "<<iDigitInECACluster<<endl;
541 digitsC->Remove(digitN) ;
543 // case 2 : // too far from each other
544 //Subh goto endofloop1;
545 // cout<<"earlier go to end of loop"<<endl;
547 //cout<<"in nextDigit loop "<<fNumberOfECAClusters<<" "<<iDigitInECACluster<<endl;
549 //cout << "Done neighbout searching" << endl;
551 } // loop over ECA cluster
552 } // energy threshold
553 else if(Calibrate(digit->GetAmp()+addOn[nSupMod-1][ieta-1][iphi-1]) < fMinECut ){
554 //if(addOn[nSupMod-1][ieta-1][iphi-1]>0)cout<<"33 digit, add "<<ieta<<" "<<iphi<<" "<<addOn[nSupMod-1][ieta-1][iphi-1]<<" "<<digit->GetAmp()<<endl;
555 digitsC->Remove(digit);
557 //cout<<"after endofloop: cluno, digNo "<<fNumberOfECAClusters<<endl;
560 AliDebug(1,Form("total no of clusters %d from %d digits",fNumberOfECAClusters,digits->GetEntriesFast()));
563 //____________________________________________________________________________
564 void AliEMCALClusterizerv1::MakeUnfolding() const
566 Fatal("AliEMCALClusterizerv1::MakeUnfolding", "--> Unfolding not implemented") ;
570 //____________________________________________________________________________
571 Double_t AliEMCALClusterizerv1::ShowerShape(Double_t r)
573 // Shape of the shower (see EMCAL TDR)
574 // If you change this function, change also the gradient evaluation in ChiSquare()
576 Double_t r4 = r*r*r*r ;
577 Double_t r295 = TMath::Power(r, 2.95) ;
578 Double_t shape = TMath::Exp( -r4 * (1. / (2.32 + 0.26 * r4) + 0.0316 / (1 + 0.0652 * r295) ) ) ;
582 //____________________________________________________________________________
583 void AliEMCALClusterizerv1::UnfoldCluster(AliEMCALRecPoint * /*iniTower*/,
585 AliEMCALDigit ** /*maxAt*/,
586 Float_t * /*maxAtEnergy*/) const
588 // Performs the unfolding of a cluster with nMax overlapping showers
590 Fatal("UnfoldCluster", "--> Unfolding not implemented") ;
594 //_____________________________________________________________________________
595 void AliEMCALClusterizerv1::UnfoldingChiSquare(Int_t & /*nPar*/, Double_t * /*Grad*/,
597 Double_t * /*x*/, Int_t /*iflag*/)
599 // Calculates the Chi square for the cluster unfolding minimization
600 // Number of parameters, Gradient, Chi squared, parameters, what to do
602 ::Fatal("UnfoldingChiSquare","Unfolding not implemented") ;
604 //____________________________________________________________________________
605 void AliEMCALClusterizerv1::Print(Option_t * /*option*/)const
607 // Print clusterizer parameters
609 TString message("\n") ;
611 if( strcmp(GetName(), "") !=0 ){
615 TString taskName(GetName()) ;
616 taskName.ReplaceAll(Version(), "") ;
618 printf("--------------- ");
619 printf(taskName.Data()) ;
622 printf("-----------\n");
623 printf("Clusterizing digits from the file: ");
624 printf(taskName.Data());
625 printf("\n Branch: ");
627 printf("\n ECA Local Maximum cut = %f", fECALocMaxCut);
628 printf("\n ECA Logarithmic weight = %f", fECAW0);
630 printf("\nUnfolding on\n");
632 printf("\nUnfolding off\n");
634 printf("------------------------------------------------------------------");
637 printf("AliEMCALClusterizerv1 not initialized ") ;
640 //____________________________________________________________________________
641 void AliEMCALClusterizerv1::PrintRecPoints(Option_t * option)
643 // Prints list of RecPoints produced at the current pass of AliEMCALClusterizer
644 AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
645 TObjArray * aECARecPoints = emcalLoader->RecPoints() ;
647 printf("PrintRecPoints: Clusterization result:") ;
649 printf("event # %d\n", emcalLoader->GetRunLoader()->GetEventNumber() ) ;
650 printf(" Found %d ECA Rec Points\n ",
651 aECARecPoints->GetEntriesFast()) ;
653 fRecPointsInRun += aECARecPoints->GetEntriesFast() ;
655 if(strstr(option,"all")) {
657 printf("\n-----------------------------------------------------------------------\n") ;
658 printf("Clusters in ECAL section\n") ;
659 printf("Index Ene(GeV) Multi Module phi r theta X Y Z Dispersion Lambda 1 Lambda 2 # of prim Primaries list\n") ;
665 for (index = 0 ; index < aECARecPoints->GetEntries() ; index++) {
666 AliEMCALRecPoint * rp = dynamic_cast<AliEMCALRecPoint * >(aECARecPoints->At(index)) ;
668 //rp->GetGlobalPosition(globalpos);
670 rp->GetLocalPosition(localpos);
672 rp->GetElipsAxis(lambda);
675 primaries = rp->GetPrimaries(nprimaries);
676 printf("\n%6d %8.4f %3d %4.1f %4.1f %4.1f %4.1f %4.1f %4.1f %4.1f %4f %4f %2d : ",
677 rp->GetIndexInList(), rp->GetEnergy(), rp->GetMultiplicity(),
678 globalpos.X(), globalpos.Y(), globalpos.Z(), localpos.X(), localpos.Y(), localpos.Z(),
679 rp->GetDispersion(), lambda[0], lambda[1], nprimaries) ;
681 if(rp->GetEnergy()>maxE){
682 maxE=rp->GetEnergy();
685 maxDis=rp->GetDispersion();
687 pointE->Fill(rp->GetEnergy());
688 pointL1->Fill(lambda[0]);
689 pointL2->Fill(lambda[1]);
690 pointDis->Fill(rp->GetDispersion());
691 pointMult->Fill(rp->GetMultiplicity());
693 for (Int_t iprimary=0; iprimary<nprimaries; iprimary++) {
694 printf("%d ", primaries[iprimary] ) ;
701 MaxDis->Fill(maxDis);
704 printf("\n-----------------------------------------------------------------------\n");
707 void AliEMCALClusterizerv1::BookHists()
709 pointE = new TH1F("pointE","point energy", 2000, 0.0, 150.);
710 pointL1 = new TH1F("pointL1","point L1", 1000, 0.0, 3.);
711 pointL2 = new TH1F("pointL2","point L2", 1000, 0.0, 3.);
712 pointDis = new TH1F("pointDis","point Dis", 1000, 0.0, 3.);
713 pointMult = new TH1F("pointMult","point Mult", 100, 0.0, 100.);
714 digitAmp = new TH1F("digitAmp","Digit Amplitude", 2000, 0.0, 5000.);
715 MaxE = new TH1F("maxE","Max point energy", 2000, 0.0, 150.);
716 MaxL1 = new TH1F("maxL1","Max point L1", 1000, 0.0, 3.);
717 MaxL2 = new TH1F("maxL2","Max point L2", 1000, 0.0, 3.);
718 MaxDis = new TH1F("maxDis","Max point Dis", 1000, 0.0, 3.);
720 void AliEMCALClusterizerv1::SaveHists()
722 recofile=new TFile("reco.root","RECREATE");
736 void AliEMCALClusterizerv1::ReadFile()
739 FILE *fp = fopen("hijing1.dat","r");
740 for(Int_t line=0;line<9113;line++){
743 ncols0 = fscanf(fp,"%d %d %d %d",&sm,&l1,&l2,&eg);
744 // cout<<eg<<" "<<l1<<" "<<l2<<endl;
745 addOn[sm-1][l1-1][l2-1]=eg;
746 //addOn[sm-1][l1-1][l2-1]=0;