FairRoot/PandaRoot
PndCAFunctionality.cxx
Go to the documentation of this file.
1  //-*- Mode: C++ -*-
2  // *****************************************************************************
3  // *
4  // @Autors: I.Kulakov; M.Zyzak; I.Kisel *
5  // @e-mail: I.Kulakov@gsi.de; M.Zyzak@gsi.de; I.Kisel@compeng.uni-frankfurt.de *
6  // *
7  // *****************************************************************************
8 
9 #include "PndCAFunctionality.h"
10 #include "PndCAHitsV.h"
11 #include "PndCATarget.h"
12 
13 float_m PndCAFunctionality::FitIteration(const PndCAParam& caParam, const PndCAHits& hits, PndCATrackParamVector& param, const vector<PndCATESV>& iHits, const PndCATarget& target, bool dir, bool useParam, const float_m& mask)
14 {
15  const unsigned int NTHits = iHits.size();
16  float_m active = mask;
17  if( active.isEmpty() ) return active;
18  // get hits
19  vector<PndCAHitV> thits( NTHits );
20  for ( unsigned int ihit = 0; ihit < NTHits; ihit++ ) {
21  PndCATESV index = iHits[ihit];
22  if (!dir) index = iHits[NTHits-1-ihit];
23 
24  PndCAHit hs[float_v::Size];
25  foreach_bit(unsigned int iV, active) {
26  hs[iV] = hits[index.s[iV]][index.e[iV]];
27  }
28 
29  thits[ihit] = PndCAHitV( hs, active );
30  }
31 
32  const PndCAHitV& hit0 = thits[0];
33 
34  if (!useParam) {
35  float_v qMom = param.QMomentum();
36  param.InitByTarget(target);
37  param.SetQMomentum(qMom);
38  param.InitDirection( hit0.X0(), hit0.X1(), hit0.X2() );
39  param.SetAngle( hit0.Angle() );
40  }
41  else {
42  param.InitCovMatrix( target.Err2QMom() );
43  }
44 
45  for ( unsigned int ihit = 0; ihit < NTHits; ihit++ ) {
46  if( active.isEmpty() ) break;
47  const PndCAHitV& hit = thits[ihit];
48  active &= param.Transport( hit, caParam, active );
49  if( active.isEmpty() ) break;
50  active &= param.Filter( hit, caParam, active );
51  }
52 
53  return active;
54 }
55 
56 float_m PndCAFunctionality::Fit(const PndCAParam& caParam, const PndCAHits& hits, PndCATrackParamVector& param, const vector<PndCATESV>& iHits, const PndCATarget& target, bool dir, const float_m& mask)
57 {
58  float_m active = mask;
59  int i = 0;
60 
61  float_v qMom = float_v(10e10f);
62 
63 #if 1
64  while ( (++i < 10) && ( abs( (param.QMomentum() - qMom)/qMom ) > 0.005f ) ) { //SG!!! 10 iterations !!!
65  qMom = param.QMomentum();
66  if( active.isEmpty() ) break;
67  active &= FitIteration( caParam, hits, param, iHits, target, dir, false, active );
68  break;// SG!!
69  }
70 #else // for Panda it is and slower, since doesn't use target z-coor?
71  active &= FitIteration( caParam, hits, param, iHits, target, dir, false, active );
72  while ( (++i < 5) && ( abs( (param.QMomentum() - qMom)/qMom ) > 0.005f ) ) {
73  qMom = param.QMomentum();
74  active &= FitIteration( caParam, hits, param, iHits, target, !dir, true, active );
75  active &= FitIteration( caParam, hits, param, iHits, target, dir, true, active );
76  }
77 #endif
78  return active;
79 }
float_m Fit(const PndCAParam &caParam, const PndCAHits &hits, PndCATrackParamVector &param, const vector< PndCATESV > &iHits, const PndCATarget &target, bool dir, const float_m &active=float_m(true))
void InitByTarget(const PndCATarget &target)
Int_t i
Definition: run_full.C:25
void SetAngle(const float_v &v)
float_m FitIteration(const PndCAParam &caParam, const PndCAHits &hits, PndCATrackParamVector &param, const vector< PndCATESV > &iHits, const PndCATarget &target, bool dir, bool useParam, const float_m &active=float_m(true))
float_v X1() const
Definition: PndCAHitsV.h:44
int_v s
Definition: PndCATES.h:42
float_m Filter(const PndCAHitV &hit, const PndCAParam &param, const float_m &mask=float_m(true), const float_v &chi2Cut=10e10f)
void InitCovMatrix(float_v d2QMom=0.f)
uint_v e
Definition: PndCATES.h:43
float_v X2() const
Definition: PndCAHitsV.h:45
void InitDirection(float_v r0, float_v r1, float_v r2)
void SetQMomentum(const float_v &v)
float_v Angle() const
Definition: PndCAHitsV.h:59
float Err2QMom() const
Definition: PndCATarget.h:29
float_m Transport(const int_v &ista, const PndCAParam &param, const float_m &mask=float_m(true))
PndSdsMCPoint * hit
Definition: anasim.C:70
CbmHit * hits[nHits]
Definition: RiemannTest.C:19
float_v X0() const
Definition: PndCAHitsV.h:43