FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndRecoDafFit Class Reference

#include <PndRecoDafFit.h>

Inheritance diagram for PndRecoDafFit:

Public Member Functions

 PndRecoDafFit ()
 
 ~PndRecoDafFit ()
 
void SetGeane (Bool_t opt=kTRUE)
 
void SetPropagateToIP (Bool_t opt=kTRUE)
 
void SetPerpPlane (Bool_t opt=kTRUE)
 
void SetNumIterations (Int_t num)
 
void SetTrackRep (Int_t num)
 
void SetVerbose (Int_t verb)
 
void SetMvdBranchName (const TString &name)
 
void SetCentralTrackerBranchName (const TString &name)
 
Bool_t Init ()
 
PndTrackFit (PndTrack *tBefore, Int_t PDG)
 

Private Member Functions

 ClassDef (PndRecoDafFit, 0)
 Verbose level. More...
 

Private Attributes

GFRecoHitFactoryfTheRecoHitFactory
 
GFDaf fGenFitter
 
FairGeanePro * fPro
 
TString fMvdBranchName
 Geane Propagator. More...
 
TString fCentralTrackerBranchName
 Name of the TCA for MVD. More...
 
Bool_t fUseGeane
 Name of the TCA for central tracker. More...
 
Bool_t fPropagateToIP
 Flag to use Geane. More...
 
Bool_t fPerpPlane
 Flag to propagate to the interaction point. More...
 
Int_t fNumIt
 Flag to use as initial plane the one perpendicular to the track. More...
 
Short_t fTrackRep
 Number of iterations. More...
 
Int_t fVerbose
 (0) GeaneTrackRep, 1 RKTrackRep More...
 

Detailed Description

Definition at line 31 of file PndRecoDafFit.h.

Constructor & Destructor Documentation

PndRecoDafFit::PndRecoDafFit ( )

Definition at line 66 of file PndRecoDafFit.cxx.

References PndGeoHandling::Instance().

66  : TNamed("Genfit", "Fit Tracks"),
68  fUseGeane(kTRUE), fPropagateToIP(kTRUE), fPerpPlane(kFALSE), fNumIt(1), fTrackRep(0), fVerbose(0)
69 {
71 }
Bool_t fUseGeane
Name of the TCA for central tracker.
Definition: PndRecoDafFit.h:63
Short_t fTrackRep
Number of iterations.
Definition: PndRecoDafFit.h:67
TString fCentralTrackerBranchName
Name of the TCA for MVD.
Definition: PndRecoDafFit.h:61
Bool_t fPerpPlane
Flag to propagate to the interaction point.
Definition: PndRecoDafFit.h:65
Bool_t fPropagateToIP
Flag to use Geane.
Definition: PndRecoDafFit.h:64
TString fMvdBranchName
Geane Propagator.
Definition: PndRecoDafFit.h:60
Int_t fNumIt
Flag to use as initial plane the one perpendicular to the track.
Definition: PndRecoDafFit.h:66
static PndGeoHandling * Instance()
Int_t fVerbose
(0) GeaneTrackRep, 1 RKTrackRep
Definition: PndRecoDafFit.h:68
PndRecoDafFit::~PndRecoDafFit ( )

Definition at line 184 of file PndRecoDafFit.cxx.

184 { }

Member Function Documentation

PndRecoDafFit::ClassDef ( PndRecoDafFit  ,
 
)
private

Verbose level.

PndTrack * PndRecoDafFit::Fit ( PndTrack tBefore,
Int_t  PDG 
)

Definition at line 186 of file PndRecoDafFit.cxx.

References GFTrack::addHitVector(), Bool_t, GFRecoHitFactory::createMany(), fabs(), fGenFitter, fPerpPlane, fPro, fPropagateToIP, fTheRecoHitFactory, fTrackRep, fVerbose, GenfitTrack2PndTrack(), GFTrack::getCand(), GFTrack::getNumHits(), PndTrack::GetParamFirst(), PndTrack::GetTrackCand(), par, PndTrackCand2GenfitTrackCand(), GFDaf::processTrack(), GFTrack::setCandidate(), PndTrack::SetFlag(), GeaneTrackRep::setPropDir(), trk, and GFException::what().

