]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Clean-up of class. Now acts as a base class.
authormarkus <markus@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Oct 2007 09:17:59 +0000 (09:17 +0000)
committermarkus <markus@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Oct 2007 09:17:59 +0000 (09:17 +0000)
STEER/AliAODCluster.cxx
STEER/AliAODCluster.h

index 0ff73c3f3e1ef960909a744dfbda1d0f783d2230..c198f9d9e5b3e312ab305fdf5ba7f4c96f6bf7bb 100644 (file)
@@ -26,15 +26,13 @@ ClassImp(AliAODCluster)
 
 //______________________________________________________________________________
 AliAODCluster::AliAODCluster() : 
-  AliVParticle(),
   fEnergy(0),
   fChi2(-999.),
   fID(-999),
-  fLabel(-999),
-  fType(kUndef),
-  fCovMatrix(NULL),
-  fProdVertex(0x0),
-  fPrimTrack(NULL)
+  fNLabel(0),
+  fLabel(0x0),
+  fFilterMap(0),
+  fType(kUndef)
 {
   // default constructor
 
@@ -44,58 +42,50 @@ AliAODCluster::AliAODCluster() :
 
 //______________________________________________________________________________
 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[9],
-                            AliAODVertex *prodVertex,
-                            AliAODTrack *primTrack,
-                            Char_t ttype) :
-  AliVParticle(),
+                            Char_t ttype,
+                            UInt_t selectInfo) :
   fEnergy(energy),
   fChi2(-999.),
   fID(id),
-  fLabel(label),
-  fType(ttype),
-  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[9],
-                            AliAODVertex *prodVertex,
-                            AliAODTrack *primTrack,
-                            Char_t ttype) :
-  AliVParticle(),
+                            Char_t ttype,
+                            UInt_t selectInfo) :
   fEnergy(energy),
   fChi2(-999.),
   fID(id),
-  fLabel(label),
-  fType(ttype),
-  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);
 }
 
 
@@ -103,28 +93,27 @@ AliAODCluster::AliAODCluster(Int_t id,
 AliAODCluster::~AliAODCluster() 
 {
   // destructor
-  delete fCovMatrix;
+
+  RemoveLabel();
 }
 
 
 //______________________________________________________________________________
 AliAODCluster::AliAODCluster(const AliAODCluster& clus) :
-  AliVParticle(clus),
+  TObject(clus),
   fEnergy(clus.fEnergy),
   fChi2(clus.fChi2),
   fID(clus.fID),
-  fLabel(clus.fLabel),
-  fType(clus.fType),
-  fCovMatrix(NULL),
-  fProdVertex(clus.fProdVertex),
-  fPrimTrack(clus.fPrimTrack)
+  fNLabel(0),
+  fLabel(0x0),
+  fFilterMap(clus.fFilterMap),
+  fType(clus.fType)
 {
   // Copy constructor
 
   clus.GetPosition(fPosition);
-  if(clus.fCovMatrix) fCovMatrix=new AliAODRedCov<4>(*clus.fCovMatrix);
   SetPID(clus.fPID);
-
+  SetLabel(clus.fLabel, clus.fNLabel);
 }
 
 //______________________________________________________________________________
@@ -133,8 +122,6 @@ AliAODCluster& AliAODCluster::operator=(const AliAODCluster& clus)
   // Assignment operator
   if(this!=&clus) {
 
-    AliVParticle::operator=(clus);
-
     clus.GetPosition(fPosition);
     clus.GetPID(fPID);
 
@@ -142,16 +129,10 @@ AliAODCluster& AliAODCluster::operator=(const AliAODCluster& clus)
     fChi2 = clus.fChi2;
 
     fID = clus.fID;
-    fLabel = clus.fLabel;    
+    SetLabel(clus.fLabel, clus.fNLabel);
+    fFilterMap = clus.fFilterMap;
 
     fType = clus.fType;
-    
-    delete fCovMatrix;
-    if(clus.fCovMatrix) fCovMatrix=new AliAODRedCov<4>(*clus.fCovMatrix);
-    else fCovMatrix=NULL;
-
-    fProdVertex = clus.fProdVertex;
-    fPrimTrack = clus.fPrimTrack;
   }
 
   return *this;
@@ -203,14 +184,53 @@ AliAODCluster::AODCluPID_t AliAODCluster::GetMostProbablePID() const
   }
 }
 
