don't sort clusters after local reco, do this in AliITSUTrackerGlo
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSURecoSens.cxx
CommitLineData
a11ef2e4 1#include "AliITSURecoSens.h"
2#include "AliITSUGeomTGeo.h"
3#include "AliITSsegmentation.h"
c61e50c3 4#include "AliExternalTrackParam.h"
68b7631d 5#include "AliITSUAux.h"
6#include "AliLog.h"
7
8using namespace AliITSUAux;
9using namespace TMath;
a11ef2e4 10
11ClassImp(AliITSURecoSens)
12
13//______________________________________________________
14AliITSURecoSens::AliITSURecoSens(Int_t id)
32d38de2 15: fNClusters(0)
16 ,fFirstClusterId(-1)
17 ,fXTF(0)
a11ef2e4 18 ,fPhiTF(0)
19 ,fPhiMin(0)
20 ,fPhiMax(0)
21 ,fZMin(0)
22 ,fZMax(0)
23{
24 // def. c-tor
25 SetID(id);
a11ef2e4 26}
27
28//______________________________________________________
29AliITSURecoSens::AliITSURecoSens(const AliITSURecoSens &source)
30 :TObject(source)
32d38de2 31 ,fNClusters(source.fNClusters)
32 ,fFirstClusterId(source.fFirstClusterId)
a11ef2e4 33 ,fXTF(source.fXTF)
34 ,fPhiTF(source.fPhiTF)
35 ,fPhiMin(source.fPhiMin)
36 ,fPhiMax(source.fPhiMax)
37 ,fZMin(source.fZMin)
38 ,fZMax(source.fZMax)
39{
40 // copy c-tor
a11ef2e4 41}
42
43//______________________________________________________
44AliITSURecoSens& AliITSURecoSens::operator=(const AliITSURecoSens &source)
45{
46 // = operator
47 if (&source==this) return *this;
48 TObject::operator=(source);
32d38de2 49 fNClusters = source.fNClusters;
50 fFirstClusterId = source.fFirstClusterId;
a11ef2e4 51 fXTF = source.fXTF;
52 fPhiTF = source.fPhiTF;
53 fPhiMin = source.fPhiMin;
54 fPhiMax = source.fPhiMax;
55 fZMin = source.fZMin;
56 fZMax = source.fZMax;
57 //
a11ef2e4 58 return *this;
59}
60
61//______________________________________________________
62void AliITSURecoSens::SetBoundaries(double phiMn,double phiMx, double zMn, double zMx)
63{
64 // set phi,z limits
65 fPhiMin = phiMn;
66 fPhiMax = phiMx;
67 fZMin = zMn;
68 fZMax = zMx;
69}
70
71//______________________________________________________
72void AliITSURecoSens::Print(Option_t*) const
73{
74 //print
68b7631d 75 printf("Sensor%4d xTF=%+.3e phiTF=%+.3e | Phi:[%5.3f:%5.3f] Z:[%+7.3f:%+7.3f]\n",
a11ef2e4 76 GetID(),GetXTF(),GetPhiTF(), fPhiMin,fPhiMax, fZMin,fZMax);
a11ef2e4 77}
78
32d38de2 79//______________________________________________________
80void AliITSURecoSens::ResetClusters()
81{
82 // discard old clusters
83 fNClusters = 0;
84 fFirstClusterId = -1;
85}
86
87//______________________________________________________
88void AliITSURecoSens::ProcessClusters(Int_t)
89{
90 // create structures for fast finding
91 //
92 // to do
93}
68b7631d 94
95//______________________________________________________________________________
96Int_t AliITSURecoSens::Compare(const TObject* obj) const
97{
98 // compare sensor positions
99 AliITSURecoSens* copy = (AliITSURecoSens*)obj;
100 double phi = MeanPhiSmall(fPhiMin,fPhiMax);
101 double phiC = MeanPhiSmall(copy->fPhiMin,copy->fPhiMax);
102 double span = DeltaPhiSmall(fPhiMin,fPhiMax)/2;
103 double dPhi = DeltaPhiSmall(phi,phiC);
104 //
105 // special case to well define 1st raw (closest to 0 from above): wrap around 0/2pi
106 if (dPhi>span) return phi<phiC ? -1 : 1;
107 //
108 double phiT = phi+span;
109 BringTo02Pi(phiT);
110 // if (phiT<phiC && OKforPhiMin(phiT,phiC)) return -1;
111 if (OKforPhiMin(phiT,phiC)) return -1;
112 phiT = phi-span;
113 BringTo02Pi(phiT);
114 //if (phiT>phiC && OKforPhiMax( phiT,phiC)) return 1;
115 if (OKforPhiMax( phiT,phiC)) return 1;
116 //
117 // sane phi range, check Z
118 double dz = (fZMax-fZMin)/2;
119 if (fZMax+dz < copy->fZMax) return -1;
120 if (fZMin-dz > copy->fZMin) return 1;
121 AliError(Form("Same chip compared? %d %d",GetID(),copy->GetID()));
122 Print();
123 copy->Print();
124 return 0;
125 //
126}
127
128//______________________________________________________________________________
129Int_t AliITSURecoSens::CheckCoverage(double phi, double z) const
130{
131 // check if the sensor contains the impact point phi, z
132 // if not, tell in which direction to move.
133 // kLeft, kRight are for smaller/larger angles, kUp,kDown for larger/smaller Z
134 //
135 int res = 0;
136 if (z<fZMin) res |= kDown;
137 else if (z>fZMax) res |= kUp;
138 //
139 if (!OKforPhiMin(fPhiMin,phi)) res |= kLeft;
140 else if (!OKforPhiMax(fPhiMax,phi)) res |= kRight;
141 return res;
142}