19 #include "TPaveText.h" 20 #include "TClonesArray.h" 22 #include "TGeoMatrix.h" 23 #include "TGeoManager.h" 24 #include "TGeoPhysicalNode.h" 28 #include <Riostream.h> 51 fAmp(0), fIndexInList(-1),
52 fGlobPos(0,0,0),fLocPos(0,0,0),
53 fMaxDigit(100), fMulDigit(0), fMaxTrack(200),
54 fMulTrack(0), fDigitsList(0), fTracksList(0),
55 fClusterType(-1), fCoreEnergy(0), fDispersion(0),
56 fEnergyList(0), fAbsIdList(0),
57 fTime(0.), fNExMax(0), fCoreRadius(10),
58 fDETracksList(0), fMulParent(0), fMaxParent(0),
59 fParentsList(0), fDEParentsList(0), fSuperModuleNumber(0),
60 fDigitIndMax(-1), fDistToBadTower(-1), fSharedCluster(kFALSE)
163 if(&rp ==
this)
return *
this;
247 Float_t * tempoE =
new Float_t[
fMaxDigit];
251 for ( index = 0 ; index <
fMulDigit ; index++ )
290 Bool_t areNeighbours = kFALSE ;
291 Int_t nSupMod = 0, nModule = 0, nIphi = 0, nIeta = 0;
292 Int_t nSupMod1 = 0, nModule1 = 0, nIphi1 = 0, nIeta1 = 0;
293 Int_t relid1[2] , relid2[2] ;
294 Int_t rowdiff = 0, coldiff = 0;
296 areNeighbours = kFALSE ;
312 rowdiff = TMath::Abs( relid1[0] - relid2[0] ) ;
313 coldiff = TMath::Abs( relid1[1] - relid2[1] ) ;
319 if ((coldiff + rowdiff == 1 ))
320 areNeighbours = kTRUE ;
322 return areNeighbours;
342 Int_t rowdif = (Int_t)(TMath::Ceil(locpos1.X()/delta)-TMath::Ceil(locpos2.X()/delta)) ;
348 else if(locpos1.Y()>locpos2.Y())
368 const Bool_t justClusters)
400 Double_t d = 0., wtot = 0., w = 0.;
401 Int_t iDigit=0, nstat=0;
405 Double_t etai, phii, etaMean=0.0, phiMean=0.0;
406 int nSupMod=0, nModule=0, nIphi=0, nIeta=0;
410 for(iDigit=0; iDigit <
fMulDigit; iDigit++)
441 else AliError(Form(
"Wrong weight %f\n", wtot));
444 for(iDigit=0; iDigit <
fMulDigit; iDigit++)
464 d += w*((etai-etaMean)*(etai-etaMean)+(phii-phiMean)*(phii-phiMean));
469 if ( wtot > 0 && nstat>1) d /= wtot ;
490 Float_t minDist = 10000.;
492 Int_t nSupMod, nModule;
510 dRrow=TMath::Abs(irow-iphi);
511 dReta=TMath::Abs(icol-ieta);
513 dist=TMath::Sqrt(dRrow*dRrow+dReta*dReta);
514 if(dist < minDist) minDist = dist;
538 dRrow=TMath::Abs(irow-iphi);
542 dReta=TMath::Abs(icol-(AliEMCALGeoParams::fgkEMCALCols+ieta));
546 dReta=TMath::Abs(AliEMCALGeoParams::fgkEMCALCols+icol-ieta);
549 dist=TMath::Sqrt(dRrow*dRrow+dReta*dReta);
550 if(dist < minDist) minDist = dist;
572 Double_t clXYZ[3]={0.,0.,0.}, clRmsXYZ[3]={0.,0.,0.}, xyzi[3], wtot=0., w=0.;
575 for(Int_t iDigit=0; iDigit<
fMulDigit; iDigit++)
594 w = TMath::Max( 0., logWeight + TMath::Log(
fEnergyList[iDigit] /
fAmp ));
605 clXYZ[i] += (w*xyzi[i]);
606 clRmsXYZ[i] += (w*xyzi[i]*xyzi[i]);
622 clRmsXYZ[i] /= (wtot*wtot);
623 clRmsXYZ[i] = clRmsXYZ[i] - clXYZ[i]*clXYZ[i];
625 if(clRmsXYZ[i] > 0.0) clRmsXYZ[i] = TMath::Sqrt(clRmsXYZ[i]);
626 else clRmsXYZ[i] = 0;
636 clXYZ[i] = clRmsXYZ[i] = -1.;
671 Double_t clXYZ[3]={0.,0.,0.}, clRmsXYZ[3]={0.,0.,0.}, lxyzi[3], xyzi[3], wtot=0., w=0.;
674 for(Int_t iDigit=0; iDigit<
fMulDigit; iDigit++)
695 w = TMath::Max( 0., logWeight + TMath::Log(
fEnergyList[iDigit] /
fAmp ));
706 clXYZ[i] += (w*xyzi[i]);
707 clRmsXYZ[i] += (w*xyzi[i]*xyzi[i]);
723 clRmsXYZ[i] /= (wtot*wtot);
724 clRmsXYZ[i] = clRmsXYZ[i] - clXYZ[i]*clXYZ[i];
726 if(clRmsXYZ[i] > 0.0) clRmsXYZ[i] = TMath::Sqrt(clRmsXYZ[i]);
727 else clRmsXYZ[i] = 0;
729 else clRmsXYZ[i] = 0;
736 clXYZ[i] = clRmsXYZ[i] = -1.;
754 printf(
"EvalGlobalPosition Cluster: (x ,y ,z) = (%f,%f,%f), eta %f,phi %f\n",
762 Double_t phiSlope, TClonesArray * digits)
767 Double_t clXYZ[3]={0.,0.,0.}, clRmsXYZ[3]={0.,0.,0.}, xyzi[3], wtot=0., w=0.;
772 for(Int_t iDigit=0; iDigit<digits->GetEntries(); iDigit++)
783 w = TMath::Max( 0., logWeight + TMath::Log(
fEnergyList[iDigit] /
fAmp ));
794 clXYZ[i] += (w*xyzi[i]);
795 clRmsXYZ[i] += (w*xyzi[i]*xyzi[i]);
813 clRmsXYZ[i] /= (wtot*wtot);
814 clRmsXYZ[i] = clRmsXYZ[i] - clXYZ[i]*clXYZ[i];
816 if(clRmsXYZ[i] > 0.0) clRmsXYZ[i] = TMath::Sqrt(clRmsXYZ[i]);
817 else clRmsXYZ[i] = 0;
818 }
else clRmsXYZ[i] = 0;
825 clXYZ[i] = clRmsXYZ[i] = -1.;
831 if(phiSlope != 0.0 && logWeight > 0.0 && wtot)
835 ycorr = clXYZ[1] * (1. + phiSlope);
864 Double_t deff=0, w0=0, esum=0;
868 if(ed.GetSize() && (digits->GetEntries()!=ed.GetSize()))
return kFALSE;
872 for(iDigit=0; iDigit<ed.GetSize(); iDigit++) esum += ed[iDigit];
883 const Double_t w0, TClonesArray *digits,
884 TArrayD &ed, TVector3 &locPos)
889 Double_t clXYZ[3]={0.,0.,0.}, xyzi[3], wtot=0., w=0.;
896 for(Int_t iDigit=0; iDigit<digits->GetEntries(); iDigit++)
905 if(w0 > 0.0) w = TMath::Max( 0., w0 + TMath::Log(ed[iDigit] / esum));
914 clXYZ[i] += (w*xyzi[i]);
929 locPos.SetX(clXYZ[0]);
930 locPos.SetY(clXYZ[1]);
931 locPos.SetZ(clXYZ[2]);
950 const Double_t kdp0=9.25147, kdp1=1.16700;
951 const Double_t kwp0=4.83713, kwp1=-2.77970e-01, kwp2 = 4.41116;
954 e = esum<0.5?0.5:esum;
957 deff = kdp0 + kdp1*TMath::Log(e);
958 w0 = kwp0 / (1. + TMath::Exp(kwp1*(e+kwp2)));
981 Double_t eta, phi, distance;
982 for(iDigit=0; iDigit <
fMulDigit; iDigit++)
988 phi = phi * TMath::DegToRad();
990 distance = TMath::Sqrt((eta-etaPoint)*(eta-etaPoint)+(phi-phiPoint)*(phi-phiPoint));
1015 Double_t etai =0, phii=0, w=0;
1016 int nSupMod=0, nModule=0, nIphi=0, nIeta=0;
1018 for(Int_t iDigit=0; iDigit<
fMulDigit; iDigit++)
1025 nSupMod = nModule = nIphi = nIeta = iphi = ieta = 0;
1034 etai=(Double_t)ieta;
1035 phii=(Double_t)iphi;
1042 dxx += w * etai * etai ;
1044 dzz += w * phii * phii ;
1047 dxz += w * etai * phii ;
1063 fLambda[0] = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
1070 fLambda[1] = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
1095 Int_t * primArray =
new Int_t[
fMaxTrack] ;
1096 memset(primArray,-1,
sizeof(Int_t)*
fMaxTrack);
1098 Float_t * dEPrimArray =
new Float_t[
fMaxTrack] ;
1099 memset(dEPrimArray,-1,
sizeof(Int_t)*fMaxTrack);
1114 if ( nprimaries == 0 ) continue ;
1118 for ( jndex = 0 ; jndex < nprimaries ; jndex++ )
1123 Error(
"EvalPrimaries",
"increase fMaxTrack ") ;
1127 Int_t newPrimary = digit->
GetPrimary (jndex+1);
1132 Bool_t already = kFALSE ;
1133 for ( kndex = 0 ; kndex <
fMulTrack ; kndex++ )
1135 if ( newPrimary == primArray[kndex] )
1138 dEPrimArray[kndex] += dEPrimary;
1144 if ( !already && (fMulTrack < fMaxTrack))
1154 TMath::Sort(
fMulTrack,dEPrimArray,sortIdx);
1156 for(index = 0; index <
fMulTrack; index++)
1158 fTracksList [index] = primArray [sortIdx[index]] ;
1163 delete [] primArray ;
1164 delete [] dEPrimArray ;
1176 Int_t * parentArray =
new Int_t[
fMaxTrack] ;
1177 memset(parentArray,-1,
sizeof(Int_t)*
fMaxTrack);
1179 Float_t * dEParentArray =
new Float_t[
fMaxTrack] ;
1180 memset(dEParentArray,-1,
sizeof(Int_t)*fMaxTrack);
1187 AliError(Form(
"Trying to get invalid digit %d (idx in WriteRecPoint %d)",
fDigitsList[index],index));
1198 if ( nparents == 0 ) continue ;
1202 for ( jndex = 0 ; jndex < nparents ; jndex++ )
1207 Error(
"EvalParents",
"increase fMaxParent") ;
1211 Int_t newParent = digit->
GetIparent (jndex+1) ;
1212 Float_t newdEParent = digit->
GetDEParent(jndex+1) ;
1217 Bool_t already = kFALSE ;
1218 for ( kndex = 0 ; kndex <
fMulParent ; kndex++ )
1220 if ( newParent == parentArray[kndex] )
1222 dEParentArray[kndex] += newdEParent;
1242 TMath::Sort(
fMulParent,dEParentArray,sortIdx);
1252 delete [] parentArray;
1253 delete [] dEParentArray;
1297 if(!tr2loc)
AliFatal(Form(
"No Tracking2LocalMatrix found."));
1300 Double_t txyz[3] = {0,0,0};
1302 tr2loc->MasterToLocal(lxyz,txyz);
1313 AliInfo(Form(
"lCS-->(%.3f,%.3f,%.3f), tCS-->(%.3f,%.3f,%.3f), gCS-->(%.3f,%.3f,%.3f), " 1314 " gCScalc->(%.3f,%.3f,%.3f), supermodule %d",
1317 gpos.X(),gpos.Y(),gpos.Z(),
1327 Float_t menergy = 0. ;
1330 for(iDigit=0; iDigit<
fMulDigit; iDigit++)
1344 Float_t menergy = 0. ;
1348 for(iDigit=0; iDigit<
fMulDigit; iDigit++)
1367 for(iDigit=0; iDigit<
fMulDigit; iDigit++)
1388 TClonesArray * digits)
const 1391 Float_t * maxAtEnergy =
new Float_t [nMult] ;
1396 delete[] maxAtEnergy ;
1413 Float_t locMaxCut,TClonesArray * digits)
const 1421 for(iDigit = 0; iDigit <
fMulDigit; iDigit++)
1426 for(iDigit = 0 ; iDigit <
fMulDigit; iDigit++)
1430 digit = maxAt[iDigit] ;
1432 for(iDigitN = 0; iDigitN <
fMulDigit; iDigitN++)
1434 if(iDigitN == iDigit)
continue;
1442 maxAt[iDigitN] = 0 ;
1454 maxAt[iDigitN] = 0 ;
1462 for(iDigit = 0; iDigit <
fMulDigit; iDigit++)
1466 maxAt[iDigitN] = maxAt[iDigit] ;
1493 for(Int_t idig=0; idig <
fMulDigit; idig++)
1510 TVector3 pos(0.,0.,0.) ;
1512 Coord_t x = pos.X() ;
1513 Coord_t y = pos.Z() ;
1514 Color_t markercolor = 1 ;
1515 Size_t markersize = 1.;
1516 Style_t markerstyle = 5 ;
1518 if (!gPad->IsBatch())
1520 gVirtualX->SetMarkerColor(markercolor) ;
1521 gVirtualX->SetMarkerSize (markersize) ;
1522 gVirtualX->SetMarkerStyle(markerstyle) ;
1525 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
1526 gPad->PaintPolyMarker(1,&x,&y,
"") ;
1535 const Double_t ca = 4.82;
1545 tmax = TMath::Log(e) + ca;
1546 if (key==0) tmax += 0.5;
1559 return (2.*TMath::ATan(TMath::Exp(-arg)));
1567 return (-1 * TMath::Log(TMath::Tan(0.5 * arg)));
1575 if(strlen(opt)==0)
return;
1578 message =
"AliEMCALRecPoint:\n" ;
1579 message +=
" digits # = " ;
1583 for(iDigit=0; iDigit<
fMulDigit; iDigit++)
1588 for(iDigit=0; iDigit<
fMulDigit; iDigit++)
1593 for(iDigit=0; iDigit<
fMulDigit; iDigit++)
1598 for(iDigit = 0;iDigit <
fMulTrack; iDigit++)
1603 message =
" ClusterType = %d" ;
1604 message +=
" Multiplicity = %d" ;
1605 message +=
" Cluster Energy = %f" ;
1606 message +=
" Core energy = %f" ;
1607 message +=
" Core radius = %f" ;
1608 message +=
" Number of primaries %d" ;
1609 message +=
" Stored at position %d" ;
Bool_t EvalLocalPosition2(TClonesArray *digits, TArrayD &ed)
void EvalDistanceToBadChannels(AliCaloCalibPedestal *caloped)
virtual void EvalElipsAxis(Float_t logWeight, TClonesArray *digits)
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
virtual Int_t GetNumberOfLocalMax(Int_t nDigitMult, Float_t locMaxCut, TClonesArray *digits) const
Int_t fMaxTrack
! Max initial size of tracks array (not saved)
Int_t GetIndexInList() const
Float_t fAmp
Summed amplitude of digits.
Float_t GetDEParent(Int_t index) const
Float_t * fDETracksList
List of tracks to which the point was assigned.
AliEMCALRecPoint & operator=(const AliEMCALRecPoint &rp)
Assignment operator.
Int_t fMaxParent
Maximum number of parents allowed.
Short_t fNExMax
Number of (Ex-)maxima before unfolding.
virtual Bool_t GetGlobalXYZ(Float_t xyz[3]) const
Int_t * fDigitsList
List of digit's indexes from which the point was reconstructed.
static const int fgkEMCALRows
Number of rows per module for EMCAL.
virtual Int_t GetSuperModuleNumber(void) const
void EtaPhiFromIndex(Int_t absId, Double_t &eta, Double_t &phi) const
Int_t fMulTrack
Total multiplicity of tracks.
virtual void EvalDispersion(Float_t logWeight, TClonesArray *digits)
Float_t GetMaximalEnergy(void) const
Finds the maximum energy in the cluster.
virtual Int_t GetDigitsMultiplicity(void) const
TVector3 fGlobPos
Global position.
virtual void Paint(Option_t *option="")
Paint this ALiRecPoint as a TMarker with its current attributes.
Float_t fDistToBadTower
Distance to nearest bad tower.
Float_t fCoreRadius
The radius in which the core energy is evaluated.
void EvalCoreEnergy(Float_t logWeight, TClonesArray *digits)
Double_t TmaxInCm(const Double_t e=0.0, const Int_t key=0)
void EvalLocal2TrackingCSTransform()
Float_t fLambda[2]
Shower ellipse axes.
Int_t GetMaximalEnergyIndex(void) const
Finds the maximum energy in the cluster.
Int_t GetIparent(Int_t index) const
Int_t fSuperModuleNumber
number identifying supermodule containing recpoint, reference is cell with maximum energy...
virtual Bool_t AreNeighbours(AliEMCALDigit *digit1, AliEMCALDigit *digit2) const
void GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta, Int_t &iphi, Int_t &ieta) const
Int_t GetMultiplicity(void) const
virtual const TGeoHMatrix * GetTracking2LocalMatrix() const
virtual void Draw(Option_t *option="")
Draw this AliEMCALRecPoint with its current attributes.
virtual void GetLocalPosition(TVector3 &lpos) const
Bool_t fSharedCluster
States if cluster is shared by 2 SuperModules in same phi rack (0,1), (2,3) ... (10,11).
Float_t fTime
Time of the digit with maximal energy deposition.
Bool_t RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr) const
static Int_t GetGlobalDebugLevel()
Int_t GetPrimaryIndex() const
Float_t ThetaToEta(Float_t arg) const
Converts Eta (Radians) to Theta (Radians)
virtual void EvalPrimaries(TClonesArray *digits)
Bool_t GetCellIndex(Int_t absId, Int_t &nSupMod, Int_t &nModule, Int_t &nIphi, Int_t &nIeta) const
Int_t GetNprimary() const
virtual void AddDigit(AliEMCALDigit &digit, const Float_t energy, const Bool_t shared)
Float_t GetDEPrimary(Int_t index) const
int GetDeadTowerCount() const
AliEMCALRecPoint()
Default constructor.
Int_t GetMultiplicityAtLevel(Float_t level) const
Calculates the multiplicity of digits with energy larger than H*energy.
Float_t * fDEParentsList
List of the parents energy deposit of the digits.
Int_t * fAbsIdList
List with absId of digits.
Int_t fMaxDigit
! Max initial size of digits array (not saved)
Int_t GetIndexInList() const
Int_t GetAbsIdMaxDigit() const
virtual void EvalParents(TClonesArray *digits)
void SetVolumeId(UShort_t id)
void GetGlobal(const Double_t *loc, Double_t *glob, int ind) const
Base Class for EMCAL description.
pedestal/bad map monitoring and calibration tools
#define AliFatal(message)
Float_t EtaToTheta(Float_t arg) const
Converts Theta (Radians) to Eta (Radians)
Float_t * fEnergyList
List with energy of digits.
Int_t fClusterType
Type of cluster stored: v1.
TVector3 fLocPos
Local position in the sub-detector coordinate.
Int_t GetSuperModuleNumber(Int_t absId) const
Float_t fCoreEnergy
Energy in a shower core.
static const int fgkEMCALCols
Number of columns per module for EMCAL.
virtual Int_t Compare(const TObject *obj) const
Compares two RecPoints according to their position in the EMCAL modules.
Int_t * fTracksList
List of tracks to which the point was assigned.
virtual void GetGlobalPosition(TVector3 &gpos) const
Int_t GetPrimary(Int_t index) const
virtual void Print(Option_t *option="") const
Print the list of digits belonging to the cluster.
void EvalTime(TClonesArray *digits)
Time is set to the time of the digit with the maximum energy.
AliEMCALEMCGeometry * GetEMCGeometry() const
Float_t fDispersion
Shower dispersion.
AliEMCALGeometry * fGeomPtr
! Pointer to geometry for utilities
virtual void EvalAll(Float_t logWeight, TClonesArray *digits, const Bool_t justClusters)
Evaluates cluster parameters: position, shower shape, primaries ...
static UShort_t LayerToVolUID(ELayerID layerId, Int_t modId)
void EvalLocalPositionFit(Double_t deff, Double_t w0, Double_t phiSlope, TClonesArray *digits)
Evaluates local position of clusters in SM.
Int_t fDigitIndMax
Index of digit with max energy in array fAbsIdList.
Float_t GetTime(void) const
#define AliError(message)
Int_t fIndexInList
The index of this RecPoint in the list stored in TreeR (to be set by analysis)
static AliEMCALGeometry * GetInstance()
Int_t GetNiparent() const
Double_t GetPointEnergy() const
virtual void EvalLocalPosition(Float_t logWeight, TClonesArray *digits)
Calculates the center of gravity in the local EMCAL-module coordinates.
virtual ~AliEMCALRecPoint()
Destructor.
Int_t fMulDigit
Total multiplicity of digits.
Bool_t EvalLocalPositionFromDigits(const Double_t esum, const Double_t deff, const Double_t w0, TClonesArray *digits, TArrayD &ed, TVector3 &locPos)
Evaluate position of digits in supermodule.
EMCal geometry, singleton.
virtual void EvalGlobalPosition(Float_t logWeight, TClonesArray *digits)
Calculates the center of gravity in the global ALICE coordinates.
static void GetDeffW0(const Double_t esum, Double_t &deff, Double_t &w0)
Int_t * fParentsList
List of the parents index of the digits.
Int_t fMulParent
Multiplicity of the parents.
TString GetGeoName() const
static double fAmp
amplitude