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