Referenced by PndRecoKalmanTask::Exec().

187 {
188  PndTrack* tAfter = NULL;
189  if (fVerbose>0) std::cout<<"PndRecoDafFit::Fit"<<std::endl;
190  if (fabs(tBefore->GetParamFirst().GetPz())<1e-9)
191  {
192  tAfter = tBefore;
193  tAfter->SetFlag(-10);
194  return tAfter; // flag -10 : pz==0
195  }
196 
197  Int_t fCharge= tBefore->GetParamFirst().GetQ();
198  Int_t PDGCode= PDG;
199  TVector3 StartPos(tBefore->GetParamFirst().GetX(),tBefore->GetParamFirst().GetY(),tBefore->GetParamFirst().GetZ());
200  TVector3 StartMom(tBefore->GetParamFirst().GetPx(),tBefore->GetParamFirst().GetPy(),tBefore->GetParamFirst().GetPz());
201  TVector3 StartPosErr(tBefore->GetParamFirst().GetDX(),tBefore->GetParamFirst().GetDY(),tBefore->GetParamFirst().GetDZ());
202  TVector3 StartMomErr(tBefore->GetParamFirst().GetDPx(),tBefore->GetParamFirst().GetDPy(),tBefore->GetParamFirst().GetDPz());
203 
204  GFAbsTrackRep* rep = 0;
205 
206  if (fPropagateToIP)
207  {
208  // Calculating params at PCA to Origin
209  FairTrackParP par = tBefore->GetParamFirst();
210  Int_t ierr = 0;
211  FairTrackParH *helix = new FairTrackParH(&par, ierr);
212  FairGeanePro *fPro0 = new FairGeanePro();
213  FairTrackParH *fRes= new FairTrackParH();
214  fPro0->SetPoint(TVector3(0,0,0));
215  fPro0->PropagateToPCA(1, -1);
216  Bool_t rc = fPro0->Propagate(helix, fRes, PDGCode);
217  if (rc)
218  {
219  StartPos.SetXYZ(fRes->GetX(), fRes->GetY(), fRes->GetZ());
220  StartMom.SetXYZ(fRes->GetPx(), fRes->GetPy(), fRes->GetPz());
221  StartPosErr.SetXYZ(fRes->GetDX(), fRes->GetDY(), fRes->GetDZ());
222  StartMomErr.SetXYZ(fRes->GetDPx(), fRes->GetDPy(), fRes->GetDPz());
223  }
224  }
225 
226  TVector3 plane_v1, plane_v2;
227  if (fPerpPlane)
228  {
229  plane_v1 = StartMom.Orthogonal();
230  plane_v2 = StartMom.Cross(plane_v1);
231  }
232  else
233  {
234  plane_v1.SetXYZ(1.,0.,0.);
235  plane_v2.SetXYZ(0.,1.,0.);
236  }
237  GFDetPlane start_pl(StartPos, plane_v1, plane_v2);
238  GFTrack* trk;
239  if (fTrackRep==0)
240  {
241  GeaneTrackRep *grep = new GeaneTrackRep(fPro,
242  start_pl,StartMom,
243  StartPosErr,StartMomErr,
244  fCharge,PDGCode);
245  grep->setPropDir(1);
246  rep = grep;
247  }
248  else if (fTrackRep==1)
249  {
250  RKTrackRep *grep = new RKTrackRep(StartPos, StartMom,
251  StartPosErr, StartMomErr,
252  PDGCode);
253  rep = grep;
254  }
255  else
256  {
257  std::cout << "*** PndRecoDafFit::Fit" << "\t" << "Not existing Track Representation " << fTrackRep << std::endl;
258  return NULL; // any smarted ideas?
259  }
260 
261  trk= new GFTrack(rep);
262 
263  PndTrackCand trackCand = tBefore->GetTrackCand();
264  trk->setCandidate(*PndTrackCand2GenfitTrackCand(&trackCand));
265 
266  // Load RecoHits
267  try
268  {
270  if (fVerbose>0) std::cout<<trk->getNumHits()<<" hits in track " << std::endl;
271  }
272  catch(GFException& e)
273  {
274  std::cout << "*** PndRecoDafFit::Fit" << "\t" << "Genfit Exception: trk->addHitVector " << e.what() << std::endl;
275  //throw e;
276  }
277  // Start Fitter
278  try
279  {
281  }
282  catch (GFException& e)
283  {
284  std::cout<<"*** PndRecoDafFit::Fit" << "\t" << "FITTER EXCEPTION ***"<<std::endl;
285  std::cout<<e.what()<<std::endl;
286  }
287 
288  if (fVerbose>0) std::cout<<"*** PndRecoDafFit::Fit" << "\t" << "SUCCESSFULL FIT!"<<std::endl;
289 
290  try
291  {
292  tAfter = (PndTrack*)GenfitTrack2PndTrack(trk);
293  }
294  catch (GFException e)
295  {
296  std::cout<<"*** PndRecoDafFit::Fit" << "\t" << "CONVERSION EXCEPTION ***"<<std::endl;
297  std::cout<<e.what()<<std::endl;
298  tAfter = tBefore;
299  tAfter->SetFlag(-2); // flag -2: conversion failed
300  }
301 
302  if (fVerbose>0) std::cout<<"Fitting done"<<std::endl;
303 
304  return tAfter;
305 }
Base Class for genfit track representations. Defines interface for track parameterizations.
Definition: GFAbsTrackRep.h:80
unsigned int getNumHits() const
Definition: GFTrack.h:148
Detector plane genfit geometry class.
Definition: GFDetPlane.h:59
Track object for genfit. genfit algorithms work on these objects.
Definition: GFTrack.h:60
std::vector< GFAbsRecoHit * > createMany(const GFTrackCand &cand)
Creat a collection of RecoHits.
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
Double_t par[3]
void addHitVector(std::vector< GFAbsRecoHit * > hits)
Add collection of hits.
Definition: GFTrack.h:310
Short_t fTrackRep
Number of iterations.
Definition: PndRecoDafFit.h:67
void setCandidate(const GFTrackCand &cand, bool doreset=false)
set track candidate
Definition: GFTrack.cxx:148
Bool_t fPerpPlane
Flag to propagate to the interaction point.
Definition: PndRecoDafFit.h:65
Bool_t fPropagateToIP
Flag to use Geane.
Definition: PndRecoDafFit.h:64
Track Representation module based on a Runge-Kutta algorithm including a full material model...
PndTrackCand GetTrackCand()
Definition: PndTrack.h:47
void setPropDir(int d)
void processTrack(GFTrack *trk)
Process a track using the DAF.
Definition: GFDaf.cxx:30
GFTrackCand * PndTrackCand2GenfitTrackCand(PndTrackCand *cand)
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
GFTrack * trk
Definition: checkgenfit.C:13
const GFTrackCand & getCand() const
Definition: GFTrack.h:142
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:45
PndTrack * GenfitTrack2PndTrack(const GFTrack *tr)
void SetFlag(Int_t i)
Definition: PndTrack.h:38
Int_t fVerbose
(0) GeaneTrackRep, 1 RKTrackRep
Definition: PndRecoDafFit.h:68
FairGeanePro * fPro
Definition: PndRecoDafFit.h:58
GFRecoHitFactory * fTheRecoHitFactory
Definition: PndRecoDafFit.h:55
FairTrackParP GetParamFirst()
Definition: PndTrack.h:49
Bool_t PndRecoDafFit::Init ( )

