14 #include "CbmGeoTrdPar.h"
25 #include "FairBaseParSet.h"
26 #include "FairDetector.h"
27 #include "FairGeoNode.h"
28 #include "FairMCPoint.h"
29 #include "FairRootManager.h"
30 #include "FairRunAna.h"
31 #include "FairRuntimeDb.h"
33 #include "TClonesArray.h"
36 #include "TLinearFitter.h"
67 , fArrayTrdHit(new TClonesArray(
"CbmTrdHit"))
68 , fArrayTrdTrack(new TClonesArray(
"CbmTrdTrack"))
115 , totCreateSegments(0)
116 , totFindNeighbour(0)
125 , totSecondLoopTime(0)
126 , totThirdLoopTime(0)
130 , fh_chi2hit_plane(0)
140 , fMomDistLongPrimaryX(0)
141 , fMomDistLongPrimaryY(0)
142 , fMomDistLongExtraX(0)
143 , fMomDistLongExtraY(0)
144 , fMomDistExtrapolPrimaryX(0)
145 , fMomDistExtrapolPrimaryY(0)
146 , fMomDistExtrapolExtraX(0)
147 , fMomDistExtrapolExtraY(0)
148 , fMomDistShortPrimaryX(0)
149 , fMomDistShortPrimaryY(0)
150 , fMomDistShortExtraX(0)
151 , fMomDistShortExtraY(0)
166 , fUsedHitsPerPlane(0)
167 , fUnUsedHitsPerPlane(0)
193 FairRootManager* ioman = FairRootManager::Instance();
195 cout <<
"-E- CbmL1CATrdTrackFinderSA::Init: "
196 <<
"RootManager not instantised!" << endl;
201 fMCTrackArray = L1_DYNAMIC_CAST<TClonesArray*>(ioman->GetObject(
"MCTrack"));
203 cout <<
"-E- CbmL1CATrdTrackFinderSA::Init: No MCTrack array!" << endl;
208 fMCPointArray = L1_DYNAMIC_CAST<TClonesArray*>(ioman->GetObject(
"TrdPoint"));
210 cout <<
"-E- CbmL1CATrdTrackFinderSA::Init: No MCPoint array!" << endl;
225 TClonesArray* trackArray) {
241 Int_t trdPlaneID = 0;
243 Int_t noHitsPerTracklet = 4;
259 Double_t dY_FL = 0.3,
268 Double_t distPropLongY_FL = 2.5,
269 distPropLongX_FL = 2.5,
270 distPropLongY_SL = 3,
271 distPropLongX_SL = 3,
272 distPropLongY_TL = 4,
273 distPropLongX_TL = 4;
276 Bool_t competition =
true;
277 Bool_t removeUsedHits =
true;
278 Bool_t secondLoop =
true;
279 Bool_t thirdLoop =
true;
285 set<Int_t> globalSetRejectedHits;
286 globalSetRejectedHits.clear();
292 Int_t nTrdHit = hitArray->GetEntriesFast();
293 for (Int_t iHit = 0; iHit < nTrdHit; iHit++) {
295 pHit = L1_DYNAMIC_CAST<CbmTrdHit*>(hitArray->At(iHit));
299 globalSetRejectedHits.insert(iHit);
303 cout <<
"-E- CbmL1CATrdTrackFinderSA::DoFind: Empty slot "
304 <<
"in HitArray at position " << iHit << endl;
311 pMCpt = L1_DYNAMIC_CAST<CbmTrdPoint*>(
fMCPointArray->At(ptIndex));
320 Int_t trdPlaneIDN = trdPlaneID - 1;
345 for (Int_t
i = 0;
i < 12;
i++) {
380 cout <<
"-I- CbmL1CATrdTrackFinderSA::DoFind " << endl;
381 for (Int_t
i = 0;
i < 12;
i++) {
382 cout <<
" Size of vector " <<
i <<
": " <<
fvTrdHitArr[
i].size() << endl;
387 vector<CbmL1TrdTracklet4*> clTracklets[3];
388 vector<CbmL1TrdTracklet4*> clTrackletsNew[3];
391 vector<CbmL1TrdTracklet*> clSpacePoints[6];
393 if (noHitsPerTracklet == 4) {
396 <<
"-I- CbmL1CATrdTrackFinderSA::DoFind " << endl
397 <<
"--------------------------------------------------" << endl
398 <<
" ### Start creation of Space Points" << endl
399 <<
"--------------------------------------------------" << endl;
402 for (Int_t
i = 0, j = 0;
i < 6;
i++, j = j + 2) {
413 for (Int_t
i = 0;
i < 6;
i++) {
414 sort(clSpacePoints[
i].begin(),
415 clSpacePoints[
i].end(),
422 <<
"-I- CbmL1CATrdTrackFinderSA::DoFind " << endl
423 <<
"--------------------------------------------------" << endl
424 <<
" ### Start creation tracklets" << endl
425 <<
"--------------------------------------------------" << endl;
428 for (Int_t
i = 0, j = 0;
i < 3;
i++, j = j + 2) {
430 clSpacePoints[j], clSpacePoints[j + 1], clTracklets[
i], dX_FL, dY_FL);
480 cout <<
"--- Finding neighbour 14-58" << endl;
482 clTracklets[0], clTracklets[1], distPropLongX_FL, distPropLongY_FL);
484 cout <<
"--- Finding neighbour 58-912" << endl;
486 clTracklets[1], clTracklets[2], distPropLongX_FL, distPropLongY_FL);
496 <<
"-I- CbmL1CATrdTrackFinderSA::DoFind " << endl
497 <<
"--------------------------------------------------" << endl
498 <<
" ### (FL) in Event No. " <<
fNofEvents <<
" ###" << endl
499 <<
"--------------------------------------------------" << endl;
502 cout <<
"size of segment vector 14 = " << clTracklets[0].size() << endl
503 <<
"size of segment vector 58 = " << clTracklets[1].size() << endl
504 <<
"size of segment vector 912 = " << clTracklets[2].size() << endl;
508 cout <<
"-I- CbmL1CATrdTrackFinderSA::DoFind " << endl
509 <<
"Tracklet finding phase completed." << endl
510 <<
"Now constructing tracks from tracklets..." << endl;
515 if (noHitsPerTracklet == 4) {
518 <<
"-I- CbmL1CATrdTrackFinderSA::DoFind " << endl
519 <<
"--------------------------------------------------" << endl
520 <<
" ### Starting tagging procedure" << endl
521 <<
"--------------------------------------------------" << endl;
524 cout <<
"--- Tagging 58-921 done." << endl;
527 cout <<
"--- Tagging 14-58 done." << endl;
538 map<Int_t, Int_t> segValues14;
539 map<Int_t, Int_t> segValues58;
540 map<Int_t, Int_t> segValues912;
543 vector<CbmL1TrdTracklet4*>::iterator itclTrackletsRight;
545 for (itclTrackletsRight = clTracklets[0].begin();
546 itclTrackletsRight != clTracklets[0].end();
547 itclTrackletsRight++) {
549 clSegRight = *itclTrackletsRight;
550 segValue = clSegRight->
GetVal();
551 segValues14[segValue]++;
552 if (segValue == 3) clTrackletsNew[0].push_back(clSegRight);
556 for (itclTrackletsRight = clTracklets[1].begin();
557 itclTrackletsRight != clTracklets[1].end();
558 itclTrackletsRight++) {
560 clSegRight = *itclTrackletsRight;
561 segValue = clSegRight->
GetVal();
562 segValues58[segValue]++;
563 if (segValue == 2) clTrackletsNew[1].push_back(clSegRight);
567 for (itclTrackletsRight = clTracklets[2].begin();
568 itclTrackletsRight != clTracklets[2].end();
569 itclTrackletsRight++) {
571 clSegRight = *itclTrackletsRight;
572 segValue = clSegRight->
GetVal();
573 segValues912[segValue]++;
574 if (segValue == 1) clTrackletsNew[2].push_back(clSegRight);
579 map<Int_t, Int_t>::iterator mIt;
581 cout <<
"--- Map no. 14 has: " << endl;
582 for (mIt = segValues14.begin(); mIt != segValues14.end(); mIt++) {
583 cout << mIt->first <<
" segment has a count of " << mIt->second << endl;
586 cout <<
"--- Map no. 58 has: " << endl;
587 for (mIt = segValues58.begin(); mIt != segValues58.end(); mIt++) {
588 cout << mIt->first <<
" segment has a count of " << mIt->second << endl;
591 cout <<
"--- Map no. 912 has: " << endl;
592 for (mIt = segValues912.begin(); mIt != segValues912.end(); mIt++) {
593 cout << mIt->first <<
" segment has a count of " << mIt->second << endl;
605 cout <<
"--------------------------------------------------" << endl
606 <<
" ### Starting creating the tracks " << endl
607 <<
"--------------------------------------------------" << endl;
611 set<Int_t> globalSetUsedHits;
612 globalSetUsedHits.clear();
617 cout <<
"Outer area: " << endl
618 <<
"--- size of fArrayTrdTrack = "
620 <<
"--- size of globalSetUsedHits = " << globalSetUsedHits.size()
636 for (Int_t
i = 0;
i < 3;
i++) {
638 clTracklets[
i].clear();
642 for (Int_t
i = 0;
i < 6;
i++) {
644 clSpacePoints[
i].clear();
651 <<
"-I- CbmL1CATrdTrackFinderSA::DoFind (Second loop)" << endl
652 <<
"--------------------------------------------------" << endl
653 <<
" ### (SL) in Event No. " <<
fNofEvents <<
" ###" << endl
654 <<
"--------------------------------------------------" << endl;
658 for (Int_t
i = 0;
i < 12;
i++) {
662 set<Int_t>::iterator iglobalSetUsedHits;
663 set<Int_t>::iterator iglobalSetRejectedHits;
665 for (Int_t iHit = 0; iHit < nTrdHit; iHit++) {
666 pHit = L1_DYNAMIC_CAST<CbmTrdHit*>(hitArray->At(iHit));
671 cout <<
"-E- CbmL1CATrdTrackFinderSA::DoFind: Empty slot "
672 <<
"in HitArray at position " << iHit << endl;
678 iglobalSetRejectedHits = globalSetRejectedHits.find(iHit);
679 if (iglobalSetRejectedHits != globalSetRejectedHits.end())
continue;
682 iglobalSetUsedHits = globalSetUsedHits.find(iHit);
683 if (iglobalSetUsedHits != globalSetUsedHits.end())
continue;
686 Int_t trdPlaneIDN = trdPlaneID - 1;
698 for (Int_t
i = 0;
i < 12;
i++) {
710 cout <<
"[Second Loop]::Creating space points" << endl;
712 for (Int_t
i = 0, j = 0;
i < 6;
i++, j = j + 2) {
721 for (Int_t
i = 0;
i < 6;
i++) {
722 sort(clSpacePoints[
i].begin(),
723 clSpacePoints[
i].end(),
727 cout <<
"[Second Loop]::Creating tracklets" << endl;
728 for (Int_t
i = 0, j = 0;
i < 3;
i++, j = j + 2) {
730 clSpacePoints[j], clSpacePoints[j + 1], clTracklets[
i], dX_SL, dY_SL);
734 cout <<
"--- size of segment vector 14 = " << clTracklets[0].size()
736 <<
"--- size of segment vector 58 = " << clTracklets[1].size()
738 <<
"--- size of segment vector 912 = " << clTracklets[2].size()
742 cout <<
"[Second Loop]::Finding friends 14-58" << endl;
744 clTracklets[0], clTracklets[1], distPropLongX_SL, distPropLongY_SL);
746 cout <<
"[Second Loop]::Finding friends 58-912" << endl;
748 clTracklets[1], clTracklets[2], distPropLongX_SL, distPropLongY_SL);
750 cout <<
"[Second Loop]::Tagging segments 58-912" << endl;
754 cout <<
"[Second Loop]::Tagging segments 14-58" << endl;
758 cout <<
"[Second Loop]::Creating tracks" << endl;
769 for (Int_t
i = 0;
i < 3;
i++) {
771 clTracklets[
i].clear();
773 for (Int_t
i = 0;
i < 6;
i++) {
775 clSpacePoints[
i].clear();
783 <<
"-I- CbmL1CATrdTrackFinderSA::DoFind (Third loop)" << endl
784 <<
"--------------------------------------------------" << endl
785 <<
" ### (TL) in Event No. " <<
fNofEvents <<
" ###" << endl
786 <<
"--------------------------------------------------" << endl;
790 for (Int_t
i = 0;
i < 12;
i++) {
794 set<Int_t>::iterator iglobalSetUsedHits;
795 set<Int_t>::iterator iglobalSetRejectedHits;
797 for (Int_t iHit = 0; iHit < nTrdHit; iHit++) {
798 pHit = L1_DYNAMIC_CAST<CbmTrdHit*>(hitArray->At(iHit));
803 cout <<
"-E- CbmL1CATrdTrackFinderSA::DoFind: Empty slot "
804 <<
"in HitArray at position " << iHit << endl;
810 iglobalSetRejectedHits = globalSetRejectedHits.find(iHit);
811 if (iglobalSetRejectedHits != globalSetRejectedHits.end())
continue;
814 iglobalSetUsedHits = globalSetUsedHits.find(iHit);
815 if (iglobalSetUsedHits != globalSetUsedHits.end())
continue;
818 Int_t trdPlaneIDN = trdPlaneID - 1;
830 for (Int_t
i = 0;
i < 12;
i++) {
834 for (Int_t
i = 0, j = 0;
i < 6;
i++, j = j + 2) {
842 for (Int_t
i = 0;
i < 6;
i++) {
843 sort(clSpacePoints[
i].begin(),
844 clSpacePoints[
i].end(),
848 for (Int_t
i = 0, j = 0;
i < 3;
i++, j = j + 2) {
850 clSpacePoints[j], clSpacePoints[j + 1], clTracklets[
i], dX_TL, dY_TL);
854 clTracklets[0], clTracklets[1], distPropLongX_TL, distPropLongY_TL);
856 clTracklets[1], clTracklets[2], distPropLongX_TL, distPropLongY_TL);
882 set<Int_t>::iterator iglSetUsedHits;
883 nTrdHit = hitArray->GetEntriesFast();
885 for (Int_t iHit = 0; iHit < nTrdHit; iHit++) {
886 pHit = L1_DYNAMIC_CAST<CbmTrdHit*>(hitArray->At(iHit));
891 iglSetUsedHits = globalSetUsedHits.find(iHit);
892 if (iglSetUsedHits != globalSetUsedHits.end()) {
904 <<
"-I- CbmL1CATrdTrackFinderSA::DoFind " << endl
905 <<
"--------------------------------------------------" << endl
906 <<
" ### Summary" << endl
907 <<
"--------------------------------------------------" << endl
908 <<
"--- Number of found tracks: " <<
fArrayTrdTrack->GetEntriesFast()
914 cout <<
"\n-I- CbmL1CATrdTrackFinderSA::DoFind " << endl
915 <<
"--------------------------------------------------" << endl
916 <<
" ### Delete:Clear" << endl
917 <<
"--------------------------------------------------" << endl;
919 for (Int_t
i = 0;
i < 12;
i++) {
924 for (Int_t
i = 0;
i < 3;
i++) {
926 clTracklets[
i].clear();
930 for (Int_t
i = 0;
i < 6;
i++) {
932 clSpacePoints[
i].clear();
949 for (Int_t iHit = 0; iHit <
fNTrdHits; iHit++) {
950 pHit = L1_DYNAMIC_CAST<CbmTrdHit*>( hitArray->At(iHit);
952 ptIndex = pHit->GetRefIndex();
956 trdPlaneID = pHit->GetPlaneID();
957 Int_t trdPlaneIDN = trdPlaneID-1;
973 for (Int_t
i = 0;
i < 12;
i++) {
989 <<
"\n-I- CbmL1CATrdTrackFinderSA::DoFind " << endl
990 <<
"--------------------------------------------------" << endl
991 <<
" ### Time" << endl
992 <<
"--------------------------------------------------" << endl;
993 cout <<
" Do find: ";
995 rtime =
doFind.RealTime();
998 printf(
"RealTime=%4.2f s, CpuTime=%4.2f s, TotCpu=%4.2f s, %4.2f/event\n",
1004 cout <<
" Sort Hits: ";
1008 printf(
"RealTime=%4.2f s, CpuTime=%4.2f s, TotCpu=%4.2f s, %4.2f/event\n",
1014 cout <<
" Create SPs: ";
1018 printf(
"RealTime=%4.2f s, CpuTime=%4.2f s, TotCpu=%4.2f s, %4.2f/event\n",
1024 cout <<
" Sort SPs: ";
1028 printf(
"RealTime=%4.2f s, CpuTime=%4.2f s, TotCpu=%4.2f s, %4.2f/event\n",
1034 cout <<
" Create segments: ";
1038 printf(
"RealTime=%4.2f s, CpuTime=%4.2f s, TotCpu=%4.2f s, %4.2f/event\n",
1044 cout <<
" Find friend: ";
1048 printf(
"RealTime=%4.2f s, CpuTime=%4.2f s, TotCpu=%4.2f s, %4.2f/event\n",
1054 cout <<
" Tag Tracklets: ";
1058 printf(
"RealTime=%4.2f s, CpuTime=%4.2f s, TotCpu=%4.2f s, %4.2f/event\n",
1064 cout <<
" Create Tracks: ";
1068 printf(
"RealTime=%4.2f s, CpuTime=%4.2f s, TotCpu=%4.2f s, %4.2f/event\n",
1074 cout <<
"Refitting Tracks: ";
1078 printf(
"RealTime=%4.2f s, CpuTime=%4.2f s, TotCpu=%4.2f s, %4.2f/event\n",
1084 cout <<
" Second Loop: ";
1088 printf(
"RealTime=%4.2f s, CpuTime=%4.2f s, TotCpu=%4.2f s, %4.2f/event\n",
1094 cout <<
" Third Loop: ";
1098 printf(
"RealTime=%4.2f s, CpuTime=%4.2f s, TotCpu=%4.2f s, %4.2f/event\n",
1104 cout <<
"Deleting Objects: ";
1108 printf(
"RealTime=%4.2f s, CpuTime=%4.2f s, TotCpu=%4.2f s, %4.2f/event\n",
1114 cout <<
"[Second Loop]" << endl;
1115 cout <<
" Create SPs: ";
1119 printf(
"RealTime=%4.2f s, CpuTime=%4.2f s, TotCpu=%4.2f s, %4.2f/event\n",
1127 <<
"-I- CbmL1CATrdTrackFinderSA::DoFind " << endl
1128 <<
"--------------------------------------------------" << endl
1129 <<
" ### END: Track constructing phase completed" << endl
1130 <<
"--------------------------------------------------" << endl;
1140 vector<CbmL1TrdTracklet4*>::iterator it;
1141 for (it = vect.begin(); it != vect.end(); it++) {
1149 vector<CbmL1TrdTracklet*>::iterator it;
1150 for (it = vect.begin(); it != vect.end(); it++) {
1160 new TH1F(
"h_UsedHitsPerPlane",
"h_UsedHitsPerPlane", 13, 0, 13);
1162 new TH1F(
"h_UnUsedHitsPerPlane",
"h_UnUsedHitsPerPlane", 13, 0, 13);
1167 new TH1F(
"h_chi2hit",
"Normalized distance to hit", 500, 0., 50.);
1169 "Normalized distance to hit vs. plane number",
1177 fDistLongX =
new TH1F(
"DistLongX",
"DistLongX", 100, -200, 200);
1178 fDistLongY =
new TH1F(
"DistLongY",
"DistLongY", 100, -200, 200);
1179 fDistShortX =
new TH1F(
"DistShortX",
"DistShortX", 100, -10, 10);
1180 fDistShortY =
new TH1F(
"DistShortY",
"DistShortY", 100, -10, 10);
1182 fDistLongBX =
new TH1F(
"DistLongBX",
"DistLongBX", 100, -200, 200);
1183 fDistLongBY =
new TH1F(
"DistLongBY",
"DistLongBY", 100, -200, 200);
1184 fDistShortBX =
new TH1F(
"DistShortBX",
"DistShortBX", 100, -200, 200);
1185 fDistShortBY =
new TH1F(
"DistShortBY",
"DistShortBY", 100, -200, 200);
1187 fDistY12 =
new TH1F(
"DistY12",
"DistY12", 100, -1, 1);
1190 "MomDistLongPrimaryX",
"MomDistLongPrimaryX", 100, 0, 10, 100, -30, 30);
1192 "MomDistLongPrimaryY",
"MomDistLongPrimaryY", 100, 0, 10, 100, -30, 30);
1194 "MomDistExtrapolPrimaryX",
1202 "MomDistExtrapolPrimaryY",
1211 "MomDistLongExtraX",
"MomDistLongExtraX", 100, 0, 10, 100, -30, 30);
1213 "MomDistLongExtraY",
"MomDistLongExtraY", 100, 0, 10, 100, -30, 30);
1215 "MomDistExtrapolExtraX",
"MomDistExtrapolExtraX", 100, 0, 10, 200, -20, 20);
1217 "MomDistExtrapolExtraY",
"MomDistExtrapolExtraY", 100, 0, 10, 200, -20, 20);
1220 "MomDistShortPrimaryX",
"MomDistShortPrimaryX", 100, 0, 10, 100, -5, 5);
1222 "MomDistShortPrimaryY",
"MomDistShortPrimaryY", 100, 0, 10, 100, -5, 5);
1224 "MomDistShortExtraX",
"MomDistShortExtraX", 100, 0, 10, 100, -5, 5);
1226 "MomDistShortExtraY",
"MomDistShortExtraY", 100, 0, 10, 100, -5, 5);
1228 fDistY =
new TH1F(
"DistY",
"DistY", 1000, -10, 10);
1229 fDistX =
new TH1F(
"DistX",
"DistX", 1000, -10, 10);
1231 fPlane1Ydens =
new TH1F(
"Plane1Ydens",
"Plane1Ydens", 1000, -1000, 1000);
1232 fPlane5Ydens =
new TH1F(
"Plane5Ydens",
"Plane5Ydens", 1000, -1000, 1000);
1233 fPlane9Ydens =
new TH1F(
"Plane9Ydens",
"Plane9Ydens", 1000, -1000, 1000);
1235 fSPlengthMC =
new TH1F(
"SPlengthMC",
"SPlengthMC", 200, 0, 20);
1236 fSPlength =
new TH1F(
"SPlength",
"SPlength", 200, 0, 20);
1238 fYat0 =
new TH1F(
"Yat0",
"Yat0", 500, -500, 500);
1239 fYat0MC =
new TH1F(
"Yat0MC",
"Yat0MC", 500, -500, 500);
1241 fNoEvTime =
new TH2F(
"NoEvTime",
"NoEvTime", 1000, 0, 1000, 1000, 0, 5);
1243 fh_SP_xDiff_MC =
new TH1F(
"fh_SP_xDiff_MC",
"fh_SP_xDiff_MC", 400, -20, 20);
1244 fh_SP_yDiff_MC =
new TH1F(
"fh_SP_yDiff_MC",
"fh_SP_yDiff_MC", 400, -20, 20);
1247 new TH1F(
"fh_SP_xDiff_nMC",
"fh_SP_xDiff_nMC", 400, -20, 20);
1249 new TH1F(
"fh_SP_yDiff_nMC",
"fh_SP_yDiff_nMC", 400, -20, 20);
1258 FairRootManager*
rootMgr = FairRootManager::Instance();
1260 cout <<
"-E- CbmL1CATrdTrackFinderSA::DataBranches : "
1261 <<
"ROOT manager is not instantiated" << endl;
1267 cout <<
"-E- CbmL1CATrdTrackFinderSA::Init: No TrdHit array!" << endl;
1278 FairRunAna* ana = FairRunAna::Instance();
1280 cout <<
"-E- CbmL1CATrdTrackFinderSA::TrdLayout :"
1281 <<
" no FairRunAna object!" << endl;
1285 FairRuntimeDb* rtdb = ana->GetRuntimeDb();
1287 cout <<
"-E- CbmL1CATrdTrackFinderSA::TrdLayout :"
1288 <<
" no runtime database!" << endl;
1292 FairBaseParSet* baseParSet =
1293 L1_DYNAMIC_CAST<FairBaseParSet*>(rtdb->getContainer(
"FairBaseParSet"));
1294 if (NULL == baseParSet) {
1295 cout <<
"-E- CbmL1CATrdTrackFinderSA::TrdLayout :"
1296 <<
" no container of base parameters!" << endl;
1300 TrdPar = L1_DYNAMIC_CAST<CbmGeoTrdPar*>(rtdb->findContainer(
"CbmGeoTrdPar"));
1301 TObjArray* Nodes =
TrdPar->GetGeoSensitiveNodes();
1302 for (Int_t
i = 0;
i < Nodes->GetEntries();
i++) {
1303 FairGeoNode* node =
dynamic_cast<FairGeoNode*
>(Nodes->At(
i));
1305 if (!node)
continue;
1307 TString name = node->getName();
1309 FairGeoVector nodeV = node->getLabTransform()->getTranslation();
1318 cout <<
" name: " << name <<
"\t(z): " << nodeV.Z() << endl;
1326 if (name ==
"trd1gas#3")
fTrd13_Z = Int_t(nodeV.Z());
1327 if (name ==
"trd1gas#4")
fTrd14_Z = Int_t(nodeV.Z());
1328 if (name ==
"trd2gas#1")
fTrd21_Z = Int_t(nodeV.Z());
1329 if (name ==
"trd2gas#4")
fTrd24_Z = Int_t(nodeV.Z());
1330 if (name ==
"trd3gas#1")
fTrd31_Z = Int_t(nodeV.Z());
1338 if (name ==
"trd1gas#1")
geoLayer.
Z[0] = nodeV.Z();
1339 if (name ==
"trd1gas#2")
geoLayer.
Z[1] = nodeV.Z();
1340 if (name ==
"trd1gas#3")
geoLayer.
Z[2] = nodeV.Z();
1341 if (name ==
"trd1gas#4")
geoLayer.
Z[3] = nodeV.Z();
1342 if (name ==
"trd2gas#1")
geoLayer.
Z[4] = nodeV.Z();
1343 if (name ==
"trd2gas#2")
geoLayer.
Z[5] = nodeV.Z();
1344 if (name ==
"trd2gas#3")
geoLayer.
Z[6] = nodeV.Z();
1345 if (name ==
"trd2gas#4")
geoLayer.
Z[7] = nodeV.Z();
1346 if (name ==
"trd3gas#1")
geoLayer.
Z[8] = nodeV.Z();
1347 if (name ==
"trd3gas#2")
geoLayer.
Z[9] = nodeV.Z();
1348 if (name ==
"trd3gas#3")
geoLayer.
Z[10] = nodeV.Z();
1349 if (name ==
"trd3gas#4")
geoLayer.
Z[11] = nodeV.Z();
1353 for (
int i = 0;
i < 4;
i++) {
1356 for (
int i = 4;
i < 8;
i++) {
1359 for (
int i = 8;
i < 12;
i++) {
1365 for (
int i = 0;
i < 12;
i++) {
1366 if (
i == 4) scaleZA = 1000;
1367 if (
i == 8) scaleZA *= 2;
1397 TObjArray* detList = baseParSet->GetDetList();
1398 if (NULL == detList) {
1399 cout <<
"-E- CbmL1CATrdTrackFinderSA::TrdLayout :"
1400 <<
" no detector list!" << endl;
1405 L1_DYNAMIC_CAST<FairDetector*>(detList->FindObject(
"TRD"));
1407 cout <<
"-E- CbmL1CATrdTrackFinderSA::TrdLayout :"
1408 <<
" no TRD detector!" << endl;
1412 TString name = trd->GetGeometryFileName();
1413 if (name.Contains(
"9")) {
1414 cout <<
"-I- CbmL1CATrdTrackFinderSA::TrdLayout :"
1415 <<
" TRD geometry : 3x3." << endl;
1418 }
else if (name.Contains(
"12")) {
1419 cout <<
"-I- CbmL1CATrdTrackFinderSA::TrdLayout :"
1420 <<
" TRD geometry : 3x4." << endl;
1423 }
else if (name.Contains(
"6x2")) {
1424 cout <<
"-I- CbmL1CATrdTrackFinderSA::TrdLayout :"
1425 <<
" TRD geometry : 6x2." << endl;
1492 map<Int_t, Int_t>::iterator iUsedHits;
1493 map<Int_t, Int_t>::iterator iUnUsedHits;
1494 map<Int_t, Int_t>::iterator iTotHits;
1500 iTotHits =
fTotHits.find(iUsedHits->first);
1501 nContent = (iUsedHits->second * 100) / iTotHits->second;
1511 iTotHits =
fTotHits.find(iUnUsedHits->first);
1512 nContent = (iUnUsedHits->second * 100) / iTotHits->second;
1540 for (
int i = 0;
i < 12;
i++) {
1548 for (
int i = 0;
i < noHits;
i++) {
1551 hit = L1_DYNAMIC_CAST<CbmTrdHit*>(
fArrayTrdHit->At(iHit));
1553 C1[
i] = hit->
GetX();
1554 C2[
i] = hit->
GetY();
1558 Double_t sumXZ = 0, sumYZ = 0, sumX = 0, sumY = 0, sumZx = 0, sumZy = 0,
1559 sumX2 = 0, sumY2 = 0, sumZx2 = 0, sumZy2 = 0;
1561 for (
int i = 0;
i < 12;
i += 2) {
1567 sumXZ += C1[
i] * Z[
i];
1570 sumX2 += C1[
i] * C1[
i];
1573 sumZx2 += Z[
i] * Z[
i];
1577 for (
int i = 1;
i < 12;
i += 2) {
1583 sumYZ += C2[
i] * Z[
i];
1586 sumY2 += C2[
i] * C2[
i];
1589 sumZy2 += Z[
i] * Z[
i];
1598 (n * sumXZ - sumX * sumZx)
1599 /
sqrt((n * sumX2 - sumX * sumX) * (n * sumZx2 - sumZx * sumZx));
1605 (n * sumYZ - sumY * sumZy)
1606 /
sqrt((n * sumY2 - sumY * sumY) * (n * sumZy2 - sumZy * sumZy));
1614 return sqrt(r1 * r1 + r2 * r2);
1631 if (iIndexFirst != -1) {
1632 pHitFirst = L1_DYNAMIC_CAST<CbmTrdHit*>(
fArrayTrdHit->At(iIndexFirst));
1633 Y1 = pHitFirst->
GetY();
1634 Z1 = pHitFirst->
GetZ();
1637 pHitSecond = L1_DYNAMIC_CAST<CbmTrdHit*>(
fArrayTrdHit->At(iIndexSecond));
1641 Double_t Y4 = pHitSecond->
GetY();
1642 Double_t Z4 = pHitSecond->
GetZ();
1644 Double_t a = (Y4 - Y1) / (Z4 - Z1);
1645 Double_t b = Y1 - a * Z1;
1646 Double_t Y = a * zed + b;
1672 if (iIndexFirst != -1) {
1673 pHitFirst = L1_DYNAMIC_CAST<CbmTrdHit*>(
fArrayTrdHit->At(iIndexFirst));
1674 X1 = pHitFirst->
GetX();
1675 Z1 = pHitFirst->
GetZ();
1678 pHitSecond = L1_DYNAMIC_CAST<CbmTrdHit*>(
fArrayTrdHit->At(iIndexSecond));
1681 Double_t X4 = pHitSecond->
GetX();
1682 Double_t Z4 = pHitSecond->
GetZ();
1684 Double_t a = (X4 - X1) / (Z4 - Z1);
1685 Double_t b = X1 - a * Z1;
1687 Double_t X = a * zed + b;
1704 vector<CbmL1TrdTracklet4*>& v2,
1708 vector<CbmL1TrdTracklet4*>::iterator iv1;
1714 aminY, amaxY, aminX, amaxX;
1715 Int_t indexA, indexB;
1716 Int_t Left = 0, Right, Mid = 0;
1719 for (iv1 = v1.begin(); iv1 != v1.end(); iv1++) {
1735 while (Left < Right) {
1736 Mid = (Left + Right) / 2;
1737 mesY = v2[Mid]->GetCoord(0);
1755 Int_t size = v2.size();
1756 for (Int_t
i = Mid;
i < size;
i++) {
1757 mesY = v2[
i]->GetCoord(0);
1758 mesX = v2[
i]->GetCoord(1);
1760 indexB = v2[
i]->GetIndex();
1763 if (mesY > amaxY)
continue;
1764 if (mesY < aminY)
break;
1770 if (aminX < mesX && mesX < amaxX) {
1772 v2[
i]->vAccostLeft.push_back(indexA);
1783 Bool_t overlap =
false;
1787 Double_t hitPosA_X, hitPosA_Y, hitPosB_X, hitPosB_Y,
1791 Double_t hitPosA_DX, hitPosA_DY, hitPosB_DX, hitPosB_DY;
1793 pHitA = L1_DYNAMIC_CAST<CbmTrdHit*>(
fArrayTrdHit->At(posA));
1794 hitPosA_X = pHitA->
GetX();
1795 hitPosA_Y = pHitA->
GetY();
1796 hitPosA_DX = pHitA->
GetDx();
1797 hitPosA_DY = pHitA->
GetDy();
1799 pHitB = L1_DYNAMIC_CAST<CbmTrdHit*>(
fArrayTrdHit->At(posB));
1800 hitPosB_X = pHitB->
GetX();
1801 hitPosB_Y = pHitB->
GetY();
1802 hitPosB_DX = pHitB->
GetDx();
1803 hitPosB_DY = pHitB->
GetDy();
1812 if (((hitPosA_X + dMul1 * hitPosA_DX) >= (hitPosB_X - dMul2 * hitPosB_DX))
1813 && ((hitPosA_X - dMul1 * hitPosA_DX) <= (hitPosB_X + dMul2 * hitPosB_DX))
1814 && ((hitPosA_Y + dMul2 * hitPosA_DY) >= (hitPosB_Y - dMul1 * hitPosB_DY))
1815 && ((hitPosA_Y - dMul2 * hitPosA_DY)
1816 <= (hitPosB_Y + dMul1 * hitPosB_DY))) {
1832 vector<CbmL1TrdTracklet4*>& clTrackletsA,
1833 vector<CbmL1TrdTracklet4*>& clTrackletsB,
1840 vector<CbmL1TrdTracklet4*>::iterator itclTrackletsRight;
1844 vector<Int_t> vLeft;
1845 vector<Int_t> vRight;
1847 vector<Int_t>::iterator ivLeft;
1850 Int_t valLeft = 0, valRight = 0;
1857 for (itclTrackletsRight = clTrackletsB.begin();
1858 itclTrackletsRight != clTrackletsB.end();
1859 itclTrackletsRight++) {
1861 clSegRight = *itclTrackletsRight;
1870 if (vLeft.size() > 0) {
1872 valRight = clSegRight->
GetVal();
1873 if (valRight == 0) {
1877 for (ivLeft = vLeft.begin(); ivLeft != vLeft.end(); ivLeft++) {
1878 valLeft = (clTrackletsA[*ivLeft])->GetVal();
1879 if (valLeft <= valRight) clTrackletsA[*ivLeft]->SetVal(valRight + 1);
1896 vector<CbmL1TrdTracklet4*> clTracklets14,
1897 vector<CbmL1TrdTracklet4*> clTracklets58,
1898 vector<CbmL1TrdTracklet4*> clTracklets912,
1899 set<Int_t>& globalSetUsedHits,
1900 Bool_t removeUsedHits,
1906 cout <<
"Inner area: " << endl
1907 <<
"--- size of fArrayTrdTrack = "
1909 <<
"--- size of globalSetUsedHits = " << globalSetUsedHits.size()
1915 vector<CbmL1TrdTracklet4*>::iterator itclSeg3;
1917 Bool_t isEmpty =
true;
1926 vector<CbmTrdTrack*> vTempTrdTrackCand;
1927 vector<CbmTrdTrack*>::iterator ivTempTrdTrackCand;
1929 set<Int_t>::iterator iglobalSetUsedHits;
1931 vector<CbmTrdTrack*>::iterator ivTrdTrackCand;
1933 Int_t iFakeTrack = 0;
1935 Bool_t bTrueTrack =
true;
1937 FairTrackParam* trParam;
1938 trParam =
new FairTrackParam();
1942 TVector3 vzero(0, 0, 0);
1945 Int_t iSecondLoop = 1;
1948 Int_t noHitsAccepted =
1951 vector<TempTrackStruct> auxTrack;
1955 vector<TempTrackStruct>::iterator ikol;
1957 cout <<
"--- Engaging main loop..." << endl;
1960 cout <<
"--- No of outer iterations to go: " << clTracklets14.size()
1969 Int_t trlsNo[] = {0, 0, 0};
1971 for (itclSeg3 = clTracklets14.begin(); itclSeg3 != clTracklets14.end();
1973 if ((*itclSeg3)->GetVal() != 3) {
1977 for (
int i = 0;
i < 12;
i++)
1986 Int_t size2 = Int_t((*itclSeg3)->vAccostRight.size());
1987 for (Int_t iSeg2 = 0; iSeg2 < size2;
1989 iInd2 = (*itclSeg3)->vAccostRight[iSeg2];
1990 clTrdSeg2 = clTracklets58[iInd2];
1991 if (clTrdSeg2->
GetVal() != 2)
continue;
2000 for (Int_t iSeg1 = 0; iSeg1 < size1;
2003 clTrdSeg1 = clTracklets912[iInd1];
2004 if (clTrdSeg1->
GetVal() != 1)
continue;
2048 sort(auxTrack.begin(), auxTrack.end(),
CompareChi2);
2056 for (ikol = auxTrack.begin(); ikol != auxTrack.end(); ikol++) {
2057 if (li >= trMax)
break;
2061 for (Int_t we = 0; we < 12; we++) {
2062 trdInd = (*ikol).M[we];
2100 vTempTrdTrackCand.push_back(tr1);
2117 cout <<
"\n--- Refiting by KF..." << endl;
2121 for (ivTempTrdTrackCand = vTempTrdTrackCand.begin();
2122 ivTempTrdTrackCand != vTempTrdTrackCand.end();
2123 ivTempTrdTrackCand++) {
2144 Int_t firstHitSunk = 0;
2145 for (ivTrdTrackCand = vTempTrdTrackCand.begin();
2146 ivTrdTrackCand != vTempTrdTrackCand.end();
2148 trCand = (*ivTrdTrackCand);
2155 if (removeUsedHits) {
2161 for (
int i = 0;
i < noHitsA;
i++) {
2163 iglobalSetUsedHits = globalSetUsedHits.find(iHit);
2165 if (iglobalSetUsedHits != globalSetUsedHits.end()) {
2166 if (firstHitSunk == noHitsAccepted) {
2188 new ((*fArrayTrdTrack)[trackArrayInd])
CbmTrdTrack(*trCand);
2190 for (
int i = 0;
i < noHitsA;
i++) {
2192 globalSetUsedHits.insert(iHit);
2198 new ((*fArrayTrdTrack)[trackArrayInd])
CbmTrdTrack(*trCand);
2204 cout <<
"\n--- Finding tracks finished" << endl;
2205 cout <<
":::Track candidates: " << vTempTrdTrackCand.size() << endl
2206 <<
":::Fake tracks: " << iFakeTrack << endl
2207 <<
":::fArrayTrdTrack: " <<
fArrayTrdTrack->GetEntriesFast() << endl;
2209 vTempTrdTrackCand.clear();
2222 vector<CbmL1TrdTracklet*> clSpacePointsAB,
2223 vector<CbmL1TrdTracklet*> clSpacePointsCD,
2224 vector<CbmL1TrdTracklet4*>& clTrackletsAD,
2228 vector<CbmL1TrdTracklet*>::iterator iSpacePtA;
2229 vector<CbmL1TrdTracklet*>::iterator iSpacePtB;
2230 vector<CbmL1TrdTracklet*>::iterator iSpacePtStart;
2240 noAllPairs = 0, iSegAcc14 = 0;
2246 iSpacePtStart = clSpacePointsCD.begin();
2249 for (iSpacePtA = clSpacePointsAB.begin(); iSpacePtA != clSpacePointsAB.end();
2251 trLeft = *iSpacePtA;
2262 y2 = 0, distBetweenLayer = x1z - y1z,
2263 y2z = y1z + distBetweenLayer * 2, x2z = x1z + distBetweenLayer * 2;
2265 y2 = (y1 / y1z) * y2z;
2266 x2 = (x1 / x1z) * x2z;
2269 Bool_t bFirst =
true;
2275 for (iSpacePtB = iSpacePtStart; iSpacePtB != clSpacePointsCD.end();
2277 trRight = *iSpacePtB;
2352 if (trRight->
GetCoord(0) > y2 + dY) {
2357 iSpacePtStart = iSpacePtB;
2360 if (trRight->
GetCoord(0) < y2 - dY)
break;
2363 if ((trRight->
GetCoord(1) < x2 + dX)
2364 && (trRight->
GetCoord(1) > x2 - dX)) {
2442 clTr->
SetInd(0, indSpacePtA);
2443 clTr->
SetInd(1, indSpacePtB);
2444 clTr->
SetInd(2, indSpacePtC);
2445 clTr->
SetInd(3, indSpacePtD);
2454 clTrackletsAD.push_back(clTr);
2460 cout <<
" ----------- Tracklet 12-34 ------------------" << endl;
2461 cout <<
" Number of X survivors: " << noXSurv << endl;
2462 cout <<
" Number of Y survivors: " << noYSurv << endl;
2463 cout <<
"Number of XY survivors: " << noXYSurv << endl;
2464 cout <<
" Number of all pairs: " << noAllPairs << endl;
2470 vector<LayerWithHits> vTrdHitArrayA,
2471 vector<LayerWithHits> vTrdHitArrayB,
2472 vector<CbmL1TrdTracklet*>& clSpacePointsAB,
2477 vector<LayerWithHits>::iterator itA;
2478 vector<LayerWithHits>::iterator itB;
2479 vector<LayerWithHits>::iterator itStart;
2481 Int_t noOverlapsAB = 0,
2489 Double_t A_X, A_Y, A_Z, A_DX, A_DY;
2491 Double_t B_X, B_Y, B_Z, B_DX, B_DY;
2493 Int_t A_planeID, B_planeID;
2495 Int_t A_mcTrID, B_mcTrID;
2506 itStart = vTrdHitArrayB.begin();
2508 for (itA = vTrdHitArrayA.begin(); itA != vTrdHitArrayA.end(); itA++) {
2510 indA = (*itA).hitIndex;
2516 A_planeID = (*itA).planeID;
2517 A_mcTrID = (*itA).mcTrackID;
2537 Bool_t bFirst =
true;
2538 for (itB = itStart; itB != vTrdHitArrayB.end(); itB++) {
2540 indB = (*itB).hitIndex;
2546 B_planeID = (*itB).planeID;
2547 B_mcTrID = (*itB).mcTrackID;
2549 if (B_Y + sigmaB * B_DY < A_Y - sigmaA * A_DY) {
2560 if (B_Y - sigmaB * B_DY > A_Y + sigmaA * A_DY)
break;
2572 if ((B_X - sigmaB * B_DX < A_X + sigmaA * A_DX)
2573 && (B_X + sigmaB * B_DX > A_X - sigmaA * A_DX)) {
2618 clSpacePointsAB.push_back(clSpacePt);
2620 if (A_mcTrID == B_mcTrID) {
2631 if (
fVerbose > 1) cout <<
"--- No Space Points: " << noOverlapsAB << endl;
2640 vector<CbmL1TrdTracklet4*> clTracklets14,
2641 vector<CbmL1TrdTracklet4*> clTracklets58,
2642 vector<CbmL1TrdTracklet4*> clTracklets912) {
2645 vector<CbmL1TrdTracklet4*>::iterator itclSeg;
2655 Int_t trackArrayInd = 0;
2657 Int_t indTrdHit1, indTrdHit2, indTrdHit3, indTrdHit4;
2659 for (itclSeg = clTracklets14.begin(); itclSeg != clTracklets14.end();
2662 clTrdSeg = *itclSeg;
2665 indTrdHit1 = clTrdSeg->
GetInd(0);
2669 indTrdHit2 = clTrdSeg->
GetInd(1);
2673 indTrdHit3 = clTrdSeg->
GetInd(2);
2677 indTrdHit4 = clTrdSeg->
GetInd(3);
2683 new ((*fArrayTrdTrack)[trackArrayInd])
CbmTrdTrack(*tr1);
2689 for (itclSeg = clTracklets58.begin(); itclSeg != clTracklets58.end();
2692 clTrdSeg = *itclSeg;
2695 indTrdHit1 = clTrdSeg->
GetInd(0);
2699 indTrdHit2 = clTrdSeg->
GetInd(1);
2703 indTrdHit3 = clTrdSeg->
GetInd(2);
2707 indTrdHit4 = clTrdSeg->
GetInd(3);
2713 new ((*fArrayTrdTrack)[trackArrayInd])
CbmTrdTrack(*tr1);
2719 for (itclSeg = clTracklets912.begin(); itclSeg != clTracklets912.end();
2722 clTrdSeg = *itclSeg;
2725 indTrdHit1 = clTrdSeg->
GetInd(0);
2729 indTrdHit2 = clTrdSeg->
GetInd(1);
2733 indTrdHit3 = clTrdSeg->
GetInd(2);
2737 indTrdHit4 = clTrdSeg->
GetInd(3);
2743 new ((*fArrayTrdTrack)[trackArrayInd])
CbmTrdTrack(*tr1);
2762 Double_t y1, y2,
z1,
z2, yA[12], zA[12], yB[12], zB[12];
2773 for (
int i = 0;
i < noHits;
i++) {
2776 pHit[
i] = L1_DYNAMIC_CAST<CbmTrdHit*>(
fArrayTrdHit->At(iHit));
2780 yA[0] = pHit[0]->
GetY();
2781 zA[0] = pHit[0]->
GetZ();
2782 yB[10] = pHit[10]->
GetY();
2783 zB[10] = pHit[10]->
GetZ();
2786 yA[1] = pHit[1]->
GetX();
2787 zA[1] = pHit[1]->
GetZ();
2788 yB[11] = pHit[11]->
GetX();
2789 zB[11] = pHit[11]->
GetZ();
2794 for (
int i = 0;
i < 4;
i++) {
2798 y1 =
fabs(pHit[t1]->GetY());
2801 yS1 =
fabs((((yB[10] - yA[0]) * (
z1 - zA[0])) / (zB[10] - zA[0])) + yA[0]);
2802 dist1 =
fabs(yS1 - y1);
2806 y2 =
fabs(pHit[t2]->GetX());
2809 yS2 =
fabs((((yB[11] - yA[1]) * (
z2 - zA[1])) / (zB[11] - zA[1])) + yA[1]);
2810 dist2 =
fabs(yS2 - y2);
2812 chi2 += (dist1 + dist2) / 2;
2884 Double_t y1, y2,
z1,
z2, yA[12], zA[12], yB[12], zB[12];
2893 for (
int i = 0;
i < noHits;
i++) {
2895 pHit[
i] = L1_DYNAMIC_CAST<CbmTrdHit*>(
fArrayTrdHit->At(iHit));
2899 yA[0] = pHit[0]->
GetY();
2900 zA[0] = pHit[0]->
GetZ();
2901 yB[10] = pHit[10]->
GetY();
2902 zB[10] = pHit[10]->
GetZ();
2905 yA[1] = pHit[1]->
GetX();
2906 zA[1] = pHit[1]->
GetZ();
2907 yB[11] = pHit[11]->
GetX();
2908 zB[11] = pHit[11]->
GetZ();
2913 for (
int i = 0;
i < 4;
i++) {
2917 y1 =
fabs(pHit[t1]->GetY());
2920 yS1 =
fabs((((yB[10] - yA[0]) * (
z1 - zA[0])) / (zB[10] - zA[0])) + yA[0]);
2921 dist1 =
fabs(yS1 - y1);
2925 y2 =
fabs(pHit[t2]->GetX());
2928 yS2 =
fabs((((yB[11] - yA[1]) * (
z2 - zA[1])) / (zB[11] - zA[1])) + yA[1]);
2929 dist2 =
fabs(yS2 - y2);
2932 chi2 +=
sqrt(pow(dist2, 2) + pow(dist1, 2));
2954 for (
int i = 0;
i < 12;
i++) {
2962 for (
int i = 0;
i < noHits;
i++) {
2965 hit = L1_DYNAMIC_CAST<CbmTrdHit*>(
fArrayTrdHit->At(iHit));
2967 C1[
i] = hit->
GetX();
2968 C2[
i] = hit->
GetY();
2972 Double_t sumXZ = 0, sumYZ = 0, sumX = 0, sumY = 0, sumZx = 0, sumZy = 0,
2973 sumX2 = 0, sumY2 = 0, sumZx2 = 0, sumZy2 = 0;
2975 for (
int i = 0;
i < 12;
i += 2) {
2980 sumXZ += C1[
i] * Z[
i];
2983 sumX2 += C1[
i] * C1[
i];
2986 sumZx2 += Z[
i] * Z[
i];
2990 for (
int i = 1;
i < 12;
i += 2) {
2995 sumYZ += C2[
i] * Z[
i];
2998 sumY2 += C2[
i] * C2[
i];
3001 sumZy2 += Z[
i] * Z[
i];
3010 (n * sumXZ - sumX * sumZx)
3011 /
sqrt((n * sumX2 - sumX * sumX) * (n * sumZx2 - sumZx * sumZx));
3017 (n * sumYZ - sumY * sumZy)
3018 /
sqrt((n * sumY2 - sumY * sumY) * (n * sumZy2 - sumZy * sumZy));
3026 return sqrt(r1 * r1 + r2 * r2);
3036 for (
int i = 0;
i < noHits;
i++) {
3038 pHit[
i] = L1_DYNAMIC_CAST<CbmTrdHit*>(
fArrayTrdHit->At(iHit));
3041 Double_t xAv = 0, yAv = 0, zAvx = 0, zAvy = 0, sumXiXav = 0, sumYiYav = 0,
3042 sumXiXav_ZiZAv = 0, sumYiYav_ZiZAv = 0, sumZiZav_x = 0,
3043 sumZiZav_y = 0, bY = 0, bX = 0;
3045 for (
int i = 0;
i < 12;
i += 2) {
3046 yAv += pHit[
i]->
GetY();
3047 zAvy += pHit[
i]->
GetZ();
3049 for (
int i = 1;
i < 12;
i += 2) {
3050 xAv += pHit[
i]->
GetX();
3051 zAvx += pHit[
i]->
GetZ();
3054 for (
int i = 0;
i < 12;
i += 2) {
3055 sumYiYav_ZiZAv += ((pHit[
i]->
GetY()) - yAv) * ((pHit[
i]->
GetZ()) - zAvy);
3056 sumYiYav += pow((pHit[
i]->GetY()) - yAv, 2);
3057 sumZiZav_y += pow((pHit[
i]->GetZ()) - zAvy, 2);
3059 for (
int i = 1;
i < 12;
i += 2) {
3060 sumXiXav_ZiZAv += ((pHit[
i]->
GetX()) - xAv) * ((pHit[
i]->
GetZ()) - zAvx);
3061 sumXiXav += pow((pHit[
i]->GetX()) - xAv, 2);
3062 sumZiZav_x += pow((pHit[
i]->GetZ()) - zAvx, 2);
3065 bY = sumYiYav_ZiZAv / sumYiYav;
3066 bX = sumXiXav_ZiZAv / sumXiXav;
3068 chi2 =
sqrt((sumZiZav_y - bY * sumYiYav_ZiZAv) / (4))
3069 +
sqrt((sumZiZav_x - bX * sumXiXav_ZiZAv) / (4));
3082 Double_t eLoss = 0.;
3086 for (Int_t iHit = 0; iHit < nTracks; iHit++) {
3090 pHit = L1_DYNAMIC_CAST<CbmTrdHit*>(
fArrayTrdHit->At(hitIndex));
3104 *(
const_cast<FairTrackParam*
>(pTrack->
GetParamLast())));
3112 *(
const_cast<FairTrackParam*
>(pTrack->
GetParamLast())));
3121 vector<CbmKFHit*>::iterator it;
3123 pKFHit = L1_DYNAMIC_CAST<CbmKFTrdHit*>(*it);
3136 const Int_t nrPnts = 12;
3146 for (
int i = 0;
i < nrPnts;
i++) {
3147 trdHit = L1_DYNAMIC_CAST<CbmTrdHit*>(
fArrayTrdHit->At(M[
i]));
3150 ax[w] = trdHit->
GetX();
3151 az1[w] = trdHit->
GetZ();
3154 ay[w] = trdHit->
GetY();
3160 lf =
new TLinearFitter(2);
3161 lf->SetFormula(
"hyp2");
3168 lf->AssignData(j, 1, ax, az1);
3170 chi2x = lf->GetChisquare();
3174 lf =
new TLinearFitter(2);
3175 lf->SetFormula(
"hyp2");
3182 lf->AssignData(j, 1, ay, az1);
3184 chi2y = lf->GetChisquare();
3186 chi2 = chi2x + chi2y;
3301 Bool_t accept =
true;
3304 random = (rand() % num);
3306 if (random >= Procent) accept =
false;