HYDRA_development_version
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
hmetamatch2.cc
Go to the documentation of this file.
1 //*-- Author : Anar Rustamov
2 //*-- Modified : 24/11/2004 by V. Pechenov
3 //*-- Modified : 02/12/2004 by V. Pechenov
4 
5 ///////////////////////////////////////////////////////////////////////////
6 //
7 // HMetaMatch2
8 //
9 // Keep indexes of hits for one track, matching qualities, and
10 // indexes of track objects (HSplineTrack, HKickTrackB,...).
11 //
12 // Indexis of hits:
13 // trkCandInd - index of HTrkCand object
14 // ----------- System=0 -----------------
15 // rpcClstInd; - index of HRpcCluster object
16 // showerHitInd - index of HShowerHit object
17 // ----------- System=1 -----------------
18 // tofHitInd - index of HTofHit or HTofCluster object
19 // ----------- RICH -----------------
20 // richInd[RICH_TAB_SIZE] - arr.of indexes of HRichHit objects
21 // richIPUInd[RICH_TAB_SIZE] - arr.of indexes of HRichHitIPU objects
22 //
23 // Arrais richInd and richIPUInd are sorted by matching quality
24 // and can keep up to 3 ring indexes.
25 //
26 // Quality MDC SHOWER matching:
27 // Xs,Ys - shower hit position in coordinate system of shower module
28 // dXs,dYs - hit position errors (== HShowerHit::getSigmaX(), getSigmaY())
29 // Xm,Ym - mdc segment cross point with shower module in coordinate system
30 // of corresponding shower module
31 // showerSigmaXOffset & showerSigmaYOffset - from HMetaMatchPar cont.
32 // showerSigmaXMdc & showerSigmaYMdc - from HMetaMatchPar cont.
33 // qualityShower =
34 // sqrt[((Xs - Xm - showerSigmaXOffset)/sqrt(dXs^2 + showerSigmaXMdc^2))^2 +
35 // ((Ys - Ym - showerSigmaYOffset)/sqrt(dYs^2 + showerSigmaYMdc^2))^2]
36 //
37 // Tof:
38 // Xt,Yt - toh hit (or tof cluster position in coordinate system of tof module
39 // Xm,Ym - mdc segment cross point with tof module in coordinate system
40 // of corresponding tof module
41 // tofSigmaXOffset, tofSigmaYOffset - from HMetaMatchPar cont.
42 // tofSigmaX, tofSigmaY - from HMetaMatchPar cont.
43 // qualityTof = sqrt[ ((Xt - Xm - tofSigmaXOffset)/tofSigmaX)^2 +
44 // ((Yt - Ym - tofSigmaYOffset)/tofSigmaY)^2 ]
45 //
46 ///////////////////////////////////////////////////////////////////////////
47 
48 #include "hmetamatch2.h"
49 #include "TMath.h"
50 #include "TBuffer.h"
51 
52 using namespace std;
53 
55  sector = -1;
56  trkCandInd = -1;
57  ownIndex = -1;
58  setDefForRest();
59 }
60 
61 HMetaMatch2::HMetaMatch2(Short_t sec, Int_t tkInd, Int_t ind) {
62  sector = sec;
63  trkCandInd = tkInd;
64  ownIndex = ind;
65  setDefForRest();
66 }
67 
69  nRichId = 0;
70  nRichIPUId = 0;
71  nRpcClust = 0;
72  nShrHits = 0;
73  nTofHits = 0;
74 
75  for(Int_t i = 0; i < META_TAB_SIZE; i++) {
76  rpcClstInd[i] = -1;
77  shrHitInd[i] = -1;
78  tofClstInd[i] = -1;
79  tofHit1Ind[i] = -1;
80  tofHit2Ind[i] = -1;
81 
82  rpcQuality[i] = 0.f;
83  rpcDX[i] = 0.f;
84  rpcDY[i] = 0.f;
85 
86  shrQuality[i] = 0.f;
87  shrDX[i] = 0.f;
88  shrDY[i] = 0.f;
89 
90  tofClstQuality[i] = 0.f;
91  tofClstDX[i] = 0.f;
92  tofClstDY[i] = 0.f;
93 
94  tofHit1Quality[i] = 0.f;
95  tofHit1DX[i] = 0.f;
96  tofHit1DY[i] = 0.f;
97 
98  tofHit2Quality[i] = 0.f;
99  tofHit2DX[i] = 0.f;
100  tofHit2DY[i] = 0.f;
101 
102 
103  rkIndShower[i] = -1;
104  rkIndTofCl[i] = -1;
105  rkIndTof1[i] = -1;
106  rkIndTof2[i] = -1;
107  rkIndRpc[i] = -1;
108 
109  kfIndShower[i] = -1;
110  kfIndTofCl[i] = -1;
111  kfIndTof1[i] = -1;
112  kfIndTof2[i] = -1;
113  kfIndRpc[i] = -1;
114 
115  emcPath[i] = -1;
116  }
117 
118  rungeKuttaInd = -1;
119 
120  for(Int_t i = 0; i < RICH_TAB_SIZE; i++) {
121  richInd[i] = -1;
122  richIPUInd[i] = -1;
123  }
124 
125  splineInd = -1;
126  //rungeKuttaInd = -1;
127  kalmanFilterInd = -1;
128  flag = 0;
129 
130  isFakeInner =kFALSE;
131  isFakeOuter =kFALSE;
132 
133 }
134 
135 void HMetaMatch2::setRpcClst(UChar_t el,Short_t ind,Float_t ql,Float_t dx,Float_t dy) {
136  if(el>nRpcClust) return;
137  rpcClstInd[el] = ind;
138  rpcQuality[el] = ql;
139  rpcDX[el] = dx;
140  rpcDY[el] = dy;
141 }
142 
143 void HMetaMatch2::setShrHit(UChar_t el,Short_t ind,Float_t ql,Float_t dx,Float_t dy) {
144  if(el>nShrHits) return;
145  shrHitInd[el] = ind;
146  shrQuality[el] = ql;
147  shrDX[el] = dx;
148  shrDY[el] = dy;
149 }
150 
151 void HMetaMatch2::setTofClst(UChar_t el,Short_t ind,Float_t ql,Float_t dx,Float_t dy) {
152  if(el>nTofHits) return;
153  tofClstInd[el] = ind;
154  tofClstQuality[el] = ql;
155  tofClstDX[el] = dx;
156  tofClstDY[el] = dy;
157 }
158 
159 void HMetaMatch2::setTofHit1(UChar_t el,Short_t ind,Float_t ql,Float_t dx,Float_t dy) {
160  if(el>nTofHits) return;
161  tofHit1Ind[el] = ind;
162  tofHit1Quality[el] = ql;
163  tofHit1DX[el] = dx;
164  tofHit1DY[el] = dy;
165 }
166 
167 void HMetaMatch2::setTofHit2(UChar_t el,Short_t ind,Float_t ql,Float_t dx,Float_t dy) {
168  if(el>nTofHits) return;
169  tofHit2Ind[el] = ind;
170  tofHit2Quality[el] = ql;
171  tofHit2DX[el] = dx;
172  tofHit2DY[el] = dy;
173 }
174 
175 void HMetaMatch2::setRpcClstMMF(UChar_t nln,Short_t ind[],Float_t ql2[][3]) {
176  // Filling function for HMetaMatchF2 class
177  nRpcClust = nln<=META_TAB_SIZE ? nln : META_TAB_SIZE;
178  for(UChar_t l=0;l<nRpcClust;l++) {
179  rpcClstInd[l] = ind[l];
180  rpcQuality[l] = TMath::Sqrt(ql2[l][0]);
181  rpcDX[l] = ql2[l][1];
182  rpcDY[l] = ql2[l][2];
183  }
184 }
185 
186 void HMetaMatch2::setShrHitMMF(UChar_t nln,Short_t ind[],Float_t ql2[][3]) {
187  // Filling function for HMetaMatchF2 class
188  nShrHits = nln<=META_TAB_SIZE ? nln : META_TAB_SIZE;
189  for(UChar_t l=0;l<nShrHits;l++) {
190  shrHitInd[l] = ind[l];
191  shrQuality[l] = TMath::Sqrt(ql2[l][0]);
192  shrDX[l] = ql2[l][1];
193  shrDY[l] = ql2[l][2];
194  }
195 }
196 
197 void HMetaMatch2::setEmcClstMMF(UChar_t nln,Short_t ind[],Float_t ql2[][4]) {
198  // Filling function for HMetaMatchF2 class
199  setEmcClusterFlag();
200  nShrHits = nln<=META_TAB_SIZE ? nln : META_TAB_SIZE;
201  for(UChar_t l=0;l<nShrHits;l++) {
202  shrHitInd[l] = ind[l];
203  shrQuality[l] = TMath::Sqrt(ql2[l][0]);
204  shrDX[l] = ql2[l][1];
205  shrDY[l] = ql2[l][2];
206  emcPath[l] = ql2[l][3];
207  }
208 }
209 
210 void HMetaMatch2::setTofClstMMF(UChar_t nln,Short_t ind[][3],Float_t ql2[][9]) {
211  // Filling function for HMetaMatchF2 class
212  nTofHits = nln<=META_TAB_SIZE ? nln : META_TAB_SIZE;
213  for(UChar_t l=0;l<nTofHits;l++) {
214  tofClstInd[l] = ind[l][0];
215  tofHit1Ind[l] = ind[l][1];
216  tofHit2Ind[l] = ind[l][2];
217 
218  tofClstQuality[l] = TMath::Sqrt(ql2[l][0]);
219  tofClstDX[l] = ql2[l][1];
220  tofClstDY[l] = ql2[l][2];
221  tofHit1Quality[l] = TMath::Sqrt(ql2[l][3]);
222  tofHit1DX[l] = ql2[l][4];
223  tofHit1DY[l] = ql2[l][5];
224  tofHit2Quality[l] = TMath::Sqrt(ql2[l][6]);
225  tofHit2DX[l] = ql2[l][7];
226  tofHit2DY[l] = ql2[l][8];
227  }
228 }
229 
230 
231 
232 //void HMetaMatch2::setRungeKuttaInd(Int_t rktr) {
233 // rungeKuttaInd=rktr;
234 // if(rungeKuttaInd>=0) setRungeKuttaAccept();
235 // else unsetRungeKuttaAccept();
236 //}
237 
238 
239 Int_t HMetaMatch2::getSystem(void) const {
240  // Return -1 - no meta m., 0 - rpc,shower, 1 - tof, 2-overlap rpc-tof
241  Int_t sys = nRpcClust>0 || nShrHits>0 ? 1 : 0;
242  if(nTofHits>0) sys |= 2;
243  return sys-1;
244 }
245 
246 void HMetaMatch2::print(void) {
247  printf("HMetaMatch2: %i sector, index of trkCand=%i [index(quality)]\n",sector+1,trkCandInd);
248  if(nRpcClust>0) {
249  printf(" HRpcCluster's:");
250  for(UChar_t n=0;n<nRpcClust;n++) {
251  if(rpcClstInd[n]>=0) printf(" %i(%.3g)",rpcClstInd[n],rpcQuality[n]);
252  }
253  printf("\n");
254  }
255  if(nShrHits>0) {
256  printf(" HShowerHit's:");
257  for(UChar_t n=0;n<nShrHits;n++) {
258  if(shrHitInd[n]>=0) printf(" %i(%.3g)",shrHitInd[n],shrQuality[n]);
259  }
260  printf("\n");
261  }
262 
263  if(nTofHits>0) {
264  for(UChar_t n=0;n<nTofHits;n++) {
265  if(tofClstInd[n]>=0) {
266  printf(" HTofCluster: %i(%.3g)",tofClstInd[n],tofClstQuality[n]);
267  if(tofHit1Ind[n]>=0) printf("/Hit1=%i(%.3g)",tofHit1Ind[n],tofHit1Quality[n]);
268  if(tofHit2Ind[n]>=0) printf("/Hit2=%i(%.3g)",tofHit2Ind[n],tofHit2Quality[n]);
269  printf("\n");
270  } else {
271  if(tofHit1Ind[n]>=0) printf(" HTofHit1: %i(%.3g)",tofHit1Ind[n],tofHit1Quality[n]);
272  if(tofHit2Ind[n]>=0) printf(" HTofHit2: %i(%.3g)",tofHit2Ind[n],tofHit2Quality[n]);
273  printf("\n");
274  }
275  }
276  }
277  if(nRichId>0) {
278  printf(" richHitInd =");
279  for(UChar_t n=0;n<nRichId;n++) printf(" %i",richInd[n]);
280  printf("\n");
281  }
282  if(nRichIPUId>0) {
283  printf(" richHitIPUInd =");
284  for(UChar_t n=0;n<nRichIPUId;n++) printf(" %i",richIPUInd[n]);
285  printf("\n");
286  }
287  if(splineInd>=0 || rungeKuttaInd>=0 || kalmanFilterInd>=0) {
288  printf(" Tracks:");
289  if(splineInd>=0) printf(" splineInd=%i",splineInd);
290  if(rungeKuttaInd>=0) printf(" rungeKuttaInd=%i",rungeKuttaInd);
291  if(kalmanFilterInd>=0) printf(" kalmanFilterInd=%i", kalmanFilterInd);
292  printf("\n");
293  } else printf(" No accepted tracks!\n");
294 }
295 void HMetaMatch2::Streamer(TBuffer &R__b)
296 {
297  // Stream an object of class HMetaMatch2.
298 
299  UInt_t R__s, R__c;
300  if (R__b.IsReading()) {
301  Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
302  TObject::Streamer(R__b);
303  R__b >> trkCandInd;
304  R__b >> ownIndex;
305  R__b >> sector;
306  R__b >> nRpcClust;
307  R__b >> nShrHits;
308  R__b >> nTofHits;
309  R__b >> rungeKuttaInd;
310  R__b.ReadStaticArray((short*)rkIndShower);
311  R__b.ReadStaticArray((short*)rkIndTofCl);
312  R__b.ReadStaticArray((short*)rkIndTof1);
313  R__b.ReadStaticArray((short*)rkIndTof2);
314  R__b.ReadStaticArray((short*)rkIndRpc);
315  R__b >> kalmanFilterInd;
316  R__b.ReadStaticArray((short*)kfIndShower);
317  R__b.ReadStaticArray((short*)kfIndTofCl);
318  R__b.ReadStaticArray((short*)kfIndTof1);
319  R__b.ReadStaticArray((short*)kfIndTof2);
320  R__b.ReadStaticArray((short*)kfIndRpc);
321  R__b.ReadStaticArray((short*)rpcClstInd);
322  R__b.ReadStaticArray((short*)shrHitInd);
323  R__b.ReadStaticArray((short*)tofClstInd);
324  R__b.ReadStaticArray((short*)tofHit1Ind);
325  R__b.ReadStaticArray((short*)tofHit2Ind);
326  R__b.ReadStaticArray((float*)rpcQuality);
327  R__b.ReadStaticArray((float*)rpcDX);
328  R__b.ReadStaticArray((float*)rpcDY);
329  R__b.ReadStaticArray((float*)shrQuality);
330  R__b.ReadStaticArray((float*)shrDX);
331  R__b.ReadStaticArray((float*)shrDY);
332  if(R__v>2) R__b.ReadStaticArray((float*)emcPath);
333  R__b.ReadStaticArray((float*)tofClstQuality);
334  R__b.ReadStaticArray((float*)tofClstDX);
335  R__b.ReadStaticArray((float*)tofClstDY);
336  R__b.ReadStaticArray((float*)tofHit1Quality);
337  R__b.ReadStaticArray((float*)tofHit1DX);
338  R__b.ReadStaticArray((float*)tofHit1DY);
339  R__b.ReadStaticArray((float*)tofHit2Quality);
340  R__b.ReadStaticArray((float*)tofHit2DX);
341  R__b.ReadStaticArray((float*)tofHit2DY);
342  R__b >> splineInd;
343  R__b >> nRichId;
344  R__b >> nRichIPUId;
345  R__b.ReadStaticArray((int*)richInd);
346  R__b.ReadStaticArray((int*)richIPUInd);
347  R__b >> flag;
348  R__b >> isFakeInner;
349  R__b >> isFakeOuter;
350  R__b.CheckByteCount(R__s, R__c, HMetaMatch2::IsA());
351  } else {
352  R__c = R__b.WriteVersion(HMetaMatch2::IsA(), kTRUE);
353  TObject::Streamer(R__b);
354  R__b << trkCandInd;
355  R__b << ownIndex;
356  R__b << sector;
357  R__b << nRpcClust;
358  R__b << nShrHits;
359  R__b << nTofHits;
360  R__b << rungeKuttaInd;
361  R__b.WriteArray(rkIndShower, 3);
362  R__b.WriteArray(rkIndTofCl, 3);
363  R__b.WriteArray(rkIndTof1, 3);
364  R__b.WriteArray(rkIndTof2, 3);
365  R__b.WriteArray(rkIndRpc, 3);
366  R__b << kalmanFilterInd;
367  R__b.WriteArray(kfIndShower, 3);
368  R__b.WriteArray(kfIndTofCl, 3);
369  R__b.WriteArray(kfIndTof1, 3);
370  R__b.WriteArray(kfIndTof2, 3);
371  R__b.WriteArray(kfIndRpc, 3);
372  R__b.WriteArray(rpcClstInd, 3);
373  R__b.WriteArray(shrHitInd, 3);
374  R__b.WriteArray(tofClstInd, 3);
375  R__b.WriteArray(tofHit1Ind, 3);
376  R__b.WriteArray(tofHit2Ind, 3);
377  R__b.WriteArray(rpcQuality, 3);
378  R__b.WriteArray(rpcDX, 3);
379  R__b.WriteArray(rpcDY, 3);
380  R__b.WriteArray(shrQuality, 3);
381  R__b.WriteArray(shrDX, 3);
382  R__b.WriteArray(shrDY, 3);
383  R__b.WriteArray(emcPath, 3);
384  R__b.WriteArray(tofClstQuality, 3);
385  R__b.WriteArray(tofClstDX, 3);
386  R__b.WriteArray(tofClstDY, 3);
387  R__b.WriteArray(tofHit1Quality, 3);
388  R__b.WriteArray(tofHit1DX, 3);
389  R__b.WriteArray(tofHit1DY, 3);
390  R__b.WriteArray(tofHit2Quality, 3);
391  R__b.WriteArray(tofHit2DX, 3);
392  R__b.WriteArray(tofHit2DY, 3);
393  R__b << splineInd;
394  R__b << nRichId;
395  R__b << nRichIPUId;
396  R__b.WriteArray(richInd, 3);
397  R__b.WriteArray(richIPUInd, 3);
398  R__b << flag;
399  R__b << isFakeInner;
400  R__b << isFakeOuter;
401  R__b.SetByteCount(R__c, kTRUE);
402  }
403 }
404 
Int_t getSystem(void) const
Definition: hmetamatch2.cc:239
void setRpcClstMMF(UChar_t nln, Short_t ind[], Float_t ql2[][3])
Definition: hmetamatch2.cc:175
#define META_TAB_SIZE
Definition: hmetamatch2.h:8
void setRpcClst(UChar_t el, Short_t ind, Float_t ql, Float_t dx, Float_t dy)
Definition: hmetamatch2.cc:135
void setDefForRest(void)
Definition: hmetamatch2.cc:68
void setEmcClstMMF(UChar_t nln, Short_t ind[], Float_t ql2[][4])
Definition: hmetamatch2.cc:197
Int_t n
ClassImp(HDbColumn) HDbColumn
Definition: hdbcolumn.cc:18
void setTofHit2(UChar_t el, Short_t ind, Float_t ql, Float_t dx, Float_t dy)
Definition: hmetamatch2.cc:167
void print(void)
Definition: hmetamatch2.cc:246
void setShrHit(UChar_t el, Short_t ind, Float_t ql, Float_t dx, Float_t dy)
Definition: hmetamatch2.cc:143
void setTofClstMMF(UChar_t nln, Short_t ind[][3], Float_t ql2[][9])
Definition: hmetamatch2.cc:210
void setTofHit1(UChar_t el, Short_t ind, Float_t ql, Float_t dx, Float_t dy)
Definition: hmetamatch2.cc:159
void setTofClst(UChar_t el, Short_t ind, Float_t ql, Float_t dx, Float_t dy)
Definition: hmetamatch2.cc:151
#define RICH_TAB_SIZE
Definition: hmetamatch2.h:7
void setShrHitMMF(UChar_t nln, Short_t ind[], Float_t ql2[][3])
Definition: hmetamatch2.cc:186