Definition at line 73 of file PndRecoDafFit.cxx.

References GFRecoHitFactory::addProducer(), fCentralTrackerBranchName, PndSttMapCreator::FillTubeArray(), fMvdBranchName, fPro, fTheRecoHitFactory, fTrackRep, fUseGeane, fVerbose, PndGeoSttPar::GetGeometryType(), GFFieldManager::getInstance(), GFFieldManager::init(), GFException::quiet(), and rtdb.

Referenced by PndRecoKalmanTask::Init().

74 {
75  //Get ROOT Manager
76  FairRootManager* ioman= FairRootManager::Instance();
77  if(ioman==0)
78  {
79  Error("PndRecoDafFit::Init","RootManager not instantiated!");
80  return kFALSE;
81  }
82 
83  // STT map loading
84  FairRuntimeDb* rtdb = FairRunAna::Instance()->GetRuntimeDb();
85  PndGeoSttPar *sttParameters = (PndGeoSttPar*) rtdb->getContainer("PndGeoSttPar");
86  TClonesArray *tubeArray = NULL;
87  if(sttParameters->GetGeometryType() != -1) {
88  PndSttMapCreator *mapper = new PndSttMapCreator(sttParameters);
89  tubeArray = mapper->FillTubeArray();
90  }
91 
92  // Build hit factory -----------------------------
94  if (fVerbose<2) GFException::quiet(true);
95 
96  TClonesArray* stripar; TClonesArray* pixelar;
97  if (fMvdBranchName == "Mix")
98  {
99  stripar=(TClonesArray*) ioman->GetObject("MVDHitsStripMix");
100  if(stripar!=0)
101  {
102  fTheRecoHitFactory->addProducer(FairRootManager::Instance()->GetBranchId("MVDHitsStripMix"),new GFRecoHitProducer<PndSdsHit,PndSdsRecoHit>(stripar));
103  std::cout << "*** PndRecoDafFit::Init" << "\t" << "MVDHitsStripMix array found" << std::endl;
104  }
105 
106  pixelar=(TClonesArray*) ioman->GetObject("MVDHitsPixelMix");
107  if(pixelar!=0)
108  {
109  fTheRecoHitFactory->addProducer(FairRootManager::Instance()->GetBranchId("MVDHitsPixelMix"),new GFRecoHitProducer<PndSdsHit,PndSdsRecoHit>(pixelar));
110  std::cout << "*** PndRecoDafFit::Init" << "\t" << "MVDHitsPixelMix array found" << std::endl;
111  }
112  }
113  else
114  {
115  stripar=(TClonesArray*) ioman->GetObject("MVDHitsStrip");
116  if(stripar!=0)
117  {
118  fTheRecoHitFactory->addProducer(FairRootManager::Instance()->GetBranchId("MVDHitsStrip"),new GFRecoHitProducer<PndSdsHit,PndSdsRecoHit>(stripar));
119  std::cout << "*** PndRecoDafFit::Init" << "\t" << "MVDHitsStrip array found" << std::endl;
120  }
121 
122  pixelar=(TClonesArray*) ioman->GetObject("MVDHitsPixel");
123  if(pixelar!=0)
124  {
125  fTheRecoHitFactory->addProducer(FairRootManager::Instance()->GetBranchId("MVDHitsPixel"),new GFRecoHitProducer<PndSdsHit,PndSdsRecoHit>(pixelar));
126  std::cout << "*** PndRecoDafFit::Init" << "\t" << "MVDHitsPixel array found" << std::endl;
127  }
128  }
129 
130  TClonesArray* sthit; //TClonesArray *sttr; //[R.K. 01/2017] unused variable?
131 
132  if (fCentralTrackerBranchName == "Mix")
133  {
134  sthit=(TClonesArray*) ioman->GetObject("STTHitMix");
135  if(sthit!=0)
136  {
137  fTheRecoHitFactory->addProducer(FairRootManager::Instance()->GetBranchId("STTHitMix"),new PndSttRecoHitProducer<PndSttHit,PndSttRecoHit>(sthit, tubeArray));
138  std::cout << "*** PndRecoDafFit::Init" << "\t" << "STTHitMix array found" << std::endl;
139  }
140  }
141  else
142  {
143  sthit=(TClonesArray*) ioman->GetObject("STTHit");
144  if(sthit!=0)
145  {
146  fTheRecoHitFactory->addProducer(FairRootManager::Instance()->GetBranchId("STTHit"),new PndSttRecoHitProducer<PndSttHit,PndSttRecoHit>(sthit, tubeArray));
147  std::cout << "*** PndRecoDafFit::Init" << "\t" << "SttHit array found" << std::endl;
148  }
149  }
150 
151  TClonesArray* gemar=(TClonesArray*) ioman->GetObject("GEMHit");
152  if(gemar!=0)
153  {
154  fTheRecoHitFactory->addProducer(FairRootManager::Instance()->GetBranchId("GEMHit"),new GFRecoHitProducer<PndGemHit,PndGemRecoHit>(gemar));
155  std::cout << "*** PndRecoDafFit::Init" << "\t" << "GEMHit array found" << std::endl;
156  }
157 
158  TClonesArray* mdtar=(TClonesArray*) ioman->GetObject("MdtHit");
159  if(mdtar!=0)
160  {
161  fTheRecoHitFactory->addProducer(FairRootManager::Instance()->GetBranchId("MdtHit"),new GFRecoHitProducer<PndMdtHit,PndMdtRecoHit>(mdtar));
162  std::cout << "*** PndRecoDafFit::Init" << "\t" << "MdtHit array found" << std::endl;
163  }
164 
165  if (fUseGeane)
166  {
167  fPro = new FairGeanePro();
168  }
169  else
170  {
171  Error("PndRecoDafFit::Init","Only GEANE Propagatio available!!!");
172  return kFALSE;
173  }
174 
175  //fGenFitter.setNumIterations(fNumIt);
177 
178  std::cout << "===PndRecoDafFit::Init() finished ===================================================" << std::endl;
179 
180  return kTRUE;
181 }
Bool_t fUseGeane
Name of the TCA for central tracker.
Definition: PndRecoDafFit.h:63
void addProducer(int detID, GFAbsRecoHitProducer *hitProd)
Register a producer module to the factory.
Template class for a hit producer module.
Short_t fTrackRep
Number of iterations.
Definition: PndRecoDafFit.h:67
Int_t GetGeometryType()
Definition: PndGeoSttPar.h:28
static void quiet(bool b=true)
Definition: GFException.h:93
Magnetic field.
TString fCentralTrackerBranchName
Name of the TCA for MVD.
Definition: PndRecoDafFit.h:61
Factory object to create RecoHits from digitized and clustered data.
TString fMvdBranchName
Geane Propagator.
Definition: PndRecoDafFit.h:60
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
TClonesArray * FillTubeArray()
void init(GFAbsBField *b)
set the magntic field here. Magnetic field classes must be derived from GFAbsBField ...
static GFFieldManager * getInstance()
Int_t fVerbose
(0) GeaneTrackRep, 1 RKTrackRep
Definition: PndRecoDafFit.h:68
FairGeanePro * fPro
Definition: PndRecoDafFit.h:58
GFRecoHitFactory * fTheRecoHitFactory
Definition: PndRecoDafFit.h:55
void PndRecoDafFit::SetCentralTrackerBranchName ( const TString name)
inline

