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