- // static Int_t pxold, pyold;
-
- static TGraph * DigitGraph = 0 ;
-
- if (!gPad->IsEditable()) return;
-
- TH2F * Histo = 0 ;
- TCanvas * HistoCanvas ;
-
- switch (event) {
-
- case kButton1Down: {
- AliPHOSDigit * digit ;
- AliPHOSGeometry * PHOSGeom = (AliPHOSGeometry *) fGeom ;
- Int_t iDigit;
- Int_t relid[4] ;
- Float_t xi[fMulDigit] ;
- Float_t zi[fMulDigit] ;
-
- // create the histogram for the single cluster
- // 1. gets histogram boundaries
- Float_t ximax = -999. ;
- Float_t zimax = -999. ;
- Float_t ximin = 999. ;
- Float_t zimin = 999. ;
+
+ //try to get run loader from default event folder
+ AliRunLoader* rn = AliRunLoader::GetRunLoader(AliConfig::GetDefaultEventFolderName());
+ if (rn == 0x0)
+ {
+ AliError(Form("Cannot find Run Loader in Default Event Folder"));
+ return;
+ }
+ AliPHOSLoader* phosLoader = dynamic_cast<AliPHOSLoader*>(rn->GetLoader("PHOSLoader"));
+ if (phosLoader == 0x0)
+ {
+ AliError(Form("Cannot find PHOS Loader from Run Loader"));
+ return;
+ }
+
+
+ const TClonesArray * digits = phosLoader->Digits() ;
+
+ switch (event) {
+
+ case kButton1Down: {
+ AliPHOSDigit * digit ;
+ Int_t iDigit;
+ Int_t relid[4] ;
+
+ const Int_t kMulDigit = AliPHOSEmcRecPoint::GetDigitsMultiplicity() ;
+ Float_t * xi = new Float_t[kMulDigit] ;
+ Float_t * zi = new Float_t[kMulDigit] ;
+
+ // create the histogram for the single cluster
+ // 1. gets histogram boundaries
+ Float_t ximax = -999. ;
+ Float_t zimax = -999. ;
+ Float_t ximin = 999. ;
+ Float_t zimin = 999. ;
+
+ for(iDigit=0; iDigit<kMulDigit; iDigit++) {
+ digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
+ phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ phosgeom->RelPosInModule(relid, xi[iDigit], zi[iDigit]);
+ if ( xi[iDigit] > ximax )
+ ximax = xi[iDigit] ;
+ if ( xi[iDigit] < ximin )
+ ximin = xi[iDigit] ;
+ if ( zi[iDigit] > zimax )
+ zimax = zi[iDigit] ;
+ if ( zi[iDigit] < zimin )
+ zimin = zi[iDigit] ;
+ }
+ ximax += phosgeom->GetCrystalSize(0) / 2. ;
+ zimax += phosgeom->GetCrystalSize(2) / 2. ;
+ ximin -= phosgeom->GetCrystalSize(0) / 2. ;
+ zimin -= phosgeom->GetCrystalSize(2) / 2. ;
+ Int_t xdim = (int)( (ximax - ximin ) / phosgeom->GetCrystalSize(0) + 0.5 ) ;
+ Int_t zdim = (int)( (zimax - zimin ) / phosgeom->GetCrystalSize(2) + 0.5 ) ;
+
+ // 2. gets the histogram title
+
+ Text_t title[100] ;
+ snprintf(title,100,"Energy=%1.2f GeV ; Digits ; %d ", GetEnergy(), GetDigitsMultiplicity()) ;
+
+ if (!histo) {
+ delete histo ;
+ histo = 0 ;
+ }
+ histo = new TH2F("cluster3D", title, xdim, ximin, ximax, zdim, zimin, zimax) ;
+
+ Float_t x, z ;
+ for(iDigit=0; iDigit<kMulDigit; iDigit++) {
+ digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
+ phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
+ phosgeom->RelPosInModule(relid, x, z);
+ histo->Fill(x, z, fEnergyList[iDigit] ) ;
+ }
+
+ if (!digitgraph) {
+ digitgraph = new TGraph(kMulDigit,xi,zi);
+ digitgraph-> SetMarkerStyle(5) ;
+ digitgraph-> SetMarkerSize(1.) ;
+ digitgraph-> SetMarkerColor(1) ;
+ digitgraph-> Paint("P") ;
+ }
+
+ // Print() ;
+ histocanvas = new TCanvas("cluster", "a single cluster", 600, 500) ;
+ histocanvas->Draw() ;
+ histo->Draw("lego1") ;
+
+ delete[] xi ;
+ delete[] zi ;
+
+ break;
+ }
+
+ case kButton1Up:
+ if (digitgraph) {
+ delete digitgraph ;
+ digitgraph = 0 ;
+ }
+ break;
+
+ }
+}
+
+//____________________________________________________________________________
+void AliPHOSEmcRecPoint::EvalDispersion(Float_t logWeight,TClonesArray * digits, TVector3 & /* vInc */)
+{
+ // Calculates the dispersion of the shower at the origine of the RecPoint
+ //DP: should we correct dispersion for non-perpendicular hit????????