17 #include "FairBaseParSet.h"
18 #include "FairDetector.h"
19 #include "FairRootManager.h"
20 #include "FairRunAna.h"
21 #include "FairRuntimeDb.h"
25 #include "TClonesArray.h"
65 fArrayKFTrdHit(new TClonesArray(
"CbmKFTrdHit"))
68 , fArrayTrdTrack(NULL)
93 fh_pullx_plane_true(0)
95 fh_pully_plane_true(0)
97 fh_pullx_plane_fake(0)
99 fh_pully_plane_fake(0)
117 fArrayStsTrackM(NULL)
119 fArrayKFTrdHit(new TClonesArray(
"CbmKFTrdHit"))
122 , fArrayTrdTrack(NULL)
135 fh_resx_plane_true(0)
137 fh_resy_plane_true(0)
139 fh_resx_plane_fake(0)
141 fh_resy_plane_fake(0)
147 fh_pullx_plane_true(0)
149 fh_pully_plane_true(0)
151 fh_pullx_plane_fake(0)
153 fh_pully_plane_fake(0)
191 TClonesArray* trackArray) {
193 if (NULL == hitArray) {
return 0; }
212 cout <<
"---------------------------------------" << endl
213 <<
"-I- CbmL1TrdTrackFinderSts -I-" << endl
214 <<
"-I- Event summary -I-" << endl
217 <<
"-I- TRD tracks found : " << nTrdTracks << endl
218 <<
"-I- TRD tracks lost : " <<
fLostTracks.size() << endl
219 <<
"---------------------------------------" << endl
222 cout <<
"-I- CbmL1TrdTrackFinderSts::DoFind : " << nTrdTracks
223 <<
" TRD tracks found." << endl;
233 cout <<
"-I- CbmL1TrdTrackFinder : " <<
fEvents <<
" events processed"
304 for (Int_t iStsTrack = 0; iStsTrack < nStsTrack; iStsTrack++) {
306 stsTrack = L1_DYNAMIC_CAST<CbmStsTrack*>(
fArrayStsTrack->At(iStsTrack));
307 if (NULL == stsTrack)
continue;
329 cout <<
"TRD track created from STS track " << iStsTrack << endl;
343 vector<CbmTrdTrack*>::iterator iter;
354 cout <<
"track candidates: " <<
fvTrdTrack.size() <<
"." << endl;
364 vector<CbmTrdTrack*>::iterator iter;
382 const Int_t& station) {
399 Double_t chi2hit = 0;
401 Int_t indexOfClosest;
409 if (stsTrackIndex < 0) { Fatal(
"ProcessStation",
"Invalid track index"); }
417 if (pTrack->
GetFlag()) {
return; }
432 for (Int_t iHit = 0; iHit <
fNoTrdHits[plane]; iHit++) {
439 pHit = L1_DYNAMIC_CAST<CbmTrdHit*>(
fArrayTrdHit->At(hitIndex));
442 trdPoint = L1_DYNAMIC_CAST<CbmTrdPoint*>(
fArrayTrdPoint->At(pointIndex));
443 trdPoint->Position(
pos);
447 if (
finite(c1) && c1 > 1.e-10)
448 c1 = (T[0] -
pos.X()) / TMath::Sqrt(c1);
451 if (
finite(c2) && c2 > 1.e-10)
452 c2 = (T[1] -
pos.Y()) / TMath::Sqrt(c2);
456 if (trdPoint->GetTrackID() == trackID) {
480 if (kFALSE ==
Overlap(kfTrack, pHit)) {
481 if (trdPoint->GetTrackID() == trackID) {
483 cout <<
"-W- Lost true hit: plane:" << plane <<
" track: ("
484 << T[0] <<
", " << T[1] <<
") ("
485 << TMath::Sqrt(TMath::Abs(kfTrack.
GetCovMatrix()[0])) <<
", "
487 <<
"), hit: (" << pHit->
GetX() <<
", " << pHit->
GetY()
488 <<
") (" << pHit->
GetDx() <<
", " << pHit->
GetDy()
489 <<
"), point: (" <<
pos.X() <<
", " <<
pos.Y() <<
")"
503 if (chi2hit < minChi2) {
505 indexOfClosest = hitIndex;
511 if (indexOfClosest != -1) {
549 pHit = L1_DYNAMIC_CAST<CbmTrdHit*>(
fArrayTrdHit->At(hitIndex));
553 pKFHit = L1_DYNAMIC_CAST<CbmKFTrdHit*>(
fArrayKFTrdHit->At(hitIndex));
555 pKFHit->
Filter(kfTrack, kTRUE, qp0);
562 if (pTrack->
GetChiSq() /
static_cast<Double_t
>(pTrack->
GetNDF()) > 100)
573 for (vector<CbmTrdTrack*>::iterator iter =
fvTrdTrack.begin();
593 map<Int_t, Bool_t> mapStsTrackUsed;
604 vector<CbmTrdTrack*>::iterator iter;
618 for (Int_t iHit = 0; iHit < nHits; iHit++) {
626 if (n_false > 0) { track->
SetFlag(1); }
638 for (Int_t iHit = 0; iHit < nHits; iHit++) {
658 if (pHit->
GetDx() < 1e-9 && pHit->
GetDy() < 1e-9) {
671 Double_t x2 = pHit->
GetX();
672 Bool_t overlap_x = TMath::Abs(x1 - x2) < 7;
674 Double_t y2 = pHit->
GetY();
675 Bool_t overlap_y = TMath::Abs(y1 - y2) < 7;
676 overlap = overlap_x && overlap_y;
702 Double_t x2 = pHit->
GetX();
703 Double_t dx2 = pHit->
GetDx();
704 Bool_t overlap_x = TMath::Abs(x1 - x2) <= (1.117 * 3 + 3 * dx2);
706 Double_t y2 = pHit->
GetY();
707 Double_t dy2 = pHit->
GetDy();
708 Bool_t overlap_y = TMath::Abs(y1 - y2) <= (1.314 * 3 + 3 * dy2);
709 overlap = overlap_x && overlap_y;
722 && pHit->
GetDy() < 1e-14) {
728 chi2 = 0.5 * (dx * dx * c0 - 2 * dx * dy * c1 + dy * dy * c2)
729 / (c0 * c2 - c1 * c1);
750 new TH1F(
"h_chi2hit",
"Normalized distance to hit", 500, 0., 50.);
752 "Normalized distance to hit vs. plane number",
761 new TH2F(
"h_resx_plane_true",
"", 200, -10., 10., 12, 0., 12.);
763 new TH2F(
"h_resy_plane_true",
"", 200, -10., 10., 12, 0., 12.);
765 new TH2F(
"h_resx_plane_fake",
"", 200, -10., 10., 12, 0., 12.);
767 new TH2F(
"h_resy_plane_fake",
"", 200, -10., 10., 12, 0., 12.);
769 new TH2F(
"h_resx_mom_true",
"", 200, -10., 10., 100, 0., 10.);
771 new TH2F(
"h_resy_mom_true",
"", 200, -10., 10., 100, 0., 10.);
774 new TH2F(
"h_pullx_plane_true",
"", 200, -10., 10., 12, 0., 12.);
776 new TH2F(
"h_pully_plane_true",
"", 200, -10., 10., 12, 0., 12.);
778 new TH2F(
"h_pullx_plane_fake",
"", 200, -10., 10., 12, 0., 12.);
780 new TH2F(
"h_pully_plane_fake",
"", 200, -10., 10., 12, 0., 12.);
790 FairRootManager*
rootMgr = FairRootManager::Instance();
792 cout <<
"-E- CbmL1TrdTrackFinderSts::DataBranches : "
793 <<
"ROOT manager is not instantiated" << endl;
798 L1_DYNAMIC_CAST<TClonesArray*>(
rootMgr->GetObject(
"TrdPoint"));
800 cout <<
"-W- CbmL1TrdTrackFinderSts::DataBranches : "
801 <<
"no TRD point array" << endl;
805 L1_DYNAMIC_CAST<TClonesArray*>(
rootMgr->GetObject(
"StsTrack"));
807 cout <<
"-W- CbmL1TrdTrackFinderSts::DataBranches : "
808 <<
"no STS track array" << endl;
812 L1_DYNAMIC_CAST<TClonesArray*>(
rootMgr->GetObject(
"StsTrackMatch"));
814 cout <<
"-W- CbmL1TrdTrackFinderSts::DataBranches : "
815 <<
"no STS track match array" << endl;
826 FairRunAna* ana = FairRunAna::Instance();
828 cout <<
"-E- CbmL1TrdTrackFinderSts::TrdLayout :"
829 <<
" no FairRunAna object!" << endl;
833 FairRuntimeDb* rtdb = ana->GetRuntimeDb();
835 cout <<
"-E- CbmL1TrdTrackFinderSts::TrdLayout :"
836 <<
" no runtime database!" << endl;
840 FairBaseParSet* baseParSet =
841 L1_DYNAMIC_CAST<FairBaseParSet*>(rtdb->getContainer(
"FairBaseParSet"));
842 if (NULL == baseParSet) {
843 cout <<
"-E- CbmL1TrdTrackFinderSts::TrdLayout :"
844 <<
" no container of base parameters!" << endl;
848 TObjArray* detList = baseParSet->GetDetList();
849 if (NULL == detList) {
850 cout <<
"-E- CbmL1TrdTrackFinderSts::TrdLayout :"
851 <<
" no detector list!" << endl;
856 L1_DYNAMIC_CAST<FairDetector*>(detList->FindObject(
"TRD"));
858 cout <<
"-E- CbmL1TrdTrackFinderSts::TrdLayout :"
859 <<
" no TRD detector!" << endl;
863 TString name = trd->GetGeometryFileName();
864 if (name.Contains(
"9")) {
865 cout <<
"-I- CbmL1TrdTrackFinderSts::TrdLayout :"
866 <<
" TRD geometry : 3x3." << endl;
869 }
else if (name.Contains(
"12")) {
870 cout <<
"-I- CbmL1TrdTrackFinderSts::TrdLayout :"
871 <<
" TRD geometry : 3x4." << endl;
874 }
else if (name.Contains(
"6x2")) {
875 cout <<
"-I- CbmL1TrdTrackFinderSts::TrdLayout :"
876 <<
" TRD geometry : 6x2." << endl;
879 }
else if (name.Contains(
"standard")) {
880 cout <<
"-I- CbmL1TrdTrackFinderSts::TrdLayout :"
881 <<
" TRD geometry : 3x4 standard." << endl;
892 for (Int_t
i = 0;
i < 12;
i++) {
899 Int_t planeNumber = 0;
901 for (Int_t iHit = 0; iHit < nTrdHits; iHit++) {
903 hit = L1_DYNAMIC_CAST<CbmTrdHit*>(
fArrayTrdHit->At(iHit));
904 if (NULL == hit)
continue;
911 if (planeNumber < 0 || planeNumber > 12) {
912 cout <<
"-W- CbmL1TrdTrackFinderSts::SortTrdHits : "
913 <<
"wrong plane number." << endl;
922 cout << endl <<
"-I- CbmL1TrdTrackFinderSts::SortTrdHits : " << endl;
924 cout <<
"TRD plane no. " <<
i <<
" has " <<
fNoTrdHits[
i] <<
" hits"