Definition at line 47 of file PndRecoDafFit.h.

References fCentralTrackerBranchName, and name.

Referenced by PndRecoKalmanTask::Init().

TString fCentralTrackerBranchName
Name of the TCA for MVD.
Definition: PndRecoDafFit.h:61
TString name
void PndRecoDafFit::SetGeane ( Bool_t  opt = kTRUE)
inline

Definition at line 40 of file PndRecoDafFit.h.

References fUseGeane.

Referenced by PndRecoKalmanTask::Init().

40 { fUseGeane = opt; }
Bool_t fUseGeane
Name of the TCA for central tracker.
Definition: PndRecoDafFit.h:63
void PndRecoDafFit::SetMvdBranchName ( const TString name)
inline

Definition at line 46 of file PndRecoDafFit.h.

References fMvdBranchName, and name.

Referenced by PndRecoKalmanTask::Init().

46 { fMvdBranchName = name; }
TString fMvdBranchName
Geane Propagator.
Definition: PndRecoDafFit.h:60
TString name
void PndRecoDafFit::SetNumIterations ( Int_t  num)
inline

Definition at line 43 of file PndRecoDafFit.h.

References fNumIt, and num.

43 { fNumIt = num; }
int num[96]
Definition: ranlxd.cxx:381
Int_t fNumIt
Flag to use as initial plane the one perpendicular to the track.
Definition: PndRecoDafFit.h:66
void PndRecoDafFit::SetPerpPlane ( Bool_t  opt = kTRUE)
inline

