]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/AliClusterMap.cxx
Adding MUON HLT code to the repository.
[u/mrichter/AliRoot.git] / ANALYSIS / AliClusterMap.cxx
CommitLineData
a5556ea5 1#include "AliClusterMap.h"
2
3//_________________________________________________
4///////////////////////////////////////////////////
5//
6// class AliClusterMap
7//
8// class that describes cluster occupation at TPC
9// Each padraw has a corresponding bit in fPadRawMap
10//
11//
12// more info: http://aliweb.cern.ch/people/skowron/analyzer/index.html
13// Piotr.Skowronski@cern.ch
14//
15///////////////////////////////////////////////////////////////////////////
16
17
18#include "AliESDtrack.h"
19#include "AliTPCtrack.h"
afa8b37b 20#include "AliVAODParticle.h"
a5556ea5 21#include <TString.h>
22const Int_t AliClusterMap::fNPadRows = 159;
23
24AliClusterMap::AliClusterMap():
25 fPadRawMap(fNPadRows)
26{
27//ctor
28
29}
30/***********************************************************************/
31AliClusterMap::AliClusterMap(AliESDtrack* track):
32 fPadRawMap( (track)?track->GetTPCClusterMap():fNPadRows )
33{
34 //ctor
35
afa8b37b 36 if (AliVAODParticle::GetDebug() > 2)
a5556ea5 37 {
38 Info("AliClusterMap(AliESDtrack*)","");
39 Print();
40 }
41}
42/***********************************************************************/
43
44AliClusterMap::AliClusterMap(AliTPCtrack* track):
45 fPadRawMap(fNPadRows)
46{
47 //ctor
48
49 //Does not work since indeces in the claster index array
50 //in the TPC track does not correspond to the padraw segmatation
afa8b37b 51 if (AliVAODParticle::GetDebug() > 9)
a5556ea5 52 Info("AliClusterMap",
53 "#####################################################################");
54 if (track == 0x0)
55 {
56 Error("AliClusterMap","Pointer to TPC track is NULL");
57 return;
58 }
59 Int_t prevrow = -1;
60 Int_t i = 0;
61 for ( ; i < track->GetNumberOfClusters(); i++)
62 {
63 Int_t idx = track->GetClusterIndex(i);
64 Int_t sect = (idx&0xff000000)>>24;
65 Int_t row = (idx&0x00ff0000)>>16;
66 if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors
afa8b37b 67 if (AliVAODParticle::GetDebug() > 9)
a5556ea5 68 Info("AliClusterMap","Cl.idx is %d, sect %d, row %d",idx,sect,row);
69
70 fPadRawMap.SetBitNumber(row,kTRUE);
71
72 //Fill the gap between previous row and this row with 0 bits
73 if (prevrow < 0)
74 {
75 prevrow = row;//if previous bit was not assigned yet == this is the first one
76 }
77 else
78 { //we don't know the order (inner to outer or reverse)
79 //just to be save in case it is going to change
80 Int_t n = 0, m = 0;
81 if (prevrow < row)
82 {
83 n = prevrow;
84 m = row;
85 }
86 else
87 {
88 n = row;
89 m = prevrow;
90 }
91 for (Int_t j = n+1; j < m; j++)
92 {
93 fPadRawMap.SetBitNumber(j,kFALSE);
94 }
95 prevrow = row;
96 }
97 }
98
afa8b37b 99 if (AliVAODParticle::GetDebug() > 2)
a5556ea5 100 {
101 Info("AliClusterMap(AliTPCtrack*)","");
102 Print();
103 }
104}
105/***********************************************************************/
106
107void AliClusterMap::Print() const
108{
109//Prints the bit map
110 TString msg;
111 for ( Int_t i = 0; i < fNPadRows; i++)
112 {
113 if ( fPadRawMap.TestBitNumber(i) )
114 {
115 msg+="1";
116 }
117 else
118 {
119 msg+="0";
120 }
121 }
122 Info("AliClusterMap","BitMap is\n %s",msg.Data());
123
124}
125
126/***********************************************************************/
127
128Float_t AliClusterMap::GetOverlapFactor(const AliClusterMap& clmap) const
129{
130 //Returns quality factor FQ = Sum(An)/Sum(clusters)
131 // | -1; if both tracks have a cluster on padrow n
132 //An = < 0; if neither track has a cluster on padrow n
133 // | 1; if only one trackhas a cluster on padrow n
134 // Returned value ranges between
135 // -0.5 (low probability that these tracks are a split track)
136 // and
137 // 1.0 (high probability that these tracks are a split track)
138 TString msg1;
139 TString msg2;
140
141 Int_t nh = 0;
142 Int_t an = 0;
143 for ( Int_t i = 0; i < fNPadRows; i++)
144 {
145 Bool_t x = HasClAtPadRow(i);
146 Bool_t y = clmap.HasClAtPadRow(i);
147
148 if (x) msg1+="1";else msg1+="0";
149 if (y) msg2+="1";else msg2+="0";
150
151 if (x && y)//both have clasters
152 {
153 an--;
154 nh+=2;
155 }
156 else
157 {
158
159 if (x || y)//only one have cluters
160 {
161 an++;
162 nh++;
163 }
164 }
165 }
166
167
168 Float_t retval = 0.0;
169 if (nh > 0) retval = ((Float_t)an)/((Float_t)nh);
170 else Warning("GetOverlapFactor","Number of counted cluters is 0.");
171
afa8b37b 172 if (AliVAODParticle::GetDebug() > 2)
a5556ea5 173 {
174 Info("GetOverlapFactor","Splitting Quality Factor is %f. SumAn = %d, SumClusters %d",retval,an,nh);
175 if (retval == 1.0)
176 {
177 Print();
178 Info("AliClusterMap","BitMap is\n %s\n",msg1.Data());
179 clmap.Print();
180 Info("AliClusterMap","BitMap is\n %s\n\n\n\n",msg2.Data());
181 }
182 if (retval == -.5)
183 {
184 Print();
185 Info("AliClusterMap","BitMap is\n %s\n",msg1.Data());
186 clmap.Print();
187 Info("AliClusterMap","BitMap is\n %s\n\n\n\n",msg2.Data());
188 }
189 }
190
191 return retval;
192}