]>
Commit | Line | Data |
---|---|---|
c7ffd78f | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
a5556ea5 | 17 | |
0206ddfb | 18 | /////////////////////////////////////////////////////////////////////////// |
a5556ea5 | 19 | // |
20 | // class AliClusterMap | |
a5556ea5 | 21 | // class that describes cluster occupation at TPC |
22 | // Each padraw has a corresponding bit in fPadRawMap | |
a5556ea5 | 23 | // more info: http://aliweb.cern.ch/people/skowron/analyzer/index.html |
24 | // Piotr.Skowronski@cern.ch | |
25 | // | |
26 | /////////////////////////////////////////////////////////////////////////// | |
27 | ||
c7ffd78f | 28 | #include <TString.h> |
a5556ea5 | 29 | |
c7ffd78f | 30 | #include "AliClusterMap.h" |
a5556ea5 | 31 | #include "AliESDtrack.h" |
c7ffd78f | 32 | #include "AliLog.h" |
a5556ea5 | 33 | #include "AliTPCtrack.h" |
c7ffd78f | 34 | |
0206ddfb | 35 | const Int_t AliClusterMap::fgkNPadRows = 159; |
a5556ea5 | 36 | |
c7ffd78f | 37 | ClassImp(AliClusterMap) |
38 | ||
a5556ea5 | 39 | AliClusterMap::AliClusterMap(): |
0206ddfb | 40 | fPadRawMap(fgkNPadRows) |
a5556ea5 | 41 | { |
42 | //ctor | |
43 | ||
44 | } | |
45 | /***********************************************************************/ | |
46 | AliClusterMap::AliClusterMap(AliESDtrack* track): | |
0206ddfb | 47 | fPadRawMap( (track)?track->GetTPCClusterMap():fgkNPadRows ) |
a5556ea5 | 48 | { |
49 | //ctor | |
50 | ||
c7ffd78f | 51 | StdoutToAliDebug(3,Print()); |
52 | ||
a5556ea5 | 53 | } |
54 | /***********************************************************************/ | |
55 | ||
56 | AliClusterMap::AliClusterMap(AliTPCtrack* track): | |
0206ddfb | 57 | fPadRawMap(fgkNPadRows) |
a5556ea5 | 58 | { |
59 | //ctor | |
60 | ||
c7ffd78f | 61 | AliDebug(10,"#####################################################################"); |
a5556ea5 | 62 | if (track == 0x0) |
63 | { | |
64 | Error("AliClusterMap","Pointer to TPC track is NULL"); | |
65 | return; | |
66 | } | |
67 | Int_t prevrow = -1; | |
68 | Int_t i = 0; | |
69 | for ( ; i < track->GetNumberOfClusters(); i++) | |
70 | { | |
71 | Int_t idx = track->GetClusterIndex(i); | |
72 | Int_t sect = (idx&0xff000000)>>24; | |
73 | Int_t row = (idx&0x00ff0000)>>16; | |
74 | if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors | |
c7ffd78f | 75 | AliDebug(9,Form("Cl.idx is %d, sect %d, row %d",idx,sect,row)); |
a5556ea5 | 76 | |
77 | fPadRawMap.SetBitNumber(row,kTRUE); | |
78 | ||
79 | //Fill the gap between previous row and this row with 0 bits | |
80 | if (prevrow < 0) | |
81 | { | |
82 | prevrow = row;//if previous bit was not assigned yet == this is the first one | |
83 | } | |
84 | else | |
85 | { //we don't know the order (inner to outer or reverse) | |
86 | //just to be save in case it is going to change | |
87 | Int_t n = 0, m = 0; | |
88 | if (prevrow < row) | |
89 | { | |
90 | n = prevrow; | |
91 | m = row; | |
92 | } | |
93 | else | |
94 | { | |
95 | n = row; | |
96 | m = prevrow; | |
97 | } | |
98 | for (Int_t j = n+1; j < m; j++) | |
99 | { | |
100 | fPadRawMap.SetBitNumber(j,kFALSE); | |
101 | } | |
102 | prevrow = row; | |
103 | } | |
104 | } | |
105 | ||
c7ffd78f | 106 | StdoutToAliDebug(3,Print()); |
107 | ||
a5556ea5 | 108 | } |
109 | /***********************************************************************/ | |
110 | ||
111 | void AliClusterMap::Print() const | |
112 | { | |
113 | //Prints the bit map | |
114 | TString msg; | |
0206ddfb | 115 | for ( Int_t i = 0; i < fgkNPadRows; i++) |
a5556ea5 | 116 | { |
117 | if ( fPadRawMap.TestBitNumber(i) ) | |
118 | { | |
119 | msg+="1"; | |
120 | } | |
121 | else | |
122 | { | |
123 | msg+="0"; | |
124 | } | |
125 | } | |
126 | Info("AliClusterMap","BitMap is\n %s",msg.Data()); | |
127 | ||
128 | } | |
129 | ||
130 | /***********************************************************************/ | |
131 | ||
132 | Float_t AliClusterMap::GetOverlapFactor(const AliClusterMap& clmap) const | |
133 | { | |
134 | //Returns quality factor FQ = Sum(An)/Sum(clusters) | |
135 | // | -1; if both tracks have a cluster on padrow n | |
136 | //An = < 0; if neither track has a cluster on padrow n | |
137 | // | 1; if only one trackhas a cluster on padrow n | |
138 | // Returned value ranges between | |
139 | // -0.5 (low probability that these tracks are a split track) | |
140 | // and | |
141 | // 1.0 (high probability that these tracks are a split track) | |
a5556ea5 | 142 | |
143 | Int_t nh = 0; | |
144 | Int_t an = 0; | |
0206ddfb | 145 | for ( Int_t i = 0; i < fgkNPadRows; i++) |
a5556ea5 | 146 | { |
147 | Bool_t x = HasClAtPadRow(i); | |
148 | Bool_t y = clmap.HasClAtPadRow(i); | |
149 | ||
a5556ea5 | 150 | if (x && y)//both have clasters |
151 | { | |
152 | an--; | |
153 | nh+=2; | |
154 | } | |
155 | else | |
156 | { | |
157 | ||
158 | if (x || y)//only one have cluters | |
159 | { | |
160 | an++; | |
161 | nh++; | |
162 | } | |
163 | } | |
164 | } | |
165 | ||
166 | ||
167 | Float_t retval = 0.0; | |
168 | if (nh > 0) retval = ((Float_t)an)/((Float_t)nh); | |
169 | else Warning("GetOverlapFactor","Number of counted cluters is 0."); | |
170 | ||
a5556ea5 | 171 | return retval; |
172 | } |