+//______________________________________________________________________________
+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());
 }
-
index 306146ac156c5a9c46498fb536db0206a384c604..03db84e8155479943d29c4754047aab0d4025409 100644 (file)
 //     Author: Markus Oldenburg, CERN
 //-------------------------------------------------------------------------
 
-#include <TRef.h>
+#include <TObject.h>
 
-#include "AliVParticle.h"
-#include "AliAODVertex.h"
-#include "AliAODTrack.h"
-
-class AliAODCluster : public AliVParticle {
+class AliAODCluster : public TObject {
 
  public:
   
   enum AODClu_t {kUndef = -1, 
                 kPHOSNeutral, 
                 kPHOSCharged,
-                kEMCALPseudoCluster, 
                 kEMCALClusterv1,
                 kPMDNeutral, 
                 kPMDCharged};
@@ -41,37 +36,30 @@ class AliAODCluster : public AliVParticle {
 
   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[9],
-               AliAODVertex *prodVertex, // not necessary for PMD
-               AliAODTrack *primTrack,
-               Char_t ttype=kUndef);
+               Char_t ttype=kUndef,
+               UInt_t selectInfo=0);
 
    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[9],
-                AliAODVertex *prodVertex,
-                AliAODTrack *primTrack,
-                Char_t ttype=kUndef);
+                Char_t ttype=kUndef,
+                UInt_t selectInfo=0);
 
   virtual ~AliAODCluster();
-  AliAODCluster(const AliAODCluster& trk); 
-  AliAODCluster& operator=(const AliAODCluster& trk);
+  AliAODCluster(const AliAODCluster& clus); 
+  AliAODCluster& operator=(const AliAODCluster& clus);
 
   Double_t Chi2() const { return fChi2; }
 
   virtual Double_t E() const { return fEnergy; }
-  // make a connection to the PID object, here!!!
-  virtual Double_t M() const { return (fType==AliAODCluster::kPHOSNeutral) ? 0. : -999.; }
-  
-  // make a connection to the PID object, here!!!
-  virtual Double_t Y() const { return (fType==AliAODCluster::kPHOSNeutral) ? Eta() : -999.; }
 
   // PID
   virtual const Double_t *PID() const { return fPID; }
@@ -84,51 +72,34 @@ class AliAODCluster : public AliVParticle {
     if(pid) for(Int_t i=0; i<9; ++i) fPID[i]=pid[i];
     else {for(Int_t i=0; i<9; fPID[i++]=0);} fPID[AliAODCluster::kUnknown]=1.;}
 
-  Int_t GetID() const { return fID; }
-  Int_t GetLabel() const { return fLabel; } 
+  Int_t  GetID() const { return fID; }
+  Int_t  GetLabel(UInt_t i) const;
+  UInt_t GetNLabel() const { return (UInt_t)fNLabel; }
+  Bool_t TestFilterBit(UInt_t filterBit) const { return (Bool_t) ((filterBit & fFilterMap) != 0); }
+  Char_t GetType() const { return fType; }
 
   template <class T> Bool_t GetPosition(T *x) const {
     x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2];
     return kTRUE;}
 
