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