Definition at line 42 of file PndRecoDafFit.h.

References fPerpPlane.

Referenced by PndRecoKalmanTask::Init().

42 { fPerpPlane = opt; }
Bool_t fPerpPlane
Flag to propagate to the interaction point.
Definition: PndRecoDafFit.h:65
void PndRecoDafFit::SetPropagateToIP ( Bool_t  opt = kTRUE)
inline

Definition at line 41 of file PndRecoDafFit.h.

References fPropagateToIP.

Referenced by PndRecoKalmanTask::Init().

41 { fPropagateToIP = opt;}
Bool_t fPropagateToIP
Flag to use Geane.
Definition: PndRecoDafFit.h:64
void PndRecoDafFit::SetTrackRep ( Int_t  num)
inline

Definition at line 44 of file PndRecoDafFit.h.

References fTrackRep, and num.

Referenced by PndRecoKalmanTask::Init().

44 { fTrackRep = num; }
int num[96]
Definition: ranlxd.cxx:381
Short_t fTrackRep
Number of iterations.
Definition: PndRecoDafFit.h:67
void PndRecoDafFit::SetVerbose ( Int_t  verb)
inline

Definition at line 45 of file PndRecoDafFit.h.

References fVerbose.

Referenced by PndRecoKalmanTask::Init().