-  template <class T> void SetCovMatrix(const T *covMatrix) {
-    if(!fCovMatrix) fCovMatrix=new AliAODRedCov<4>();
-    fCovMatrix->SetCovMatrix(covMatrix);}
-
-  template <class T> Bool_t GetCovMatrix(T *covMatrix) const {
-    if(!fCovMatrix) return kFALSE;
-    fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;}
+  Bool_t IsEMCALCluster() {if(fType == kEMCALClusterv1) return kTRUE;
+    else return kFALSE;}
+  Bool_t IsPHOSCluster() {if(fType == kPHOSCharged || fType == kPHOSNeutral) return kTRUE;
+    else return kFALSE;}
 
-  void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;}
-
-  AliAODVertex *GetProdVertex() const { return (AliAODVertex*)fProdVertex.GetObject(); }
-  AliAODTrack *GetPrimTrack() const { return (AliAODTrack*)fPrimTrack.GetObject(); }
-  
   // print
   void  Print(const Option_t *opt = "") const;
 
   // setters
   void SetID(Int_t id) { fID = id; }
-  void SetLabel(Int_t label) {fLabel = label; }
-
+  void SetType(AODClu_t ttype) { fType=ttype; }
+  void SetLabel(Int_t *label, UInt_t size);  
+  void RemoveLabel();
   template <class T> void SetPosition(const T *x);
 
   void SetChi2(Double_t chi2) { fChi2 = chi2; }
 
-  void SetProdVertex(TObject *vertex) { fProdVertex = vertex; }
-  void SetPrimTrack(TObject *ptrack) { fPrimTrack = ptrack; }
-
-  virtual Double_t Px() const {return (fType==AliAODCluster::kPHOSNeutral) ? fEnergy*fPosition[0] : 0.;}
-  virtual Double_t Py() const {return (fType==AliAODCluster::kPHOSNeutral) ? fEnergy*fPosition[1] : 0.;}
-  virtual Double_t Pz() const {return (fType==AliAODCluster::kPHOSNeutral) ? fEnergy*fPosition[2] : 0.;}
-  virtual Double_t Pt() const {return TMath::Sqrt(Px()*Px() + Py()*Py()); }
-  virtual Double_t P() const {return TMath::Sqrt(Px()*Px() + Py()*Py() + Pz()*Pz()); }
-  virtual Double_t OneOverPt() const {return Pt() ? 1./Pt(): -999.;}
-  virtual Double_t Phi() const {return (fType==AliAODCluster::kPHOSNeutral) ? TMath::Pi()+TMath::ATan2(-fPosition[1], -fPosition[0]) : 0.;}
-  virtual Double_t Theta() const {return (fType==AliAODCluster::kPHOSNeutral) ? TMath::ATan2(Pt(), fPosition[2]) : 0.;}
-  virtual Double_t Eta() const {return (fType==AliAODCluster::kPHOSNeutral) ? -TMath::Log(TMath::Tan(0.5 * Theta())) : 0.;}
-  virtual Short_t  Charge() const {return (fType==AliAODCluster::kPHOSNeutral) ? 0 : -999;}
-
  private :
 
   // Energy & position
@@ -139,17 +110,13 @@ class AliAODCluster : public AliVParticle {
   Double32_t    fPID[9];         // [0.,1.,8] pointer to PID object
 
   Int_t         fID;             // unique cluster ID, points back to the ESD cluster
-  Int_t         fLabel;          // particle label, points back to MC track
+  Int_t         fNLabel;         // number of original track for this cluster      
+  Int_t        *fLabel;          // [fNLabel] particle label, points back to MC tracks
+  UInt_t        fFilterMap;      // filter information, one bit per set of cuts
   
   Char_t        fType;           // cluster type
 
-  AliAODRedCov<4> *fCovMatrix;   // covariance matrix (x, y, z, E)
-  TRef          fProdVertex;     // vertex of origin (not necessary for PMD)
-  TRef          fPrimTrack;      // primary track associated with this cluster (not necessary for PMD)
-
-  // TRef      fAssocCluster;       // for PMD: cluster of other layer associated with this cluster
-
-  ClassDef(AliAODCluster,3);
+  ClassDef(AliAODCluster,4);
 };
 
 #endif