-Int_t AliEMCALClusterizerv1::AreInGroup(AliEMCALDigit * d1, AliEMCALDigit * d2) const
-{
- // Tells whether two digits fall within the same supermodule and
- // tower grouping. The number of towers in a group is controlled by
- // the parameter nTowersInGroup
- // = 0 are not in same group but continue searching
- // = 1 same group
- // = 2 is in different SM, quit from searching
- // = 3 different tower group, quit from searching
- //
- // The order of d1 and d2 is important: first (d1) should be a digit
- // already in a cluster which is compared to a digit (d2) not yet in a cluster
-
- //JLK Question: does the quit from searching assume that the digits
- //are ordered, so that once you are in a different SM, you'll not
- //find another in the list that will match? How about my TowerGroup search?
-
- static Int_t rv;
- static Int_t nSupMod1=0, nTower1=0, nIphi1=0, nIeta1=0, iphi1=0, ieta1=0;
- static Int_t nSupMod2=0, nTower2=0, nIphi2=0, nIeta2=0, iphi2=0, ieta2=0;
- static Int_t towerGroup1 = -1, towerGroup2 = -1;
- rv = 0 ;
-
- fGeom->GetCellIndex(d1->GetId(), nSupMod1,nTower1,nIphi1,nIeta1);
- fGeom->GetCellIndex(d2->GetId(), nSupMod2,nTower2,nIphi2,nIeta2);
- if(nSupMod1 != nSupMod2) return 2; // different SM
-
- static Int_t nTowerInSM = fGeom->GetNCellsInSupMod()/fGeom->GetNCellsInTower();
-
- //figure out which tower grouping each digit belongs to
- for(int it = 0; it < nTowerInSM/fNTowerInGroup; it++) {
- if(nTower1 <= nTowerInSM - it*fNTowerInGroup) towerGroup1 = it;
- if(nTower2 <= nTowerInSM - it*fNTowerInGroup) towerGroup2 = it;
- }
- if(towerGroup1 != towerGroup2) return 3; //different Towergroup
-
- //same SM, same towergroup, we're happy
- if(towerGroup1 == towerGroup2 && towerGroup2 >= 0)
- rv = 1;
-
- if (gDebug == 2 && rv==1)
- printf("AreInGroup: neighbours=%d, id1=%d, relid1=%d,%d \n id2=%d, relid2=%d,%d \n",
- rv, d1->GetId(), iphi1,ieta1, d2->GetId(), iphi2,ieta2);
-
- return rv ;
-}
-
-//____________________________________________________________________________
-void AliEMCALClusterizerv1::Unload()
-{
- // Unloads the Digits and RecPoints
- AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
-
- emcalLoader->UnloadDigits() ;
- emcalLoader->UnloadRecPoints() ;
-}
-
-//____________________________________________________________________________
-void AliEMCALClusterizerv1::WriteRecPoints()
-{
-
- // Creates new branches with given title
- // fills and writes into TreeR.
-
- AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"));
-
- TObjArray * aECARecPoints = emcalLoader->RecPoints() ;
-
- TClonesArray * digits = emcalLoader->Digits() ;
- TTree * treeR = emcalLoader->TreeR();
- if ( treeR==0 ) {
- emcalLoader->MakeRecPointsContainer();
- treeR = emcalLoader->TreeR();
- }
- Int_t index ;
-
- //Evaluate position, dispersion and other RecPoint properties for EC section
- for(index = 0; index < aECARecPoints->GetEntries(); index++)
- (dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(index)))->EvalAll(fECAW0,digits) ;
-
- aECARecPoints->Sort() ;
-
- for(index = 0; index < aECARecPoints->GetEntries(); index++) {
- (dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(index)))->SetIndexInList(index) ;
- (dynamic_cast<AliEMCALRecPoint *>(aECARecPoints->At(index)))->Print();
- }
-
- Int_t bufferSize = 32000 ;
- Int_t splitlevel = 0 ;
-
- //EC section branch
-
- TBranch * branchECA = 0;
- if ((branchECA = treeR->GetBranch("EMCALECARP")))
- branchECA->SetAddress(&aECARecPoints);
- else
- treeR->Branch("EMCALECARP","TObjArray",&aECARecPoints,bufferSize,splitlevel);
- treeR->Fill() ;
-
- emcalLoader->WriteRecPoints("OVERWRITE");
-
-}
-
-//____________________________________________________________________________
-void AliEMCALClusterizerv1::MakeClusters(char* option)