45 { fVerbose = verb; }
Int_t fVerbose
(0) GeaneTrackRep, 1 RKTrackRep
Definition: PndRecoDafFit.h:68

Member Data Documentation

TString PndRecoDafFit::fCentralTrackerBranchName
private

Name of the TCA for MVD.

Definition at line 61 of file PndRecoDafFit.h.

Referenced by Init(), and SetCentralTrackerBranchName().

GFDaf PndRecoDafFit::fGenFitter
private

Definition at line 56 of file PndRecoDafFit.h.

Referenced by Fit().

TString PndRecoDafFit::fMvdBranchName
private

Geane Propagator.

Definition at line 60 of file PndRecoDafFit.h.

Referenced by Init(), and SetMvdBranchName().

Int_t PndRecoDafFit::fNumIt
private

Flag to use as initial plane the one perpendicular to the track.

Definition at line 66 of file PndRecoDafFit.h.

Referenced by SetNumIterations().

Bool_t PndRecoDafFit::fPerpPlane
private

Flag to propagate to the interaction point.

Definition at line 65 of file PndRecoDafFit.h.

Referenced by Fit(), and SetPerpPlane().

FairGeanePro* PndRecoDafFit::fPro
private

Definition at line 58 of file PndRecoDafFit.h.

Referenced by Fit(), and Init().

Bool_t PndRecoDafFit::fPropagateToIP
private

Flag to use Geane.

Definition at line 64 of file PndRecoDafFit.h.

Referenced by Fit(), and SetPropagateToIP().

GFRecoHitFactory* PndRecoDafFit::fTheRecoHitFactory
private

Definition at line 55 of file PndRecoDafFit.h.

Referenced by Fit(), and Init().

Short_t PndRecoDafFit::fTrackRep
private

Number of iterations.

Definition at line 67 of file PndRecoDafFit.h.

Referenced by Fit(), Init(), and SetTrackRep().

Bool_t PndRecoDafFit::fUseGeane
private

Name of the TCA for central tracker.

Definition at line 63 of file PndRecoDafFit.h.

Referenced by Init(), and SetGeane().

Int_t PndRecoDafFit::fVerbose
private

(0) GeaneTrackRep, 1 RKTrackRep

Definition at line 68 of file PndRecoDafFit.h.

Referenced by Fit(), Init(), and SetVerbose().


The documentation for this class was generated from the following files: