]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/UPGRADE/AliITSUClusterPix.h
added cluster sharing histogramming
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUClusterPix.h
index 2b2bc005c416d67a33749a96094c80ab7eaa8b5e..9b7f324851b5bd5711f4e5f3af1dfd2eb5170aec 100644 (file)
@@ -2,6 +2,7 @@
 #define ALIITSUCLUSTERPIX_H
 
 #include "AliCluster.h"
+#include <TMath.h>
 
 class TGeoHMatrix;
 class AliITSUGeomTGeo;
@@ -15,12 +16,13 @@ class AliITSUClusterPix : public AliCluster
     ,kFrameTrk = BIT(17)
     ,kFrameGlo = BIT(18)
     ,kFrameBits = kFrameLoc|kFrameTrk|kFrameGlo
+    ,kSplit    = BIT(19)
   };
   //
   enum SortMode_t { // various modes
-    kSortLoc = BIT(0)
-    ,kSortTrk = BIT(1)
-    ,kSortBits = kSortLoc|kSortTrk
+    kSortIdLocXZ  = BIT(0)    // sort according to ID, then X,Z of local frame
+    ,kSortIdTrkYZ = BIT(1)    // sort according to ID, then Y,Z of tracking frame
+    ,kSortBits = kSortIdLocXZ|kSortIdTrkYZ
   };
 
  public:
@@ -32,19 +34,33 @@ class AliITSUClusterPix : public AliCluster
   Bool_t  IsFrameLoc()         const {return TestBit(kFrameLoc);}
   Bool_t  IsFrameGlo()         const {return TestBit(kFrameGlo);}
   Bool_t  IsFrameTrk()         const {return TestBit(kFrameTrk);}
+  //
+  Bool_t  IsSplit()            const {return TestBit(kSplit);}
+  //
   void    SetFrameLoc()              {ResetBit(kFrameBits); SetBit(kFrameLoc);}
   void    SetFrameGlo()              {ResetBit(kFrameBits); SetBit(kFrameGlo);}
   void    SetFrameTrk()              {ResetBit(kFrameTrk);  SetBit(kFrameTrk);}
-   //
+  //
+  void    SetSplit(Bool_t v=kTRUE)   {SetBit(kSplit,v);}
+  //
   void    GoToFrameGlo();
   void    GoToFrameLoc();
   void    GoToFrameTrk();
-  void    GetLocalXYZ(Float_t xyz[3]) const;
-  void    GetTrackingXYZ(Float_t xyz[3]) const;
+  void    GetLocalXYZ(Float_t xyz[3])                       const;
+  void    GetTrackingXYZ(Float_t xyz[3])                    const; 
+  //
+  void    SetNxNzN(UChar_t nx,UChar_t nz,UShort_t n)              {fNxNzN = ( ((n&0xff)<<16)) + ((nx&0xff)<<8) + (nz&0xff);}
+  void    SetClUsage(Int_t n);
+  void    ModClUsage(Bool_t used=kTRUE)                           {used ? IncClUsage() : DecClUsage();}
+  void    IncClUsage()                                            {SetClUsage(GetClUsage()+1); IncreaseClusterUsage();}
+  void    DecClUsage();
+  Int_t   GetNx()                                           const {return (fNxNzN>>8)&0xff;}
+  Int_t   GetNz()                                           const {return fNxNzN&0xff;}
+  Int_t   GetNPix()                                         const {return (fNxNzN>>16)&0xff;}
+  Int_t   GetClUsage()                                      const {return (fNxNzN>>24)&0xff;}
   //
-  void    SetNxNz(UChar_t nx,UChar_t nz) {fNxNz = (nx<<8) + nz;}
-  Int_t   GetNx()                                           const {return fNxNz>>8;}
-  Int_t   GetNz()                                           const {return fNxNz&0xff;}
+  void    SetQ(UShort_t q)                                        {fCharge = q;}
+  Int_t   GetQ()                                            const {return fCharge;}
   //
   virtual void                 Print(Option_t* option = "") const;
   virtual const TGeoHMatrix*   GetTracking2LocalMatrix()           const;
@@ -57,20 +73,40 @@ class AliITSUClusterPix : public AliCluster
   virtual Bool_t               IsEqual(const TObject* obj)  const;
   virtual Int_t                       Compare(const TObject* obj)  const;
   //
+  Bool_t  HasCommonTrack(const AliCluster* cl)          const;
+  //
   static  void                 SetGeom(AliITSUGeomTGeo* gm) {fgGeom = gm;}
   static  void                 SetSortMode(SortMode_t md)   {fgMode &= ~kSortBits; fgMode |= md;}
-  static  UInt_t               GetSortMode()                {return fgMode|kSortBits;}
+  static  UInt_t               GetSortMode()                {return fgMode&kSortBits;}
   static  UInt_t               GetMode()                    {return fgMode;}
-  static  SortMode_t SortModeTrkID()                        {return kSortTrk;}
-  static  SortMode_t SortModeLocID()                        {return kSortLoc;}
+  static  SortMode_t           SortModeIdTrkYZ()            {return kSortIdTrkYZ;}
+  static  SortMode_t           SortModeIdLocXZ()            {return kSortIdLocXZ;}
   //
  protected:
   //
-  UShort_t                fNxNz;          // effective cluster size in X (1st byte) and Z (2nd byte) directions
-  static UInt_t           fgMode;         // general mode (sorting mode etc)
-  static AliITSUGeomTGeo* fgGeom;         // pointer on the geometry data
+  UShort_t                fCharge;        //  charge (for MC studies only)
+  Int_t                   fNxNzN;         //  effective cluster size in X (1st byte) and Z (2nd byte) directions 
+                                          //  and total Npix(3d byte). 4th byte is used for clusters usage counter
+  static UInt_t           fgMode;         //! general mode (sorting mode etc)
+  static AliITSUGeomTGeo* fgGeom;         //! pointer on the geometry data
 
   ClassDef(AliITSUClusterPix,1)
 };
 
+//______________________________________________________
+inline void AliITSUClusterPix::DecClUsage() {
+  // decrease cluster usage counter
+  int n=GetClUsage(); 
+  if (n) SetClUsage(--n);
+  //
+}
+
+//______________________________________________________
+inline void AliITSUClusterPix::SetClUsage(Int_t n) {
+  // set cluster usage counter
+  fNxNzN &= ((n&0xff)<<24)&0x00ffffff; 
+  if (n<2) SetBit(kShared,kFALSE);
+  if (!n)  SetBit(kUsed,kFALSE);
+}
+
 #endif