CbmRoot
CbmL1StsTrackFinder.cxx
Go to the documentation of this file.
1 /*
2  *====================================================================
3  *
4  * CBM Level 1 Reconstruction
5  *
6  * Authors: I.Kisel, S.Gorbunov
7  *
8  * e-mail : ikisel@kip.uni-heidelberg.de
9  *
10  *====================================================================
11  *
12  * CbmL1StsTrackFinder source file
13  *
14  *====================================================================
15  */
16 #include "CbmL1StsTrackFinder.h"
17 
18 #include "L1Algo/L1Algo.h"
19 
20 #include "CbmEvent.h"
21 #include "CbmKFMath.h"
22 #include "CbmStsHit.h"
23 #include "CbmStsTrack.h"
24 #include "FairHit.h"
25 #include "FairMCPoint.h"
26 #include "FairRootManager.h"
27 
28 #include "TClonesArray.h"
29 
30 #include <iostream>
31 #include <vector>
32 
33 using std::cout;
34 using std::endl;
35 using std::vector;
36 
38 
39  // ----- Default constructor -------------------------------------------
41  fName = "STS Track Finder L1";
42 }
43 // -------------------------------------------------------------------------
44 
45 
46 // ----- Destructor ----------------------------------------------------
48 // -------------------------------------------------------------------------
49 
50 
51 // ----- Public method Init --------------------------------------------
53 // -------------------------------------------------------------------------
54 
55 
56 // ----- Copy tracks to output array -----------------------------------
58 
59  CbmL1* L1 = CbmL1::Instance();
60  if (!L1) return 0;
61 
62  Int_t trackIndex = fTracks->GetEntriesFast();
63  Int_t nTracks = 0;
64  LOG(debug) << "Copy L1 tracks : " << L1->vRTracks.size() << " tracks in L1";
65  for (vector<CbmL1Track>::iterator it = L1->vRTracks.begin();
66  it != L1->vRTracks.end();
67  ++it) {
68  CbmL1Track& T = *it;
69  new ((*fTracks)[trackIndex]) CbmStsTrack();
70  nTracks++;
71  if (event) event->AddData(ECbmDataType::kStsTrack, trackIndex);
72  CbmStsTrack* t = L1_DYNAMIC_CAST<CbmStsTrack*>(fTracks->At(trackIndex++));
73  t->SetFlag(0);
74  FairTrackParam fpar(*t->GetParamFirst()), lpar(*t->GetParamLast());
75  CbmKFMath::CopyTC2TrackParam(&fpar, T.T, T.C);
77  t->SetParamFirst(&fpar);
78  t->SetParamLast(&lpar);
79  t->SetChiSq(T.chi2);
80  t->SetNDF(T.NDF);
81  t->SetPidHypo(T.T[4] >= 0 ? 211 : -211);
82  t->SetTime(T.Tpv[6]);
83  t->SetTimeError(T.Cpv[20]);
84 
85  for (vector<int>::iterator ih = it->StsHits.begin();
86  ih != it->StsHits.end();
87  ++ih) {
88  CbmL1HitStore& h = L1->vHitStore[*ih];
89  // double zref = L1->algo->vStations[h.iStation].z[0];
90  if (h.ExtIndex < 0) {
91  // CbmMvdHit tmp;
92  // tmp.SetZ(zref);
93  t->AddMvdHit(-h.ExtIndex - 1); //, &tmp );
94  } else {
95  //CbmStsHit tmp;
96  //tmp.SetZ(zref);
97  t->AddHit(h.ExtIndex, kSTSHIT); //, &tmp );
98  }
99  }
100  }
101 
102  return nTracks;
103 }
104 // -------------------------------------------------------------------------
105 
106 
107 // ----- Public method DoFind ------------------------------------------
109 
110  if (!fTracks) {
111  LOG(error) << "-E- CbmL1StsTrackFinder::DoFind: "
112  << "Track array missing! ";
113  return -1;
114  }
115 
116  CbmL1* L1 = CbmL1::Instance();
117  if (!L1) return 0;
118 
119  L1->Reconstruct();
120  int ntracks = CopyL1Tracks();
121 
122  return ntracks;
123 }
124 // -------------------------------------------------------------------------
125 
126 
127 // ----- Track finding in one event ------------------------------------
129 
130  CbmL1* l1 = CbmL1::Instance();
131  if (!l1) return 0;
132 
133  l1->Reconstruct(event);
134  int nTracks = CopyL1Tracks(event);
135 
136  return nTracks;
137 }
138 // -------------------------------------------------------------------------
CbmL1TrackPar::NDF
int NDF
Definition: CbmL1TrackPar.h:18
h
Generates beam ions for transport simulation.
Definition: CbmBeamGenerator.h:17
CbmTrack::GetParamLast
const FairTrackParam * GetParamLast() const
Definition: CbmTrack.h:62
L1Algo.h
CbmL1StsTrackFinder::CopyL1Tracks
Int_t CopyL1Tracks(CbmEvent *event=NULL)
Definition: CbmL1StsTrackFinder.cxx:57
CbmL1Track::Tpv
double Tpv[7]
Definition: CbmL1Track.h:63
CbmL1Track::CLast
double CLast[21]
Definition: CbmL1Track.h:66
CbmL1HitStore
Definition: CbmL1.h:94
CbmTrack::SetTime
void SetTime(Double_t time)
Definition: CbmTrack.h:78
CbmTrack::SetParamLast
void SetParamLast(const FairTrackParam *par)
Definition: CbmTrack.h:76
CbmTrack::SetNDF
void SetNDF(Int_t ndf)
Definition: CbmTrack.h:71
ClassImp
ClassImp(CbmL1StsTrackFinder) CbmL1StsTrackFinder
Definition: CbmL1StsTrackFinder.cxx:37
CbmL1Track::TLast
double TLast[7]
Definition: CbmL1Track.h:66
CbmTrack::SetFlag
void SetFlag(Int_t flag)
Definition: CbmTrack.h:69
CbmL1TrackPar::T
double T[7]
Definition: CbmL1TrackPar.h:17
CbmKFMath.h
CbmEvent.h
ECbmDataType::kStsTrack
@ kStsTrack
CbmStsTrack.h
Data class for STS tracks.
CbmL1::Instance
static CbmL1 * Instance()
Definition: CbmL1.h:129
CbmTrack::SetPidHypo
void SetPidHypo(Int_t pid)
Definition: CbmTrack.h:68
CbmTrack::SetChiSq
void SetChiSq(Double_t chiSq)
Definition: CbmTrack.h:70
CbmL1StsTrackFinder::FindTracks
virtual Int_t FindTracks(CbmEvent *event)
Definition: CbmL1StsTrackFinder.cxx:128
CbmTrack::SetTimeError
void SetTimeError(Double_t error)
Definition: CbmTrack.h:79
CbmTrack::GetParamFirst
const FairTrackParam * GetParamFirst() const
Definition: CbmTrack.h:61
CbmL1Track
Definition: CbmL1Track.h:33
CbmL1StsTrackFinder.h
CbmL1StsTrackFinder::~CbmL1StsTrackFinder
virtual ~CbmL1StsTrackFinder()
Definition: CbmL1StsTrackFinder.cxx:47
CbmL1StsTrackFinder
Definition: CbmL1StsTrackFinder.h:29
CbmL1StsTrackFinder::CbmL1StsTrackFinder
CbmL1StsTrackFinder()
CbmStsTrackFinder::fTracks
TClonesArray * fTracks
Definition: CbmStsTrackFinder.h:83
CbmL1StsTrackFinder::DoFind
virtual Int_t DoFind()
Definition: CbmL1StsTrackFinder.cxx:108
CbmL1::vRTracks
vector< CbmL1Track > vRTracks
Definition: CbmL1.h:125
kSTSHIT
@ kSTSHIT
Definition: CbmHit.h:20
CbmKFMath::CopyTC2TrackParam
static void CopyTC2TrackParam(FairTrackParam *par, Double_t T[], Double_t C[])
Definition: CbmKFMath.cxx:809
CbmTrack::SetParamFirst
void SetParamFirst(const FairTrackParam *par)
Definition: CbmTrack.h:75
CbmEvent
Class characterising one event by a collection of links (indices) to data objects,...
Definition: CbmEvent.h:30
CbmL1TrackPar::C
double C[21]
Definition: CbmL1TrackPar.h:17
CbmL1StsTrackFinder::Init
virtual void Init()
Definition: CbmL1StsTrackFinder.cxx:52
CbmStsTrack
Definition: CbmStsTrack.h:37
CbmL1
Definition: CbmL1.h:113
CbmL1::vHitStore
vector< CbmL1HitStore > vHitStore
Definition: CbmL1.h:180
CbmTrack::AddHit
void AddHit(Int_t index, HitType type)
Definition: CbmTrack.cxx:75
CbmL1::Reconstruct
void Reconstruct(CbmEvent *event=NULL)
Definition: CbmL1.cxx:1310
CbmL1Track::Cpv
double Cpv[21]
Definition: CbmL1Track.h:63
CbmStsHit.h
Data class for a reconstructed hit in the STS.
CbmL1TrackPar::chi2
double chi2
Definition: CbmL1TrackPar.h:17
CbmStsTrack::AddMvdHit
void AddMvdHit(Int_t hitIndex)
Definition: CbmStsTrack.h:50