//*-- Author: Heather Gray (LBL) merged AliEMCALRecPoint and AliEMCALTowerRecPoint 02/04
// --- ROOT system ---
-#include "TPad.h"
-#include "TGraph.h"
-#include "TPaveText.h"
-#include "TClonesArray.h"
-#include "TMath.h"
+class Riostream;
+#include <TPad.h>
+class TGraph;
+class TPaveText;
+#include <TClonesArray.h>
+#include <TMath.h>
// --- Standard library ---
// --- AliRoot header files ---
-#include "AliGenerator.h"
+//#include "AliGenerator.h"
+class AliGenerator;
+#include "AliRunLoader.h"
+#include "AliRun.h"
+class AliEMCAL;
+#include "AliEMCALLoader.h"
#include "AliEMCALGeometry.h"
+#include "AliEMCALHit.h"
#include "AliEMCALDigit.h"
#include "AliEMCALRecPoint.h"
-#include "AliEMCALGetter.h"
ClassImp(AliEMCALRecPoint)
//____________________________________________________________________________
AliEMCALRecPoint::AliEMCALRecPoint()
- : AliRecPoint()
+ : AliRecPoint(),
+ fGeomPtr(0),
+ fClusterType(-1),
+ fCoreEnergy(0),
+ fDispersion(0),
+ fEnergyList(0),
+ fTimeList(0),
+ fAbsIdList(0),
+ fTime(0.),
+ fCoreRadius(10), //HG check this
+ fMulParent(0),
+ fMaxParent(0),
+ fParentsList(0),
+ fSuperModuleNumber(0)
{
// ctor
fMaxTrack = 0 ;
- fMulDigit = 0 ;
- fMaxParent = 0;
- fMulParent = 0;
+ fMulDigit = 0 ;
fAmp = 0. ;
- fCoreEnergy = 0 ;
- fEnergyList = 0 ;
- fParentsList = 0;
- fTime = 0. ;
- fLocPos.SetX(0.) ; //Local position should be evaluated
- fCoreRadius = 10; //HG Check this
+ // fLocPos.SetX(1.e+6) ; //Local position should be evaluated
+
+ AliRunLoader *rl = AliRunLoader::GetRunLoader();
+ fGeomPtr = dynamic_cast<AliEMCAL*>(rl->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
+ //fGeomPtr = AliEMCALGeometry::GetInstance();
+ fGeomPtr->GetTransformationForSM(); // Global <-> Local
}
//____________________________________________________________________________
-AliEMCALRecPoint::AliEMCALRecPoint(const char * opt) : AliRecPoint(opt)
+AliEMCALRecPoint::AliEMCALRecPoint(const char * opt)
+ : AliRecPoint(opt),
+ fGeomPtr(0),
+ fClusterType(-1),
+ fCoreEnergy(0),
+ fDispersion(0),
+ fEnergyList(0),
+ fTimeList(0),
+ fAbsIdList(0),
+ fTime(-1.),
+ fCoreRadius(10), //HG check this
+ fMulParent(0),
+ fMaxParent(1000),
+ fParentsList(0),
+ fSuperModuleNumber(0)
{
// ctor
fMaxTrack = 1000 ;
- fMaxParent = 1000;
fMulDigit = 0 ;
- fMulParent = 0;
fAmp = 0. ;
- fCoreEnergy = 0 ;
- fEnergyList = 0 ;
fParentsList = new Int_t[fMaxParent];
- fTime = -1. ;
- fLocPos.SetX(1000000.) ; //Local position should be evaluated
- fCoreRadius = 10; //HG Check this
+
+ //fLocPos.SetX(1.e+6) ; //Local position should be evaluated
+ //fGeomPtr = AliEMCALGeometry::GetInstance();
+ AliRunLoader *rl = AliRunLoader::GetRunLoader();
+ fGeomPtr = dynamic_cast<AliEMCAL*>(rl->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
+ fGeomPtr->GetTransformationForSM(); // Global <-> Local
+}
+
+//____________________________________________________________________________
+AliEMCALRecPoint::AliEMCALRecPoint(const AliEMCALRecPoint & rp)
+ : AliRecPoint(rp),
+ fGeomPtr(rp.fGeomPtr),
+ fClusterType(rp.fClusterType),
+ fCoreEnergy(rp.fCoreEnergy),
+ fDispersion(rp.fDispersion),
+ fEnergyList(0),
+ fTimeList(0),
+ fAbsIdList(0),
+ fTime(rp.fTime),
+ fCoreRadius(rp.fCoreRadius),
+ fMulParent(rp.fMulParent),
+ fMaxParent(rp.fMaxParent),
+ fParentsList(0),
+ fSuperModuleNumber(rp.fSuperModuleNumber)
+{
+ //copy ctor
+ fLambda[0] = rp.fLambda[0];
+ fLambda[1] = rp.fLambda[1];
+
+ fEnergyList = new Float_t[rp.fMulDigit];
+ fTimeList = new Float_t[rp.fMulDigit];
+ fAbsIdList = new Int_t[rp.fMulDigit];
+ for(Int_t i = 0; i < rp.fMulDigit; i++) {
+ fEnergyList[i] = rp.fEnergyList[i];
+ fTimeList[i] = rp.fTimeList[i];
+ fAbsIdList[i] = rp.fAbsIdList[i];
+ }
+ fParentsList = new Int_t[rp.fMulParent];
+ for(Int_t i = 0; i < rp.fMulParent; i++) fParentsList[i] = rp.fParentsList[i];
+
}
//____________________________________________________________________________
AliEMCALRecPoint::~AliEMCALRecPoint()
// dtor
if ( fEnergyList )
delete[] fEnergyList ;
+ if ( fTimeList )
+ delete[] fTimeList ;
+ if ( fAbsIdList )
+ delete[] fAbsIdList ;
if ( fParentsList)
delete[] fParentsList;
}
if(fEnergyList == 0)
fEnergyList = new Float_t[fMaxDigit];
+ if(fTimeList == 0)
+ fTimeList = new Float_t[fMaxDigit];
+ if(fAbsIdList == 0) {
+ fAbsIdList = new Int_t[fMaxDigit];
+ fSuperModuleNumber = fGeomPtr->GetSuperModuleNumber(digit.GetId());
+ }
if ( fMulDigit >= fMaxDigit ) { // increase the size of the lists
fMaxDigit*=2 ;
Int_t * tempo = new Int_t[fMaxDigit];
Float_t * tempoE = new Float_t[fMaxDigit];
+ Float_t * tempoT = new Float_t[fMaxDigit];
+ Int_t * tempoId = new Int_t[fMaxDigit];
Int_t index ;
for ( index = 0 ; index < fMulDigit ; index++ ){
- tempo[index] = fDigitsList[index] ;
- tempoE[index] = fEnergyList[index] ;
+ tempo[index] = fDigitsList[index] ;
+ tempoE[index] = fEnergyList[index] ;
+ tempoT[index] = fTimeList[index] ;
+ tempoId[index] = fAbsIdList[index] ;
}
delete [] fDigitsList ;
delete [] fEnergyList ;
fEnergyList = new Float_t[fMaxDigit];
+ delete [] fTimeList ;
+ fTimeList = new Float_t[fMaxDigit];
+
+ delete [] fAbsIdList ;
+ fAbsIdList = new Int_t[fMaxDigit];
+
for ( index = 0 ; index < fMulDigit ; index++ ){
fDigitsList[index] = tempo[index] ;
fEnergyList[index] = tempoE[index] ;
+ fTimeList[index] = tempoT[index] ;
+ fAbsIdList[index] = tempoId[index] ;
}
delete [] tempo ;
delete [] tempoE ;
+ delete [] tempoT ;
+ delete [] tempoId ;
} // if
fDigitsList[fMulDigit] = digit.GetIndexInList() ;
fEnergyList[fMulDigit] = Energy ;
+ fTimeList[fMulDigit] = digit.GetTime() ;
+ fAbsIdList[fMulDigit] = digit.GetId();
fMulDigit++ ;
fAmp += Energy ;
// Tells if (true) or not (false) two digits are neighbours
// A neighbour is defined as being two digits which share a corner
- Bool_t areNeighbours = kFALSE ;
-
- AliEMCALGeometry * geom = (AliEMCALGetter::Instance())->EMCALGeometry();
+ static Bool_t areNeighbours = kFALSE ;
+ static Int_t nSupMod=0, nTower=0, nIphi=0, nIeta=0;
+ static int nSupMod1=0, nTower1=0, nIphi1=0, nIeta1=0;
+ static Int_t relid1[2] , relid2[2] ; // ieta, iphi
+ static Int_t rowdiff=0, coldiff=0;
- Int_t relid1[2] ;
- //copied for shish-kebab geometry, ieta,iphi is cast as float as eta,phi conversion
- // for this geometry does not exist
- int nSupMod=0, nTower=0, nIphi=0, nIeta=0;
- int iphi=0, ieta=0;
- geom->GetCellIndex(digit1->GetId(), nSupMod,nTower,nIphi,nIeta);
- geom->GetCellPhiEtaIndexInSModule(nTower,nIphi,nIeta, iphi,ieta);
- relid1[0]=ieta;
- relid1[1]=iphi;
-// geom->AbsToRelNumbering(digit1->GetId(), relid1) ;
-
- Int_t relid2[2] ;
- //copied for shish-kebab geometry, ieta,iphi is cast as float as eta,phi conversion
- // for this geometry does not exist
- int nSupMod1=0, nTower1=0, nIphi1=0, nIeta1=0;
- int iphi1=0, ieta1=0;
- geom->GetCellIndex(digit2->GetId(), nSupMod1,nTower1,nIphi1,nIeta1);
- geom->GetCellPhiEtaIndexInSModule(nTower1,nIphi1,nIeta1, iphi1,ieta1);
- relid2[0]=ieta1;
- relid2[1]=iphi1;
-// geom->AbsToRelNumbering(digit2->GetId(), relid2) ;
+ areNeighbours = kFALSE ;
+
+ fGeomPtr->GetCellIndex(digit1->GetId(), nSupMod,nTower,nIphi,nIeta);
+ fGeomPtr->GetCellPhiEtaIndexInSModule(nSupMod,nTower,nIphi,nIeta, relid1[0],relid1[1]);
+
+ fGeomPtr->GetCellIndex(digit2->GetId(), nSupMod1,nTower1,nIphi1,nIeta1);
+ fGeomPtr->GetCellPhiEtaIndexInSModule(nSupMod1,nTower1,nIphi1,nIeta1, relid2[0],relid2[1]);
- Int_t rowdiff = TMath::Abs( relid1[0] - relid2[0] ) ;
- Int_t coldiff = TMath::Abs( relid1[1] - relid2[1] ) ;
+ rowdiff = TMath::Abs( relid1[0] - relid2[0] ) ;
+ coldiff = TMath::Abs( relid1[1] - relid2[1] ) ;
if (( coldiff <= 1 ) && ( rowdiff <= 1 ) && (coldiff + rowdiff > 0))
- areNeighbours = kTRUE ;
+ areNeighbours = kTRUE ;
return areNeighbours;
}
TVector3 locpos2;
clu->GetLocalPosition(locpos2);
- Int_t rowdif = (Int_t)TMath::Ceil(locpos1.X()/delta)-(Int_t)TMath::Ceil(locpos2.X()/delta) ;
+ Int_t rowdif = (Int_t)(TMath::Ceil(locpos1.X()/delta)-TMath::Ceil(locpos2.X()/delta)) ;
if (rowdif> 0)
rv = 1 ;
else if(rowdif < 0)
// Evaluates all shower parameters
EvalLocalPosition(logWeight, digits) ;
- printf("eval position done\n");
+ // printf("eval position done\n");
EvalElipsAxis(logWeight, digits) ;
- printf("eval axis done\n");
+ // printf("eval axis done\n");
EvalDispersion(logWeight, digits) ;
- printf("eval dispersion done\n");
- // EvalCoreEnergy(logWeight, digits);
+ // printf("eval dispersion done\n");
+ //EvalCoreEnergy(logWeight, digits);
// printf("eval energy done\n");
EvalTime(digits) ;
- printf("eval time done\n");
+ // printf("eval time done\n");
EvalPrimaries(digits) ;
- printf("eval pri done\n");
+ // printf("eval pri done\n");
EvalParents(digits);
- printf("eval parent done\n");
+ // printf("eval parent done\n");
}
//____________________________________________________________________________
{
// Calculates the dispersion of the shower at the origin of the RecPoint
- Float_t d = 0. ;
- Float_t wtot = 0. ;
-
+ Double_t d = 0., wtot = 0., w = 0., xyzi[3], diff=0.;
+ Int_t iDigit=0, nstat=0, i=0;
AliEMCALDigit * digit ;
-
- AliEMCALGeometry * geom = (AliEMCALGetter::Instance())->EMCALGeometry();
-
- // Calculates the centre of gravity in the local EMCAL-module coordinates
- Int_t iDigit;
- if (!fLocPos.X() || !fLocPos.Y())
+ // Calculates the centre of gravity in the local EMCAL-module coordinates
+ if (!fLocPos.Mag())
EvalLocalPosition(logWeight, digits) ;
- //Sub const Float_t kDeg2Rad = TMath::DegToRad() ;
-
- Float_t cluEta = fLocPos.X() ;
- Float_t cluPhi = fLocPos.Y() ;
- Float_t cluR = fLocPos.Z() ;
-
- if (gDebug == 2)
- printf("EvalDispersion: eta,phi,r = %f,%f,%f", cluEta, cluPhi, cluR) ;
-
// Calculates the dispersion in coordinates
- wtot = 0.;
for(iDigit=0; iDigit < fMulDigit; iDigit++) {
digit = (AliEMCALDigit *) digits->At(fDigitsList[iDigit]) ;
- Float_t etai = 0.;
- Float_t phii = 0.;
- //copied for shish-kebab geometry, ieta,iphi is cast as float as eta,phi conversion
- // for this geometry does not exist
- int nSupMod=0, nTower=0, nIphi=0, nIeta=0;
- int iphi=0, ieta=0;
- geom->GetCellIndex(digit->GetId(), nSupMod,nTower,nIphi,nIeta);
- geom->GetCellPhiEtaIndexInSModule(nTower,nIphi,nIeta, iphi,ieta);
- etai=(Float_t)ieta;
- phii=(Float_t)iphi;
- printf("%f,%d,%d \n", fAmp, ieta, iphi) ;
-
-/* Sub
- geom->EtaPhiFromIndex(digit->GetId(), etai, phii);
- phii = phii * kDeg2Rad;
-*/
-///////////////////////////
- if(fAmp>0)printf("%f %d %f", fAmp,iDigit,fEnergyList[iDigit]) ;
-/////////////////////////
-
- if (gDebug == 2)
- printf("EvalDispersion: id = %d, etai,phii = %f,%f", digit->GetId(), etai, phii) ;
-
- Float_t w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
- d += w * ( (etai-cluEta)*(etai-cluEta) + (phii-cluPhi)*(phii-cluPhi) ) ;
- wtot+=w ;
+
+ fGeomPtr->RelPosCellInSModule(digit->GetId(), xyzi[0], xyzi[1], xyzi[2]);
+ w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
+
+ if(w>0.0) {
+ wtot += w;
+ nstat++;
+ for(i=0; i<3; i++ ) {
+ diff = xyzi[i] - double(fLocPos[i]);
+ d += w * diff*diff;
+ }
+ }
}
- if ( wtot > 0 )
- d /= wtot ;
- else
- d = 0. ;
+ if ( wtot > 0 && nstat>1) d /= wtot ;
+ else d = 0. ;
fDispersion = TMath::Sqrt(d) ;
- printf("Dispersion: = %f", fDispersion) ;
}
//____________________________________________________________________________
void AliEMCALRecPoint::EvalLocalPosition(Float_t logWeight, TClonesArray * digits)
{
// Calculates the center of gravity in the local EMCAL-module coordinates
- Float_t wtot = 0. ;
-
- // Int_t relid[3] ;
+ // Info("Print", " logWeight %f : cluster energy %f ", logWeight, fAmp); // for testing
- AliEMCALDigit * digit ;
- AliEMCALGeometry * geom = (AliEMCALGetter::Instance())->EMCALGeometry();
- Int_t iDigit;
- Float_t cluEta = 0;
- Float_t cluPhi = 0;
- //Sub const Float_t kDeg2Rad = TMath::DegToRad();
+ AliEMCALDigit * digit;
+ Int_t i=0, nstat=0;
+ Double_t clXYZ[3]={0.,0.,0.}, clRmsXYZ[3]={0.,0.,0.}, xyzi[3], wtot=0., w=0.;
- for(iDigit=0; iDigit<fMulDigit; iDigit++) {
+ for(Int_t iDigit=0; iDigit<fMulDigit; iDigit++) {
digit = dynamic_cast<AliEMCALDigit *>(digits->At(fDigitsList[iDigit])) ;
- Float_t etai ;
- Float_t phii ;
- //copied for shish-kebab geometry, ieta,iphi is cast as float as eta,phi conversion
- // for this geometry does not exist
- int nSupMod=0, nTower=0, nIphi=0, nIeta=0;
- int iphi=0, ieta=0;
- geom->GetCellIndex(digit->GetId(), nSupMod,nTower,nIphi,nIeta);
- geom->GetCellPhiEtaIndexInSModule(nTower,nIphi,nIeta, iphi,ieta);
- etai=(Float_t)ieta;
- phii=(Float_t)iphi;
-//Sub geom->EtaPhiFromIndex(digit->GetId(), etai, phii);
-//Sub phii = phii * kDeg2Rad;
- Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
- cluEta += (etai * w) ;
- cluPhi += (phii * w );
- wtot += w ;
- }
+ fGeomPtr->RelPosCellInSModule(digit->GetId(), xyzi[0], xyzi[1], xyzi[2]);
+ // printf(" Id %i : Local x,y,z %f %f %f \n", digit->GetId(), xyzi[0], xyzi[1], xyzi[2]);
+
+ if(logWeight > 0.0) w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ));
+ else w = fEnergyList[iDigit]; // just energy
+ if(w>0.0) {
+ wtot += w ;
+ nstat++;
+ for(i=0; i<3; i++ ) {
+ clXYZ[i] += (w*xyzi[i]);
+ clRmsXYZ[i] += (w*xyzi[i]*xyzi[i]);
+ }
+ }
+ }
+ // cout << " wtot " << wtot << endl;
if ( wtot > 0 ) {
- cluEta /= wtot ;
- cluPhi /= wtot ;
+ // xRMS = TMath::Sqrt(x2m - xMean*xMean);
+ for(i=0; i<3; i++ ) {
+ clXYZ[i] /= wtot;
+ if(nstat>1) {
+ clRmsXYZ[i] /= (wtot*wtot);
+ clRmsXYZ[i] = clRmsXYZ[i] - clXYZ[i]*clXYZ[i];
+ if(clRmsXYZ[i] > 0.0) {
+ clRmsXYZ[i] = TMath::Sqrt(clRmsXYZ[i]);
+ } else clRmsXYZ[i] = 0;
+ } else clRmsXYZ[i] = 0;
+ }
} else {
- cluEta = -1 ;
- cluPhi = -1.;
+ for(i=0; i<3; i++ ) {
+ clXYZ[i] = clRmsXYZ[i] = -1.;
+ }
}
-
- fLocPos.SetX(cluEta);
- fLocPos.SetY(cluPhi);
- fLocPos.SetZ(geom->GetIP2ECASection());
+ // clRmsXYZ[i] ??
+ fLocPos.SetX(clXYZ[0]);
+ fLocPos.SetY(clXYZ[1]);
+ fLocPos.SetZ(clXYZ[2]);
// if (gDebug==2)
- printf("EvalLocalPosition: eta,phi,r = %f,%f,%f", fLocPos.X(), fLocPos.Y(), fLocPos.Z()) ;
- fLocPosM = 0 ;
+// printf("EvalLocalPosition: eta,phi,r = %f,%f,%f", fLocPos.X(), fLocPos.Y(), fLocPos.Z()) ;
+ fLocPosM = 0 ; // covariance matrix
}
+//void AliEMCALRecPoint::EvalLocalPositionSimple()
+//{ // Weight is proportional of cell energy
+//}
+
//______________________________________________________________________________
void AliEMCALRecPoint::EvalCoreEnergy(Float_t logWeight, TClonesArray * digits)
{
// This function calculates energy in the core,
- // i.e. within a radius rad = 3cm around the center. Beyond this radius
+ // i.e. within a radius rad = fCoreEnergy around the center. Beyond this radius
// in accordance with shower profile the energy deposition
// should be less than 2%
AliEMCALDigit * digit ;
const Float_t kDeg2Rad = TMath::DegToRad() ;
- AliEMCALGeometry * geom = (AliEMCALGetter::Instance())->EMCALGeometry();
+
Int_t iDigit;
- if (!fLocPos.X() || !fLocPos.Y() ) {
+ if (!fLocPos.Mag()) {
EvalLocalPosition(logWeight, digits);
}
for(iDigit=0; iDigit < fMulDigit; iDigit++) {
digit = (AliEMCALDigit *) ( digits->At(fDigitsList[iDigit]) ) ;
- Float_t etai = 0. ;
- Float_t phii = 0. ;
- geom->PosInAlice(digit->GetId(), etai, phii);
- phii = phii * kDeg2Rad;
+
+ Float_t ieta = 0.0;
+ Float_t iphi = 0.0;
+ //fGeomPtr->PosInAlice(digit->GetId(), ieta, iphi);
+ fGeomPtr->EtaPhiFromIndex(digit->GetId(),ieta, iphi) ;
+ iphi = iphi * kDeg2Rad;
- Float_t distance = TMath::Sqrt((etai-fLocPos.X())*(etai-fLocPos.X())+(phii-fLocPos.Y())*(phii-fLocPos.Y())) ;
+ Float_t distance = TMath::Sqrt((ieta-fLocPos.X())*(ieta-fLocPos.X())+(iphi-fLocPos.Y())*(iphi-fLocPos.Y())) ;
if(distance < fCoreRadius)
fCoreEnergy += fEnergyList[iDigit] ;
}
const Float_t kDeg2Rad = TMath::DegToRad();
AliEMCALDigit * digit ;
- AliEMCALGeometry * geom = (AliEMCALGetter::Instance())->EMCALGeometry();
- TString gn(geom->GetName());
+ TString gn(fGeomPtr->GetName());
Int_t iDigit;
digit = (AliEMCALDigit *) digits->At(fDigitsList[iDigit]) ;
Float_t etai = 0. ;
Float_t phii = 0. ;
- if(gn.Contains("SHISH")) {
+ if(gn.Contains("SHISH")) { // have to be change - Feb 28, 2006
//copied for shish-kebab geometry, ieta,iphi is cast as float as eta,phi conversion
// for this geometry does not exist
int nSupMod=0, nTower=0, nIphi=0, nIeta=0;
int iphi=0, ieta=0;
- geom->GetCellIndex(digit->GetId(), nSupMod,nTower,nIphi,nIeta);
- geom->GetCellPhiEtaIndexInSModule(nTower,nIphi,nIeta, iphi,ieta);
+ fGeomPtr->GetCellIndex(digit->GetId(), nSupMod,nTower,nIphi,nIeta);
+ fGeomPtr->GetCellPhiEtaIndexInSModule(nSupMod,nTower,nIphi,nIeta, iphi,ieta);
etai=(Float_t)ieta;
phii=(Float_t)iphi;
} else {
- geom->EtaPhiFromIndex(digit->GetId(), etai, phii);
+ fGeomPtr->EtaPhiFromIndex(digit->GetId(), etai, phii);
phii = phii * kDeg2Rad;
}
void AliEMCALRecPoint::GetLocalPosition(TVector3 & lpos) const
{
// returns the position of the cluster in the local reference system of ALICE
- // X = eta, Y = phi, Z = r (a constant for the EMCAL)
lpos.SetX(fLocPos.X()) ;
lpos.SetY(fLocPos.Y()) ;
{
// returns the position of the cluster in the global reference system of ALICE
// These are now the Cartesian X, Y and Z
-
- AliEMCALGeometry * geom = (AliEMCALGetter::Instance())->EMCALGeometry();
- Int_t absid = geom->TowerIndexFromEtaPhi(fLocPos.X(), TMath::RadToDeg()*fLocPos.Y());
- geom->XYZFromIndex(absid, gpos);
+ // cout<<" geom "<<geom<<endl;
+ fGeomPtr->GetGlobal(fLocPos, gpos, fSuperModuleNumber);
}
//____________________________________________________________________________
}
return iDigitN ;
}
+
+//____________________________________________________________________________
+Int_t AliEMCALRecPoint::GetPrimaryIndex() const
+{
+ // Get the primary track index in TreeK which deposits the most energy
+ // in Digits which forms RecPoint. Kinematics, Hits and Digits must be
+ // loaded before the call of the method.
+
+ AliRunLoader *rl = AliRunLoader::GetRunLoader();
+ if (!rl)
+ AliError(Form(" No Runloader ")) ;
+
+ AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>
+ (rl->GetDetectorLoader("EMCAL"));
+
+ // Get the list of digits forming this RecPoint
+ Int_t nDigits = fMulDigit ;
+ Int_t *digitList = fDigitsList ;
+
+ // Find the digit with maximum amplitude
+ AliEMCALDigit *digit = 0;
+ TClonesArray *digits = emcalLoader->Digits();
+ Int_t maxAmp = 0;
+ Int_t bestDigitIndex = -1;
+ for (Int_t iDigit=0; iDigit<nDigits; iDigit++) {
+ digit = static_cast<AliEMCALDigit *>(digits->At(digitList[iDigit]));
+ if (digit->GetAmp() > maxAmp) {
+ maxAmp = digit->GetAmp();
+ bestDigitIndex = iDigit;
+ }
+ }
+
+ digit = static_cast<AliEMCALDigit *>(digits->At(digitList[bestDigitIndex]));
+
+ // Get the list of hits producing this digit,
+ // find which hit has deposited more energy
+ // and find the primary track.
+
+ AliEMCALHit *hit = 0;
+ TClonesArray *hits = emcalLoader->Hits();
+
+ Double_t maxedep = 0;
+ Int_t maxtrack = -1;
+ Int_t nHits = hits ->GetEntries();
+ Int_t id = digit->GetId();
+ for (Int_t iHit=0; iHit<nHits; iHit++) {
+ hit = static_cast<AliEMCALHit*> (hits->At(iHit)) ;
+ if(hit->GetId() == id){
+ Double_t edep = hit->GetEnergy();
+ Int_t track = hit->GetIparent();//Primary();
+ if(edep > maxedep){
+ maxedep = edep;
+ maxtrack = track;
+ }
+ }
+ }
+ if (maxtrack != -1) return maxtrack;
+ return -12345; // no track found :(
+}
+
//____________________________________________________________________________
void AliEMCALRecPoint::EvalTime(TClonesArray * digits){
// time is set to the time of the digit with the maximum energy
void AliEMCALRecPoint::Print(Option_t *) const
{
// Print the list of digits belonging to the cluster
-
+ return;
TString message ;
- message = "AliPHOSEmcRecPoint:\n" ;
+ message = "AliEMCALRecPoint:\n" ;
message += " digits # = " ;
Info("Print", message.Data()) ;
Int_t iDigit;
for(iDigit=0; iDigit<fMulDigit; iDigit++)
printf(" %d ", fDigitsList[iDigit] ) ;
-
+ printf("\n");
+
Info("Print", " Energies = ") ;
for(iDigit=0; iDigit<fMulDigit; iDigit++)
printf(" %f ", fEnergyList[iDigit] ) ;
- printf("\n") ;
- Info("Print", " Primaries ") ;
+ printf("\n");
+
+ Info("Print", "\n Abs Ids = ") ;
+ for(iDigit=0; iDigit<fMulDigit; iDigit++)
+ printf(" %i ", fAbsIdList[iDigit] ) ;
+ printf("\n");
+
+ Info("Print", " Primaries ") ;
for(iDigit = 0;iDigit < fMulTrack; iDigit++)
printf(" %d ", fTracksList[iDigit]) ;
- printf("\n") ;
- message = " Multiplicity = %d" ;
+
+ printf("\n Local x %6.2f y %7.2f z %7.1f \n", fLocPos[0], fLocPos[1], fLocPos[2]);
+
+ message = " ClusterType = %d" ;
+ message += " Multiplicity = %d" ;
message += " Cluster Energy = %f" ;
message += " Core energy = %f" ;
message += " Core radius = %f" ;
message += " Number of primaries %d" ;
message += " Stored at position %d" ;
-
- Info("Print", message.Data(), fMulDigit, fAmp, fCoreEnergy, fCoreRadius, fMulTrack, GetIndexInList() ) ;
+ Info("Print", message.Data(), fClusterType, fMulDigit, fAmp, fCoreEnergy, fCoreRadius, fMulTrack, GetIndexInList() ) ;
}