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