FairRoot/PandaRoot
Functions
PndGenfitAdapters.h File Reference

Go to the source code of this file.

Functions

PndTrackCandGenfitTrackCand2PndTrackCand (const GFTrackCand *)
 
GFTrackCandPndTrackCand2GenfitTrackCand (PndTrackCand *)
 
PndTrackGenfitTrack2PndTrack (const GFTrack *)
 

Function Documentation

PndTrack* GenfitTrack2PndTrack ( const GFTrack )

Definition at line 43 of file PndGenfitAdapters.cxx.

References GFAbsTrackRep::clone(), count, GenfitTrackCand2PndTrackCand(), GFTrack::getCand(), GFTrack::getCardinalRep(), GFTrack::getChiSqu(), GFAbsTrackRep::getFirstCov(), GFAbsTrackRep::getFirstPlane(), GFAbsTrackRep::getFirstState(), GFAbsTrackRep::getLastCov(), GFAbsTrackRep::getLastPlane(), GFAbsTrackRep::getLastState(), GFAbsTrackRep::getMom(), GFTrack::getNDF(), GFDetPlane::getNormal(), GFDetPlane::getO(), GFDetPlane::getU(), GFDetPlane::getV(), i, PndTrack::SetChi2(), PndTrack::SetFlag(), PndTrack::SetNDF(), and GFException::what().

Referenced by PndLmdKalmanTask::Exec(), PndRecoDafFit::Fit(), and PndRecoKalmanFit::Fit().

43  {
44  GFAbsTrackRep* clone = tr->getCardinalRep()->clone();
45  TMatrixT<double> firstState = clone->getFirstState();
46  TMatrixT<double> lastState = clone->getLastState();
47  TMatrixT<double> firstCov = clone->getFirstCov();
48  TMatrixT<double> lastCov = clone->getLastCov();
49  GFDetPlane firstPlane = clone->getFirstPlane();
50  GFDetPlane lastPlane = clone->getLastPlane();
51 
52  GFAbsTrackRep* gtr;
53  if (dynamic_cast<GeaneTrackRep*>(clone)!=NULL)
54  gtr = dynamic_cast<GeaneTrackRep*>(clone);
55  else if (dynamic_cast<RKTrackRep*>(clone)!=NULL)
56  gtr = dynamic_cast<RKTrackRep*>(clone);
57  else {
58  std::cerr << " GenfitGFAbsTrackRep2PndTrack() can currently only handle GeaneTrackRep and RKTrackRep" << std::endl;
59  throw;
60  }
61 
62  //make the FairTrackParP for first and last hit
63  double firstCova[15];
64  int count=0;;
65  for(int i=0; i<5;++i){
66  for(int j=i;j<5;++j){
67  firstCova[count++]=firstCov[i][j];
68  }
69  }
70  double lastCova[15];
71  count=0;;
72  for(int i=0; i<5;++i){
73  for(int j=i;j<5;++j){
74  lastCova[count++]=lastCov[i][j];
75  }
76  }
77 
78  // calculation of spu = sign[p(DJ x DK)]
79  double first_pro(0), last_pro(0), first_spu, last_spu;
80  bool exc(false);
81 
82  try{
83  first_pro = gtr->getMom(firstPlane).Dot(firstPlane.getNormal());
84  last_pro = gtr->getMom(lastPlane).Dot(lastPlane.getNormal());
85  }
86  catch (GFException& e){
87  exc=true;
88  std::cerr<<"*** PndGenfitAdapters::GenfitTrack2PndTrack" << "\t" << "could not convert GenfitTrack to PndTrack"<<std::endl;
89  e.what();
90  }
91 
92  first_spu = (first_pro>=0) ? 1 : -1;
93  last_spu = (last_pro>=0) ? 1 : -1;
94 
95  FairTrackParP first(firstState[3][0],firstState[4][0],firstState[1][0],firstState[2][0],firstState[0][0],firstCova,firstPlane.getO(),firstPlane.getU(),firstPlane.getV(),first_spu);
96  FairTrackParP last(lastState[3][0],lastState[4][0],lastState[1][0],lastState[2][0],lastState[0][0],lastCova,lastPlane.getO(),lastPlane.getU(),lastPlane.getV(),last_spu);
97 
98  //copy the trackCand
99  GFTrackCand genfitCand = tr->getCand();
100  PndTrackCand* pndCand = GenfitTrackCand2PndTrackCand(&genfitCand);
101  PndTrack* retVal = new PndTrack(first,last,*pndCand);
102  retVal->SetChi2(tr->getChiSqu());
103  retVal->SetNDF(tr->getNDF());
104  if (tr->getNDF()==0)
105  {
106  retVal->SetFlag(-15);
107  }
108  else if (exc) {
109  retVal->SetFlag(-1);
110  }
111  else {
112  retVal->SetFlag(1);
113  }
114 
115  delete pndCand;
116  return retVal;
117 
118 }
Base Class for genfit track representations. Defines interface for track parameterizations.
Definition: GFAbsTrackRep.h:80
GFDetPlane getFirstPlane() const
TVector3 getV() const
Definition: GFDetPlane.h:77
Int_t i
Definition: run_full.C:25
Detector plane genfit geometry class.
Definition: GFDetPlane.h:59
virtual const char * what() const
standard error message handling for exceptions. use like &quot;std::cerr &lt;&lt; e.what();&quot; ...
Definition: GFException.cxx:47
void SetChi2(Double_t d)
Definition: PndTrack.h:39
virtual TVector3 getMom(const GFDetPlane &pl)=0
TMatrixT< double > getFirstCov() const
TMatrixT< double > getLastState() const
TMatrixT< double > getLastCov() const
TMatrixT< double > getFirstState() const
Track candidate – a list of cluster indices.
Definition: GFTrackCand.h:55
GFDetPlane getLastPlane() const
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:45
void SetFlag(Int_t i)
Definition: PndTrack.h:38
void SetNDF(Int_t i)
Definition: PndTrack.h:40
TVector3 getU() const
Definition: GFDetPlane.h:76
int count
TVector3 getNormal() const
Definition: GFDetPlane.cxx:138
TVector3 getO() const
Definition: GFDetPlane.h:75
PndTrackCand * GenfitTrackCand2PndTrackCand(const GFTrackCand *cand)
PndTrackCand* GenfitTrackCand2PndTrackCand ( const GFTrackCand )

