// --- ROOT system ---
-#include "TPad.h"
#include "TH2.h"
#include "TMath.h"
#include "TCanvas.h"
// --- Standard library ---
-#include <iostream.h>
-
// --- AliRoot header files ---
#include "AliGenerator.h"
fAmp = 0. ;
fCoreEnergy = 0 ;
fEnergyList = 0 ;
- fTime = -1. ;
- fLocPos.SetX(1000000.) ; //Local position should be evaluated
-
+ fTime = 0. ;
+ fLocPos.SetX(0.) ; //Local position should be evaluated
}
//____________________________________________________________________________
fCoreEnergy = 0 ;
fEnergyList = 0 ;
fTime = -1. ;
- fLocPos.SetX(1000000.) ; //Local position should be evaluated
-
+ fLocPos.SetX(1000000.) ; //Local position should be evaluated
}
//____________________________________________________________________________
Bool_t aren = kFALSE ;
- AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
- AliEMCALGeometry * phosgeom = (AliEMCALGeometry*)gime->EMCALGeometry();
+ AliEMCALGeometry * phosgeom = (AliEMCALGetter::Instance())->EMCALGeometry();
Int_t relid1[4] ;
phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ;
{
// Compares two RecPoints according to their position in the EMCAL modules
- Float_t delta = 1 ; //Width of "Sorting row". If you changibg this
+ Float_t delta = 1 ; //Width of "Sorting row". If you change this
//value (what is senseless) change as vell delta in
//AliEMCALTrackSegmentMakerv* and other RecPoints...
Int_t rv ;
// and switched off when the mouse button is released.
- // AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
-// if(!gime) return ;
-// AliEMCALGeometry * emcalgeom = (AliEMCALGeometry*)gime->EMCALGeometry();
-
+ // AliEMCALGeometry * phosgeom = (AliEMCALGetter::Instance())->EMCALGeometry();
+
// static TGraph * digitgraph = 0 ;
// if (!gPad->IsEditable()) return;
AliEMCALDigit * digit ;
- AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
- AliEMCALGeometry * emcalgeom = (AliEMCALGeometry*)gime->EMCALGeometry();
+ AliEMCALGeometry * emcalgeom = (AliEMCALGetter::Instance())->EMCALGeometry();
// Calculates the center of gravity in the local EMCAL-module coordinates
Int_t iDigit;
- Int_t relid[4] ;
- if (!fTheta || !fPhi ) {
- for(iDigit=0; iDigit<fMulDigit; iDigit++) {
- digit = dynamic_cast<AliEMCALDigit *>(digits->At(fDigitsList[iDigit])) ;
-
- Float_t thetai ;
- Float_t phii ;
- emcalgeom->AbsToRelNumbering(digit->GetId(), relid) ;
- emcalgeom->PosInAlice(relid, thetai, phii);
- Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
- fTheta = fTheta + thetai * w ;
- fPhi += (phii * w );
- wtot += w ;
- }
+ if (!fTheta || !fPhi )
+ EvalGlobalPosition(logWeight, digits) ;
+
+ const Float_t kDeg2Rad = TMath::DegToRad() ;
- fTheta /= wtot ;
- fPhi /= wtot ;
- }
-
- const Float_t kDeg2Rad = TMath::Pi() / static_cast<Double_t>(180) ;
+ Float_t cyl_radius = 0 ;
- Float_t cyl_radius = emcalgeom->GetIPDistance()+emcalgeom->GetAirGap() ;
- Float_t x = cyl_radius * TMath::Cos(fPhi * kDeg2Rad ) ;
- Float_t y = cyl_radius * TMath::Cos(fPhi * kDeg2Rad ) ;
- Float_t z = cyl_radius * TMath::Tan(fTheta * kDeg2Rad ) ;
+ if (IsInPRE())
+ cyl_radius = emcalgeom->GetIP2PRESection() ;
+ else if (IsInECA())
+ cyl_radius = emcalgeom->GetIP2ECASection() ;
+ else if (IsInHCA())
+ cyl_radius = emcalgeom->GetIP2HCASection() ;
+ else
+ Fatal("EvalDispersion", "Unexpected tower section!") ;
+ Float_t x = fLocPos.X() ;
+ Float_t y = fLocPos.Y() ;
+ Float_t z = fLocPos.Z() ;
+
+ if (gDebug == 2)
+ Info("EvalDispersion", "x,y,z = %f,%f,%f", x, y, z) ;
+
// Calculates the dispersion in coordinates
wtot = 0.;
for(iDigit=0; iDigit < fMulDigit; iDigit++) {
digit = (AliEMCALDigit *) digits->At(fDigitsList[iDigit]) ;
Float_t thetai = 0. ;
Float_t phii = 0.;
- emcalgeom->AbsToRelNumbering(digit->GetId(), relid) ;
- emcalgeom->PosInAlice(relid, thetai, phii);
+ emcalgeom->PosInAlice(digit->GetId(), thetai, phii);
Float_t xi = cyl_radius * TMath::Cos(phii * kDeg2Rad ) ;
Float_t yi = cyl_radius * TMath::Sin(phii * kDeg2Rad ) ;
- Float_t zi = cyl_radius * TMath::Tan(thetai * kDeg2Rad ) ;
+ Float_t zi = cyl_radius / TMath::Tan(thetai * kDeg2Rad ) ;
+
+ if (gDebug == 2)
+ Info("EvalDispersion", "id = %d, xi,yi,zi = %f,%f,%f", digit->GetId(), xi, yi, zi) ;
Float_t w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
- d += w*((xi-x)*(xi-x) + (yi-y)*(yi-y)+ (zi-z)*(zi-z) ) ;
+ d += w * ( (xi-x)*(xi-x) + (zi-z)*(zi-z) ) ;
wtot+=w ;
}
- d /= wtot ;
+ if ( wtot > 0 )
+ d /= wtot ;
+ else
+ d = 0. ;
fDispersion = TMath::Sqrt(d) ;
Float_t coreRadius = 10. ;
AliEMCALDigit * digit ;
- Int_t relid[4] ;
Float_t wtot = 0. ;
- AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
- AliEMCALGeometry * emcalgeom = (AliEMCALGeometry*)gime->EMCALGeometry();
-
+ AliEMCALGeometry * emcalgeom = (AliEMCALGetter::Instance())->EMCALGeometry();
Int_t iDigit;
if (!fTheta || !fPhi ) {
Float_t thetai ;
Float_t phii ;
- emcalgeom->AbsToRelNumbering(digit->GetId(), relid) ;
- emcalgeom->PosInAlice(relid, thetai, phii);
+ emcalgeom->PosInAlice(digit->GetId(), thetai, phii);
Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
fTheta = fTheta + thetai * w ;
fPhi += (phii * w );
wtot += w ;
}
- fTheta /= wtot ;
- fPhi /= wtot ;
+ if (wtot > 0 ) {
+ fTheta /= wtot ;
+ fPhi /= wtot ;
+ } else {
+ fTheta = -1 ;
+ fPhi = -1 ;
+ }
}
-
- const Float_t kDeg2Rad = TMath::Pi() / static_cast<Double_t>(180) ;
-
- Float_t cyl_radius = emcalgeom->GetIPDistance()+emcalgeom->GetAirGap() ;
+
+ const Float_t kDeg2Rad = TMath::DegToRad() ;
+
+ Float_t cyl_radius = emcalgeom->GetIP2ECASection();
Float_t x = cyl_radius * TMath::Cos(fPhi * kDeg2Rad ) ;
Float_t y = cyl_radius * TMath::Cos(fPhi * kDeg2Rad ) ;
Float_t z = cyl_radius * TMath::Tan(fTheta * kDeg2Rad ) ;
for(iDigit=0; iDigit < fMulDigit; iDigit++) {
digit = (AliEMCALDigit *) ( digits->At(fDigitsList[iDigit]) ) ;
- Int_t relid[4] ;
Float_t thetai = 0. ;
Float_t phii = 0. ;
- emcalgeom->AbsToRelNumbering(digit->GetId(), relid) ;
- emcalgeom->PosInAlice(relid, thetai, phii);
+ emcalgeom->PosInAlice(digit->GetId(), thetai, phii);
Float_t xi = cyl_radius * TMath::Cos(phii * kDeg2Rad ) ;
Float_t yi = cyl_radius * TMath::Sin(phii * kDeg2Rad ) ;
if(distance < coreRadius)
fCoreEnergy += fEnergyList[iDigit] ;
}
-
+
}
//____________________________________________________________________________
AliEMCALDigit * digit ;
- AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
- AliEMCALGeometry * emcalgeom = (AliEMCALGeometry*)gime->EMCALGeometry();
+ AliEMCALGeometry * emcalgeom = (AliEMCALGetter::Instance())->EMCALGeometry();
Int_t iDigit;
- const Float_t kDeg2Rad = TMath::Pi() / static_cast<Double_t>(180) ;
+ const Float_t kDeg2Rad = TMath::DegToRad() ;
- Float_t cyl_radius = emcalgeom->GetIPDistance()+emcalgeom->GetAirGap() ;
+ Float_t cyl_radius = 0 ;
+
+ if (IsInPRE())
+ cyl_radius = emcalgeom->GetIP2PRESection() ;
+ else if (IsInECA())
+ cyl_radius = emcalgeom->GetIP2ECASection() ;
+ else if (IsInHCA())
+ cyl_radius = emcalgeom->GetIP2HCASection() ;
+ else
+ Fatal("EvalDispersion", "Unexpected tower section!") ;
for(iDigit=0; iDigit<fMulDigit; iDigit++) {
digit = (AliEMCALDigit *) digits->At(fDigitsList[iDigit]) ;
- Int_t relid[4] ;
Float_t thetai = 0. ;
Float_t phii = 0. ;
- emcalgeom->AbsToRelNumbering(digit->GetId(), relid) ;
- emcalgeom->PosInAlice(relid, thetai, phii);
+ emcalgeom->PosInAlice(digit->GetId(), thetai, phii);
Double_t w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
Float_t xi = cyl_radius * TMath::Cos(fPhi * kDeg2Rad ) ;
- Float_t zi = cyl_radius * TMath::Tan(fTheta * kDeg2Rad ) ;
+ Float_t zi = cyl_radius / TMath::Tan(fTheta * kDeg2Rad ) ;
dxx += w * xi * xi ;
x += w * xi ;
dzz += w * zi * zi ;
dxz += w * xi * zi ;
wtot += w ;
}
- dxx /= wtot ;
- x /= wtot ;
- dxx -= x * x ;
- dzz /= wtot ;
- z /= wtot ;
- dzz -= z * z ;
- dxz /= wtot ;
- dxz -= x * z ;
-
-// //Apply correction due to non-perpendicular incidence
+ if ( wtot > 0 ) {
+ dxx /= wtot ;
+ x /= wtot ;
+ dxx -= x * x ;
+ dzz /= wtot ;
+ z /= wtot ;
+ dzz -= z * z ;
+ dxz /= wtot ;
+ dxz -= x * z ;
+
+
+ // //Apply correction due to non-perpendicular incidence
// Double_t CosX ;
// Double_t CosZ ;
-// AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
-// AliEMCALGeometry * emcalgeom = (AliEMCALGeometry*)gime->EMCALGeometry();
+// AliEMCALGeometry * emcalgeom = (AliEMCALGetter::Instance())->EMCALGeometry();
// Double_t DistanceToIP= (Double_t ) emcalgeom->GetIPDistance() ;
// CosX = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+x*x) ;
// dxz = dxz/(CosX*CosZ) ;
- fLambda[0] = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
- if(fLambda[0] > 0)
- fLambda[0] = TMath::Sqrt(fLambda[0]) ;
-
- fLambda[1] = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
- if(fLambda[1] > 0) //To avoid exception if numerical errors lead to negative lambda.
- fLambda[1] = TMath::Sqrt(fLambda[1]) ;
- else
+ fLambda[0] = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
+ if(fLambda[0] > 0)
+ fLambda[0] = TMath::Sqrt(fLambda[0]) ;
+
+ fLambda[1] = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
+ if(fLambda[1] > 0) //To avoid exception if numerical errors lead to negative lambda.
+ fLambda[1] = TMath::Sqrt(fLambda[1]) ;
+ else
+ fLambda[1]= 0. ;
+ } else {
+ fLambda[0]= 0. ;
fLambda[1]= 0. ;
+ }
}
//____________________________________________________________________________
// Calculates the center of gravity in the local EMCAL-module coordinates
Float_t wtot = 0. ;
- Int_t relid[4] ;
+ // Int_t relid[4] ;
AliEMCALDigit * digit ;
-
- AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
- AliEMCALGeometry * emcalgeom = static_cast<AliEMCALGeometry*>(gime->EMCALGeometry());
+ AliEMCALGeometry * emcalgeom = (AliEMCALGetter::Instance())->EMCALGeometry();
Int_t iDigit;
for(iDigit=0; iDigit<fMulDigit; iDigit++) {
Float_t thetai ;
Float_t phii ;
- emcalgeom->AbsToRelNumbering(digit->GetId(), relid) ;
- emcalgeom->PosInAlice(relid, thetai, phii);
+ emcalgeom->PosInAlice(digit->GetId(), thetai, phii);
Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
fTheta = fTheta + thetai * w ;
fPhi += (phii * w );
wtot += w ;
}
- fTheta /= wtot ;
- fPhi /= wtot ;
+ if ( wtot > 0 ) {
+ fTheta /= wtot ;
+ fPhi /= wtot ;
+ } else {
+ fTheta = -1 ;
+ fPhi = -1.;
+ }
+
+
+ const Float_t kDeg2Rad = TMath::DegToRad() ;
+
+ Float_t cyl_radius = 0 ;
+
+ if (IsInPRE())
+ cyl_radius = emcalgeom->GetIP2PRESection() ;
+ else if (IsInECA())
+ cyl_radius = emcalgeom->GetIP2ECASection() ;
+ else if (IsInHCA())
+ cyl_radius = emcalgeom->GetIP2HCASection() ;
+ else
+ Fatal("EvalGlobalPosition", "Unexpected tower section!") ;
+
+ Float_t x = cyl_radius * TMath::Cos(fPhi * kDeg2Rad ) ;
+ Float_t y = cyl_radius * TMath::Sin(fPhi * kDeg2Rad ) ;
+ Float_t z = cyl_radius / TMath::Tan(fTheta * kDeg2Rad ) ;
+
+ fLocPos.SetX(x) ;
+ fLocPos.SetY(y) ;
+ fLocPos.SetZ(z) ;
+
+ if (gDebug==2)
+ Info("EvalGlobalPosition", "x,y,z = %f,%f,%f", fLocPos.X(), fLocPos.Y(), fLocPos.Z()) ;
- fLocPos.SetX(0.) ;
- fLocPos.SetY(0.) ;
- fLocPos.SetZ(0.) ;
fLocPosM = 0 ;
}
}
//____________________________________________________________________________
-Int_t AliEMCALTowerRecPoint::GetNumberOfLocalMax(Int_t * maxAt, Float_t * maxAtEnergy,
+Int_t AliEMCALTowerRecPoint::GetNumberOfLocalMax(AliEMCALDigit ** maxAt, Float_t * maxAtEnergy,
Float_t locMaxCut,TClonesArray * digits) const
{
// Calculates the number of local maxima in the cluster using fLocalMaxCut as the minimum
Int_t iDigit ;
for(iDigit = 0; iDigit < fMulDigit; iDigit++)
- maxAt[iDigit] = (Int_t) digits->At(fDigitsList[iDigit]) ;
+ maxAt[iDigit] = (AliEMCALDigit*) digits->At(fDigitsList[iDigit]) ;
for(iDigit = 0 ; iDigit < fMulDigit; iDigit++) {
- if(maxAt[iDigit] != -1) {
- digit = (AliEMCALDigit *) maxAt[iDigit] ;
+ if(maxAt[iDigit]) {
+ digit = maxAt[iDigit] ;
for(iDigitN = 0; iDigitN < fMulDigit; iDigitN++) {
digitN = (AliEMCALDigit *) digits->At(fDigitsList[iDigitN]) ;
if ( AreNeighbours(digit, digitN) ) {
if (fEnergyList[iDigit] > fEnergyList[iDigitN] ) {
- maxAt[iDigitN] = -1 ;
+ maxAt[iDigitN] = 0 ;
// but may be digit too is not local max ?
if(fEnergyList[iDigit] < fEnergyList[iDigitN] + locMaxCut)
- maxAt[iDigit] = -1 ;
+ maxAt[iDigit] = 0 ;
}
else {
- maxAt[iDigit] = -1 ;
+ maxAt[iDigit] = 0 ;
// but may be digitN too is not local max ?
if(fEnergyList[iDigit] > fEnergyList[iDigitN] - locMaxCut)
- maxAt[iDigitN] = -1 ;
+ maxAt[iDigitN] = 0 ;
}
} // if Areneighbours
} // while digitN
iDigitN = 0 ;
for(iDigit = 0; iDigit < fMulDigit; iDigit++) {
- if(maxAt[iDigit] != -1){
+ if(maxAt[iDigit] ){
maxAt[iDigitN] = maxAt[iDigit] ;
maxAtEnergy[iDigitN] = fEnergyList[iDigit] ;
iDigitN++ ;
{
// Print the list of digits belonging to the cluster
- cout << "AliEMCALTowerRecPoint: " << endl ;
+ TString message("\n") ;
Int_t iDigit;
- cout << " digits # = " ;
- for(iDigit=0; iDigit<fMulDigit; iDigit++)
- cout << fDigitsList[iDigit] << " " ;
- cout << endl ;
-
- cout << " Energies = " ;
- for(iDigit=0; iDigit<fMulDigit; iDigit++)
- cout << fEnergyList[iDigit] << " ";
- cout << endl ;
-
- cout << " Primaries " ;
- for(iDigit = 0;iDigit < fMulTrack; iDigit++)
- cout << fTracksList[iDigit] << " " << endl ;
-
- cout << " Multiplicity = " << fMulDigit << endl ;
- cout << " Cluster Energy = " << fAmp << endl ;
- cout << " Number of primaries " << fMulTrack << endl ;
- cout << " Stored at position " << GetIndexInList() << endl ;
-
+ message += "digits # = " ;
+ for(iDigit=0; iDigit<fMulDigit; iDigit++) {
+ message += fDigitsList[iDigit] ;
+ message += " " ;
+ }
+
+ message += "\nEnergies = " ;
+ for(iDigit=0; iDigit<fMulDigit; iDigit++) {
+ message += fEnergyList[iDigit] ;
+ message += " " ;
+ }
+
+ message += "\nPrimaries " ;
+ for(iDigit = 0;iDigit < fMulTrack; iDigit++) {
+ message += fTracksList[iDigit] ;
+ message += " " ;
+ }
+ message += "\n Multiplicity = " ;
+ message += fMulDigit ;
+ message += "\n Cluster Energy = " ;
+ message += fAmp ;
+ message += "\n Number of primaries " ;
+ message += fMulTrack ;
+ message += "\n Stored at position " ;
+ message += GetIndexInList() ;
+
+ Info("Print", message.Data() ) ;
}
+//____________________________________________________________________________
+const TVector3 AliEMCALTowerRecPoint::XYZInAlice(Float_t r, Float_t theta, Float_t phi) const
+{
+ // spherical coordinates of recpoint in Alice reference frame
+
+ if (gDebug == 2)
+ Info("XYZInAlice", "this= %d , r = %f, theta = %f, phi = %f", this, r, theta, phi) ;
+
+ if (theta == 9999. || phi == 9999. || r == 9999.) {
+ TVector3 globalpos;
+ GetGlobalPosition(globalpos);
+ phi = globalpos.X() * TMath::DegToRad() ;
+ r = globalpos.Y() ;
+ theta = globalpos.Z() * TMath::DegToRad() ;
+ }
+ else {
+ theta *= TMath::DegToRad() ;
+ phi *= TMath::DegToRad() ;
+ }
+
+ Float_t y = r * TMath::Cos(phi) ;
+ Float_t x = r * TMath::Sin(phi) * TMath::Sin(theta) ;
+ Float_t z = r * TMath::Sin(phi) * TMath::Cos(theta) ;
+
+ TVector3 vec(z, x, y) ;
+ return vec ;
+}