-#include "AliAODParticle.h"
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id$ */
+
//___________________________________________________________
/////////////////////////////////////////////////////////////
//
//
/////////////////////////////////////////////////////////////
#include <TParticle.h>
-#include "AliTrackPoints.h"
+
+#include "AliAODParticle.h"
#include "AliClusterMap.h"
+#include "AliLog.h"
+#include "AliTrackPoints.h"
ClassImp(AliAODParticle)
AliAODParticle::AliAODParticle():
fPdgIdx(0), fIdxInEvent(0),fNPids(0),fPids(0x0),fPidProb(0x0),
fCalcMass(0),fPx(0), fPy(0),fPz(0),fE(0), fVx(0), fVy(0),fVz(0),fVt(0),
- fTrackPoints(0x0),fClusterMap(0x0)
+ fTPCTrackPoints(0x0),fITSTrackPoints(0x0),fClusterMap(0x0)
{//empty particle
}
//______________________________________________________________________________
fCalcMass(0),
fPx(px), fPy(py),fPz(pz),fE(etot),
fVx(vx), fVy(vy),fVz(vz),fVt(time),
- fTrackPoints(0x0),fClusterMap(0x0)
+ fTPCTrackPoints(0x0),fITSTrackPoints(0x0),fClusterMap(0x0)
{
//mormal constructor
SetPdgCode(pdg);
fCalcMass(0),
fPx(px), fPy(py),fPz(pz),fE(etot),
fVx(vx), fVy(vy),fVz(vz),fVt(time),
- fTrackPoints(0x0),fClusterMap(0x0)
+ fTPCTrackPoints(0x0),fITSTrackPoints(0x0),fClusterMap(0x0)
{
//mormal constructor
SetPdgCode(pdg,prob);
}
}
//______________________________________________________________________________
+
AliAODParticle::AliAODParticle(const AliAODParticle& in):
AliVAODParticle(in),
fPdgIdx(in.fPdgIdx), fIdxInEvent(in.fIdxInEvent),
fNPids(in.fNPids),fPids(new Int_t[fNPids]),fPidProb(new Float_t[fNPids]),
fCalcMass(in.GetCalcMass()),
- fPx(in.Px()),fPy(in.Py()),fPz(in.Pz()),fE(in.Energy()),
+ fPx(in.Px()),fPy(in.Py()),fPz(in.Pz()),fE(in.E()),
fVx(in.Vx()),fVy(in.Vy()),fVz(in.Vz()),fVt(in.T()),
- fTrackPoints(0x0), fClusterMap(0x0)
+ fTPCTrackPoints(0x0),fITSTrackPoints(0x0),fClusterMap(0x0)
{
//Copy constructor
+// Info("AliAODParticle(const AliAODParticle& in)","");
for(Int_t i = 0; i<fNPids; i++)
{
fPids[i] = in.fPids[i];
fPidProb[i] = in.fPidProb[i];
}
- if (in.fTrackPoints)
- fTrackPoints = (AliTrackPoints*)in.fTrackPoints->Clone();
+ if (in.fTPCTrackPoints)
+ fTPCTrackPoints = (AliTrackPoints*)in.fTPCTrackPoints->Clone();
+ if (in.fITSTrackPoints)
+ fITSTrackPoints = (AliTrackPoints*)in.fITSTrackPoints->Clone();
if (in.fClusterMap)
fClusterMap = (AliClusterMap*)in.fClusterMap->Clone();
}
+//______________________________________________________________________________
+AliAODParticle::AliAODParticle(const AliVAODParticle& in):
+ AliVAODParticle(in),
+ fPdgIdx(0), fIdxInEvent(in.GetUID()),
+ fNPids(0),fPids(0x0),fPidProb(0x0),
+ fCalcMass(-1.0),
+ fPx(in.Px()),fPy(in.Py()),fPz(in.Pz()),fE(in.E()),
+ fVx(in.Vx()),fVy(in.Vy()),fVz(in.Vz()),fVt(in.T()),
+ fTPCTrackPoints(0x0),fITSTrackPoints(0x0),fClusterMap(0x0)
+{
+ //Copy constructor
+// Info("AliAODParticle(const AliVAODParticle& in)","");
+ for(Int_t i = 0; i<in.GetNumberOfPids(); i++)
+ {
+ SetPIDprobability(in.GetNthPid(i),in.GetNthPidProb(i));
+ }
+ SetPdgCode(in.GetPdgCode(),in.GetPidProb());
+
+ AliTrackPoints* tpts = in.GetTPCTrackPoints();
+ if (tpts) SetTPCTrackPoints((AliTrackPoints*)tpts->Clone());
+
+ tpts = in.GetITSTrackPoints();
+ if (tpts) SetITSTrackPoints((AliTrackPoints*)tpts->Clone());
+
+ AliClusterMap* clmap = in.GetClusterMap();
+ if (clmap) SetClusterMap((AliClusterMap*)clmap->Clone());
+}
//______________________________________________________________________________
+
AliAODParticle::AliAODParticle(const TParticle &p,Int_t idx):
fPdgIdx(0), fIdxInEvent(idx),
fNPids(0),fPids(0x0),fPidProb(0x0),
fCalcMass(p.GetCalcMass()),
fPx(p.Px()),fPy(p.Py()),fPz(p.Pz()),fE(p.Energy()),
fVx(p.Vx()),fVy(p.Vy()),fVz(p.Vz()),fVt(p.T()),
- fTrackPoints(0x0),fClusterMap(0x0)
+ fTPCTrackPoints(0x0),fITSTrackPoints(0x0),fClusterMap(0x0)
{
//all copied in the initialization
SetPdgCode(p.GetPdgCode());
//dtor
delete [] fPids;
delete [] fPidProb;
- delete fTrackPoints;
+ delete fTPCTrackPoints;
+ delete fITSTrackPoints;
+ delete fClusterMap;
+}
+//______________________________________________________________________________
+
+void AliAODParticle::Clear(Option_t*)
+{
+//Must be implemented in order to store this object in Clones Array
+ delete [] fPids;
+ delete [] fPidProb;
+ delete fTPCTrackPoints;
+ delete fITSTrackPoints;
+ delete fClusterMap;
+
+ fPids = 0x0;
+ fPidProb = 0x0;
+ fTPCTrackPoints = 0x0;
+ fITSTrackPoints = 0x0;
+ fClusterMap = 0x0;
+}
+//______________________________________________________________________________
+
+AliVAODParticle& AliAODParticle::operator=(const AliVAODParticle& in)
+{
+//operator=
+// Info("operator=(const AliVAODParticle& in)","AliAODParticle");
+
+ if (&in == this) return *this;
+
+ delete [] fPids;
+ delete [] fPidProb;
+ fPids = 0x0;
+ fPidProb = 0x0;
+ fNPids = 0;
+
+ Int_t npids = in.GetNumberOfPids();
+ for (Int_t i = 0; i < npids; i++)
+ {
+ SetPIDprobability(in.GetNthPid(i),in.GetNthPidProb(i));
+ }
+
+ SetPdgCode(in.GetPdgCode(),in.GetPidProb());
+
+ SetUID(in.GetUID());
+
+ fCalcMass = in.Mass();
+
+ fPx = in.Px();
+ fPy = in.Py();
+ fPz = in.Pz();
+ fE = in.E();
+ fVx = in.Vx();
+ fVy = in.Vy();
+ fVz = in.Vz();
+ fVt = in.T();
+
+ delete fTPCTrackPoints;
+ AliTrackPoints* tpts = in.GetTPCTrackPoints();
+ fTPCTrackPoints = (tpts)?(AliTrackPoints*)tpts->Clone():0x0;
+
+ delete fITSTrackPoints;
+ tpts = in.GetITSTrackPoints();
+ fITSTrackPoints = (tpts)?(AliTrackPoints*)tpts->Clone():0x0;
+
delete fClusterMap;
+ AliClusterMap* incmap = in.GetClusterMap();
+ fClusterMap = (incmap)?(AliClusterMap*)incmap->Clone():0x0;
+
+ return *this;
}
//______________________________________________________________________________
AliAODParticle& AliAODParticle::operator=(const AliAODParticle& in)
{
//assigment operator
-
+// Info("operator=(const AliAODParticle& in)","AliAODParticle");
+ if (&in == this) return *this;
fNPids = in.fNPids;
delete [] fPids;
delete [] fPidProb;
- Int_t* fPids = new Int_t[fNPids];
- Float_t* fPidProb = new Float_t[fNPids];
+ fPids = new Int_t[fNPids];
+ fPidProb = new Float_t[fNPids];
for (Int_t i = 0; i < fNPids;i++)
{
fPids[i] = in.fPids[i];
fPx = in.Px();
fPy = in.Py();
fPz = in.Pz();
- fE = in.Energy();
+ fE = in.E();
fVx = in.Vx();
fVy = in.Vy();
fVz = in.Vz();
fVt = in.T();
- delete fTrackPoints;
- fTrackPoints = (in.fTrackPoints)?(AliTrackPoints*)fTrackPoints->Clone():0x0;
+ delete fTPCTrackPoints;
+ fTPCTrackPoints = (in.fTPCTrackPoints)?(AliTrackPoints*)in.fTPCTrackPoints->Clone():0x0;
+
+ delete fITSTrackPoints;
+ fITSTrackPoints = (in.fITSTrackPoints)?(AliTrackPoints*)in.fITSTrackPoints->Clone():0x0;
delete fClusterMap;
fClusterMap = (in.fClusterMap)?(AliClusterMap*)in.fClusterMap->Clone():0x0;
void AliAODParticle::SetPdgCode(Int_t pdg,Float_t prob)
{
+//Set PDG Code
SetPIDprobability(pdg,prob);
fPdgIdx = GetPidSlot(pdg);
}
{
//Sets another pdg code and corresponding probabilty
//Ids are set in decreasing order
-//Check if total prbaility is not ivercoming unity is performed
+//Check if total probability is not overcoming unity is performed
//in case, warning is printed
- if (GetDebug() > 9) Info("SetPIDprobability","Setting PID %d prob %f",pdg,prob);
+ AliDebug(9,Form("SetPIDprobability","Setting PID %d prob %f",pdg,prob));
Float_t totprob = 0.0;//sums up probabilities
Int_t idx = GetPidSlot(pdg);
Int_t i;
+
if (idx > -1)
{
fPidProb[idx] = prob;
{
Warning("SetPIDprobability","Total probability greater than unity (%f)",totprob);
}
- if (GetDebug() > 9)
- {
- Info("SetPIDprobability","Current Total probability: %f",totprob);
- }
+ AliDebug(9,Form("Current Total probability: %f",totprob));
return;
}
{
if ( fPidProb[i] > prob)
{
- if (GetDebug()>9) Info("SetPID","Copying entry %d",i);
+ AliDebug(9,Form("Copying entry %d",i));
aPidProbNew[i] = fPidProb[i];
aPidsNew[i] = fPids[i];
totprob+=fPidProb[i];
else break;
}
- if (GetDebug() > 9) Info("SetPID","Setting new PID on entry %d",i);
+ AliDebug(9,Form("SetPID","Setting new PID on entry %d",i));
aPidProbNew[i] = prob;
aPidsNew[i] = pdg;
totprob+=prob;
- for (Int_t j = fNPids-1; j > i ;j--)//copy rest of old araays
+ for (Int_t j = fNPids-1; j > i ;j--)//copy rest of old arays
{
- if (GetDebug() > 9) Info("SetPID","Copying from old entry %d to new entry %d",j-1,j);
+ AliDebug(9,Form("SetPID","Copying from old entry %d to new entry %d",j-1,j));
aPidProbNew[j] = fPidProb[j-1];
aPidsNew[j] = fPids[j-1];
totprob+=fPidProb[j-1];
fPdgIdx = GetPidSlot(currentpid);
if (fPdgIdx == -1) fPdgIdx = 0;
- if (totprob > (1.0+0.000001))//place for numerical error
+ if (totprob > (1.0+0.000001))//space for numerical error
{
Warning("SetId","Total probability is greater than unity (%f)!!!",totprob);
Print();
}
//______________________________________________________________________________
-void AliAODParticle::Print() const
+void AliAODParticle::Print(const Option_t * /*opt*/) const
{
//prints information about particle
printf("____________________________________________________\n");
}
printf("Px: %+f Py: %+f Pz: %+f E: %+f Calculated Mass: %f\nVx: %+f Vy: %+f Vz: %+f T: %+f\n",
- Px(),Py(),Pz(),Energy(),GetCalcMass(),Vx(),Vy(),Vz(),T());
+ Px(),Py(),Pz(),E(),GetCalcMass(),Vx(),Vy(),Vz(),T());
for (Int_t i = 0; i < fNPids; i++)
{
printf("Not known\n");
}
}
+
+ if (fITSTrackPoints) fITSTrackPoints->Print();
+ if (fTPCTrackPoints) fTPCTrackPoints->Print();
+
}
//______________________________________________________________________________