29 #include "FairRootManager.h"
30 #include "FairRuntimeDb.h"
31 #include "FairRunAna.h"
32 #include "TClonesArray.h"
57 #include "TLorentzVector.h"
59 #include "FairTrackParH.h"
62 #include "RKTrackRep.h"
65 #include "FairGeanePro.h"
71 fMvdBranchName(
""), fCentralTrackerBranchName(
""),
72 fUseGeane(kTRUE), fPropagateToIP(kTRUE), fPropagateDistance(-1.
f), fPerpPlane(kFALSE), fNumIt(1), fTrackRep(0),
fVerbose(0)
80 FairRootManager* ioman= FairRootManager::Instance();
83 Error(
"PndRecoKalmanFit::Init",
"RootManager not instantiated!");
88 FairRuntimeDb*
rtdb = FairRunAna::Instance()->GetRuntimeDb();
90 TClonesArray *tubeArray = NULL;
97 TClonesArray *ftsTubeArray = NULL;
108 TClonesArray* stripar; TClonesArray* pixelar;
111 stripar=(TClonesArray*) ioman->GetObject(
"MVDHitsStripMix");
115 std::cout <<
"*** PndRecoKalmanFit::Init" <<
"\t" <<
"MVDHitsStripMix array found" << std::endl;
118 pixelar=(TClonesArray*) ioman->GetObject(
"MVDHitsPixelMix");
122 std::cout <<
"*** PndRecoKalmanFit::Init" <<
"\t" <<
"MVDHitsPixelMix array found" << std::endl;
127 stripar=(TClonesArray*) ioman->GetObject(
"MVDHitsStrip");
131 std::cout <<
"*** PndRecoKalmanFit::Init" <<
"\t" <<
"MVDHitsStrip array found" << std::endl;
134 pixelar=(TClonesArray*) ioman->GetObject(
"MVDHitsPixel");
138 std::cout <<
"*** PndRecoKalmanFit::Init" <<
"\t" <<
"MVDHitsPixel array found" << std::endl;
146 sthit=(TClonesArray*) ioman->GetObject(
"STTHitMix");
150 std::cout <<
"*** PndRecoKalmanFit::Init" <<
"\t" <<
"STTHitMix array found" << std::endl;
155 sthit=(TClonesArray*) ioman->GetObject(
"STTHit");
159 std::cout <<
"*** PndRecoKalmanFit::Init" <<
"\t" <<
"SttHit array found" << std::endl;
163 TClonesArray* gemar=(TClonesArray*) ioman->GetObject(
"GEMHit");
167 std::cout <<
"*** PndRecoKalmanFit::Init" <<
"\t" <<
"GEMHit array found" << std::endl;
170 TClonesArray* mdtar=(TClonesArray*) ioman->GetObject(
"MdtHit");
174 std::cout <<
"*** PndRecoKalmanFit::Init" <<
"\t" <<
"MdtHit array found" << std::endl;
177 TClonesArray* ftsar=(TClonesArray*) ioman->GetObject(
"FTSHit");
181 std::cout <<
"*** PndRecoKalmanFit::Init" <<
"\t" <<
"FtsHit array found" << std::endl;
186 fPro =
new FairGeanePro();
191 Error(
"PndRecoKalmanFit::Init",
"Only GEANE Propagatio available!!!");
199 std::cout <<
"===PndRecoKalmanFit::Init() finished ===================================================" << std::endl;
212 if (
fVerbose>0) std::cout<<
"PndRecoKalmanFit::Fit"<<std::endl;
234 FairTrackParH helix(&par, ierr);
236 if (
fVerbose==0) fPro0.SetPrintErrors(kFALSE);
238 fPro0.SetPoint(TVector3(0,0,0));
239 fPro0.PropagateToPCA(1, -1);
240 Bool_t rc = fPro0.Propagate(&helix, &fRes, PDGCode);
243 StartPos.SetXYZ(fRes.GetX(), fRes.GetY(), fRes.GetZ());
244 StartMom.SetXYZ(fRes.GetPx(), fRes.GetPy(), fRes.GetPz());
245 StartPosErr.SetXYZ(fRes.GetDX(), fRes.GetDY(), fRes.GetDZ());
246 StartMomErr.SetXYZ(fRes.GetDPx(), fRes.GetDPy(), fRes.GetDPz());
254 FairTrackParH helix(&par, ierr);
256 if (
fVerbose==0) fPro0.SetPrintErrors(kFALSE);
259 Bool_t rc = fPro0.Propagate(&helix, &fRes, PDGCode);
262 StartPos.SetXYZ(fRes.GetX(), fRes.GetY(), fRes.GetZ());
263 StartMom.SetXYZ(fRes.GetPx(), fRes.GetPy(), fRes.GetPz());
264 StartPosErr.SetXYZ(fRes.GetDX(), fRes.GetDY(), fRes.GetDZ());
265 StartMomErr.SetXYZ(fRes.GetDPx(), fRes.GetDPy(), fRes.GetDPz());
269 TVector3 plane_v1, plane_v2;
272 plane_v1 = StartMom.Orthogonal();
273 plane_v2 = StartMom.Cross(plane_v1);
277 plane_v1.SetXYZ(1.,0.,0.);
278 plane_v2.SetXYZ(0.,1.,0.);
280 GFDetPlane start_pl(StartPos, plane_v1, plane_v2);
286 StartPosErr,StartMomErr,
294 StartPosErr, StartMomErr,
300 std::cout <<
"*** PndRecoKalmanFit::Fit" <<
"\t" <<
"Not existing Track Representation " <<
fTrackRep << std::endl;
317 std::cout <<
"*** PndRecoKalmanFit::Fit" <<
"\t" <<
"Genfit Exception: trk->addHitVector " << e.
what() << std::endl;
327 std::cout<<
"*** PndRecoKalmanFit::Fit" <<
"\t" <<
"FITTER EXCEPTION ***"<<std::endl;
328 std::cout<<e.
what()<<std::endl;
330 if (
fVerbose>0) std::cout<<
"*** PndRecoKalmanFit::Fit" <<
"\t" <<
"SUCCESSFULL FIT!"<<std::endl;
338 std::cout<<
"*** PndRecoKalmanFit::Fit" <<
"\t" <<
"CONVERSION EXCEPTION ***"<<std::endl;
339 std::cout<<e.
what()<<std::endl;
344 if (
fVerbose>0) std::cout<<
"Fitting done"<<std::endl;
Base Class for genfit track representations. Defines interface for track parameterizations.
unsigned int getNumHits() const
TString fCentralTrackerBranchName
Name of the TCA for MVD.
Detector plane genfit geometry class.
Track object for genfit. genfit algorithms work on these objects.
std::vector< GFAbsRecoHit * > createMany(const GFTrackCand &cand)
Creat a collection of RecoHits.
void addProducer(int detID, GFAbsRecoHitProducer *hitProd)
Register a producer module to the factory.
virtual const char * what() const
standard error message handling for exceptions. use like "std::cerr << e.what();" ...
Short_t fTrackRep
Number of iterations.
void addHitVector(std::vector< GFAbsRecoHit * > hits)
Add collection of hits.
Template class for a hit producer module.
Bool_t fPropagateToIP
Flag to use Geane.
void setCandidate(const GFTrackCand &cand, bool doreset=false)
set track candidate
static void quiet(bool b=true)
TString fMvdBranchName
Geane Propagator.
Factory object to create RecoHits from digitized and clustered data.
Track Representation module based on a Runge-Kutta algorithm including a full material model...
Bool_t fPerpPlane
Distance in [cm] to back-propagate the parameters, negative number means no backpropagation.
PndTrackCand GetTrackCand()
TClonesArray * FillTubeArray()
GFTrackCand * PndTrackCand2GenfitTrackCand(PndTrackCand *cand)
void processTrack(GFTrack *trk)
Performs fit on a GFTrack.
friend F32vec4 fabs(const F32vec4 &a)
Int_t fVerbose
(0) GeaneTrackRep, 1 RKTrackRep
static PndGeoHandling * Instance()
Float_t fPropagateDistance
Flag to propagate to the interaction point.
Int_t fNumIt
Flag to use as initial plane the one perpendicular to the track.
const GFTrackCand & getCand() const
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Bool_t fUseGeane
Name of the TCA for central tracker.
void init(GFAbsBField *b)
set the magntic field here. Magnetic field classes must be derived from GFAbsBField ...
PndTrack * GenfitTrack2PndTrack(const GFTrack *tr)
GFRecoHitFactory * fTheRecoHitFactory
static GFFieldManager * getInstance()
TClonesArray * FillTubeArray()
this function will be used in PndFtsHitProducesRealFast
PndTrack * Fit(PndTrack *tBefore, Int_t PDG)
void setNumIterations(Int_t i)
Set number of iterations for Kalman Filter.
FairTrackParP GetParamFirst()