//______________________________________________________________________________
AliAODCluster::AliAODCluster() :
- AliVirtualParticle(),
fEnergy(0),
fChi2(-999.),
fID(-999),
- fLabel(-999),
- fCovMatrix(NULL),
- fProdVertex(0x0),
- fPrimTrack(NULL),
+ fNLabel(0),
+ fLabel(0x0),
+ fFilterMap(0),
fType(kUndef)
{
// default constructor
//______________________________________________________________________________
AliAODCluster::AliAODCluster(Int_t id,
- Int_t label,
+ UInt_t nLabel,
+ Int_t *label,
Double_t energy,
Double_t x[3],
- Double_t covMatrix[10],
- Double_t pid[10],
- AliAODVertex *prodVertex,
- AliAODTrack *primTrack,
- Char_t ttype) :
- AliVirtualParticle(),
+ Double_t pid[13],
+ Char_t ttype,
+ UInt_t selectInfo) :
fEnergy(energy),
fChi2(-999.),
fID(id),
- fLabel(label),
- fCovMatrix(NULL),
- fProdVertex(prodVertex),
- fPrimTrack(primTrack),
+ fNLabel(0),
+ fLabel(0x0),
+ fFilterMap(selectInfo),
fType(ttype)
{
// constructor
SetPosition(x);
- if(covMatrix) SetCovMatrix(covMatrix);
SetPID(pid);
-
+ SetLabel(label, nLabel);
}
//______________________________________________________________________________
AliAODCluster::AliAODCluster(Int_t id,
- Int_t label,
+ UInt_t nLabel,
+ Int_t *label,
Float_t energy,
Float_t x[3],
- Float_t covMatrix[10],
- Float_t pid[10],
- AliAODVertex *prodVertex,
- AliAODTrack *primTrack,
- Char_t ttype) :
- AliVirtualParticle(),
+ Float_t pid[13],
+ Char_t ttype,
+ UInt_t selectInfo) :
fEnergy(energy),
fChi2(-999.),
fID(id),
- fLabel(label),
- fCovMatrix(NULL),
- fProdVertex(prodVertex),
- fPrimTrack(primTrack),
+ fNLabel(0),
+ fLabel(0x0),
+ fFilterMap(selectInfo),
fType(ttype)
{
// constructor
SetPosition(x);
- if(covMatrix) SetCovMatrix(covMatrix);
SetPID(pid);
-
+ SetLabel(label, nLabel);
}
AliAODCluster::~AliAODCluster()
{
// destructor
- delete fCovMatrix;
+
+ RemoveLabel();
}
//______________________________________________________________________________
-AliAODCluster::AliAODCluster(const AliAODCluster& trk) :
- AliVirtualParticle(trk),
- fEnergy(trk.fEnergy),
- fChi2(trk.fChi2),
- fID(trk.fID),
- fLabel(trk.fLabel),
- fCovMatrix(NULL),
- fProdVertex(trk.fProdVertex),
- fPrimTrack(trk.fPrimTrack),
- fType(trk.fType)
+AliAODCluster::AliAODCluster(const AliAODCluster& clus) :
+ TObject(clus),
+ fEnergy(clus.fEnergy),
+ fChi2(clus.fChi2),
+ fID(clus.fID),
+ fNLabel(0),
+ fLabel(0x0),
+ fFilterMap(clus.fFilterMap),
+ fType(clus.fType)
{
// Copy constructor
- trk.GetPosition(fPosition);
- if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<4>(*trk.fCovMatrix);
- SetPID(trk.fPID);
-
+ clus.GetPosition(fPosition);
+ SetPID(clus.fPID);
+ SetLabel(clus.fLabel, clus.fNLabel);
}
//______________________________________________________________________________
-AliAODCluster& AliAODCluster::operator=(const AliAODCluster& trk)
+AliAODCluster& AliAODCluster::operator=(const AliAODCluster& clus)
{
// Assignment operator
- if(this!=&trk) {
+ if(this!=&clus) {
- AliVirtualParticle::operator=(trk);
+ clus.GetPosition(fPosition);
+ clus.GetPID(fPID);
- trk.GetPosition(fPosition);
- trk.GetPID(fPID);
+ fEnergy = clus.fEnergy;
+ fChi2 = clus.fChi2;
- fChi2 = trk.fEnergy;
- fChi2 = trk.fChi2;
+ fID = clus.fID;
+ SetLabel(clus.fLabel, clus.fNLabel);
+ fFilterMap = clus.fFilterMap;
- fID = trk.fID;
- fLabel = trk.fLabel;
-
- delete fCovMatrix;
- if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<4>(*trk.fCovMatrix);
- else fCovMatrix=NULL;
- fProdVertex = trk.fProdVertex;
- fPrimTrack = trk.fPrimTrack;
-
- fType = trk.fType;
+ fType = clus.fType;
}
return *this;
}
}
+//______________________________________________________________________________
+AliAODCluster::AODCluPID_t AliAODCluster::GetMostProbablePID() const
+{
+ // Returns the most probable PID array element.
+
+ Int_t nPID = 13;
+ if (fPID) {
+ AODCluPID_t loc = kUnknown;
+ Double_t max = 0.;
+ Bool_t allTheSame = kTRUE;
+
+ for (Int_t iPID = 0; iPID < nPID; iPID++) {
+ if (fPID[iPID] >= max) {
+ if (fPID[iPID] > max) {
+ allTheSame = kFALSE;
+ max = fPID[iPID];
+ loc = (AODCluPID_t)iPID;
+ } else {
+ allTheSame = kTRUE;
+ }
+ }
+ }
+
+ return allTheSame ? kUnknown : loc;
+ } else {
+ return kUnknown;
+ }
+}
+
+//______________________________________________________________________________
+void AliAODCluster::SetLabel(Int_t *label, UInt_t size)
+{
+ if (label && size>0) {
+ if (size != (UInt_t)fNLabel) {
+ RemoveLabel();
+ fNLabel = size;
+ fLabel = new Int_t[fNLabel];
+ }
+
+ for (Int_t i = 0; i < fNLabel; i++) {
+ fLabel[i] = label[i];
+ }
+ } else {
+ RemoveLabel();
+ }
+
+ return;
+}
+
+//______________________________________________________________________________
+Int_t AliAODCluster::GetLabel(UInt_t i) const
+{
+ if (fLabel && i < (UInt_t)fNLabel) {
+ return fLabel[i];
+ } else {
+ return -999;
+ }
+}
+
+//______________________________________________________________________________
+void AliAODCluster::RemoveLabel()
+{
+ delete[] fLabel;
+ fLabel = 0x0;
+ fNLabel = 0;
+
+ return;
+}
+
//______________________________________________________________________________
void AliAODCluster::Print(Option_t* /* option */) const
{
// prints information about AliAODCluster
- printf("Object name: %s Cluster type: %s\n", GetName(), GetTitle());
- printf(" energy = %f\n", E());
- printf(" chi2 = %f\n", Chi2());
- printf(" PID object: %p\n", PID());
+ printf("Cluster type: %d\n", GetType());
+ printf(" energy = %f\n", E());
+ printf(" chi2 = %f\n", Chi2());
+ printf(" PID object: %p\n", PID());
}
-