LCOV - code coverage report
Current view: top level - HLT/ITS/trackingSAP - AliITSSAPLayer.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 32 0.0 %
Date: 2016-06-14 17:26:59 Functions: 0 28 0.0 %

          Line data    Source code
       1             : #ifndef ALIITSSAPLAYER_H
       2             : #define ALIITSSAPLAYER_H
       3             : 
       4             : #include <algorithm>
       5             : #include <vector>
       6             : #include <TObject.h>
       7             : #include <TObjArray.h>
       8             : #include "AliITSRecPoint.h"
       9             : class AliVertex;
      10             : class AliITSSAPLayer 
      11             : {
      12             : 
      13             :  public:
      14             :   struct ClsInfo   // cluster info, optionally XY origin at vertex
      15             :   { 
      16             :     float x,y,z,phi,r;    // lab params
      17             :     int   zphibin; // bins is z,phi
      18             :     int   index;          // index in RecPoints array
      19             :     int   detid;          // detector index //RS ??? Do we need it?
      20           0 :     bool operator<(const ClsInfo &rhs) const {return zphibin<rhs.zphibin;}
      21             :     //
      22             :   };
      23             :   typedef struct ClsInfo ClsInfo_t;
      24             :   //
      25             :   struct ClBinInfo  // info on bin clusters start, number of clusters
      26             :   {
      27             :     unsigned short ncl;    // number of clusters
      28             :     unsigned short first;  // entry of 1st cluster in sorted vector of ClsInfo
      29             :     int            index;  // index in the vector containing cells with non-0 occupancy
      30             :   };
      31             :   typedef struct ClBinInfo ClBinInfo_t;
      32             :   //
      33             :   struct ITSDetInfo  // info on sensor
      34             :   {
      35             :     int index; // sensor vid
      36             :     float xTF,xTFmisal,phiTF,sinTF,cosTF; //tracking frame parameters of the detector
      37             :   };
      38             :   typedef struct ITSDetInfo ITSDetInfo_t;
      39             : 
      40             : 
      41             :   AliITSSAPLayer();
      42             :   AliITSSAPLayer(int id, float zspan,int nzbins,int nphibins, int buffer=100);
      43             :   virtual ~AliITSSAPLayer();
      44             :   //
      45           0 :   int     GetVIDOffset()                const {return fVIDOffset;}
      46           0 :   int     GetNClusters()                const {return fNClusters;}
      47           0 :   int     GetNZBins()                   const {return fNZBins;}
      48           0 :   int     GetNPhiBins()                 const {return fNPhiBins;}
      49           0 :   float   GetZMin()                     const {return fZMin;}
      50           0 :   float   GetZMax()                     const {return fZMax;}
      51             :   //
      52           0 :   void    SetNZBins(int v)                    {fNZBins = v;}
      53           0 :   void    SetNPhiBins(int v)                  {fNPhiBins = v;}
      54           0 :   void    SetZMin(float v)                    {fZMin = v;}
      55           0 :   void    SetZMax(float v)                    {fZMax = v;}
      56             :   //
      57             :   void Init(int buffer=100);
      58             :   //
      59           0 :   void AddCluster(AliITSRecPoint *cl)         {fClusters->AddAtAndExpand(cl,fNClusters++);}
      60             :   //
      61             :   void SortClusters(const AliVertex* vtx=0);
      62           0 :   int  GetPhiBin(float phi)             const {return phi*fDPhiInv;}
      63           0 :   int  GetZBin  (float z)               const {return (z-fZMin)*fDZInv;}
      64           0 :   int  GetBinIndex(int iz, int iphi)    const {return iphi*fNZBins + iz;}
      65           0 :   int  GetBinZ(int ipz)                 const {return ipz%fNZBins;}
      66           0 :   int  GetBinPhi(int ipz)               const {return ipz/fNZBins;}
      67           0 :   void GetBinZPhi(int ipz,int &iz,int &iphi) const {iz = GetBinZ(ipz); iphi=GetBinPhi(ipz);}
      68             :   //
      69             :   int  SelectClusters(float zmin,float zmax,float phimin,float phimax);
      70           0 :   int  GetNFoundBins()                  const {return fFoundBins.size();}
      71           0 :   int  GetFoundBin(int i)               const {return fFoundBins[i];}
      72             :   int  GetFoundBinClusters(int i, int &first)  const;
      73             :   void ResetFoundIterator();
      74           0 :   AliITSSAPLayer::ClsInfo_t* GetClusterInfo(int i) const {return (AliITSSAPLayer::ClsInfo_t*)&fSortedClInfo[i];}
      75             :   AliITSSAPLayer::ClsInfo_t* GetNextClusterInfo();
      76             :   int                     GetNextClusterInfoID();
      77             :   AliITSRecPoint*         GetNextCluster();
      78           0 :   AliITSRecPoint*         GetClusterSorted(int i)   const {return (AliITSRecPoint*)fClusters->UncheckedAt(fSortedClInfo[i].index);}
      79           0 :   AliITSRecPoint*         GetClusterUnSorted(int i) const {return (AliITSRecPoint*)fClusters->UncheckedAt(i);}
      80             :   //
      81           0 :   AliITSSAPLayer::ITSDetInfo_t& GetDetInfo(int id)     const {return (ITSDetInfo_t&)fDetectors[id];}
      82           0 :   Int_t                   GetNDetectors()           const {return fDetectors.size();}
      83             : 
      84             :   void         ClearSortedInfo();
      85             :   virtual void Clear(Option_t *opt="");
      86             :   virtual void Print(Option_t *opt="")  const;
      87             : 
      88             :  private:
      89             :   AliITSSAPLayer(const AliITSSAPLayer&);
      90             :   AliITSSAPLayer& operator=(const AliITSSAPLayer&);
      91             :   //
      92             :  protected:
      93             :   TObjArray* fClusters;       // externally supplied clusters
      94             :   int   fLrID;                // layer id
      95             :   int   fVIDOffset;           // offset of VID for detectors of this layer
      96             :   int   fNClusters;           // N clusters
      97             :   //
      98             :   float fZMin;                // Zmin
      99             :   float fZMax;                // Zmax
     100             :   float fDZInv;               // inverse size of Z bin
     101             :   float fDPhiInv;             // inverse size of Phi bin
     102             :   int   fNZBins;             // N cells in Z
     103             :   int   fNPhiBins;           // N cells in Phi
     104             :   //
     105             :   int   fQueryZBmin;         // min bin in Z of the query
     106             :   int   fQueryZBmax;         // max bin in Z of the query
     107             :   int   fQueryPhiBmin;       // min bin in phi of the query
     108             :   int   fQueryPhiBmax;       // max bin in phi of the query
     109             :   ClBinInfo_t* fBins;           // 2D (z,phi) grid of clusters binned in z,phi
     110             :   int* fOccBins;              // id's of bins with non-0 occupancy
     111             :   int  fNOccBins;             // number of occupied bins
     112             :   int  fNFoundClusters;       // number of found clusters in the query zone
     113             :   int  fFoundClusterIterator; // at which cluster within the bin we are?
     114             :   int  fFoundBinIterator;     // at which foune bin we are?
     115             :   std::vector<int>     fFoundBins;    // occupied bins satisfying to query
     116             :   std::vector<ClsInfo_t> fSortedClInfo; // processed cluster info
     117             :   std::vector<ITSDetInfo_t> fDetectors; // detector params
     118             :   //
     119             : };
     120             : 
     121             : //_____________________________________________________ 
     122             : inline int AliITSSAPLayer::GetFoundBinClusters(int i, int &first)  const {
     123             :   // set the entry of the first cl.info in the fSortedClInfo 
     124             :   // and return n clusters in the bin
     125           0 :   ClBinInfo_t& bin=fBins[GetFoundBin(i)];
     126           0 :   first = bin.first;
     127           0 :   return bin.ncl;
     128             : }
     129             : 
     130             : //_____________________________________________________ 
     131             : inline AliITSRecPoint* AliITSSAPLayer::GetNextCluster() {
     132             :   // return next cluster
     133           0 :   ClsInfo_t* cli=GetNextClusterInfo(); 
     134           0 :   return cli ? (AliITSRecPoint*)fClusters->UncheckedAt(cli->index) : 0;
     135             : }
     136             : 
     137             : //_____________________________________________________________
     138             : inline AliITSSAPLayer::ClsInfo_t* AliITSSAPLayer::GetNextClusterInfo()
     139             : {
     140             :   // return cluster info for next matching cluster
     141           0 :   int id = GetNextClusterInfoID();
     142           0 :   return id<0 ? 0 : (AliITSSAPLayer::ClsInfo_t*)&fSortedClInfo[id];
     143             : }
     144             : 
     145             : #endif

Generated by: LCOV version 1.11