Definition at line 19 of file PndGenfitAdapters.cxx.

References PndTrackCand::AddHit(), GFTrackCand::getHit(), GFTrackCand::getMcTrackId(), GFTrackCand::getNHits(), i, nhits, and PndTrackCand::setMcTrackId().

Referenced by GenfitTrack2PndTrack().

19  {
20  PndTrackCand* retVal = new PndTrackCand();
21  unsigned int nhits = cand->getNHits();
22  unsigned detId,hitId;
23  double rho;
24  for(unsigned int i=0;i<nhits;++i){
25  cand->getHit(i,detId,hitId,rho);
26  retVal->AddHit(detId,hitId,rho);
27  }
28  retVal->setMcTrackId(cand->getMcTrackId());
29  return retVal;
30 }
Int_t i
Definition: run_full.C:25
void setMcTrackId(int i)
Definition: PndTrackCand.h:72
void AddHit(UInt_t detId, UInt_t hitId, Double_t rho)
GFTrackCand* PndTrackCand2GenfitTrackCand ( PndTrackCand )

Definition at line 32 of file PndGenfitAdapters.cxx.

References GFTrackCand::addHit(), PndTrackCandHit::GetDetId(), PndTrackCandHit::GetHitId(), PndTrackCand::getMcTrackId(), PndTrackCand::GetNHits(), PndTrackCandHit::GetRho(), PndTrackCand::GetSortedHit(), i, nhits, and GFTrackCand::setMcTrackId().

Referenced by PndLmdKalmanTask::Exec(), PndRecoDafFit::Fit(), and PndRecoKalmanFit::Fit().

32  {
33  GFTrackCand* retVal = new GFTrackCand();
34  unsigned int nhits = cand->GetNHits();
35  for(unsigned int i=0;i<nhits;++i){
36  PndTrackCandHit candHit = cand->GetSortedHit(i);
37  retVal->addHit(candHit.GetDetId(),candHit.GetHitId(),candHit.GetRho(),i);
38  }
39  retVal->setMcTrackId(cand->getMcTrackId());
40  return retVal;
41 }
Int_t i
Definition: run_full.C:25
void setMcTrackId(int i)
set the MCT track id, for MC simulations
Definition: GFTrackCand.h:149
Double_t GetRho() const
Track candidate – a list of cluster indices.
Definition: GFTrackCand.h:55
void addHit(unsigned int detId, unsigned int hitId, double rho=0., unsigned int planeId=0)
Definition: GFTrackCand.cxx:44
Int_t GetHitId() const
Int_t GetDetId() const