]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliMultiplicity.h
Reset of centrality object.
[u/mrichter/AliRoot.git] / STEER / AliMultiplicity.h
index d76d2312302b04bb5f611cb81e7382561f16bfb1..0d485607373bf2ee6ec879476c80f3921e652a89 100644 (file)
@@ -1,9 +1,10 @@
 #ifndef ALIMULTIPLICITY_H
 #define ALIMULTIPLICITY_H
 
-#include<TObject.h>
+#include <TObject.h>
 #include <TBits.h>
-#include<TMath.h>
+#include <TMath.h>
+class AliRefArray;
 
 ////////////////////////////////////////////////////////
 ////   Class containing multiplicity information      //
 class AliMultiplicity : public TObject {
 
  public:
-
+  //
+  enum {kMultTrackRefs  =BIT(14),// in new format (old is default for bwd.comp.) multiple cluster->track references are allowed
+       kScaleDThtbySin2=BIT(15) // scale Dtheta by 1/sin^2(theta). Default is DON'T scale, for bwd.comp.
+  };   
   AliMultiplicity();               // default constructor
   // standard constructor
   AliMultiplicity(Int_t ntr,Float_t *th, Float_t *ph, Float_t *dth, Float_t *dph, Int_t *labels,
@@ -24,7 +28,13 @@ class AliMultiplicity : public TObject {
   virtual void Copy(TObject &obj) const;
   virtual void Clear(Option_t* opt="");
   virtual ~AliMultiplicity();
-// methods to access tracklet information
+  // methods to access tracklet information
+  Bool_t  GetMultTrackRefs()                  const {return TestBit(kMultTrackRefs);}
+  void    SetMultTrackRefs(Bool_t v)                {SetBit(kMultTrackRefs,v);}
+  Bool_t  GetScaleDThetaBySin2T()             const {return TestBit(kScaleDThtbySin2);}
+  void    SetScaleDThetaBySin2T(Bool_t v)           {SetBit(kScaleDThtbySin2,v);}
+
+  //
   Int_t GetNumberOfTracklets() const {return fNtracks;}
   Double_t GetTheta(Int_t i) const { 
     if(i>=0 && i<fNtracks) return fTh[i];
@@ -47,12 +57,13 @@ class AliMultiplicity : public TObject {
     Error("GetDeltaPhi","Invalid track number %d",i); return -9999.;
   }
 
+  Double_t  CalcDist(Int_t it)  const;
+
   Int_t GetLabel(Int_t i, Int_t layer) const;
   void  SetLabel(Int_t i, Int_t layer, Int_t label);
   Int_t GetLabelSingle(Int_t i) const;
   void  SetLabelSingle(Int_t i, Int_t label);
 
-
   Bool_t FreeClustersTracklet(Int_t i, Int_t mode) const;
   Bool_t FreeSingleCluster(Int_t i, Int_t mode)    const;
 
@@ -86,7 +97,9 @@ class AliMultiplicity : public TObject {
   Bool_t TestFiredChipMap(UInt_t chipKey) const {return fClusterFiredChips.TestBitNumber(chipKey);}
 
   Bool_t GetTrackletTrackIDs(Int_t i, Int_t mode, Int_t &spd1, Int_t &spd2) const;
+  Int_t  GetTrackletTrackIDsLay(Int_t lr,Int_t i, Int_t mode, UInt_t* refs, UInt_t maxRef) const;
   Bool_t GetSingleClusterTrackID(Int_t i, Int_t mode, Int_t &tr) const;
+  Int_t  GetSingleClusterTrackIDs(Int_t i, Int_t mode, UInt_t* refs, UInt_t maxRef) const;
 
   // array getters
   Double_t* GetTheta()       const {return (Double_t*)fTh;}
@@ -98,23 +111,47 @@ class AliMultiplicity : public TObject {
   Int_t*    GetLabels()      const {return (Int_t*)fLabels;}  
   Int_t*    GetLabels2()     const {return (Int_t*)fLabelsL2;}
   Int_t*    GetLabelsSingle()      const {return (Int_t*)fLabelssingle;} 
-  
-  void SetTrackletData(Int_t id, const Float_t* tlet, UInt_t trSPD1, UInt_t trSPD2);
-  void SetSingleClusterData(Int_t id, const Float_t* scl,UInt_t tr);
-  void CompactBits();
 
+  void AttachTracklet2TrackRefs(AliRefArray* l1t1,AliRefArray* l1t2,AliRefArray* l2t1,AliRefArray* l2t2) {
+    fTCl2Tracks[0][0] = l1t1; fTCl2Tracks[0][1] = l1t2; fTCl2Tracks[1][0] = l2t1; fTCl2Tracks[1][1] = l2t2; 
+  }
+  void AttachCluster2TrackRefs(AliRefArray* l1t1,AliRefArray* l1t2) {
+    fSCl2Tracks[0] = l1t1; fSCl2Tracks[1] = l1t2;
+  }
+  void SetTrackletData(Int_t id, const Float_t* tlet, UInt_t trSPD1=0, UInt_t trSPD2=0);
+  void SetSingleClusterData(Int_t id, const Float_t* scl,UInt_t tr=0);
+  void CompactBits();
+  //
+  void    SetDPhiWindow2(Float_t v=-1)            {fDPhiWindow2 = v;}
+  void    SetDThetaWindow2(Float_t v=-1)          {fDThetaWindow2 = v;}
+  void    SetDPhiShift(Float_t v=-1)              {fDPhiShift = v;}
+  void    SetNStdDev(Float_t v=1)                 {fNStdDev = v;}
+  //
+  Float_t GetDPhiWindow2()                  const {return fDPhiWindow2;}
+  Float_t GetDThetaWindow2()                const {return fDThetaWindow2;}
+  Float_t GetDPhiShift()                    const {return fDPhiShift;}
+  Float_t GetNStdDev()                      const {return fNStdDev;}
+
+  //
   virtual void Print(Option_t *opt="") const;
 
   protected:
   void Duplicate(const AliMultiplicity &m);  // used by copy ctr.
 
   Int_t fNtracks;            // Number of tracklets
-  Int_t fNsingle;            // Number of clusters on SPD layer 1, not associated
-                             // with a tracklet on SPD layer 2
+  Int_t fNsingle;            // Number of clusters on SPD layer 1, not associated with a tracklet on SPD layer 2
+  //
+  Float_t fDPhiWindow2;      // sigma^2 in dphi used in reco
+  Float_t fDThetaWindow2;    // sigma^2 in dtheta used in reco
+  Float_t fDPhiShift;        // bending shift used
+  Float_t fNStdDev;          // number of standard deviations kept
+  //
   Int_t *fLabels;            //[fNtracks] array with labels of cluster in L1 used for tracklet
   Int_t *fLabelsL2;          //[fNtracks] array with labels of cluster in L2 used for tracklet
-  UInt_t* fUsedClusS;        //[fNsingle] id+1 of the tracks using cluster, coded as (TPC/ITS+ITS_SA)+(ITS_SA_PURE<<16)
+  UInt_t* fUsedClusS;        //[fNsingle] id+1 of the tracks using cluster, coded as (TPC/ITS+ITS_SA)+(ITS_SA_PURE<<16) !!! Outphased for multiple refs
   ULong64_t* fUsedClusT;     //[fNtracks] id+1 of the tracks using clusters, coded as (TPC/ITS+ITS_SA)+(ITS_SA_PURE<<16) for SPD1 and SPD2 in low and high parts
+  AliRefArray *fTCl2Tracks[2][2]; // container with multiple tracklet_cluster->track references
+  AliRefArray *fSCl2Tracks[2];    // container with multiple single_cluster->track references
   Double32_t *fTh;           //[fNtracks] array with theta values
   Double32_t *fPhi;          //[fNtracks] array with phi values
   Double32_t *fDeltTh;       //[fNtracks] array with delta theta values
@@ -127,7 +164,7 @@ class AliMultiplicity : public TObject {
   TBits fFastOrFiredChips;   // Map of FastOr fired chips
   TBits fClusterFiredChips;  // Map of fired chips (= at least one cluster)
 
-  ClassDef(AliMultiplicity,17);
+  ClassDef(AliMultiplicity,18);
 };
 
 inline Int_t AliMultiplicity::GetLabel(Int_t i, Int_t layer) const
@@ -162,6 +199,21 @@ inline Int_t AliMultiplicity::GetLabelSingle(Int_t i) const
 }
 
 
+inline Double_t AliMultiplicity::CalcDist(Int_t i) const
+{
+  // calculate eliptical distance. theta is the angle of cl1, dtheta = tht(cl1)-tht(cl2)
+  if (i<0 && i>=fNtracks) return -1;
+  if (fDPhiWindow2<1E-9 || fDThetaWindow2<1E-9) return -1; // not stored
+  double dphi   = TMath::Abs(fDeltPhi[i]) - fDPhiShift;
+  double dtheta = fDeltTh[i];
+  if (GetScaleDThetaBySin2T()) {
+    double sinTI = TMath::Sin(fTh[i]-dtheta/2);
+    sinTI *= sinTI;
+    dtheta /= sinTI>1.e-6 ? sinTI : 1.e-6;
+  }
+  return dphi*dphi/fDPhiWindow2 + dtheta*dtheta/fDThetaWindow2;
+}
+
 
 
 #endif