- AliEMCALDigit * digitN ;
- index = 0 ;
- while (index < iDigitInCluster){ // scan over digits already in cluster
- digit = (AliEMCALDigit*)digits->At(clusterdigitslist[index]) ;
- index++ ;
- while ( (digitN = (AliEMCALDigit *)nextdigit()) ) { // scan over the reduced list of digits
- Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!!
- switch (ineb ) {
- case 0 : // not a neighbour
- break ;
- case 1 : // are neighbours
- clu->AddDigit(*digitN, Calibrate( digitN->GetAmp(), digitN->IsInPreShower() ) ) ;
- clusterdigitslist[iDigitInCluster] = digitN->GetIndexInList() ;
- iDigitInCluster++ ;
- digitsC->Remove(digitN) ;
- break ;
- case 2 : // too far from each other
- goto endofloop;
- } // switch
-
- } // while digitN
-
- endofloop: ;
- nextdigit.Reset() ;
- } // loop over cluster
- } // energy theshold
- } // while digit
- delete digitsC ;
-}
-
-//____________________________________________________________________________
-void AliEMCALClusterizerv1::MakeUnfolding()
-{
- Fatal("AliEMCALClusterizerv1::MakeUnfolding", "--> Unfolding not implemented") ;
-
-}
-
-//____________________________________________________________________________
-Double_t AliEMCALClusterizerv1::ShowerShape(Double_t r)
-{
- // Shape of the shower (see EMCAL TDR)
- // If you change this function, change also the gradient evaluation in ChiSquare()
-
- Double_t r4 = r*r*r*r ;
- Double_t r295 = TMath::Power(r, 2.95) ;
- Double_t shape = TMath::Exp( -r4 * (1. / (2.32 + 0.26 * r4) + 0.0316 / (1 + 0.0652 * r295) ) ) ;
- return shape ;
-}
-
-//____________________________________________________________________________
-void AliEMCALClusterizerv1::UnfoldCluster(AliEMCALTowerRecPoint * iniTower,
- Int_t nMax,
- AliEMCALDigit ** maxAt,
- Float_t * maxAtEnergy)
-{
- // Performs the unfolding of a cluster with nMax overlapping showers
-
- Fatal("UnfoldCluster", "--> Unfolding not implemented") ;
-
-}
-
-//_____________________________________________________________________________
-void AliEMCALClusterizerv1::UnfoldingChiSquare(Int_t & nPar, Double_t * Grad, Double_t & fret, Double_t * x, Int_t iflag)
-{
- // Calculates the Chi square for the cluster unfolding minimization
- // Number of parameters, Gradient, Chi squared, parameters, what to do
-
- ::Fatal("UnfoldingChiSquare","Unfolding not implemented") ;
-}
-//____________________________________________________________________________
-void AliEMCALClusterizerv1::Print(Option_t * option)const
-{
- // Print clusterizer parameters
-
- TString message("\n") ;
-
- if( strcmp(GetName(), "") !=0 ){
-
- // Print parameters
-
- TString taskName(GetName()) ;
- taskName.ReplaceAll(Version(), "") ;
-
- message += "--------------- " ;
- message += taskName.Data() ;
- message += " " ;
- message += GetTitle() ;
- message += "-----------\n" ;
- message += "Clusterizing digits from the file: " ;
- message += taskName.Data() ;
- message += "\n Branch: " ;
- message += GetName() ;
- message += "\n EMC Clustering threshold = " ;
- message += fTowerClusteringThreshold ;
- message += "\n EMC Local Maximum cut = " ;
- message += fTowerLocMaxCut ;
- message += "\n EMC Logarothmic weight = " ;
- message += fW0 ;
- message += "\n CPV Clustering threshold = " ;
- message += fPreShoClusteringThreshold ;
- message += "\n CPV Local Maximum cut = " ;
- message += fPreShoLocMaxCut ;
- message += "\n CPV Logarothmic weight = " ;
- message += fW0CPV ;
- if(fToUnfold)
- message +="\nUnfolding on\n" ;
- else
- message += "\nUnfolding off\n";
-
- message += "------------------------------------------------------------------" ;
- }
- else
- message += "AliEMCALClusterizerv1 not initialized " ;
+ // Grow cluster by finding neighbours
+ TIter nextClusterDigit(&clusterDigits);
+
+ while ( (digit = dynamic_cast<AliEMCALDigit*>(nextClusterDigit())) ) { // scan over digits in cluster
+ TIter nextdigitN(digitsC);
+ AliEMCALDigit *digitN = 0; // digi neighbor
+ while ( (digitN = (AliEMCALDigit *)nextdigitN()) ) { // scan over all digits to look for neighbours
+ //Do not add digits with too different time
+ Bool_t shared = kFALSE;//cluster shared by 2 SuperModules?
+ if(TMath::Abs(time - digitN->GetTime()) > fTimeCut ) continue; //Time or TimeR?
+ if (AreNeighbours(digit, digitN, shared)==1) { // call (digit,digitN) in THAT order !!!!!
+ recPoint->AddDigit(*digitN, digitN->GetCalibAmp(), shared);
+ clusterDigits.AddLast(digitN);
+ digitsC->Remove(digitN);
+ } // if(ineb==1)
+ } // scan over digits
+ } // scan over digits already in cluster
+
+ AliDebug(2,Form("MakeClusters: %d digitd, energy %f \n", clusterDigits.GetEntries(), recPoint->GetEnergy()));
+ }//recpoint
+ else AliFatal("Null recpoint in array!");
+ } // If seed found
+ } // while digit