]>
Commit | Line | Data |
---|---|---|
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 | ||
20 | class AliVertex; | |
21 | ||
22 | class AliITSUCATrackingStation | |
23 | { | |
24 | ||
25 | public: | |
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 | ||
105 | protected: | |
106 | TClonesArray* fClusters; // externally supplied clusters | |
107 | AliITSURecoLayer* fLayer; // layer id | |
108 | int fVIDOffset; // offset of VID for detectors of this layer | |
109 | int fNClusters; // N clusters | |
110 | // | |
111 | float fZMin; // Zmin | |
112 | float fZMax; // Zmax | |
113 | float fDZInv; // inverse size of Z bin | |
114 | float fDPhiInv; // inverse size of Phi bin | |
115 | int fNZBins; // N cells in Z | |
116 | int fNPhiBins; // N cells in Phi | |
117 | // | |
118 | int fQueryZBmin; // min bin in Z of the query | |
119 | int fQueryZBmax; // max bin in Z of the query | |
120 | int fQueryPhiBmin; // min bin in phi of the query | |
121 | int fQueryPhiBmax; // max bin in phi of the query | |
122 | ClBinInfo_t* fBins; // 2D (z,phi) grid of clusters binned in z,phi | |
123 | int* fOccBins; // id's of bins with non-0 occupancy | |
124 | int fNOccBins; // number of occupied bins | |
125 | int fNFoundClusters; // number of found clusters in the query zone | |
126 | int fFoundClusterIterator; // at which cluster within the bin we are? | |
127 | int fFoundBinIterator; // at which foune bin we are? | |
128 | std::vector<int> fIndex; | |
129 | std::vector<int> fFoundBins; // occupied bins satisfying to query | |
130 | std::vector<ClsInfo_t> fSortedClInfo; // processed cluster info | |
131 | std::vector<ITSDetInfo_t> fDetectors; // detector params | |
132 | // | |
133 | }; | |
134 | ||
135 | //_____________________________________________________ | |
136 | inline int AliITSUCATrackingStation::GetFoundBinClusters(int i, int &first) const { | |
137 | // set the entry of the first cl.info in the fSortedClInfo | |
138 | // and return n clusters in the bin | |
139 | ClBinInfo_t& bin = fBins[GetFoundBin(i)]; | |
140 | first = bin.first; | |
141 | return bin.ncl; | |
142 | } | |
143 | ||
144 | //_____________________________________________________ | |
145 | inline AliITSUClusterPix* AliITSUCATrackingStation::GetNextCluster() { | |
146 | // return next cluster | |
147 | ClsInfo_t* cli = GetNextClusterInfo(); | |
148 | return cli ? (AliITSUClusterPix*)fClusters->UncheckedAt(cli->index) : 0; | |
149 | } | |
150 | ||
151 | //_____________________________________________________________ | |
152 | inline AliITSUCATrackingStation::ClsInfo_t* AliITSUCATrackingStation::GetNextClusterInfo() | |
153 | { | |
154 | // return cluster info for next matching cluster | |
155 | int id = GetNextClusterInfoID(); | |
156 | return id < 0 ? 0 : (AliITSUCATrackingStation::ClsInfo_t*)&fSortedClInfo[id]; | |
157 | } | |
158 | ||
159 | #endif |