CbmRoot
CbmLitAllHitsTofMerger.cxx
Go to the documentation of this file.
1 
8 
9 #include "data/CbmLitHit.h"
10 #include "data/CbmLitTofTrack.h"
11 #include "data/CbmLitTrack.h"
12 #include "data/CbmLitTrackParam.h"
15 #include "utils/CbmLitMath.h"
16 
17 #include <iostream>
18 #include <map>
19 
20 using std::map;
21 
23  : fFieldPropagator()
24  , fLinePropagator()
25  , fFilter()
26  , fPDG(211)
27  , fChiSqCut(25.) {}
28 
30 
33  TofTrackPtrVector& tofTracks) {
34  // First find hit with minimum Z position and build map from Z hit position
35  // to track parameter to improve the calculation speed.
37  map<litfloat, CbmLitTrackParam> zParamMap;
38  for (HitPtrIterator it = hits.begin(); it != hits.end(); it++) {
39  const CbmLitHit* hit = *it;
40  zMin = std::min(zMin, hit->GetZ());
41  zParamMap[hit->GetZ()] = CbmLitTrackParam();
42  }
43 
44  // Loop over input tracks
45  for (TrackPtrIterator it = tracks.begin(); it != tracks.end(); it++) {
46  CbmLitTrack* track = *it;
47  if (track->GetQuality() != kLITGOODMERGE) { continue; }
48  CbmLitTrackParam par(*track->GetParamLast());
49 
50  // Extrapolate track minimum Z position of hit using magnetic field propagator.
51  if (fFieldPropagator->Propagate(&par, zMin, fPDG) == kLITERROR) {
52  continue; // skip this track if its propagation failed
53  }
54 
55  // Extrapolate track parameters to each Z position in the map.
56  // This is done to improve calculation speed.
57  // In case of planar TOF geometry only 1 track extrapolation is required,
58  // since all hits located at the same Z.
59  for (map<litfloat, CbmLitTrackParam>::iterator it2 = zParamMap.begin();
60  it2 != zParamMap.end();
61  it2++) {
62  (*it2).second = par;
63  fLinePropagator->Propagate(&(*it2).second, (*it2).first, fPDG);
64  }
65 
66  // Loop over hits
67  for (HitPtrIterator it = hits.begin(); it != hits.end(); it++) {
68  const CbmLitHit* hit = *it;
69  if (zParamMap.find(hit->GetZ())
70  == zParamMap.end()) { // This should never happen
71  std::cout << "-E- CbmLitAllHitsTofMerger::DoMerge: Z position "
72  << hit->GetZ() << " not found in map. Something is wrong.\n";
73  }
74  CbmLitTrackParam tpar(zParamMap[hit->GetZ()]);
75  litfloat chi = 0.;
76  fFilter->Update(&tpar, hit, chi);
77  if (
78  chi
79  < fChiSqCut) { // Check if hit is inside validation gate and closer to the track.
80  //Create new TOF track
81  CbmLitTofTrack* tofTrack = new CbmLitTofTrack();
82  tofTrack->SetTrack(track);
83  tofTrack->SetHit(hit);
84  tofTrack->SetTrackParam(&tpar);
85  tofTrack->SetDistance(chi);
86  tofTracks.push_back(tofTrack);
87  }
88  }
89  }
90  return kLITSUCCESS;
91 }
CbmLitTrackParam.h
Data class for track parameters.
CbmLitTofTrack::SetTrack
void SetTrack(const CbmLitTrack *track)
Definition: CbmLitTofTrack.h:42
litfloat
double litfloat
Definition: CbmLitFloat.h:15
CbmLitAllHitsTofMerger::fFieldPropagator
TrackPropagatorPtr fFieldPropagator
Definition: CbmLitAllHitsTofMerger.h:48
TofTrackPtrVector
vector< CbmLitTofTrack * > TofTrackPtrVector
Definition: CbmLitTypes.h:32
CbmLitAllHitsTofMerger::fPDG
Int_t fPDG
Definition: CbmLitAllHitsTofMerger.h:51
CbmLitAllHitsTofMerger::fFilter
TrackUpdatePtr fFilter
Definition: CbmLitAllHitsTofMerger.h:50
CbmLitHit::GetZ
litfloat GetZ() const
Definition: CbmLitHit.h:48
CbmLitTrackParam
Data class for track parameters.
Definition: CbmLitTrackParam.h:29
CbmLitAllHitsTofMerger::fChiSqCut
litfloat fChiSqCut
Definition: CbmLitAllHitsTofMerger.h:52
CbmLitAllHitsTofMerger::fLinePropagator
TrackPropagatorPtr fLinePropagator
Definition: CbmLitAllHitsTofMerger.h:49
fLinePropagator
TrackPropagatorPtr fLinePropagator
Definition: CbmGlobalTrackingTof.cxx:20
CbmLitAllHitsTofMerger::DoMerge
virtual LitStatus DoMerge(HitPtrVector &hits, TrackPtrVector &tracks, TofTrackPtrVector &tofTracks)
Inherited from CbmLitHitToTrackMerger.
Definition: CbmLitAllHitsTofMerger.cxx:31
fFilter
TrackUpdatePtr fFilter
Definition: CbmGlobalTrackingTof.cxx:21
CbmLitTrackUpdate.h
Interface for track update algorithm.
kLITSUCCESS
@ kLITSUCCESS
Definition: CbmLitEnums.h:24
min
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
Definition: L1/vectors/P4_F32vec4.h:33
kLITGOODMERGE
@ kLITGOODMERGE
Definition: CbmLitEnums.h:34
TrackPtrIterator
std::vector< CbmTofTrack * >::iterator TrackPtrIterator
Definition: CbmTofTypes.h:21
TrackPtrVector
std::vector< CbmTofTrack * > TrackPtrVector
Definition: CbmTofTypes.h:22
CbmLitHit
Base data class for hits.
Definition: CbmLitHit.h:26
tracks
TClonesArray * tracks
Definition: Analyze_matching.h:17
HitPtrIterator
std::vector< CbmTofHit * >::iterator HitPtrIterator
Definition: CbmTofTypes.h:17
CbmLitTofTrack
Definition: CbmLitTofTrack.h:21
CbmLitMath.h
CbmLitTrackPropagator.h
kLITERROR
@ kLITERROR
Definition: CbmLitEnums.h:25
CbmLitTrack
Base data class for track.
Definition: CbmLitTrack.h:30
CbmLitTofTrack::SetHit
void SetHit(const CbmLitHit *hit)
Definition: CbmLitTofTrack.h:43
CbmLitTofTrack::SetDistance
void SetDistance(litfloat distance)
Definition: CbmLitTofTrack.h:45
CbmLitTrack::GetParamLast
const CbmLitTrackParam * GetParamLast() const
Definition: CbmLitTrack.h:63
CbmLitAllHitsTofMerger.h
Hit-to-track merging in TOF detector attaching all hits in the validation region.
CbmLitTofTrack.h
CbmLitTrack.h
Base data class for track.
hits
static vector< vector< QAHit > > hits
Definition: CbmTofHitFinderTBQA.cxx:114
CbmLitTofTrack::SetTrackParam
void SetTrackParam(const CbmLitTrackParam *par)
Definition: CbmLitTofTrack.h:44
LitStatus
LitStatus
Definition: CbmLitEnums.h:23
max
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: L1/vectors/P4_F32vec4.h:36
CbmLitTrack::GetQuality
LitTrackQa GetQuality() const
Definition: CbmLitTrack.h:57
CbmLitHit.h
Base data class for hits.
CbmLitAllHitsTofMerger::CbmLitAllHitsTofMerger
CbmLitAllHitsTofMerger()
Constructor.
Definition: CbmLitAllHitsTofMerger.cxx:22
CbmLitAllHitsTofMerger::~CbmLitAllHitsTofMerger
virtual ~CbmLitAllHitsTofMerger()
Destructor.
Definition: CbmLitAllHitsTofMerger.cxx:29
HitPtrVector
std::vector< CbmTofHit * > HitPtrVector
Definition: CbmTofTypes.h:14