FairRoot/PandaRoot
PndPidCandidate.cxx
Go to the documentation of this file.
1 // //
3 // PndPidCandidate //
4 // //
5 // Definition of the Panda pid candidate. //
6 // //
7 // Author: Klaus Goetzen, GSI, 12.06.08 //
8 // Copyright (C) 2008, GSI Darmstadt. //
9 // //
11 
12 #include "PndPidCandidate.h"
13 
14 //class VAbsPidInfo;
15 
16 // ========================================================================
17 // ===== PndPidCandidate - Class definig the AOD interface ====
18 // ========================================================================
19 
21  fLocked(kFALSE),
22  fCharge(0),
23  fXposition(0.),
24  fYposition(0.),
25  fZposition(0.),
26  fXmomentum(0.),
27  fYmomentum(0.),
28  fZmomentum(0.),
29  fEnergy(0.),
30  fFirstHitX(0.),
31  fFirstHitY(0.),
32  fFirstHitZ(0.),
33  fLastHitX(0.),
34  fLastHitY(0.),
35  fLastHitZ(0.),
36  fMcIndex(-1),
37  fTrackIndex(-1),
38  fTrackBranch(-1),
39  fMvdDEDX(0.),
40  fMvdHits(0),
41  fSttMeanDEDX(0.),
42  fSttHits(0),
43  fGemHits(0),
44  fTofStopTime(0.),
45  fTofM2(0.),
46  fTofTrackLength(0.),
47  fTofQuality(-1.),
48  fTofIndex(-1),
49  fDrcThetaC(0.),
50  fDrcThetaCErr(0.),
51  fDrcQuality(-1.),
52  fDrcNumberOfPhotons(0),
53  fDrcIndex(-1),
54  fDiscThetaC(0.),
55  fDiscThetaCErr(0.),
56  fDiscQuality(-1.),
57  fDiscNumberOfPhotons(0),
58  fDiscIndex(-1),
59  fRichThetaC(0.),
60  fRichThetaCErr(0.),
61  fRichQuality(-1.),
62  fRichNumberOfPhotons(0),
63  fRichIndex(-1),
64  fEmcRawEnergy(0.),
65  fEmcCalEnergy(0.),
66  fEmcQuality(-1.),
67  fEmcTimeStamp(0.),
68  fEmcNumberOfCrystals(0),
69  fEmcNumberOfBumps(0),
70  fEmcModule(-1),
71  fEmcIndex(-1),
72  fEmcZ20(0.),
73  fEmcZ53(0.),
74  fEmcLat(0.),
75  fEmcE1 (0.),
76  fEmcE9 (0.),
77  fEmcE25(0.),
78  fMuoNumberOfLayers(0),
79  fMuoProbability(0.),
80  fMuoQuality(-1.),
81  fMuoIron(0.),
82  fMuoMomentumIn(0.),
83  fMuoModule(0),
84  fMuoHits(0),
85  fMuoIndex(-1),
86  fDegreesOfFreedom(0),
87  fFitStatus(-1),
88  fChiSquared(0.),
89  fPidHyp(0)
90 
91 {
92  SetDefault();
93 }
94 
95 PndPidCandidate::PndPidCandidate(Int_t charge, TVector3 &pos, TLorentzVector &p4, TMatrixD &cov7 ) :
96  fLocked(kFALSE),
97  fCharge(0),
98  fXposition(0.),
99  fYposition(0.),
100  fZposition(0.),
101  fXmomentum(0.),
102  fYmomentum(0.),
103  fZmomentum(0.),
104  fEnergy(0.),
105  fFirstHitX(0.),
106  fFirstHitY(0.),
107  fFirstHitZ(0.),
108  fLastHitX(0.),
109  fLastHitY(0.),
110  fLastHitZ(0.),
111  fMcIndex(-1),
112  fTrackIndex(-1),
113  fTrackBranch(-1),
114  fMvdDEDX(0.),
115  fMvdHits(0),
116  fSttMeanDEDX(0.),
117  fSttHits(0),
118  fGemHits(0),
119  fTofStopTime(0.),
120  fTofM2(0.),
121  fTofTrackLength(0.),
122  fTofQuality(-1.),
123  fTofIndex(-1),
124  fDrcThetaC(0.),
125  fDrcThetaCErr(0.),
126  fDrcQuality(-1.),
127  fDrcNumberOfPhotons(0),
128  fDrcIndex(-1),
129  fDiscThetaC(0.),
130  fDiscThetaCErr(0.),
131  fDiscQuality(-1.),
132  fDiscNumberOfPhotons(0),
133  fDiscIndex(-1),
134  fRichThetaC(0.),
135  fRichThetaCErr(0.),
136  fRichQuality(-1.),
137  fRichNumberOfPhotons(0),
138  fRichIndex(-1),
139  fEmcRawEnergy(0.),
140  fEmcCalEnergy(0.),
141  fEmcQuality(-1.),
142  fEmcTimeStamp(0.),
143  fEmcNumberOfCrystals(0),
144  fEmcNumberOfBumps(0),
145  fEmcModule(-1),
146  fEmcIndex(-1),
147  fEmcZ20(0.),
148  fEmcZ53(0.),
149  fEmcLat(0.),
150  fEmcE1 (0.),
151  fEmcE9 (0.),
152  fEmcE25(0.),
153  fMuoNumberOfLayers(0),
154  fMuoProbability(0.),
155  fMuoQuality(-1.),
156  fMuoIron(0.),
157  fMuoMomentumIn(0.),
158  fMuoModule(0),
159  fMuoHits(0),
160  fMuoIndex(-1),
161  fDegreesOfFreedom(0),
162  fFitStatus(-1),
163  fChiSquared(0.),
164  fPidHyp(0)
165 {
166  SetDefault();
167  SetPosition(pos);
168  SetLorentzVector(p4);
169  SetCov7(cov7);
170  SetCharge(charge);
171 }
172 
173 PndPidCandidate::PndPidCandidate(Int_t charge, TVector3 &pos, TLorentzVector &p4) :
174  fLocked(kFALSE),
175  fCharge(0),
176  fXposition(0.),
177  fYposition(0.),
178  fZposition(0.),
179  fXmomentum(0.),
180  fYmomentum(0.),
181  fZmomentum(0.),
182  fEnergy(0.),
183  fFirstHitX(0.),
184  fFirstHitY(0.),
185  fFirstHitZ(0.),
186  fLastHitX(0.),
187  fLastHitY(0.),
188  fLastHitZ(0.),
189  fMcIndex(-1),
190  fTrackIndex(-1),
191  fTrackBranch(-1),
192  fMvdDEDX(0.),
193  fMvdHits(0),
194  fSttMeanDEDX(0.),
195  fSttHits(0),
196  fGemHits(0),
197  fTofStopTime(0.),
198  fTofM2(0.),
199  fTofTrackLength(0.),
200  fTofQuality(-1.),
201  fTofIndex(-1),
202  fDrcThetaC(0.),
203  fDrcThetaCErr(0.),
204  fDrcQuality(-1.),
205  fDrcNumberOfPhotons(0),
206  fDrcIndex(-1),
207  fDiscThetaC(0.),
208  fDiscThetaCErr(0.),
209  fDiscQuality(-1.),
210  fDiscNumberOfPhotons(0),
211  fDiscIndex(-1),
212  fRichThetaC(0.),
213  fRichThetaCErr(0.),
214  fRichQuality(-1.),
215  fRichNumberOfPhotons(0),
216  fRichIndex(-1),
217  fEmcRawEnergy(0.),
218  fEmcCalEnergy(0.),
219  fEmcQuality(-1.),
220  fEmcTimeStamp(0.),
221  fEmcNumberOfCrystals(0),
222  fEmcNumberOfBumps(0),
223  fEmcModule(-1),
224  fEmcIndex(-1),
225  fEmcZ20(0.),
226  fEmcZ53(0.),
227  fEmcLat(0.),
228  fEmcE1 (0.),
229  fEmcE9 (0.),
230  fEmcE25(0.),
231  fMuoNumberOfLayers(0),
232  fMuoProbability(0.),
233  fMuoQuality(-1.),
234  fMuoIron(0.),
235  fMuoMomentumIn(0.),
236  fMuoModule(0),
237  fMuoHits(0),
238  fMuoIndex(-1),
239  fDegreesOfFreedom(0),
240  fFitStatus(-1),
241  fChiSquared(0.),
242  fPidHyp(0)
243 {
244  SetDefault();
245  SetPosition(pos);
246  SetLorentzVector(p4);
247  SetCharge(charge);
248 }
249 
250 
252 {
253 }
254 
256 {
257  static TMatrixD cov(7,7);
258 
259  // position error
260 
261  cov(0,0) = fErrP7[0]; cov(1,0) = fErrP7[1]; cov(1,1) = fErrP7[2];
262  cov(2,0) = fErrP7[3]; cov(2,1) = fErrP7[4]; cov(2,2) = fErrP7[5];
263 
264  // position-momentum covariance
265 
266  cov(3,0) = fErrP7[6]; cov(3,1) = fErrP7[7]; cov(3,2) = fErrP7[8];
267  cov(4,0) = fErrP7[9]; cov(4,1) = fErrP7[10]; cov(4,2) = fErrP7[11];
268  cov(5,0) = fErrP7[12]; cov(5,1) = fErrP7[13]; cov(5,2) = fErrP7[14];
269  cov(6,0) = fErrP7[15]; cov(6,1) = fErrP7[16]; cov(6,2) = fErrP7[17];
270 
271  // momentum error
272  cov(3,3) = fErrP7[18]; cov(4,3) = fErrP7[19]; cov(4,4) = fErrP7[20];
273  cov(5,3) = fErrP7[21]; cov(5,4) = fErrP7[22]; cov(5,5) = fErrP7[23];
274  cov(6,3) = fErrP7[24]; cov(6,4) = fErrP7[25]; cov(6,5) = fErrP7[26];
275  cov(6,6) = fErrP7[27];
276 
277  for (int i=0; i<6; i++)
278  for (int j=i+1; j<7; j++)
279  cov(i,j)=cov(j,i);
280 
281  return cov;
282 }
283 
285 {
286  static TMatrixD covP4(4,4);
287 
288  covP4(0,0) = fErrP7[18]; covP4(1,0) = fErrP7[19]; covP4(1,1) = fErrP7[20];
289  covP4(2,0) = fErrP7[21]; covP4(2,1) = fErrP7[22]; covP4(2,2) = fErrP7[23];
290  covP4(3,0) = fErrP7[24]; covP4(3,1) = fErrP7[25]; covP4(3,2) = fErrP7[26];
291  covP4(3,3) = fErrP7[27];
292 
293  for (int i=0; i<3; i++)
294  for (int j=i+1; j<4; j++)
295  covP4(i,j)=covP4(j,i);
296 
297  return covP4;
298 }
299 
300 void PndPidCandidate::SetLorentzVector(TLorentzVector &p4)
301 {
302  fXmomentum = p4.X();
303  fYmomentum = p4.Y();
304  fZmomentum = p4.Z();
305  fEnergy = p4.T();
306 }
307 
309 {
310  // position error
311 
312  fErrP7[0] = cov7(0,0); fErrP7[1] = cov7(1,0); fErrP7[2] = cov7(1,1);
313  fErrP7[3] = cov7(2,0); fErrP7[4] = cov7(2,1); fErrP7[5] = cov7(2,2);
314 
315  // position-momentum covariance
316 
317  fErrP7[6] = cov7(3,0); fErrP7[7] = cov7(3,1); fErrP7[8] = cov7(3,2);
318  fErrP7[9] = cov7(4,0); fErrP7[10] = cov7(4,1); fErrP7[11] = cov7(4,2);
319  fErrP7[12] = cov7(5,0); fErrP7[13] = cov7(5,1); fErrP7[14] = cov7(5,2);
320  fErrP7[15] = cov7(6,0); fErrP7[16] = cov7(6,1); fErrP7[17] = cov7(6,2);
321 
322  // momentum error
323  fErrP7[18] = cov7(3,3); fErrP7[19] = cov7(4,3); fErrP7[20] = cov7(4,4);
324  fErrP7[21] = cov7(5,3); fErrP7[22] = cov7(5,4); fErrP7[23] = cov7(5,5);
325  fErrP7[24] = cov7(6,3); fErrP7[25] = cov7(6,4); fErrP7[26] = cov7(6,5);
326  fErrP7[27] = cov7(6,6);
327 }
328 
330 {
331  // position error
332 
333  fErrP7[0] = 0; fErrP7[1] = 0; fErrP7[2] = 0;
334  fErrP7[3] = 0; fErrP7[4] = 0; fErrP7[5] = 0;
335 
336  // position-momentum covariance
337 
338  fErrP7[6] = 0; fErrP7[7] = 0; fErrP7[8] = 0;
339  fErrP7[9] = 0; fErrP7[10] = 0; fErrP7[11] = 0;
340  fErrP7[12] = 0; fErrP7[13] = 0; fErrP7[14] = 0;
341  fErrP7[15] = 0; fErrP7[16] = 0; fErrP7[17] = 0;
342 
343  // momentum error
344  fErrP7[18] = covP4(0,0); fErrP7[19] = covP4(1,0); fErrP7[20] = covP4(1,1);
345  fErrP7[21] = covP4(2,0); fErrP7[22] = covP4(2,1); fErrP7[23] = covP4(2,2);
346  fErrP7[24] = covP4(3,0); fErrP7[25] = covP4(3,1); fErrP7[26] = covP4(3,2);
347  fErrP7[27] = covP4(3,3);
348 }
349 
351 {
352  fLocked = kFALSE;
353  fCharge = 0;
354  fXposition = 0.;
355  fYposition = 0.;
356  fZposition = 0.;
357  fXmomentum = 0.;
358  fYmomentum = 0.;
359  fZmomentum = 0.;
360  fEnergy = 0.;
361  fFirstHitX = 0.;
362  fFirstHitY = 0.;
363  fFirstHitZ = 0.;
364  fLastHitX = 0.;
365  fLastHitY = 0.;
366  fLastHitZ = 0.;
367  fMcIndex = -1;
368  fTrackIndex = -1;
369  fTrackBranch = -1;
370  fMvdDEDX = 0.;
371  fMvdHits = 0;
372  fSttMeanDEDX = 0.;
373  fSttHits = 0;
374  fGemHits = 0;
375  fTofStopTime = 0.;
376  fTofM2 = 0.;
377  fTofTrackLength = 0.;
378  fTofQuality = -1.;
379  fTofIndex = -1;
380  fDrcThetaC = 0.;
381  fDrcThetaCErr = 0.;
382  fDrcQuality = -1.;
384  fDrcIndex = -1;
385  fDiscThetaC = 0.;
386  fDiscThetaCErr = 0.;
387  fDiscQuality = -1.;
389  fDiscIndex = -1;
390  fRichThetaC = 0.;
391  fRichThetaCErr = 0.;
392  fRichQuality = -1.;
394  fRichIndex = -1;
395  fEmcRawEnergy = 0.;
396  fEmcCalEnergy = 0.;
397  fEmcQuality = -1.;
399  fEmcNumberOfBumps = 0;
400  fEmcModule = -1;
401  fEmcIndex = -1;
402  fEmcZ20 = 0.;
403  fEmcZ53 = 0.;
404  fEmcLat = 0.;
405  fEmcE1 = 0.;
406  fEmcE9 = 0.;
407  fEmcE25 = 0.;
408  fEmcTimeStamp = -1.;
409  fMuoNumberOfLayers = 0;
410  fMuoProbability = 0.;
411  fMuoQuality = -1.;
412  fMuoIron = 0.;
413  fMuoMomentumIn = 0.;
414  fMuoModule = 0;
415  fMuoHits = 0;
416  fMuoIndex = -1;
417  fDegreesOfFreedom = 0;
418  fFitStatus = 0;
419  fChiSquared = 0.;
420 
421  Int_t i;
422  for (i=0; i<28;i++) fErrP7[i] = 0;
423  for (i=0; i<5;i++) fParams[i] = 0;
424  for (i=0; i<15;i++) fCov[i] = 0;
425 }
426 
427 TBuffer &operator>>(TBuffer &buf, PndPidCandidate *&obj)
428 {
429  obj = (PndPidCandidate *) buf.ReadObject(PndPidCandidate::Class());
430  return buf;
431 }
432 
433 #include <iostream>
434 using namespace std;
435 
437 {
438  o << " ======= Fit Params ======= " << endl;
439  TVector3 r = GetPosition();
440  TVector3 p = GetMomentum();
441  o << " Position : (" << r.X() << ";" << r.Y() << ";" << r.Z() << ")" << endl;
442  o << " Momentum : (" << p.X() << ";" << p.Y() << ";" << p.Z() << ")" << endl;
443  o << " Momentum.mag : " << p.Mag() << endl;
444  o << " Charge : " << GetCharge() << endl;
445  o << " Energy : " << GetEnergy() << endl;
446 
447  if (GetCharge() != 0) {
448  o << " ======= Track Quality ======= "
449  << "\n Fit quality : Ndof " << GetDegreesOfFreedom()<< " chi2 " << GetChiSquared()
450  << endl;//"\n track length : " << GetTrackLength()<<endl;
451  }
452 
453 }
454 
TVector3 pos
void SetP4Cov(const TMatrixD &covP4)
TMatrixD & P4Cov() const
double r
Definition: RiemannTest.C:14
Int_t i
Definition: run_full.C:25
void SetPosition(TVector3 &pos)
void SetCov7(const TMatrixD &cov7)
Float_t fErrP7[28]
Double_t p
Definition: anasim.C:58
Float_t fParams[5]
void PrintOn(std::ostream &o) const
std::ostream & operator<<(std::ostream &o, const PndPidCandidate &a)
Int_t a
Definition: anaLmdDigi.C:126
TBuffer & operator>>(TBuffer &buf, PndPidCandidate *&obj)
Float_t fEmcTimeStamp
TimeStamp at the cluster or bump position no track length correction done at this stage...
void SetLorentzVector(TLorentzVector &p4)
TMatrixD & Cov7() const
void SetCharge(Int_t charge)
return buf
Float_t fCov[15]
PndAnaPidSelector *& obj
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52