Skip to content
Snippets Groups Projects
Commit 8034e539 authored by Alexandru Bercuci's avatar Alexandru Bercuci Committed by Sergey Gorbunov
Browse files

add the basic functionality of track fitting for each measured point

parent 18b04a0f
1 merge request!1702reco QA task to monitor reconstruction using tracks.
......@@ -2,9 +2,14 @@
SPDX-License-Identifier: GPL-3.0-only
Authors: Alexandru Bercuci [committer] */
// CBM headers
#include "CbmGlobalTrack.h"
#include "CbmRecoQaTask.h"
// FAIR headers
#include "FairRootManager.h"
// ROOT headers
#include "TClonesArray.h"
//#include "TObject.h"
//_____________________________________________________________________
CbmRecoQaTask::CbmRecoQaTask() : FairTask("RecoQA", 0)
......@@ -30,12 +35,69 @@ InitStatus CbmRecoQaTask::Init()
return kERROR;
}
return kSUCCESS;
fGlobalTracks = static_cast<TClonesArray*>(ioman->GetObject("GlobalTrack"));
if (!fGlobalTracks) {
LOG(error) << "CbmRecoQaTask::Init: Global track array not found!";
return kERROR;
}
fGlobalTrackMatches = static_cast<TClonesArray*>(ioman->GetObject("GlobalTrackMatch"));
if (!fGlobalTrackMatches) {
LOG(warn) << "CbmRecoQaTask::Init: MC info for Global track not available !";
}
return kSUCCESS;
}
//_____________________________________________________________________
void CbmRecoQaTask::Exec(Option_t*)
{
for (int iTr = 0; iTr < fGlobalTracks->GetEntriesFast(); iTr++) {
// if (static_cast<int>(fTracks.size()) >= fMaxNtracks) {
// break;
// }
const CbmGlobalTrack* globalTrack = dynamic_cast<const CbmGlobalTrack*>(fGlobalTracks->At(iTr));
if (!globalTrack) {
LOG(fatal) << "RecoQA: null pointer to the global track!";
break;
}
CbmKfTrackFitter::Track trk;
if (!fFitter.CreateGlobalTrack(trk, *globalTrack)) {
LOG(fatal) << "RecoQA: can not create the global track for the fit! ";
break;
}
trk.fNodes.insert(trk.fNodes.begin(), CbmKfTrackFitter::FitNode());
trk.fMsQp0 = 1. / 0.5;
trk.fIsMsQp0Set = true;
// try first fit with all hits ON
trk.MakeConsistent();
fFitter.FitTrack(trk);
CbmKfTrackFitter::FitNode &node = trk.fNodes.front();
printf("val @ vx %f fit %f\n", node.fMxy.X()[0], node.fTrack.X()[0]);
for (auto& n : trk.fNodes) {
n.fIsTimeSet = false;
n.fIsXySet = false;
trk.MakeConsistent();
fFitter.FitTrack(trk);
double dx = n.fMxy.X()[0] - n.fTrack.X()[0],
dy = n.fMxy.Y()[0] - n.fTrack.Y()[0],
pullx = dx / sqrt(n.fMxy.Dx2()[0] + n.fTrack.GetCovariance(0, 0)[0]),
pully = dy / sqrt(n.fMxy.Dy2()[0] + n.fTrack.GetCovariance(1, 1)[0]);
}
// //if (t.fNstsHits < 1) continue;
// //if (t.fNtrdHits < 2) continue;
// if (t.fNstsHits + t.fNmuchHits + t.fNtrd1dHits + t.fNtrd2dHits + t.fNtofHits < fNtrackingStations - 1) continue;
// //if (t.fNtrdHits < 3) continue;
// if (t.fNstsHits < 2) continue;
// if (t.fNtofHits < 2) continue;
//
fFitter.FitTrack(trk);
fTracks.push_back(trk);
}
}
//_____________________________________________________________________
......
......@@ -8,8 +8,9 @@
#include "FairTask.h"
#include "CbmKfTrackFitter.h"
#include <vector>
class TClonesArray;
class CbmRecoQaTask : public FairTask {
public:
CbmRecoQaTask();
......@@ -27,7 +28,10 @@ private:
CbmRecoQaTask& operator=(const CbmRecoQaTask&);
CbmKfTrackFitter fFitter;
TClonesArray* fGlobalTracks = nullptr; //! reconstructed global tracks / event
TClonesArray* fGlobalTrackMatches = nullptr; //! MC info for the global tracks
std::vector<CbmKfTrackFitter::Track> fTracks;
ClassDef(CbmRecoQaTask, 1);
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment