//_______________________________________________________________________
AliESDCaloCluster::AliESDCaloCluster() :
- TObject(),
+ AliVCluster(),
fTracksMatched(0x0),
fLabels(0x0),
- fDigitAmplitude(0x0),
- fDigitTime(0x0),
- fDigitIndex(0x0),
+ fNCells(0),
+ fCellsAbsId(0x0),
+ fCellsAmpFraction(0x0),
fEnergy(0),
fDispersion(0),
fChi2(0),
fM20(0),
fM02(0),
- fM11(0),
fEmcCpvDistance(1024),
+ fTrackDx(1024),fTrackDz(1024),
fDistToBadChannel(1024),
fID(0),
fNExMax(0),
- fClusterType(kUndef)
+ fClusterType(kUndef), fTOF(0.)
{
//
// The default ESD constructor
//_______________________________________________________________________
AliESDCaloCluster::AliESDCaloCluster(const AliESDCaloCluster& clus) :
- TObject(clus),
+ AliVCluster(clus),
fTracksMatched(clus.fTracksMatched?new TArrayI(*clus.fTracksMatched):0x0),
fLabels(clus.fLabels?new TArrayI(*clus.fLabels):0x0),
- fDigitAmplitude(clus.fDigitAmplitude?new TArrayS(*clus.fDigitAmplitude):0x0),
- fDigitTime(clus.fDigitTime?new TArrayS(*clus.fDigitTime):0x0),
- fDigitIndex(clus.fDigitIndex?new TArrayS(*clus.fDigitIndex):0x0),
+ fNCells(clus.fNCells),
+ fCellsAbsId(),
+ fCellsAmpFraction(),
fEnergy(clus.fEnergy),
fDispersion(clus.fDispersion),
fChi2(clus.fChi2),
fM20(clus.fM20),
fM02(clus.fM02),
- fM11(clus.fM11),
fEmcCpvDistance(clus.fEmcCpvDistance),
+ fTrackDx(clus.fTrackDx),
+ fTrackDz(clus.fTrackDz),
fDistToBadChannel(clus.fDistToBadChannel),
fID(clus.fID),
fNExMax(clus.fNExMax),
- fClusterType(clus.fClusterType)
+ fClusterType(clus.fClusterType),
+ fTOF(clus.fTOF)
{
//
// The copy constructor
for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = clus.fPID[i];
+ if (clus.fNCells > 0) {
+
+ if(clus.fCellsAbsId){
+ fCellsAbsId = new UShort_t[clus.fNCells];
+ for (Int_t i=0; i<clus.fNCells; i++)
+ fCellsAbsId[i]=clus.fCellsAbsId[i];
+ }
+
+ if(clus.fCellsAmpFraction){
+ fCellsAmpFraction = new Double32_t[clus.fNCells];
+ for (Int_t i=0; i<clus.fNCells; i++)
+ fCellsAmpFraction[i]=clus.fCellsAmpFraction[i];
+ }
+
+ }
+
}
//_______________________________________________________________________
// assignment operator
if(&source == this) return *this;
- TObject::operator=(source);
-
+ AliVCluster::operator=(source);
fGlobalPos[0] = source.fGlobalPos[0];
fGlobalPos[1] = source.fGlobalPos[1];
fGlobalPos[2] = source.fGlobalPos[2];
-
fEnergy = source.fEnergy;
fDispersion = source.fDispersion;
fChi2 = source.fChi2;
fM20 = source.fM20;
fM02 = source.fM02;
- fM11 = source.fM11;
fEmcCpvDistance = source.fEmcCpvDistance;
+ fTrackDx= source.fTrackDx ;
+ fTrackDz= source.fTrackDz ;
fDistToBadChannel = source.fDistToBadChannel ;
for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = source.fPID[i];
fID = source.fID;
- delete fTracksMatched;
- fTracksMatched = source.fTracksMatched?new TArrayI(*source.fTracksMatched):0x0;
- delete fLabels;
- fLabels = source.fLabels?new TArrayI(*source.fLabels):0x0;
-
- delete fDigitAmplitude;
- fDigitAmplitude = source.fDigitAmplitude?new TArrayS(*source.fDigitAmplitude):0x0;
-
- delete fDigitTime;
- fDigitTime = source.fDigitTime?new TArrayS(*source.fDigitTime):0x0;
-
- delete fDigitIndex;
- fDigitIndex = source.fDigitIndex?new TArrayS(*source.fDigitIndex):0x0;
+ fNCells= source.fNCells;
+
+ if (source.fNCells > 0) {
+ if(source.fCellsAbsId){
+ if(fNCells != source.fNCells||!fCellsAbsId){
+ if(fCellsAbsId)delete [] fCellsAbsId;
+ fCellsAbsId = new UShort_t[source.fNCells];
+ }
+ for (Int_t i=0; i<source.fNCells; i++){
+ fCellsAbsId[i]=source.fCellsAbsId[i];
+ }
+ }
+
+ if(source.fCellsAmpFraction){
+ if(fNCells != source.fNCells||!fCellsAmpFraction){
+ if(fCellsAmpFraction) delete [] fCellsAmpFraction;
+ fCellsAmpFraction = new Double32_t[source.fNCells];
+ }
+ for (Int_t i=0; i<source.fNCells; i++)
+ fCellsAmpFraction[i]=source.fCellsAmpFraction[i];
+ }
+ }
fNExMax = source.fNExMax;
fClusterType = source.fClusterType;
+ fTOF = source.fTOF;
+
+ //not in use
+ if(source.fTracksMatched){
+ // assign or copy construct
+ if(fTracksMatched){
+ *fTracksMatched = *source.fTracksMatched;
+ }
+ else fTracksMatched = new TArrayI(*source.fTracksMatched);
+ }
+ else{
+ if(fTracksMatched)delete fTracksMatched;
+ fTracksMatched = 0;
+ }
+ if(source.fLabels){
+ // assign or copy construct
+ if(fLabels){
+ *fLabels = *source.fLabels;
+ }
+ else fLabels = new TArrayI(*source.fLabels);
+ }
+ else{
+ if(fLabels)delete fLabels;
+ fLabels = 0;
+ }
+
+
return *this;
}
+//_______________________________________________________________________
+void AliESDCaloCluster::Copy(TObject &obj) const {
+
+ // this overwrites the virtual TOBject::Copy()
+ // to allow run time copying without casting
+ // in AliESDEvent
+
+ if(this==&obj)return;
+ AliESDCaloCluster *robj = dynamic_cast<AliESDCaloCluster*>(&obj);
+ if(!robj)return; // not an AliESDCluster
+ *robj = *this;
+
+}
//_______________________________________________________________________
AliESDCaloCluster::~AliESDCaloCluster(){
//
// This is destructor according Coding Conventions
//
- delete fTracksMatched;
- delete fLabels;
- delete fDigitAmplitude;
- delete fDigitTime;
- delete fDigitIndex;
+ if(fTracksMatched)delete fTracksMatched;fTracksMatched = 0;
+ if(fLabels) delete fLabels; fLabels = 0;
+ if(fCellsAmpFraction){ delete[] fCellsAmpFraction; fCellsAmpFraction=0;}
+ if(fCellsAbsId){ delete[] fCellsAbsId; fCellsAbsId = 0;}
}
//_______________________________________________________________________
-void AliESDCaloCluster::SetPid(const Float_t *p) {
+void AliESDCaloCluster::Clear(const Option_t*){
+ //
+ // This is destructor according Coding Conventions
+ //
+ if(fTracksMatched)delete fTracksMatched;fTracksMatched = 0;
+ if(fLabels) delete fLabels; fLabels = 0;
+ if(fCellsAmpFraction){ delete[] fCellsAmpFraction; fCellsAmpFraction=0;}
+ if(fCellsAbsId){ delete[] fCellsAbsId; fCellsAbsId = 0;}
+}
+
+
+//_______________________________________________________________________
+void AliESDCaloCluster::SetPID(const Float_t *p) {
// Sets the probability of each particle type
// Copied from AliESDtrack SetPIDValues
// This function copies "n" PID weights from "scr" to "dest"
//Vertex can be recovered with esd pointer doing:
//" Double_t vertex[3] ; esd->GetVertex()->GetXYZ(vertex) ; "
+ Double32_t pos[3]={ fGlobalPos[0], fGlobalPos[1], fGlobalPos[2]};
if(vertex){//calculate direction from vertex
- fGlobalPos[0]-=vertex[0];
- fGlobalPos[1]-=vertex[1];
- fGlobalPos[2]-=vertex[2];
+ pos[0]-=vertex[0];
+ pos[1]-=vertex[1];
+ pos[2]-=vertex[2];
}
- Double_t r = TMath::Sqrt(fGlobalPos[0]*fGlobalPos[0]+
- fGlobalPos[1]*fGlobalPos[1]+
- fGlobalPos[2]*fGlobalPos[2] ) ;
-
- p.SetPxPyPzE( fEnergy*fGlobalPos[0]/r, fEnergy*fGlobalPos[1]/r, fEnergy*fGlobalPos[2]/r, fEnergy) ;
+ Double_t r = TMath::Sqrt(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2] ) ;
+ p.SetPxPyPzE( fEnergy*pos[0]/r, fEnergy*pos[1]/r, fEnergy*pos[2]/r, fEnergy) ;
}
-// Sep 7, 2007
-Int_t AliESDCaloCluster::GetTrueDigitAmplitude(Int_t i, Double_t cc)
+
+//_______________________________________________________________________
+void AliESDCaloCluster::SetCellsAbsId(UShort_t *array)
{
- static Int_t amp=0; // amp is integer now
- amp = 0;
- if(i>=0 && i<fDigitAmplitude->GetSize() && cc>0.0) {
- // true formula
- amp = Int_t(Double_t(fDigitAmplitude->At(i))/500./cc+0.5);
+ // Set the array of cell absId numbers
+ if (fNCells) {
+ fCellsAbsId = new UShort_t[fNCells];
+ for (Int_t i = 0; i < fNCells; i++) fCellsAbsId[i] = array[i];
}
- return amp;
}
-Double_t AliESDCaloCluster::GetTrueDigitEnergy(Int_t i, Double_t cc)
+//_______________________________________________________________________
+void AliESDCaloCluster::SetCellsAmplitudeFraction(Double32_t *array)
{
- return Double_t(GetTrueDigitAmplitude(i,cc)) * cc;
+ // Set the array of cell amplitude fraction
+ if (fNCells) {
+ fCellsAmpFraction = new Double32_t[fNCells];
+ for (Int_t i = 0; i < fNCells; i++) fCellsAmpFraction[i] = array[i];
+ }
}
-Double_t AliESDCaloCluster::GetRecalibratedDigitEnergy(Int_t i, Double_t ccOld, Double_t ccNew)
+//______________________________________________________________________________
+void AliESDCaloCluster::SetPosition(Float_t *x)
{
- return Double_t(GetTrueDigitAmplitude(i,ccOld)) * ccNew;
+ // set the position
+
+ if (x) {
+ fGlobalPos[0] = x[0];
+ fGlobalPos[1] = x[1];
+ fGlobalPos[2] = x[2];
+ } else {
+
+ fGlobalPos[0] = -999.;
+ fGlobalPos[1] = -999.;
+ fGlobalPos[2] = -999.;
+ }
}
+
+