diff --git a/macro/mcbm/mcbm_display_event.C b/macro/mcbm/mcbm_display_event.C index 73e45509b53b806039c07dd49c22f4b4e197a5f0..d5429fb58cc26bc3fac0cff6d2fd2dd6c1bbeec7 100644 --- a/macro/mcbm/mcbm_display_event.C +++ b/macro/mcbm/mcbm_display_event.C @@ -44,7 +44,6 @@ void mcbm_display_event(Int_t nEvents = 3, TString dataset = "data/test", const // ------------------------------------------------------------------------ Int_t iTofCluMode = 1; - Int_t iTrackMode = 1; // ----- Load the geometry setup ------------------------------------- std::cout << std::endl; @@ -244,107 +243,98 @@ void mcbm_display_event(Int_t nEvents = 3, TString dataset = "data/test", const // ----- Track reconstruction ------------------------------------------ Double_t beamWidthX = 0.1; Double_t beamWidthY = 0.1; - switch (iTrackMode) { - case 1: { - Int_t iGenCor = 1; - Double_t dScalFac = 1.; - Double_t dChi2Lim2 = 3.5; - TString cTrkFile = Form("%s_tofFindTracks.hst.root", "MC"); - Int_t iTrackingSetup = 1; - - CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); - tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm - tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz - tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz - tofTrackFinder->SetTyMean(0.); // mean slope dy/dz - CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); - TFitter* MyFit = new TFitter(1); // initialize Minuit - tofTrackFinder->SetFitter(tofTrackFitter); - CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder"); - tofFindTracks->UseFinder(tofTrackFinder); - tofFindTracks->UseFitter(tofTrackFitter); - tofFindTracks->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 - tofFindTracks->SetTtTarg(0.041); // target value for inverse velocity, > 0.033 ns/cm! - //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! - tofFindTracks->SetCalParFileName(cTrkFile); // Tracker parameter value file name - tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter - tofFindTracks->SetStationMaxHMul(30); // Max Hit Multiplicity in any used station - - tofFindTracks->SetT0MAX(dScalFac); // in ns - tofFindTracks->SetSIGT(0.08); // default in ns - tofFindTracks->SetSIGX(0.3); // default in cm - tofFindTracks->SetSIGY(0.45); // default in cm - tofFindTracks->SetSIGZ(0.05); // default in cm - tofFindTracks->SetUseSigCalib(kFALSE); // ignore resolutions in CalPar file - tofTrackFinder->SetSIGLIM(dChi2Lim2 * 2.); // matching window in multiples of chi2 - tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 - - Int_t iMinNofHits = -1; - Int_t iNStations = 0; - Int_t iNReqStations = 3; - switch (iTrackingSetup) { - case 0: // bypass mode - iMinNofHits = -1; - iNStations = 1; - tofFindTracks->SetStation(0, 5, 0, 0); // Diamond - break; - case 1: // for calibration mode of full setup - iMinNofHits = 3; - iNStations = 39; - iNReqStations = 3; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 4, 0); - tofFindTracks->SetStation(2, 0, 3, 0); - tofFindTracks->SetStation(3, 0, 4, 1); - tofFindTracks->SetStation(4, 0, 3, 1); - tofFindTracks->SetStation(5, 0, 4, 2); - tofFindTracks->SetStation(6, 0, 3, 2); - tofFindTracks->SetStation(7, 0, 4, 3); - tofFindTracks->SetStation(8, 0, 3, 3); - tofFindTracks->SetStation(9, 0, 4, 4); - tofFindTracks->SetStation(10, 0, 3, 4); - tofFindTracks->SetStation(11, 9, 0, 0); - tofFindTracks->SetStation(12, 9, 0, 1); - tofFindTracks->SetStation(13, 7, 0, 0); - tofFindTracks->SetStation(14, 6, 0, 0); - tofFindTracks->SetStation(15, 6, 0, 1); - tofFindTracks->SetStation(16, 8, 0, 0); - tofFindTracks->SetStation(17, 8, 0, 1); - tofFindTracks->SetStation(18, 8, 0, 2); - tofFindTracks->SetStation(19, 8, 0, 3); - tofFindTracks->SetStation(20, 8, 0, 4); - tofFindTracks->SetStation(21, 8, 0, 5); - tofFindTracks->SetStation(22, 8, 0, 6); - tofFindTracks->SetStation(23, 8, 0, 7); - tofFindTracks->SetStation(24, 0, 2, 2); - tofFindTracks->SetStation(25, 0, 1, 2); - tofFindTracks->SetStation(26, 0, 0, 2); - tofFindTracks->SetStation(27, 0, 2, 1); - tofFindTracks->SetStation(28, 0, 1, 1); - tofFindTracks->SetStation(29, 0, 0, 1); - tofFindTracks->SetStation(30, 0, 2, 3); - tofFindTracks->SetStation(31, 0, 1, 3); - tofFindTracks->SetStation(32, 0, 0, 3); - tofFindTracks->SetStation(33, 0, 2, 0); - tofFindTracks->SetStation(34, 0, 1, 0); - tofFindTracks->SetStation(35, 0, 0, 0); - tofFindTracks->SetStation(36, 0, 2, 4); - tofFindTracks->SetStation(37, 0, 1, 4); - tofFindTracks->SetStation(38, 0, 0, 4); - break; - } - tofFindTracks->SetMinNofHits(iMinNofHits); - tofFindTracks->SetNStations(iNStations); - tofFindTracks->SetNReqStations(iNReqStations); - tofFindTracks->PrintSetup(); - run->AddTask(tofFindTracks); - } break; - default: { - CbmBinnedTrackerTask* trackerTask = new CbmBinnedTrackerTask(kTRUE, beamWidthX, beamWidthY); - trackerTask->SetUse(kTrd, kFALSE); - run->AddTask(trackerTask); - } + Int_t iGenCor = 1; + Double_t dScalFac = 1.; + Double_t dChi2Lim2 = 3.5; + TString cTrkFile = Form("%s_tofFindTracks.hst.root", "MC"); + Int_t iTrackingSetup = 1; + + CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); + tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm + tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz + tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz + tofTrackFinder->SetTyMean(0.); // mean slope dy/dz + CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); + TFitter* MyFit = new TFitter(1); // initialize Minuit + tofTrackFinder->SetFitter(tofTrackFitter); + CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder"); + tofFindTracks->UseFinder(tofTrackFinder); + tofFindTracks->UseFitter(tofTrackFitter); + tofFindTracks->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 + tofFindTracks->SetTtTarg(0.041); // target value for inverse velocity, > 0.033 ns/cm! + //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! + tofFindTracks->SetCalParFileName(cTrkFile); // Tracker parameter value file name + tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter + tofFindTracks->SetStationMaxHMul(30); // Max Hit Multiplicity in any used station + + tofFindTracks->SetT0MAX(dScalFac); // in ns + tofFindTracks->SetSIGT(0.08); // default in ns + tofFindTracks->SetSIGX(0.3); // default in cm + tofFindTracks->SetSIGY(0.45); // default in cm + tofFindTracks->SetSIGZ(0.05); // default in cm + tofFindTracks->SetUseSigCalib(kFALSE); // ignore resolutions in CalPar file + tofTrackFinder->SetSIGLIM(dChi2Lim2 * 2.); // matching window in multiples of chi2 + tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 + + Int_t iMinNofHits = -1; + Int_t iNStations = 0; + Int_t iNReqStations = 3; + switch (iTrackingSetup) { + case 0: // bypass mode + iMinNofHits = -1; + iNStations = 1; + tofFindTracks->SetStation(0, 5, 0, 0); // Diamond + break; + case 1: // for calibration mode of full setup + iMinNofHits = 3; + iNStations = 39; + iNReqStations = 3; + tofFindTracks->SetStation(0, 5, 0, 0); + tofFindTracks->SetStation(1, 0, 4, 0); + tofFindTracks->SetStation(2, 0, 3, 0); + tofFindTracks->SetStation(3, 0, 4, 1); + tofFindTracks->SetStation(4, 0, 3, 1); + tofFindTracks->SetStation(5, 0, 4, 2); + tofFindTracks->SetStation(6, 0, 3, 2); + tofFindTracks->SetStation(7, 0, 4, 3); + tofFindTracks->SetStation(8, 0, 3, 3); + tofFindTracks->SetStation(9, 0, 4, 4); + tofFindTracks->SetStation(10, 0, 3, 4); + tofFindTracks->SetStation(11, 9, 0, 0); + tofFindTracks->SetStation(12, 9, 0, 1); + tofFindTracks->SetStation(13, 7, 0, 0); + tofFindTracks->SetStation(14, 6, 0, 0); + tofFindTracks->SetStation(15, 6, 0, 1); + tofFindTracks->SetStation(16, 8, 0, 0); + tofFindTracks->SetStation(17, 8, 0, 1); + tofFindTracks->SetStation(18, 8, 0, 2); + tofFindTracks->SetStation(19, 8, 0, 3); + tofFindTracks->SetStation(20, 8, 0, 4); + tofFindTracks->SetStation(21, 8, 0, 5); + tofFindTracks->SetStation(22, 8, 0, 6); + tofFindTracks->SetStation(23, 8, 0, 7); + tofFindTracks->SetStation(24, 0, 2, 2); + tofFindTracks->SetStation(25, 0, 1, 2); + tofFindTracks->SetStation(26, 0, 0, 2); + tofFindTracks->SetStation(27, 0, 2, 1); + tofFindTracks->SetStation(28, 0, 1, 1); + tofFindTracks->SetStation(29, 0, 0, 1); + tofFindTracks->SetStation(30, 0, 2, 3); + tofFindTracks->SetStation(31, 0, 1, 3); + tofFindTracks->SetStation(32, 0, 0, 3); + tofFindTracks->SetStation(33, 0, 2, 0); + tofFindTracks->SetStation(34, 0, 1, 0); + tofFindTracks->SetStation(35, 0, 0, 0); + tofFindTracks->SetStation(36, 0, 2, 4); + tofFindTracks->SetStation(37, 0, 1, 4); + tofFindTracks->SetStation(38, 0, 0, 4); + break; } + tofFindTracks->SetMinNofHits(iMinNofHits); + tofFindTracks->SetNStations(iNStations); + tofFindTracks->SetNReqStations(iNReqStations); + tofFindTracks->PrintSetup(); + run->AddTask(tofFindTracks); // ------------------------------------------------------------------------ diff --git a/macro/mcbm/mcbm_reco.C b/macro/mcbm/mcbm_reco.C index 179d93b7cc418e3eca3aaad03488185f4b6baa1d..65643aa5b6f70149f667aa87ba8c844411c2af96 100644 --- a/macro/mcbm/mcbm_reco.C +++ b/macro/mcbm/mcbm_reco.C @@ -42,7 +42,6 @@ void mcbm_reco(Int_t nEvents = 10, TString dataset = "data/test", TString sEvBui // ------------------------------------------------------------------------ Int_t iTofCluMode = 1; - Int_t iTrackMode = 1; // ----- Load the geometry setup ------------------------------------- std::cout << std::endl; @@ -317,112 +316,104 @@ void mcbm_reco(Int_t nEvents = 10, TString dataset = "data/test", TString sEvBui // ----- Track reconstruction ------------------------------------------ Double_t beamWidthX = 0.1; Double_t beamWidthY = 0.1; - switch (iTrackMode) { - case 1: { - Int_t iGenCor = 1; - Double_t dScalFac = 1.; - Double_t dChi2Lim2 = 3.5; - TString cTrkFile = Form("%s_tofFindTracks.hst.root", "MC"); - Int_t iTrackingSetup = 1; - - CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); - tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm - tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz - tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz - tofTrackFinder->SetTyMean(0.); // mean slope dy/dz - CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); - TFitter* MyFit = new TFitter(1); // initialize Minuit - tofTrackFinder->SetFitter(tofTrackFitter); - CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder"); - tofFindTracks->UseFinder(tofTrackFinder); - tofFindTracks->UseFitter(tofTrackFitter); - tofFindTracks->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 - tofFindTracks->SetTtTarg(0.041); // target value for inverse velocity, > 0.033 ns/cm! - //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! - tofFindTracks->SetCalParFileName(cTrkFile); // Tracker parameter value file name - tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter - tofFindTracks->SetStationMaxHMul(30); // Max Hit Multiplicity in any used station - - tofFindTracks->SetT0MAX(dScalFac); // in ns - tofFindTracks->SetSIGT(0.08); // default in ns - tofFindTracks->SetSIGX(0.3); // default in cm - tofFindTracks->SetSIGY(0.45); // default in cm - tofFindTracks->SetSIGZ(0.05); // default in cm - tofFindTracks->SetUseSigCalib(kFALSE); // ignore resolutions in CalPar file - tofTrackFinder->SetSIGLIM(dChi2Lim2 * 2.); // matching window in multiples of chi2 - tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 - - Int_t iMinNofHits = -1; - Int_t iNStations = 0; - Int_t iNReqStations = 3; - switch (iTrackingSetup) { - case 0: // bypass mode - iMinNofHits = -1; - iNStations = 1; - tofFindTracks->SetStation(0, 5, 0, 0); // Diamond - break; - case 1: // for calibration mode of full setup - iMinNofHits = 3; - // iNStations = 39; - iNStations = 26; - iNReqStations = 3; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 2, 2); - tofFindTracks->SetStation(2, 0, 1, 2); - tofFindTracks->SetStation(3, 0, 0, 2); - tofFindTracks->SetStation(4, 0, 2, 1); - tofFindTracks->SetStation(5, 0, 1, 1); - tofFindTracks->SetStation(6, 0, 0, 1); - tofFindTracks->SetStation(7, 0, 2, 3); - tofFindTracks->SetStation(8, 0, 1, 3); - tofFindTracks->SetStation(9, 0, 0, 3); - tofFindTracks->SetStation(10, 0, 2, 0); - tofFindTracks->SetStation(11, 0, 1, 0); - tofFindTracks->SetStation(12, 0, 0, 0); - tofFindTracks->SetStation(13, 0, 2, 4); - tofFindTracks->SetStation(14, 0, 1, 4); - tofFindTracks->SetStation(15, 0, 0, 4); - tofFindTracks->SetStation(16, 0, 4, 0); - tofFindTracks->SetStation(17, 0, 3, 0); - tofFindTracks->SetStation(18, 0, 4, 1); - tofFindTracks->SetStation(19, 0, 3, 1); - tofFindTracks->SetStation(20, 0, 4, 2); - tofFindTracks->SetStation(21, 0, 3, 2); - tofFindTracks->SetStation(22, 0, 4, 3); - tofFindTracks->SetStation(23, 0, 3, 3); - tofFindTracks->SetStation(24, 0, 4, 4); - tofFindTracks->SetStation(25, 0, 3, 4); - - /* - tofFindTracks->SetStation(26, 9, 0, 0); - tofFindTracks->SetStation(27, 9, 0, 1); - tofFindTracks->SetStation(28, 7, 0, 0); - tofFindTracks->SetStation(29, 6, 0, 0); - tofFindTracks->SetStation(30, 6, 0, 1); - tofFindTracks->SetStation(31, 8, 0, 0); - tofFindTracks->SetStation(32, 8, 0, 1); - tofFindTracks->SetStation(33, 8, 0, 2); - tofFindTracks->SetStation(34, 8, 0, 3); - tofFindTracks->SetStation(35, 8, 0, 4); - tofFindTracks->SetStation(36, 8, 0, 5); - tofFindTracks->SetStation(37, 8, 0, 6); - tofFindTracks->SetStation(38, 8, 0, 7); - */ - - break; - } - tofFindTracks->SetMinNofHits(iMinNofHits); - tofFindTracks->SetNStations(iNStations); - tofFindTracks->SetNReqStations(iNReqStations); - tofFindTracks->PrintSetup(); - // run->AddTask(tofFindTracks); - } break; - default: { - CbmBinnedTrackerTask* trackerTask = new CbmBinnedTrackerTask(kTRUE, beamWidthX, beamWidthY); - trackerTask->SetUse(ECbmModuleId::kTrd, kFALSE); - // run->AddTask(trackerTask); - } + Int_t iGenCor = 1; + Double_t dScalFac = 1.; + Double_t dChi2Lim2 = 3.5; + TString cTrkFile = Form("%s_tofFindTracks.hst.root", "MC"); + Int_t iTrackingSetup = 1; + + CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); + tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm + tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz + tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz + tofTrackFinder->SetTyMean(0.); // mean slope dy/dz + CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); + TFitter* MyFit = new TFitter(1); // initialize Minuit + tofTrackFinder->SetFitter(tofTrackFitter); + CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder"); + tofFindTracks->UseFinder(tofTrackFinder); + tofFindTracks->UseFitter(tofTrackFitter); + tofFindTracks->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 + tofFindTracks->SetTtTarg(0.041); // target value for inverse velocity, > 0.033 ns/cm! + //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! + tofFindTracks->SetCalParFileName(cTrkFile); // Tracker parameter value file name + tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter + tofFindTracks->SetStationMaxHMul(30); // Max Hit Multiplicity in any used station + + tofFindTracks->SetT0MAX(dScalFac); // in ns + tofFindTracks->SetSIGT(0.08); // default in ns + tofFindTracks->SetSIGX(0.3); // default in cm + tofFindTracks->SetSIGY(0.45); // default in cm + tofFindTracks->SetSIGZ(0.05); // default in cm + tofFindTracks->SetUseSigCalib(kFALSE); // ignore resolutions in CalPar file + tofTrackFinder->SetSIGLIM(dChi2Lim2 * 2.); // matching window in multiples of chi2 + tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 + + Int_t iMinNofHits = -1; + Int_t iNStations = 0; + Int_t iNReqStations = 3; + switch (iTrackingSetup) { + case 0: // bypass mode + iMinNofHits = -1; + iNStations = 1; + tofFindTracks->SetStation(0, 5, 0, 0); // Diamond + break; + case 1: // for calibration mode of full setup + iMinNofHits = 3; + // iNStations = 39; + iNStations = 26; + iNReqStations = 3; + tofFindTracks->SetStation(0, 5, 0, 0); + tofFindTracks->SetStation(1, 0, 2, 2); + tofFindTracks->SetStation(2, 0, 1, 2); + tofFindTracks->SetStation(3, 0, 0, 2); + tofFindTracks->SetStation(4, 0, 2, 1); + tofFindTracks->SetStation(5, 0, 1, 1); + tofFindTracks->SetStation(6, 0, 0, 1); + tofFindTracks->SetStation(7, 0, 2, 3); + tofFindTracks->SetStation(8, 0, 1, 3); + tofFindTracks->SetStation(9, 0, 0, 3); + tofFindTracks->SetStation(10, 0, 2, 0); + tofFindTracks->SetStation(11, 0, 1, 0); + tofFindTracks->SetStation(12, 0, 0, 0); + tofFindTracks->SetStation(13, 0, 2, 4); + tofFindTracks->SetStation(14, 0, 1, 4); + tofFindTracks->SetStation(15, 0, 0, 4); + tofFindTracks->SetStation(16, 0, 4, 0); + tofFindTracks->SetStation(17, 0, 3, 0); + tofFindTracks->SetStation(18, 0, 4, 1); + tofFindTracks->SetStation(19, 0, 3, 1); + tofFindTracks->SetStation(20, 0, 4, 2); + tofFindTracks->SetStation(21, 0, 3, 2); + tofFindTracks->SetStation(22, 0, 4, 3); + tofFindTracks->SetStation(23, 0, 3, 3); + tofFindTracks->SetStation(24, 0, 4, 4); + tofFindTracks->SetStation(25, 0, 3, 4); + + /* + tofFindTracks->SetStation(26, 9, 0, 0); + tofFindTracks->SetStation(27, 9, 0, 1); + tofFindTracks->SetStation(28, 7, 0, 0); + tofFindTracks->SetStation(29, 6, 0, 0); + tofFindTracks->SetStation(30, 6, 0, 1); + tofFindTracks->SetStation(31, 8, 0, 0); + tofFindTracks->SetStation(32, 8, 0, 1); + tofFindTracks->SetStation(33, 8, 0, 2); + tofFindTracks->SetStation(34, 8, 0, 3); + tofFindTracks->SetStation(35, 8, 0, 4); + tofFindTracks->SetStation(36, 8, 0, 5); + tofFindTracks->SetStation(37, 8, 0, 6); + tofFindTracks->SetStation(38, 8, 0, 7); + */ + + break; } + tofFindTracks->SetMinNofHits(iMinNofHits); + tofFindTracks->SetNStations(iNStations); + tofFindTracks->SetNReqStations(iNReqStations); + tofFindTracks->PrintSetup(); + // run->AddTask(tofFindTracks); + // ------------------------------------------------------------------------ diff --git a/macro/mcbm/mcbm_reco_event.C b/macro/mcbm/mcbm_reco_event.C index b0d10234cf6033b2cf698f119120d124d64cd1a0..1bf88a0050da22cb6cebabfacca49e3e924b98e5 100644 --- a/macro/mcbm/mcbm_reco_event.C +++ b/macro/mcbm/mcbm_reco_event.C @@ -42,7 +42,6 @@ void mcbm_reco_event(Int_t nEvents = 10, TString dataset = "data/test", // ------------------------------------------------------------------------ Int_t iTofCluMode = 1; - Int_t iTrackMode = 1; // ----- Load the geometry setup ------------------------------------- std::cout << std::endl; @@ -248,112 +247,104 @@ void mcbm_reco_event(Int_t nEvents = 10, TString dataset = "data/test", // ----- Track reconstruction ------------------------------------------ Double_t beamWidthX = 0.1; Double_t beamWidthY = 0.1; - switch (iTrackMode) { - case 1: { - Int_t iGenCor = 1; - Double_t dScalFac = 1.; - Double_t dChi2Lim2 = 3.5; - TString cTrkFile = Form("%s_tofFindTracks.hst.root", "MC"); - Int_t iTrackingSetup = 1; - - CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); - tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm - tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz - tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz - tofTrackFinder->SetTyMean(0.); // mean slope dy/dz - CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); - TFitter* MyFit = new TFitter(1); // initialize Minuit - tofTrackFinder->SetFitter(tofTrackFitter); - CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder"); - tofFindTracks->UseFinder(tofTrackFinder); - tofFindTracks->UseFitter(tofTrackFitter); - tofFindTracks->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 - tofFindTracks->SetTtTarg(0.041); // target value for inverse velocity, > 0.033 ns/cm! - //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! - tofFindTracks->SetCalParFileName(cTrkFile); // Tracker parameter value file name - tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter - tofFindTracks->SetStationMaxHMul(30); // Max Hit Multiplicity in any used station - - tofFindTracks->SetT0MAX(dScalFac); // in ns - tofFindTracks->SetSIGT(0.08); // default in ns - tofFindTracks->SetSIGX(0.3); // default in cm - tofFindTracks->SetSIGY(0.45); // default in cm - tofFindTracks->SetSIGZ(0.05); // default in cm - tofFindTracks->SetUseSigCalib(kFALSE); // ignore resolutions in CalPar file - tofTrackFinder->SetSIGLIM(dChi2Lim2 * 2.); // matching window in multiples of chi2 - tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 - - Int_t iMinNofHits = -1; - Int_t iNStations = 0; - Int_t iNReqStations = 3; - switch (iTrackingSetup) { - case 0: // bypass mode - iMinNofHits = -1; - iNStations = 1; - tofFindTracks->SetStation(0, 5, 0, 0); // Diamond - break; - case 1: // for calibration mode of full setup - iMinNofHits = 3; - // iNStations = 39; - iNStations = 26; - iNReqStations = 3; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 2, 2); - tofFindTracks->SetStation(2, 0, 1, 2); - tofFindTracks->SetStation(3, 0, 0, 2); - tofFindTracks->SetStation(4, 0, 2, 1); - tofFindTracks->SetStation(5, 0, 1, 1); - tofFindTracks->SetStation(6, 0, 0, 1); - tofFindTracks->SetStation(7, 0, 2, 3); - tofFindTracks->SetStation(8, 0, 1, 3); - tofFindTracks->SetStation(9, 0, 0, 3); - tofFindTracks->SetStation(10, 0, 2, 0); - tofFindTracks->SetStation(11, 0, 1, 0); - tofFindTracks->SetStation(12, 0, 0, 0); - tofFindTracks->SetStation(13, 0, 2, 4); - tofFindTracks->SetStation(14, 0, 1, 4); - tofFindTracks->SetStation(15, 0, 0, 4); - tofFindTracks->SetStation(16, 0, 4, 0); - tofFindTracks->SetStation(17, 0, 3, 0); - tofFindTracks->SetStation(18, 0, 4, 1); - tofFindTracks->SetStation(19, 0, 3, 1); - tofFindTracks->SetStation(20, 0, 4, 2); - tofFindTracks->SetStation(21, 0, 3, 2); - tofFindTracks->SetStation(22, 0, 4, 3); - tofFindTracks->SetStation(23, 0, 3, 3); - tofFindTracks->SetStation(24, 0, 4, 4); - tofFindTracks->SetStation(25, 0, 3, 4); - - /* - tofFindTracks->SetStation(26, 9, 0, 0); - tofFindTracks->SetStation(27, 9, 0, 1); - tofFindTracks->SetStation(28, 7, 0, 0); - tofFindTracks->SetStation(29, 6, 0, 0); - tofFindTracks->SetStation(30, 6, 0, 1); - tofFindTracks->SetStation(31, 8, 0, 0); - tofFindTracks->SetStation(32, 8, 0, 1); - tofFindTracks->SetStation(33, 8, 0, 2); - tofFindTracks->SetStation(34, 8, 0, 3); - tofFindTracks->SetStation(35, 8, 0, 4); - tofFindTracks->SetStation(36, 8, 0, 5); - tofFindTracks->SetStation(37, 8, 0, 6); - tofFindTracks->SetStation(38, 8, 0, 7); - */ - - break; - } - tofFindTracks->SetMinNofHits(iMinNofHits); - tofFindTracks->SetNStations(iNStations); - tofFindTracks->SetNReqStations(iNReqStations); - tofFindTracks->PrintSetup(); - // run->AddTask(tofFindTracks); - } break; - default: { - CbmBinnedTrackerTask* trackerTask = new CbmBinnedTrackerTask(kTRUE, beamWidthX, beamWidthY); - trackerTask->SetUse(ECbmModuleId::kTrd, kFALSE); - // run->AddTask(trackerTask); - } + Int_t iGenCor = 1; + Double_t dScalFac = 1.; + Double_t dChi2Lim2 = 3.5; + TString cTrkFile = Form("%s_tofFindTracks.hst.root", "MC"); + Int_t iTrackingSetup = 1; + + CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); + tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm + tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz + tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz + tofTrackFinder->SetTyMean(0.); // mean slope dy/dz + CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); + TFitter* MyFit = new TFitter(1); // initialize Minuit + tofTrackFinder->SetFitter(tofTrackFitter); + CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder"); + tofFindTracks->UseFinder(tofTrackFinder); + tofFindTracks->UseFitter(tofTrackFitter); + tofFindTracks->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 + tofFindTracks->SetTtTarg(0.041); // target value for inverse velocity, > 0.033 ns/cm! + //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! + tofFindTracks->SetCalParFileName(cTrkFile); // Tracker parameter value file name + tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter + tofFindTracks->SetStationMaxHMul(30); // Max Hit Multiplicity in any used station + + tofFindTracks->SetT0MAX(dScalFac); // in ns + tofFindTracks->SetSIGT(0.08); // default in ns + tofFindTracks->SetSIGX(0.3); // default in cm + tofFindTracks->SetSIGY(0.45); // default in cm + tofFindTracks->SetSIGZ(0.05); // default in cm + tofFindTracks->SetUseSigCalib(kFALSE); // ignore resolutions in CalPar file + tofTrackFinder->SetSIGLIM(dChi2Lim2 * 2.); // matching window in multiples of chi2 + tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 + + Int_t iMinNofHits = -1; + Int_t iNStations = 0; + Int_t iNReqStations = 3; + switch (iTrackingSetup) { + case 0: // bypass mode + iMinNofHits = -1; + iNStations = 1; + tofFindTracks->SetStation(0, 5, 0, 0); // Diamond + break; + case 1: // for calibration mode of full setup + iMinNofHits = 3; + // iNStations = 39; + iNStations = 26; + iNReqStations = 3; + tofFindTracks->SetStation(0, 5, 0, 0); + tofFindTracks->SetStation(1, 0, 2, 2); + tofFindTracks->SetStation(2, 0, 1, 2); + tofFindTracks->SetStation(3, 0, 0, 2); + tofFindTracks->SetStation(4, 0, 2, 1); + tofFindTracks->SetStation(5, 0, 1, 1); + tofFindTracks->SetStation(6, 0, 0, 1); + tofFindTracks->SetStation(7, 0, 2, 3); + tofFindTracks->SetStation(8, 0, 1, 3); + tofFindTracks->SetStation(9, 0, 0, 3); + tofFindTracks->SetStation(10, 0, 2, 0); + tofFindTracks->SetStation(11, 0, 1, 0); + tofFindTracks->SetStation(12, 0, 0, 0); + tofFindTracks->SetStation(13, 0, 2, 4); + tofFindTracks->SetStation(14, 0, 1, 4); + tofFindTracks->SetStation(15, 0, 0, 4); + tofFindTracks->SetStation(16, 0, 4, 0); + tofFindTracks->SetStation(17, 0, 3, 0); + tofFindTracks->SetStation(18, 0, 4, 1); + tofFindTracks->SetStation(19, 0, 3, 1); + tofFindTracks->SetStation(20, 0, 4, 2); + tofFindTracks->SetStation(21, 0, 3, 2); + tofFindTracks->SetStation(22, 0, 4, 3); + tofFindTracks->SetStation(23, 0, 3, 3); + tofFindTracks->SetStation(24, 0, 4, 4); + tofFindTracks->SetStation(25, 0, 3, 4); + + /* + tofFindTracks->SetStation(26, 9, 0, 0); + tofFindTracks->SetStation(27, 9, 0, 1); + tofFindTracks->SetStation(28, 7, 0, 0); + tofFindTracks->SetStation(29, 6, 0, 0); + tofFindTracks->SetStation(30, 6, 0, 1); + tofFindTracks->SetStation(31, 8, 0, 0); + tofFindTracks->SetStation(32, 8, 0, 1); + tofFindTracks->SetStation(33, 8, 0, 2); + tofFindTracks->SetStation(34, 8, 0, 3); + tofFindTracks->SetStation(35, 8, 0, 4); + tofFindTracks->SetStation(36, 8, 0, 5); + tofFindTracks->SetStation(37, 8, 0, 6); + tofFindTracks->SetStation(38, 8, 0, 7); + */ + + break; } + tofFindTracks->SetMinNofHits(iMinNofHits); + tofFindTracks->SetNStations(iNStations); + tofFindTracks->SetNReqStations(iNReqStations); + tofFindTracks->PrintSetup(); + // run->AddTask(tofFindTracks); + // ------------------------------------------------------------------------ diff --git a/macro/mcbm/mcbm_reco_event_tb.C b/macro/mcbm/mcbm_reco_event_tb.C index 746623f1996fcffe8be21ce40b67e08c3c457b59..8b3a7a845e75707cd610c7ec7c582b7bfc889200 100644 --- a/macro/mcbm/mcbm_reco_event_tb.C +++ b/macro/mcbm/mcbm_reco_event_tb.C @@ -33,7 +33,6 @@ void mcbm_reco_event_tb(Int_t nEvents = 10, TString dataset = "data/mcbm_beam_20 // ------------------------------------------------------------------------ Int_t iTofCluMode = 1; - Int_t iTrackMode = 1; // ----- Environment -------------------------------------------------- TString myName = "mcbm_reco"; // this macro's name for screen output @@ -288,108 +287,100 @@ void mcbm_reco_event_tb(Int_t nEvents = 10, TString dataset = "data/mcbm_beam_20 // ----- Track reconstruction ------------------------------------------ Double_t beamWidthX = 0.1; Double_t beamWidthY = 0.1; - switch (iTrackMode) { - case 1: { - Int_t iGenCor = 1; - Double_t dScalFac = 1.; - Double_t dChi2Lim2 = 3.5; - TString cTrkFile = Form("%s_tofFindTracks.hst.root", "MC"); - Int_t iTrackingSetup = 1; - - CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); - tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm - tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz - tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz - tofTrackFinder->SetTyMean(0.); // mean slope dy/dz - CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); - TFitter* MyFit = new TFitter(1); // initialize Minuit - tofTrackFinder->SetFitter(tofTrackFitter); - CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder"); - tofFindTracks->UseFinder(tofTrackFinder); - tofFindTracks->UseFitter(tofTrackFitter); - tofFindTracks->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 - tofFindTracks->SetTtTarg(0.041); // target value for inverse velocity, > 0.033 ns/cm! - //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! - tofFindTracks->SetCalParFileName(cTrkFile); // Tracker parameter value file name - tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter - tofFindTracks->SetStationMaxHMul(30); // Max Hit Multiplicity in any used station - - tofFindTracks->SetT0MAX(dScalFac); // in ns - tofFindTracks->SetSIGT(0.08); // default in ns - tofFindTracks->SetSIGX(0.3); // default in cm - tofFindTracks->SetSIGY(0.45); // default in cm - tofFindTracks->SetSIGZ(0.05); // default in cm - tofFindTracks->SetUseSigCalib(kFALSE); // ignore resolutions in CalPar file - tofTrackFinder->SetSIGLIM(dChi2Lim2 * 2.); // matching window in multiples of chi2 - tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 - - Int_t iMinNofHits = -1; - Int_t iNStations = 0; - Int_t iNReqStations = 3; - switch (iTrackingSetup) { - case 0: // bypass mode - iMinNofHits = -1; - iNStations = 1; - tofFindTracks->SetStation(0, 5, 0, 0); // Diamond - break; - case 1: // for calibration mode of full setup - iMinNofHits = 3; - iNStations = 39; - iNReqStations = 3; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 2, 2); - tofFindTracks->SetStation(2, 0, 1, 2); - tofFindTracks->SetStation(3, 0, 0, 2); - tofFindTracks->SetStation(4, 0, 2, 1); - tofFindTracks->SetStation(5, 0, 1, 1); - tofFindTracks->SetStation(6, 0, 0, 1); - tofFindTracks->SetStation(7, 0, 2, 3); - tofFindTracks->SetStation(8, 0, 1, 3); - tofFindTracks->SetStation(9, 0, 0, 3); - tofFindTracks->SetStation(10, 0, 2, 0); - tofFindTracks->SetStation(11, 0, 1, 0); - tofFindTracks->SetStation(12, 0, 0, 0); - tofFindTracks->SetStation(13, 0, 2, 4); - tofFindTracks->SetStation(14, 0, 1, 4); - tofFindTracks->SetStation(15, 0, 0, 4); - tofFindTracks->SetStation(16, 0, 4, 0); - tofFindTracks->SetStation(17, 0, 3, 0); - tofFindTracks->SetStation(18, 0, 4, 1); - tofFindTracks->SetStation(19, 0, 3, 1); - tofFindTracks->SetStation(20, 0, 4, 2); - tofFindTracks->SetStation(21, 0, 3, 2); - tofFindTracks->SetStation(22, 0, 4, 3); - tofFindTracks->SetStation(23, 0, 3, 3); - tofFindTracks->SetStation(24, 0, 4, 4); - tofFindTracks->SetStation(25, 0, 3, 4); - tofFindTracks->SetStation(26, 9, 0, 0); - tofFindTracks->SetStation(27, 9, 0, 1); - tofFindTracks->SetStation(28, 7, 0, 0); - tofFindTracks->SetStation(29, 6, 0, 0); - tofFindTracks->SetStation(30, 6, 0, 1); - tofFindTracks->SetStation(31, 8, 0, 0); - tofFindTracks->SetStation(32, 8, 0, 1); - tofFindTracks->SetStation(33, 8, 0, 2); - tofFindTracks->SetStation(34, 8, 0, 3); - tofFindTracks->SetStation(35, 8, 0, 4); - tofFindTracks->SetStation(36, 8, 0, 5); - tofFindTracks->SetStation(37, 8, 0, 6); - tofFindTracks->SetStation(38, 8, 0, 7); - - break; - } - tofFindTracks->SetMinNofHits(iMinNofHits); - tofFindTracks->SetNStations(iNStations); - tofFindTracks->SetNReqStations(iNReqStations); - tofFindTracks->PrintSetup(); - run->AddTask(tofFindTracks); - } break; - default: { - CbmBinnedTrackerTask* trackerTask = new CbmBinnedTrackerTask(kTRUE, beamWidthX, beamWidthY); - trackerTask->SetUse(kTrd, kFALSE); - run->AddTask(trackerTask); - } + + Int_t iGenCor = 1; + Double_t dScalFac = 1.; + Double_t dChi2Lim2 = 3.5; + TString cTrkFile = Form("%s_tofFindTracks.hst.root", "MC"); + Int_t iTrackingSetup = 1; + + CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); + tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm + tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz + tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz + tofTrackFinder->SetTyMean(0.); // mean slope dy/dz + CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); + TFitter* MyFit = new TFitter(1); // initialize Minuit + tofTrackFinder->SetFitter(tofTrackFitter); + CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder"); + tofFindTracks->UseFinder(tofTrackFinder); + tofFindTracks->UseFitter(tofTrackFitter); + tofFindTracks->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 + tofFindTracks->SetTtTarg(0.041); // target value for inverse velocity, > 0.033 ns/cm! + //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! + tofFindTracks->SetCalParFileName(cTrkFile); // Tracker parameter value file name + tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter + tofFindTracks->SetStationMaxHMul(30); // Max Hit Multiplicity in any used station + + tofFindTracks->SetT0MAX(dScalFac); // in ns + tofFindTracks->SetSIGT(0.08); // default in ns + tofFindTracks->SetSIGX(0.3); // default in cm + tofFindTracks->SetSIGY(0.45); // default in cm + tofFindTracks->SetSIGZ(0.05); // default in cm + tofFindTracks->SetUseSigCalib(kFALSE); // ignore resolutions in CalPar file + tofTrackFinder->SetSIGLIM(dChi2Lim2 * 2.); // matching window in multiples of chi2 + tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 + + Int_t iMinNofHits = -1; + Int_t iNStations = 0; + Int_t iNReqStations = 3; + switch (iTrackingSetup) { + case 0: // bypass mode + iMinNofHits = -1; + iNStations = 1; + tofFindTracks->SetStation(0, 5, 0, 0); // Diamond + break; + case 1: // for calibration mode of full setup + iMinNofHits = 3; + iNStations = 39; + iNReqStations = 3; + tofFindTracks->SetStation(0, 5, 0, 0); + tofFindTracks->SetStation(1, 0, 2, 2); + tofFindTracks->SetStation(2, 0, 1, 2); + tofFindTracks->SetStation(3, 0, 0, 2); + tofFindTracks->SetStation(4, 0, 2, 1); + tofFindTracks->SetStation(5, 0, 1, 1); + tofFindTracks->SetStation(6, 0, 0, 1); + tofFindTracks->SetStation(7, 0, 2, 3); + tofFindTracks->SetStation(8, 0, 1, 3); + tofFindTracks->SetStation(9, 0, 0, 3); + tofFindTracks->SetStation(10, 0, 2, 0); + tofFindTracks->SetStation(11, 0, 1, 0); + tofFindTracks->SetStation(12, 0, 0, 0); + tofFindTracks->SetStation(13, 0, 2, 4); + tofFindTracks->SetStation(14, 0, 1, 4); + tofFindTracks->SetStation(15, 0, 0, 4); + tofFindTracks->SetStation(16, 0, 4, 0); + tofFindTracks->SetStation(17, 0, 3, 0); + tofFindTracks->SetStation(18, 0, 4, 1); + tofFindTracks->SetStation(19, 0, 3, 1); + tofFindTracks->SetStation(20, 0, 4, 2); + tofFindTracks->SetStation(21, 0, 3, 2); + tofFindTracks->SetStation(22, 0, 4, 3); + tofFindTracks->SetStation(23, 0, 3, 3); + tofFindTracks->SetStation(24, 0, 4, 4); + tofFindTracks->SetStation(25, 0, 3, 4); + tofFindTracks->SetStation(26, 9, 0, 0); + tofFindTracks->SetStation(27, 9, 0, 1); + tofFindTracks->SetStation(28, 7, 0, 0); + tofFindTracks->SetStation(29, 6, 0, 0); + tofFindTracks->SetStation(30, 6, 0, 1); + tofFindTracks->SetStation(31, 8, 0, 0); + tofFindTracks->SetStation(32, 8, 0, 1); + tofFindTracks->SetStation(33, 8, 0, 2); + tofFindTracks->SetStation(34, 8, 0, 3); + tofFindTracks->SetStation(35, 8, 0, 4); + tofFindTracks->SetStation(36, 8, 0, 5); + tofFindTracks->SetStation(37, 8, 0, 6); + tofFindTracks->SetStation(38, 8, 0, 7); + + break; } + tofFindTracks->SetMinNofHits(iMinNofHits); + tofFindTracks->SetNStations(iNStations); + tofFindTracks->SetNReqStations(iNReqStations); + tofFindTracks->PrintSetup(); + run->AddTask(tofFindTracks); // ------------------------------------------------------------------------ diff --git a/macro/mcbm/mcbm_reco_event_tb_nh.C b/macro/mcbm/mcbm_reco_event_tb_nh.C index 4d91ca9afa722ff6e40acceeb9446c9568572162..42e1cc95e7a5927aeba9e3acfacb6d6d24bcd877 100644 --- a/macro/mcbm/mcbm_reco_event_tb_nh.C +++ b/macro/mcbm/mcbm_reco_event_tb_nh.C @@ -56,7 +56,6 @@ void mcbm_reco_event_tb_nh(Int_t nEvents = 10, TString RunId = "test", TString I // ------------------------------------------------------------------------ Int_t iTofCluMode = 1; // 1 - CbmTofEventClusterizer - Int_t iTrackMode = 0; // ----- Load the geometry setup ------------------------------------- std::cout << std::endl; @@ -465,96 +464,85 @@ void mcbm_reco_event_tb_nh(Int_t nEvents = 10, TString RunId = "test", TString I // ----- Track reconstruction ------------------------------------------ Double_t beamWidthX = 0.1; Double_t beamWidthY = 0.1; - switch (iTrackMode) { - case 2: { - Int_t iGenCor = 1; - Double_t dScalFac = 1.; - Double_t dChi2Lim2 = 3.5; - TString cTrkFile = Form("%s_tofFindTracks.hst.root", "MC"); - Int_t iTrackingSetup = 1; - - CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); - tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm - tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz - tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz - tofTrackFinder->SetTyMean(0.); // mean slope dy/dz - CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); - TFitter* MyFit = new TFitter(1); // initialize Minuit - tofTrackFinder->SetFitter(tofTrackFitter); - CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder"); - tofFindTracks->UseFinder(tofTrackFinder); - tofFindTracks->UseFitter(tofTrackFitter); - tofFindTracks->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 - tofFindTracks->SetTtTarg(0.041); // target value for inverse velocity, > 0.033 ns/cm! - //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! - tofFindTracks->SetCalParFileName(cTrkFile); // Tracker parameter value file name - tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter - tofFindTracks->SetStationMaxHMul(30); // Max Hit Multiplicity in any used station - - tofFindTracks->SetT0MAX(dScalFac); // in ns - tofFindTracks->SetSIGT(0.08); // default in ns - tofFindTracks->SetSIGX(0.3); // default in cm - tofFindTracks->SetSIGY(0.45); // default in cm - tofFindTracks->SetSIGZ(0.05); // default in cm - tofFindTracks->SetUseSigCalib(kFALSE); // ignore resolutions in CalPar file - tofTrackFinder->SetSIGLIM(dChi2Lim2 * 2.); // matching window in multiples of chi2 - tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 - - Int_t iMinNofHits = -1; - Int_t iNStations = 0; - Int_t iNReqStations = 3; - switch (iTrackingSetup) { - case 0: // bypass mode - iMinNofHits = -1; - iNStations = 1; - tofFindTracks->SetStation(0, 5, 0, 0); // Diamond - break; - case 1: // for calibration mode of full setup - iMinNofHits = 3; - iNStations = 26; - iNReqStations = 3; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 2, 2); - tofFindTracks->SetStation(2, 0, 1, 2); - tofFindTracks->SetStation(3, 0, 0, 2); - tofFindTracks->SetStation(4, 0, 2, 1); - tofFindTracks->SetStation(5, 0, 1, 1); - tofFindTracks->SetStation(6, 0, 0, 1); - tofFindTracks->SetStation(7, 0, 2, 3); - tofFindTracks->SetStation(8, 0, 1, 3); - tofFindTracks->SetStation(9, 0, 0, 3); - tofFindTracks->SetStation(10, 0, 2, 0); - tofFindTracks->SetStation(11, 0, 1, 0); - tofFindTracks->SetStation(12, 0, 0, 0); - tofFindTracks->SetStation(13, 0, 2, 4); - tofFindTracks->SetStation(14, 0, 1, 4); - tofFindTracks->SetStation(15, 0, 0, 4); - tofFindTracks->SetStation(16, 0, 4, 0); - tofFindTracks->SetStation(17, 0, 3, 0); - tofFindTracks->SetStation(18, 0, 4, 1); - tofFindTracks->SetStation(19, 0, 3, 1); - tofFindTracks->SetStation(20, 0, 4, 2); - tofFindTracks->SetStation(21, 0, 3, 2); - tofFindTracks->SetStation(22, 0, 4, 3); - tofFindTracks->SetStation(23, 0, 3, 3); - tofFindTracks->SetStation(24, 0, 4, 4); - tofFindTracks->SetStation(25, 0, 3, 4); - break; - } - tofFindTracks->SetMinNofHits(iMinNofHits); - tofFindTracks->SetNStations(iNStations); - tofFindTracks->SetNReqStations(iNReqStations); - tofFindTracks->PrintSetup(); - run->AddTask(tofFindTracks); - } break; - case 1: { - CbmBinnedTrackerTask* trackerTask = new CbmBinnedTrackerTask(kTRUE, beamWidthX, beamWidthY); - trackerTask->SetUse(ECbmModuleId::kTrd, kFALSE); - run->AddTask(trackerTask); - } - case 0: - default:; + Int_t iGenCor = 1; + Double_t dScalFac = 1.; + Double_t dChi2Lim2 = 3.5; + TString cTrkFile = Form("%s_tofFindTracks.hst.root", "MC"); + Int_t iTrackingSetup = 1; + + CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); + tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm + tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz + tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz + tofTrackFinder->SetTyMean(0.); // mean slope dy/dz + CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); + TFitter* MyFit = new TFitter(1); // initialize Minuit + tofTrackFinder->SetFitter(tofTrackFitter); + CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder"); + tofFindTracks->UseFinder(tofTrackFinder); + tofFindTracks->UseFitter(tofTrackFitter); + tofFindTracks->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 + tofFindTracks->SetTtTarg(0.041); // target value for inverse velocity, > 0.033 ns/cm! + //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! + tofFindTracks->SetCalParFileName(cTrkFile); // Tracker parameter value file name + tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter + tofFindTracks->SetStationMaxHMul(30); // Max Hit Multiplicity in any used station + + tofFindTracks->SetT0MAX(dScalFac); // in ns + tofFindTracks->SetSIGT(0.08); // default in ns + tofFindTracks->SetSIGX(0.3); // default in cm + tofFindTracks->SetSIGY(0.45); // default in cm + tofFindTracks->SetSIGZ(0.05); // default in cm + tofFindTracks->SetUseSigCalib(kFALSE); // ignore resolutions in CalPar file + tofTrackFinder->SetSIGLIM(dChi2Lim2 * 2.); // matching window in multiples of chi2 + tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 + + Int_t iMinNofHits = -1; + Int_t iNStations = 0; + Int_t iNReqStations = 3; + switch (iTrackingSetup) { + case 0: // bypass mode + iMinNofHits = -1; + iNStations = 1; + tofFindTracks->SetStation(0, 5, 0, 0); // Diamond + break; + case 1: // for calibration mode of full setup + iMinNofHits = 3; + iNStations = 26; + iNReqStations = 3; + tofFindTracks->SetStation(0, 5, 0, 0); + tofFindTracks->SetStation(1, 0, 2, 2); + tofFindTracks->SetStation(2, 0, 1, 2); + tofFindTracks->SetStation(3, 0, 0, 2); + tofFindTracks->SetStation(4, 0, 2, 1); + tofFindTracks->SetStation(5, 0, 1, 1); + tofFindTracks->SetStation(6, 0, 0, 1); + tofFindTracks->SetStation(7, 0, 2, 3); + tofFindTracks->SetStation(8, 0, 1, 3); + tofFindTracks->SetStation(9, 0, 0, 3); + tofFindTracks->SetStation(10, 0, 2, 0); + tofFindTracks->SetStation(11, 0, 1, 0); + tofFindTracks->SetStation(12, 0, 0, 0); + tofFindTracks->SetStation(13, 0, 2, 4); + tofFindTracks->SetStation(14, 0, 1, 4); + tofFindTracks->SetStation(15, 0, 0, 4); + tofFindTracks->SetStation(16, 0, 4, 0); + tofFindTracks->SetStation(17, 0, 3, 0); + tofFindTracks->SetStation(18, 0, 4, 1); + tofFindTracks->SetStation(19, 0, 3, 1); + tofFindTracks->SetStation(20, 0, 4, 2); + tofFindTracks->SetStation(21, 0, 3, 2); + tofFindTracks->SetStation(22, 0, 4, 3); + tofFindTracks->SetStation(23, 0, 3, 3); + tofFindTracks->SetStation(24, 0, 4, 4); + tofFindTracks->SetStation(25, 0, 3, 4); + break; } + tofFindTracks->SetMinNofHits(iMinNofHits); + tofFindTracks->SetNStations(iNStations); + tofFindTracks->SetNReqStations(iNReqStations); + tofFindTracks->PrintSetup(); + run->AddTask(tofFindTracks); // ------------------------------------------------------------------------ diff --git a/reco/tracking/BinnedTracker/Bins.h b/reco/tracking/BinnedTracker/Bins.h deleted file mode 100644 index e0c08ca7349dce30bbbef45a977e365818a121af..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/Bins.h +++ /dev/null @@ -1,163 +0,0 @@ -/* Copyright (C) 2017-2019 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#ifndef BINS_H -#define BINS_H - -#include "CbmDefs.h" -#include "CbmPixelHit.h" - -#include <limits> -#include <list> - -#include <cmath> - -class CbmXBin; - -class CbmTBin { -public: - struct HitHolder { - ECbmModuleId type; - const CbmPixelHit* hit; - Int_t index; - bool use; - CbmTBin& bin; - //std::list<HitHolder*> children; - char stage; - std::list<void*> tracks; - - void SetUse(bool v) - { - use = v; - bin.SetUseRc(v); - } - }; - -public: - explicit CbmTBin(CbmXBin* owner) : fOwner(owner), fUse(false), fHits() {} - CbmTBin(const CbmTBin&) = delete; - CbmTBin& operator=(const CbmTBin&) = delete; - bool Use() const { return fUse; } - void SetUse(bool v) { fUse = v; } - void SetUseRc(bool v); - std::list<HitHolder>::iterator HitsBegin() { return fHits.begin(); } - std::list<HitHolder>::iterator HitsEnd() { return fHits.end(); } - void Clear() { fHits.clear(); } - void AddHit(ECbmModuleId type, const CbmPixelHit* hit, Int_t index, bool use) - { - fHits.push_back({type, hit, index, use, *this, std::numeric_limits<char>::max(), {}}); - } - -private: - CbmXBin* fOwner; - bool fUse; - std::list<HitHolder> fHits; -}; - -class CbmYBin; - -class CbmXBin { -public: - CbmXBin(CbmYBin* owner, int nofTBins) - : fOwner(owner) - , fUse(false) - , fTBins(reinterpret_cast<CbmTBin*>(new unsigned char[nofTBins * sizeof(CbmTBin)])) - { - for (int i = 0; i < nofTBins; ++i) - new (&fTBins[i]) CbmTBin(this); - } - - CbmXBin(const CbmXBin&) = delete; - CbmXBin& operator=(const CbmXBin&) = delete; - bool Use() const { return fUse; } - void SetUse(bool v) { fUse = v; } - void SetUseRc(bool v); - - CbmTBin& operator[](int i) { return fTBins[i]; } - -private: - CbmYBin* fOwner; - bool fUse; - CbmTBin* fTBins; - //int fNofTBins; -}; - -inline void CbmTBin::SetUseRc(bool v) -{ - fUse = v; - fOwner->SetUseRc(v); -} - -class CbmZBin; - -class CbmYBin { -public: - CbmYBin(CbmZBin* owner, int nofXBins, int nofTBins) - : fOwner(owner) - , fUse(false) - , fXBins(reinterpret_cast<CbmXBin*>(new unsigned char[nofXBins * sizeof(CbmXBin)])) - // fNofXBins(nofXBins) - { - for (int i = 0; i < nofXBins; ++i) - new (&fXBins[i]) CbmXBin(this, nofTBins); - } - - CbmYBin(const CbmYBin&) = delete; - CbmYBin& operator=(const CbmYBin&) = delete; - bool Use() const { return fUse; } - void SetUse(bool v) { fUse = v; } - void SetUseRc(bool v); - - CbmXBin& operator[](int i) { return fXBins[i]; } - -private: - CbmZBin* fOwner; - bool fUse; - CbmXBin* fXBins; - //int fNofXBins; (VF) unused -}; - -inline void CbmXBin::SetUseRc(bool v) -{ - fUse = v; - fOwner->SetUseRc(v); -} - -class CbmZBin { -public: - explicit CbmZBin(int nofYBins, int nofXBins, int nofTBins) - : fUse(false) - , fYBins(reinterpret_cast<CbmYBin*>(new unsigned char[nofYBins * sizeof(CbmYBin)])) - { - for (int i = 0; i < nofYBins; ++i) - new (&fYBins[i]) CbmYBin(this, nofXBins, nofTBins); - } - - CbmZBin(const CbmZBin&) = delete; - CbmZBin& operator=(const CbmZBin&) = delete; - bool Use() const { return fUse; } - void SetUse(bool v) { fUse = v; } - - CbmYBin& operator[](int i) { return fYBins[i]; } - -private: - bool fUse; - CbmYBin* fYBins; - // int fNofYBins; (VF) unused -}; - -inline void CbmYBin::SetUseRc(bool v) -{ - fUse = v; - - if (fOwner) fOwner->SetUse(v); -} - -#endif /* BINS_H */ diff --git a/reco/tracking/BinnedTracker/CMakeLists.txt b/reco/tracking/BinnedTracker/CMakeLists.txt deleted file mode 100644 index 538986f3659d791405d0fe4e77ce63016dde7d0e..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/CMakeLists.txt +++ /dev/null @@ -1,75 +0,0 @@ -Set(INCLUDE_DIRECTORIES - ${CBMROOT_SOURCE_DIR}/reco/tracking/BinnedTracker - - ${CBMBASE_DIR} - - ${CBMDATA_DIR} - ${CBMDATA_DIR}/sts - ${CBMDATA_DIR}/much - ${CBMDATA_DIR}/trd - ${CBMDATA_DIR}/tof - - ${CBMDETECTORBASE_DIR}/sts - - ${CBMDETECTORBASE_DIR}/much - - ${CBMROOT_SOURCE_DIR}/run - - ${CBMROOT_SOURCE_DIR}/sim/transport - ${CBMROOT_SOURCE_DIR}/sim/transport/base - ${CBMROOT_SOURCE_DIR}/sim/transport/steer - ${CBMROOT_SOURCE_DIR}/sim/transport/geosetup -) - -Include_Directories( ${INCLUDE_DIRECTORIES}) - -Set(SYSTEM_INCLUDE_DIRECTORIES - ${BASE_INCLUDE_DIRECTORIES} - #${Boost_INCLUDE_DIRS} -) - -Include_Directories(SYSTEM ${SYSTEM_INCLUDE_DIRECTORIES}) - -Set(LINK_DIRECTORIES - ${ROOT_LIBRARY_DIR} - ${FAIRROOT_LIBRARY_DIR} - ${Boost_LIBRARY_DIRS} -) - -Link_Directories( ${LINK_DIRECTORIES}) - -Set(SRCS - CbmBinnedTrackerConfigurator.cxx - CbmBinnedTrackerTask.cxx - CbmBinnedTrackerQa.cxx - CbmBinnedTrackerQaNew.cxx - ContFactory.cxx - Settings.cxx - CbmTrackParam2.cxx -) - -Set(NO_DICT_SRCS - GeoReader.cxx - HitReader.cxx - Station.cxx - Station3D.cxx - Station4D.cxx - Tracker.cxx -) - -set(LINKDEF CbmBinnedTrackerLinkDef.h) -Set(LIBRARY_NAME CbmBinnedTracker) -Set(DEPENDENCIES - CbmBase CbmData CbmMuchBase CbmStsBase Base CbmSimSteer -) - -GENERATE_LIBRARY() - -Install(FILES Tracker.h - Station.h - Station3D.h - Station4D.h - Bins.h - HitReader.h - DESTINATION include - ) diff --git a/reco/tracking/BinnedTracker/CbmBinnedTrackerConfigurator.cxx b/reco/tracking/BinnedTracker/CbmBinnedTrackerConfigurator.cxx deleted file mode 100644 index 266a2b02ca66026ffe886c43445c142ca6fad769..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/CbmBinnedTrackerConfigurator.cxx +++ /dev/null @@ -1,110 +0,0 @@ -/* Copyright (C) 2017-2020 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer], Florian Uhlig */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#include "CbmBinnedTrackerConfigurator.h" - -#include "CbmMCDataManager.h" -#include "CbmStsSetup.h" - -#include "FairRunAna.h" -#include "FairRuntimeDb.h" -#include <Logger.h> - -#include "GeoReader.h" - -CbmBinnedTrackerConfigurator::CbmBinnedTrackerConfigurator(bool useAllDetectors) - : fUseAllDetectors(useAllDetectors) - , fTracker(0) - , fSettings(0) - , fPrimaryParticleIds() - , fMCTracks(0) - , fStsPoints(0) - , fMuchPoints(0) - , fTrdPoints(0) - , fTofPoints(0) -{ - fill_n(fUseModules, int(ECbmModuleId::kLastModule), fUseAllDetectors); - fPrimaryParticleIds.push_back(ppiNone); - //fUseModules[kMuch] = false;// Temporary hack - fUseModules[ToIntegralType(ECbmModuleId::kRich)] = false; // Temporary hack -} - -CbmBinnedTrackerConfigurator::~CbmBinnedTrackerConfigurator() { delete fTracker; } - -InitStatus CbmBinnedTrackerConfigurator::Init() -{ - CbmStsSetup* stsSetup = CbmStsSetup::Instance(); - - if (!stsSetup->IsInit()) stsSetup->Init(); - - fSettings->SetConfiguring(true); - fSettings->SetPrimaryParticles(fPrimaryParticleIds); - fSettings->SetUse(fUseModules); - fSettings->SetNofStsStations(0); - fSettings->SetNofMuchStations(0); - fSettings->SetNofTrdStations(0); - fSettings->SetNofStations(0); - fSettings->ResetScats(); - CbmBinnedGeoReader* geoReader = CbmBinnedGeoReader::Instance(); - - if (0 == geoReader) LOG(fatal) << "Couldn't instantiate CbmBinnedGeoReader"; - - geoReader->Read(); - - FairRootManager* ioman = FairRootManager::Instance(); - - if (0 == ioman) LOG(fatal) << "No FairRootManager"; - - fMCTracks = static_cast<TClonesArray*>(ioman->GetObject("MCTrack")); - - if (0 == fMCTracks) LOG(fatal) << "No MC tracks in the input file"; - - if (fSettings->Use(ECbmModuleId::kSts)) { - fStsPoints = static_cast<TClonesArray*>(ioman->GetObject("StsPoint")); - - if (0 == fStsPoints) LOG(fatal) << "No sts MC points in the input file"; - } - - if (fSettings->Use(ECbmModuleId::kMuch)) { - fMuchPoints = static_cast<TClonesArray*>(ioman->GetObject("MuchPoint")); - - if (0 == fMuchPoints) LOG(fatal) << "No much MC points in the input file"; - } - - if (fSettings->Use(ECbmModuleId::kTrd)) { - fTrdPoints = static_cast<TClonesArray*>(ioman->GetObject("TrdPoint")); - - if (0 == fTrdPoints) LOG(fatal) << "No trd MC points in the input file"; - } - - if (fSettings->Use(ECbmModuleId::kTof)) { - fTofPoints = static_cast<TClonesArray*>(ioman->GetObject("TofPoint")); - - if (0 == fTofPoints) LOG(fatal) << "No tof MC points in the input file"; - } - - return kSUCCESS; -} - -void CbmBinnedTrackerConfigurator::Exec(Option_t*) -{ - CbmBinnedHitReader::Instance()->Read(); - CbmBinnedHitReader::Instance()->Handle(); -} - -void CbmBinnedTrackerConfigurator::Finish() { CbmBinnedHitReader::Instance()->Finish(); } - -void CbmBinnedTrackerConfigurator::SetParContainers() -{ - fSettings = - static_cast<CbmBinnedSettings*>(FairRunAna::Instance()->GetRuntimeDb()->getContainer("CbmBinnedSettings")); -} - -ClassImp(CbmBinnedTrackerConfigurator) diff --git a/reco/tracking/BinnedTracker/CbmBinnedTrackerConfigurator.h b/reco/tracking/BinnedTracker/CbmBinnedTrackerConfigurator.h deleted file mode 100644 index 1987e76c6c12f4ea2f98d31c327d7a4bc99eeb13..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/CbmBinnedTrackerConfigurator.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (C) 2017-2020 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#ifndef CBMBINNEDTRACKERCONFIGURATOR_H -#define CBMBINNEDTRACKERCONFIGURATOR_H - -#include "CbmPixelHit.h" - -#include "FairTask.h" - -#include "TClonesArray.h" -#include "Tracker.h" - -#include "Settings.h" - -class CbmBinnedTrackerConfigurator : public FairTask { -public: - explicit CbmBinnedTrackerConfigurator(bool useAllDetectors); - CbmBinnedTrackerConfigurator(const CbmBinnedTrackerConfigurator&) = delete; - CbmBinnedTrackerConfigurator& operator=(const CbmBinnedTrackerConfigurator&) = delete; - ~CbmBinnedTrackerConfigurator(); - - InitStatus Init(); // Overridden from FairTask - void Exec(Option_t* opt); // Overridden from FairTask - void Finish(); // Overridden from FairTask - void SetParContainers(); - void SetUse(Int_t m, bool v) { fUseModules[m] = v; } - - void SetPrimaryParticle(EPrimaryParticleId v) - { - fPrimaryParticleIds.clear(); - fPrimaryParticleIds.push_back(v); - } - - void AddPrimaryParticle(EPrimaryParticleId v) { fPrimaryParticleIds.push_back(v); } - -private: - bool fUseAllDetectors; - bool fUseModules[ToIntegralType(ECbmModuleId::kLastModule)]; - CbmBinnedTracker* fTracker; - CbmBinnedSettings* fSettings; - std::list<EPrimaryParticleId> fPrimaryParticleIds; - - TClonesArray* fMCTracks; - TClonesArray* fStsPoints; - TClonesArray* fMuchPoints; - TClonesArray* fTrdPoints; - TClonesArray* fTofPoints; - ClassDef(CbmBinnedTrackerConfigurator, 1) -}; - -#endif /* CBMBINNEDTRACKERCONFIGURATOR_H */ diff --git a/reco/tracking/BinnedTracker/CbmBinnedTrackerLinkDef.h b/reco/tracking/BinnedTracker/CbmBinnedTrackerLinkDef.h deleted file mode 100644 index 1e58bb1642d6f712558e9a6dd5a8ac8b7a64d367..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/CbmBinnedTrackerLinkDef.h +++ /dev/null @@ -1,19 +0,0 @@ -/* Copyright (C) 2017-2018 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -#ifdef __CINT__ - -#pragma link off all globals; -#pragma link off all classes; -#pragma link off all functions; - -#pragma link C++ class CbmBinnedContFactory; -#pragma link C++ class CbmBinnedSettings + ; -#pragma link C++ class CbmBinnedTrackerConfigurator + ; -#pragma link C++ class CbmBinnedTrackerTask + ; -#pragma link C++ class CbmBinnedTrackerQa + ; -#pragma link C++ class CbmBinnedTrackerQaNew + ; -#pragma link C++ class CbmTrackParam2 + ; - -#endif diff --git a/reco/tracking/BinnedTracker/CbmBinnedTrackerQa.cxx b/reco/tracking/BinnedTracker/CbmBinnedTrackerQa.cxx deleted file mode 100644 index 5f6c37648912f752422979590670953ba94edbce..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/CbmBinnedTrackerQa.cxx +++ /dev/null @@ -1,2177 +0,0 @@ -/* Copyright (C) 2017-2020 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -//#define CBM_BINNED_QA_FILL_HISTOS - -#include "CbmBinnedTrackerQa.h" - -#include "CbmMCDataManager.h" -#include "CbmMCTrack.h" -#include "CbmMatch.h" -#include "CbmMuchCluster.h" -#include "CbmMuchDigi.h" -#include "CbmMuchGeoScheme.h" -#include "CbmMuchPixelHit.h" -#include "CbmMuchPoint.h" -#include "CbmMuchStation.h" -#include "CbmStsCluster.h" -#include "CbmStsDigi.h" -#include "CbmStsHit.h" -#include "CbmStsPoint.h" -#include "CbmStsSetup.h" -#include "CbmTofPoint.h" -#include "CbmTrdCluster.h" -#include "CbmTrdDigi.h" -#include "global/CbmGlobalTrack.h" -#include "trd/CbmTrdAddress.h" - -#include "FairRun.h" -#include "FairRuntimeDb.h" - -#include "TH1.h" -#include "TProfile.h" - -#include <complex> - -#include "GeoReader.h" - -using namespace std; - -//#define TRD_IDEAL - -struct TrackDesc { - static Int_t nofStsStations; - static Int_t nofMuchStations; - static Int_t nofTrdStations; - static bool hasTof; - - static Int_t firstStsStationNo; - static Int_t firstMuchStationNo; - static Int_t firstTrdStationNo; - static Int_t tofStationNo; - - // In the pairs below - pair<set<Int_t>, set<Int_t>>* sts; - pair<set<Int_t>, set<Int_t>>* much; - pair<set<Int_t>, set<Int_t>>* trd; - pair<set<Int_t>, set<Int_t>> tof; - set<const CbmStsPoint*>* stsPoints; - set<const CbmMuchPoint*>* muchPoints; - set<const CbmTrdPoint*>* trdPoints; - bool isPrimary; - const CbmMCTrack* ptr; - Double_t* nearestHitDistSts; - Double_t* nearestHitDistMuch; - Double_t* nearestHitDistTrd; - const CbmStsPoint** nearestPointsSts; - const CbmMuchPoint** nearestPointsMuch; - const CbmTrdPoint** nearestPointsTrd; - Double_t* pullXsts; - Double_t* pullYsts; - Double_t* pullXmuch; - Double_t* pullYmuch; - Double_t* pullXtrd; - Double_t* pullYtrd; - - list<TrackDesc*> children; - bool isReference; - bool isReconstructed; - - TrackDesc() - : sts(nofStsStations > 0 ? new pair<set<Int_t>, set<Int_t>>[nofStsStations] : 0) - , much(nofMuchStations > 0 ? new pair<set<Int_t>, set<Int_t>>[nofMuchStations] : 0) - , trd(nofTrdStations > 0 ? new pair<set<Int_t>, set<Int_t>>[nofTrdStations] : 0) - , tof() - , stsPoints(nofStsStations > 0 ? new set<const CbmStsPoint*>[nofStsStations] : 0) - , muchPoints(nofMuchStations > 0 ? new set<const CbmMuchPoint*>[nofMuchStations] : 0) - , trdPoints(nofTrdStations > 0 ? new set<const CbmTrdPoint*>[nofTrdStations] : 0) - , isPrimary(false) - , ptr(0) - , nearestHitDistSts(nofStsStations > 0 ? new Double_t[nofStsStations] : 0) - , nearestHitDistMuch(nofMuchStations > 0 ? new Double_t[nofMuchStations] : 0) - , nearestHitDistTrd(nofTrdStations > 0 ? new Double_t[nofTrdStations] : 0) - , nearestPointsSts(nofStsStations > 0 ? new const CbmStsPoint*[nofStsStations] : 0) - , nearestPointsMuch(nofMuchStations > 0 ? new const CbmMuchPoint*[nofMuchStations] : 0) - , nearestPointsTrd(nofTrdStations > 0 ? new const CbmTrdPoint*[nofTrdStations] : 0) - , pullXsts(nofStsStations > 0 ? new Double_t[nofStsStations] : 0) - , pullYsts(nofStsStations > 0 ? new Double_t[nofStsStations] : 0) - , pullXmuch(nofMuchStations > 0 ? new Double_t[nofMuchStations] : 0) - , pullYmuch(nofMuchStations > 0 ? new Double_t[nofMuchStations] : 0) - , pullXtrd(nofTrdStations > 0 ? new Double_t[nofTrdStations] : 0) - , pullYtrd(nofTrdStations > 0 ? new Double_t[nofTrdStations] : 0) - , children() - , isReference(false) - , isReconstructed(false) - { - fill_n(nearestHitDistSts, nofStsStations, -1); - fill_n(nearestHitDistMuch, nofMuchStations, -1); - fill_n(nearestHitDistTrd, nofTrdStations, -1); - fill_n(nearestPointsSts, nofStsStations, static_cast<const CbmStsPoint*>(0)); - fill_n(nearestPointsMuch, nofMuchStations, static_cast<const CbmMuchPoint*>(0)); - fill_n(nearestPointsTrd, nofTrdStations, static_cast<const CbmTrdPoint*>(0)); - fill_n(pullXsts, nofStsStations, 0); - fill_n(pullYsts, nofStsStations, 0); - fill_n(pullXmuch, nofMuchStations, 0); - fill_n(pullYmuch, nofMuchStations, 0); - fill_n(pullXtrd, nofTrdStations, 0); - fill_n(pullYtrd, nofTrdStations, 0); - } - - ~TrackDesc() - { - delete[] sts; - delete[] much; - delete[] trd; - delete[] stsPoints; - delete[] muchPoints; - delete[] trdPoints; - delete[] nearestHitDistSts; - delete[] nearestHitDistMuch; - delete[] nearestHitDistTrd; - delete[] nearestPointsSts; - delete[] nearestPointsMuch; - delete[] nearestPointsTrd; - delete[] pullXsts; - delete[] pullYsts; - delete[] pullXmuch; - delete[] pullYmuch; - delete[] pullXtrd; - delete[] pullYtrd; - } - - TrackDesc(const TrackDesc&) = default; - TrackDesc& operator=(const TrackDesc&) = default; -}; - -Int_t TrackDesc::nofStsStations = 0; -Int_t TrackDesc::nofMuchStations = 0; -Int_t TrackDesc::nofTrdStations = 0; -bool TrackDesc::hasTof = false; - -Int_t TrackDesc::firstStsStationNo = 0; -Int_t TrackDesc::firstMuchStationNo = 0; -Int_t TrackDesc::firstTrdStationNo = 0; -Int_t TrackDesc::tofStationNo = 0; - -static vector<vector<TrackDesc>> gTracks; -static vector<vector<bool>> gStsPoints; -static vector<vector<bool>> gMuchPoints; -static vector<vector<bool>> gTrdPoints; -static vector<vector<char>> gTofPoints; - -static TProfile* effByMom = 0; -static TProfile* effByMomPrimary = 0; -static TProfile* effByMomNonPrimary = 0; - -static TProfile* effByPolarAngle = 0; -static TProfile* effByPolarAnglePrimary = 0; -static TProfile* effByPolarAngleNonPrimary = 0; - -static TProfile* effByXAngle = 0; -static TProfile* effByXAnglePrimary = 0; -static TProfile* effByXAngleNonPrimary = 0; - -static TProfile* effByYAngle = 0; -static TProfile* effByYAnglePrimary = 0; -static TProfile* effByYAngleNonPrimary = 0; - -static TH1F* lambdaChildrenMoms = 0; -static TProfile* lambdaChildrenEffByMom = 0; -static TH1F* clonesNofSameHits = 0; - -static TH1F* muchHitResidualX = 0; -static TH1F* muchHitResidualY = 0; -static TH1F* muchHitResidualT = 0; -static TH1F* muchHitPullX = 0; -static TH1F* muchHitPullY = 0; -static TH1F* muchHitPullT = 0; - -static TH1F* stsTrackResidualFirstX = 0; -static TH1F* stsTrackResidualFirstY = 0; -static TH1F* stsTrackPullFirstX = 0; -static TH1F* stsTrackPullFirstY = 0; -static TH1F* stsTrackResidualLastX = 0; -static TH1F* stsTrackResidualLastY = 0; -static TH1F* stsTrackPullLastX = 0; -static TH1F* stsTrackPullLastY = 0; - -static TH1F* muchTrackResidualFirstX = 0; -static TH1F* muchTrackResidualFirstY = 0; -static TH1F* muchTrackPullFirstX = 0; -static TH1F* muchTrackPullFirstY = 0; -static TH1F* muchTrackResidualLastX = 0; -static TH1F* muchTrackResidualLastY = 0; -static TH1F* muchTrackPullLastX = 0; -static TH1F* muchTrackPullLastY = 0; - -static TH1F* trdTrackResidualFirstX = 0; -static TH1F* trdTrackResidualFirstY = 0; -static TH1F* trdTrackPullFirstX = 0; -static TH1F* trdTrackPullFirstY = 0; -static TH1F* trdTrackResidualLastX = 0; -static TH1F* trdTrackResidualLastY = 0; -static TH1F* trdTrackPullLastX = 0; -static TH1F* trdTrackPullLastY = 0; - -static TH1F* globalTrackResidualFirstX = 0; -static TH1F* globalTrackResidualFirstY = 0; -static TH1F* globalTrackPullFirstX = 0; -static TH1F* globalTrackPullFirstY = 0; -static TH1F* globalTrackResidualLastX = 0; -static TH1F* globalTrackResidualLastY = 0; -static TH1F* globalTrackPullLastX = 0; -static TH1F* globalTrackPullLastY = 0; - -#ifdef CBM_BINNED_QA_FILL_HISTOS -static TH1F* stsXResHisto = 0; -static TH1F* stsYResHisto = 0; -static TH1F* stsTResHisto = 0; -static TH1F* trdXResHisto = 0; -static TH1F* trdYResHisto = 0; -static TH1F* trdTResHisto = 0; -static TH1F* muchXResHisto = 0; -static TH1F* muchYResHisto = 0; -static TH1F* muchTResHisto = 0; -static TH1F* tofXResHisto = 0; -static TH1F* tofYResHisto = 0; -static TH1F* tofTResHisto = 0; - -static TH1F* stsXPullHistos[] = {0, 0}; -static TH1F* stsYPullHistos[] = {0, 0}; - -static TH1F* trdXPullHistos[] = {0, 0, 0, 0}; -static TH1F* trdYPullHistos[] = {0, 0, 0, 0}; - -static TH1F* extrStsXHisto = 0; -static TH1F* extrStsYHisto = 0; - -static TH1F* vtxXHisto = 0; -static TH1F* vtxYHisto = 0; -static TH1F* vtxZHisto = 0; - -static TH1F* extrTrdXHistos[] = {0, 0, 0, 0}; -static TH1F* extrTrdYHistos[] = {0, 0, 0, 0}; - -static TH1F* trdNearestHitDistHistos[] = {0, 0, 0, 0}; -#endif //CBM_BINNED_QA_FILL_HISTOS - -//static int trdNofStrangerHits[] = { 0, 0, 0, 0 }; - -static list<TrackDesc*> lambdaList; - -CbmBinnedTrackerQa::CbmBinnedTrackerQa() - : fPrimaryParticleIds() - , fIsOnlyPrimary(false) - , fSettings(0) - , fGlobalTracks(0) - , fStsTracks(0) - , fMuchTracks(0) - , fTrdTracks(0) - , fStsHits(0) - , fMuchHits(0) - , fTrdHits(0) - , fTofHits(0) - , fStsClusters(0) - , fMuchClusters(0) - , fTrdClusters(0) - , fTrdDigiMatches(0) - , fTofHitDigiMatches(0) - , fTofDigiPointMatches(0) - , fStsDigis(0) - , fStsDigiMatches(0) - , fMuchDigis(0) - , fTrdDigis(0) - , fTofDigis(0) - , fMCTracks(0) - , fStsPoints(0) - , fMuchPoints(0) - , fTrdPoints(0) - , fTofPoints(0) -{ - fPrimaryParticleIds.push_back(ppiNone); -} - -InitStatus CbmBinnedTrackerQa::Init() -{ - CbmStsSetup* stsSetup = CbmStsSetup::Instance(); - - if (!stsSetup->IsInit()) stsSetup->Init(); - - fSettings = CbmBinnedSettings::Instance(); - fIsOnlyPrimary = fSettings->IsOnlyPrimary(); - TrackDesc::nofStsStations = fSettings->Use(ECbmModuleId::kSts) ? fSettings->GetNofStsStations() : 0; - LOG(info) << "The number of STS stations: " << TrackDesc::nofStsStations; - TrackDesc::nofMuchStations = fSettings->Use(ECbmModuleId::kMuch) ? fSettings->GetNofMuchStations() : 0; - LOG(info) << "The number of MuCh stations: " << TrackDesc::nofMuchStations; - TrackDesc::nofTrdStations = fSettings->Use(ECbmModuleId::kTrd) ? fSettings->GetNofTrdStations() : 0; - LOG(info) << "The number of TRD stations: " << TrackDesc::nofTrdStations; - TrackDesc::hasTof = fSettings->Use(ECbmModuleId::kTof); - LOG(info) << "Use ToF station: " << (TrackDesc::hasTof ? "true" : "false"); - - TrackDesc::firstMuchStationNo = TrackDesc::nofStsStations; - TrackDesc::firstTrdStationNo = TrackDesc::firstMuchStationNo + TrackDesc::nofMuchStations; - TrackDesc::tofStationNo = TrackDesc::firstTrdStationNo + TrackDesc::nofTrdStations; - - effByMom = new TProfile("effByMom", "Track reconstruction efficiency by momentum distribution %", 400, 0., 10.); - effByMomPrimary = new TProfile("effByMomPrimary", - "Track reconstruction efficiency by momentum " - "distribution for primary tracks %", - 400, 0., 10.); - effByMomNonPrimary = new TProfile("effByMomNonPrimary", - "Track reconstruction efficiency by momentum distribution for " - "non primary tracks %", - 200, 0., 10.); - - effByPolarAngle = - new TProfile("effByPolarAngle", "Track reconstruction efficiency by polar angle distribution %", 300, 0., 30.); - effByPolarAnglePrimary = new TProfile("effByPolarAnglePrimary", - "Track reconstruction efficiency by polar angle distribution " - "for primary tracks %", - 300, 0., 30.); - effByPolarAngleNonPrimary = new TProfile("effByPolarAngleNonPrimary", - "Track reconstruction efficiency by polar angle distribution " - "for non primary tracks %", - 300, 0., 30.); - - effByXAngle = new TProfile("effByXAngle", "Track reconstruction efficiency by XZ angle distribution %", 300, 0., 30.); - effByXAnglePrimary = new TProfile("effByXAnglePrimary", - "Track reconstruction efficiency by XZ " - "angle distribution for primary tracks %", - 300, 0., 30.); - effByXAngleNonPrimary = new TProfile("effByXAngleNonPrimary", - "Track reconstruction efficiency by XZ angle distribution for " - "non primary tracks %", - 300, 0., 30.); - - effByYAngle = new TProfile("effByYAngle", "Track reconstruction efficiency by YZ angle distribution %", 300, 0., 30.); - effByYAnglePrimary = new TProfile("effByYAnglePrimary", - "Track reconstruction efficiency by YZ " - "angle distribution for primary tracks %", - 300, 0., 30.); - effByYAngleNonPrimary = new TProfile("effByYAngleNonPrimary", - "Track reconstruction efficiency by YZ angle distribution for " - "non primary tracks %", - 300, 0., 30.); - - lambdaChildrenMoms = new TH1F("lambdaChildrenMoms", "Lambda children momenta distribution", 100, 0., 10.); - lambdaChildrenEffByMom = new TProfile("lambdaChildrenEffByMom", - "Track reconstruction for Lambda children efficiency by " - "momentum distribution %", - 200, 0., 10.); - clonesNofSameHits = - new TH1F("clonesNofSameHits", "The number of hits which are the same for a clone track", 10, 0., 10.); - - muchHitResidualX = new TH1F("muchHitResidualX", "muchHitResidualX", 100, -5.0, 5.0); - muchHitResidualY = new TH1F("muchHitResidualY", "muchHitResidualY", 100, -5.0, 5.0); - muchHitResidualT = new TH1F("muchHitResidualT", "muchHitResidualT", 100, -20.0, 20.0); - muchHitPullX = new TH1F("muchHitPullX", "muchHitPullX", 100, -5.0, 5.0); - muchHitPullY = new TH1F("muchHitPullY", "muchHitPullY", 100, -5.0, 5.0); - muchHitPullT = new TH1F("muchHitPullT", "muchHitPullT", 100, -5.0, 5.0); - - stsTrackResidualFirstX = new TH1F("stsTrackResidualFirstX", "stsTrackResidualFirstX", 100, -0.1, 0.1); - stsTrackResidualFirstY = new TH1F("stsTrackResidualFirstY", "stsTrackResidualFirstY", 100, -0.1, 0.1); - stsTrackPullFirstX = new TH1F("stsTrackPullFirstX", "stsTrackPullFirstX", 100, -5.0, 5.0); - stsTrackPullFirstY = new TH1F("stsTrackPullFirstY", "stsTrackPullFirstY", 100, -5.0, 5.0); - stsTrackResidualLastX = new TH1F("stsTrackResidualLastX", "stsTrackResidualLastX", 100, -0.1, 0.1); - stsTrackResidualLastY = new TH1F("stsTrackResidualLastY", "stsTrackResidualLastY", 100, -0.1, 0.1); - stsTrackPullLastX = new TH1F("stsTrackPullLastX", "stsTrackPullLastX", 100, -5.0, 5.0); - stsTrackPullLastY = new TH1F("stsTrackPullLastY", "stsTrackPullLastY", 100, -5.0, 5.0); - - muchTrackResidualFirstX = new TH1F("muchTrackResidualFirstX", "muchTrackResidualFirstX", 100, -5.0, 5.0); - muchTrackResidualFirstY = new TH1F("muchTrackResidualFirstY", "muchTrackResidualFirstY", 100, -5.0, 5.0); - muchTrackPullFirstX = new TH1F("muchTrackPullFirstX", "muchTrackPullFirstX", 100, -10.0, 10.0); - muchTrackPullFirstY = new TH1F("muchTrackPullFirstY", "muchTrackPullFirstY", 100, -10.0, 10.0); - muchTrackResidualLastX = new TH1F("muchTrackResidualLastX", "muchTrackResidualLastX", 100, -5.0, 5.0); - muchTrackResidualLastY = new TH1F("muchTrackResidualLastY", "muchTrackResidualLastY", 100, -5.0, 5.0); - muchTrackPullLastX = new TH1F("muchTrackPullLastX", "muchTrackPullLastX", 100, -10.0, 10.0); - muchTrackPullLastY = new TH1F("muchTrackPullLastY", "muchTrackPullLastY", 100, -10.0, 10.0); - - trdTrackResidualFirstX = new TH1F("trdTrackResidualFirstX", "trdTrackResidualFirstX", 100, -10.0, 10.0); - trdTrackResidualFirstY = new TH1F("trdTrackResidualFirstY", "trdTrackResidualFirstY", 100, -10.0, 10.0); - trdTrackPullFirstX = new TH1F("trdTrackPullFirstX", "trdTrackPullFirstX", 100, -5.0, 5.0); - trdTrackPullFirstY = new TH1F("trdTrackPullFirstY", "trdTrackPullFirstY", 100, -5.0, 5.0); - trdTrackResidualLastX = new TH1F("trdTrackResidualLastX", "trdTrackResidualLastX", 100, -10.0, 10.0); - trdTrackResidualLastY = new TH1F("trdTrackResidualLastY", "trdTrackResidualLastY", 100, -10.0, 10.0); - trdTrackPullLastX = new TH1F("trdTrackPullLastX", "trdTrackPullLastX", 100, -5.0, 5.0); - trdTrackPullLastY = new TH1F("trdTrackPullLastY", "trdTrackPullLastY", 100, -5.0, 5.0); - - globalTrackResidualFirstX = new TH1F("globalTrackResidualFirstX", "globalTrackResidualFirstX", 100, -0.2, 0.2); - globalTrackResidualFirstY = new TH1F("globalTrackResidualFirstY", "globalTrackResidualFirstY", 100, -0.2, 0.2); - globalTrackPullFirstX = new TH1F("globalTrackPullFirstX", "globalTrackPullFirstX", 100, -5.0, 5.0); - globalTrackPullFirstY = new TH1F("globalTrackPullFirstY", "globalTrackPullFirstY", 100, -5.0, 5.0); - globalTrackResidualLastX = new TH1F("globalTrackResidualLastX", "globalTrackResidualLastX", 100, -1.5, 1.5); - globalTrackResidualLastY = new TH1F("globalTrackResidualLastY", "globalTrackResidualLastY", 100, -1.5, 1.5); - globalTrackPullLastX = new TH1F("globalTrackPullLastX", "globalTrackPullLastX", 100, -5.0, 5.0); - globalTrackPullLastY = new TH1F("globalTrackPullLastY", "globalTrackPullLastY", 100, -5.0, 5.0); - -#ifdef CBM_BINNED_QA_FILL_HISTOS - stsXResHisto = new TH1F("stsXResHisto", "stsXResHisto", 200, -0.1, 0.1); - stsYResHisto = new TH1F("stsYResHisto", "stsYResHisto", 200, -0.1, 0.1); - stsTResHisto = new TH1F("stsTResHisto", "stsTResHisto", 200, -10.0, 10.0); - trdXResHisto = new TH1F("trdXResHisto", "trdXResHisto", 600, -60.0, 60.0); - trdYResHisto = new TH1F("trdYResHisto", "trdYResHisto", 600, -60.0, 60.0); - trdTResHisto = new TH1F("trdTResHisto", "trdTResHisto", 200, -10.0, 10.0); - muchXResHisto = new TH1F("muchXResHisto", "muchXResHisto", 200, -3.0, 3.0); - muchYResHisto = new TH1F("muchYResHisto", "muchYResHisto", 200, -3.0, 3.0); - muchTResHisto = new TH1F("muchTResHisto", "muchTResHisto", 200, -10.0, 100.0); - tofXResHisto = new TH1F("tofXResHisto", "tofXResHisto", 200, -3.0, 3.0); - tofYResHisto = new TH1F("tofYResHisto", "tofYResHisto", 200, -3.0, 3.0); - tofTResHisto = new TH1F("tofTResHisto", "tofTResHisto", 200, -10.0, 10.0); - - extrStsXHisto = new TH1F("extrStsXHisto", "extrStsXHisto", 200, -0.5, 0.5); - extrStsYHisto = new TH1F("extrStsYHisto", "extrStsYHisto", 200, -0.5, 0.5); - - vtxXHisto = new TH1F("vtxXHisto", "vtxXHisto", 100, -0.5, 0.5); - vtxYHisto = new TH1F("vtxYHisto", "vtxYHisto", 100, -0.5, 0.5); - vtxZHisto = new TH1F("vtxZHisto", "vtxZHisto", 100, -0.5, 0.5); - - for (int i = 0; i < 2; ++i) { - char name[256]; - sprintf(name, "stsXPullHistos_%d", i); - Double_t range = 5; - stsXPullHistos[i] = new TH1F(name, name, 200, -range, range); - sprintf(name, "stsYPullHistos_%d", i); - stsYPullHistos[i] = new TH1F(name, name, 200, -range, range); - } - - for (int i = 0; i < 4; ++i) { - char name[256]; - sprintf(name, "extrTrdXHisto_%d", i); - extrTrdXHistos[i] = new TH1F(name, name, 200, 0.5, 0.5); - sprintf(name, "extrTrdYHisto_%d", i); - extrTrdYHistos[i] = new TH1F(name, name, 200, 0.5, 0.5); - - sprintf(name, "trdNearestHitDistHistos_%d", i); - trdNearestHitDistHistos[i] = new TH1F(name, name, 200, -100, 100); - - sprintf(name, "trdXPullHistos_%d", i); - Double_t range = i % 2 ? 5 : 25; - trdXPullHistos[i] = new TH1F(name, name, 200, -range, range); - sprintf(name, "trdYPullHistos_%d", i); - range = i % 2 ? 25 : 5; - trdYPullHistos[i] = new TH1F(name, name, 200, -range, range); - } -#endif //CBM_BINNED_QA_FILL_HISTOS - - FairRootManager* ioman = FairRootManager::Instance(); - - if (0 == ioman) LOG(fatal) << "No FairRootManager"; - - CbmMCDataManager* mcManager = static_cast<CbmMCDataManager*>(ioman->GetObject("MCDataManager")); - - if (0 == mcManager) LOG(fatal) << "No MC data manager"; - - fMCTracks = mcManager->InitBranch("MCTrack"); - - if (0 == fMCTracks) LOG(fatal) << "No MC tracks in the input file"; - - for (Int_t i = 0; fMCTracks->Size(0, i) >= 0; ++i) { - gTracks.push_back(vector<TrackDesc>()); - gStsPoints.push_back(vector<bool>()); - gMuchPoints.push_back(vector<bool>()); - gTrdPoints.push_back(vector<bool>()); - gTofPoints.push_back(vector<char>()); - - Int_t nofMcTracks = fMCTracks->Size(0, i); - vector<TrackDesc>& eventTracks = gTracks.back(); - eventTracks.resize(nofMcTracks); - - for (Int_t j = 0; j < nofMcTracks; ++j) { - TrackDesc& track = eventTracks[j]; - const CbmMCTrack* mcTrack = static_cast<const CbmMCTrack*>(fMCTracks->Get(0, i, j)); - track.ptr = mcTrack; - - bool isPrimary = false; - Int_t motherId = mcTrack->GetMotherId(); - TrackDesc* motherTrack = 0 > motherId ? 0 : &eventTracks[motherId]; - - for (EPrimaryParticleId ppi : fPrimaryParticleIds) { - switch (ppi) { - case ppiJpsi: { - if (motherId >= 0) isPrimary = 443 == motherTrack->ptr->GetPdgCode(); - - break; - } - - default: isPrimary = motherId < 0; - } - - if (isPrimary) break; - } - - if (isPrimary) { - track.isPrimary = true; -#ifdef CBM_BINNED_QA_FILL_HISTOS - vtxXHisto->Fill(mcTrack->GetStartX()); - vtxYHisto->Fill(mcTrack->GetStartY()); - vtxZHisto->Fill(mcTrack->GetStartZ()); -#endif //CBM_BINNED_QA_FILL_HISTOS - } - else if (motherId >= 0) { - if (motherTrack->ptr->GetPdgCode() == 3122) // Mother particle is a Lambda baryon - motherTrack->children.push_back(&track); - } - - if (mcTrack->GetPdgCode() == 3122) // Lambda baryon - lambdaList.push_back(&track); - } - } - - LOG(info) << "The number of MC events in the input: " << gTracks.size(); - - fGlobalTracks = static_cast<TClonesArray*>(ioman->GetObject("GlobalTrack")); - - if (0 == fGlobalTracks) LOG(fatal) << "No global tracks in the input file"; - - if (TrackDesc::nofStsStations > 0) { - fStsTracks = static_cast<TClonesArray*>(ioman->GetObject("StsTrack")); - - if (0 == fStsTracks) LOG(fatal) << "No sts tracks in the input file"; - - fStsHits = static_cast<TClonesArray*>(ioman->GetObject("StsHit")); - - if (0 == fStsHits) LOG(fatal) << "No sts hits in the input file"; - - fStsClusters = static_cast<TClonesArray*>(ioman->GetObject("StsCluster")); - - if (0 == fStsClusters) LOG(fatal) << "No sts clusters in the input file"; - - fStsDigis = static_cast<TClonesArray*>(ioman->GetObject("StsDigi")); - - if (0 == fStsDigis) LOG(fatal) << "No sts digis in the input file"; - - fStsDigiMatches = static_cast<TClonesArray*>(ioman->GetObject("StsDigiMatch")); - - if (0 == fStsDigiMatches) LOG(fatal) << "No sts digi matches in the input file"; - - fStsPoints = mcManager->InitBranch("StsPoint"); - - if (0 == fStsPoints) LOG(fatal) << "No sts MC points in the input file"; - - for (Int_t i = 0; fStsPoints->Size(0, i) >= 0; ++i) { - Int_t nofPoints = fStsPoints->Size(0, i); - gStsPoints[i].resize(nofPoints, false); - vector<TrackDesc>& tracks = gTracks[i]; - - for (Int_t j = 0; j < nofPoints; ++j) { - const CbmStsPoint* stsPoint = static_cast<const CbmStsPoint*>(fStsPoints->Get(0, i, j)); - Int_t trackId = stsPoint->GetTrackID(); - Int_t stationNumber = CbmStsSetup::Instance()->GetStationNumber(stsPoint->GetDetectorID()); - //Int_t stationNumber = CbmStsAddress::GetElementId(stsPoint->GetDetectorID(), kSts); - //tracks[trackId].sts[stationNumber].first.insert(j); - TrackDesc& trackDesk = tracks[trackId]; - trackDesk.stsPoints[stationNumber].insert(stsPoint); - } - } - } - - if (TrackDesc::nofMuchStations > 0) { - fMuchTracks = static_cast<TClonesArray*>(ioman->GetObject("MuchTrack")); - - if (0 == fMuchTracks) LOG(fatal) << "No much tracks in the input file"; - - fMuchHits = static_cast<TClonesArray*>(ioman->GetObject("MuchPixelHit")); - - if (0 == fMuchHits) LOG(fatal) << "No much hits in the input file"; - - fMuchClusters = static_cast<TClonesArray*>(ioman->GetObject("MuchCluster")); - - if (0 == fMuchClusters) LOG(fatal) << "No much clusters in the input file"; - - fMuchDigis = static_cast<TClonesArray*>(ioman->GetObject("MuchDigi")); - - if (0 == fMuchDigis) LOG(fatal) << "No much digis in the input file"; - - fMuchDigiMatches = static_cast<TClonesArray*>(ioman->GetObject("MuchDigiMatch")); - - if (0 == fMuchDigiMatches) LOG(fatal) << "No much digi matches in the input file"; - - fMuchPoints = mcManager->InitBranch("MuchPoint"); - - if (0 == fMuchPoints) LOG(fatal) << "No much MC points in the input file"; - - for (Int_t i = 0; fMuchPoints->Size(0, i) >= 0; ++i) { - Int_t nofPoints = fMuchPoints->Size(0, i); - gMuchPoints[i].resize(nofPoints, false); - vector<TrackDesc>& tracks = gTracks[i]; - - for (Int_t j = 0; j < nofPoints; ++j) { - const CbmMuchPoint* muchPoint = static_cast<const CbmMuchPoint*>(fMuchPoints->Get(0, i, j)); - Int_t trackId = muchPoint->GetTrackID(); - int muchStationNumber = CbmMuchGeoScheme::GetStationIndex(muchPoint->GetDetectorID()); - int layerNumber = CbmMuchGeoScheme::GetLayerIndex(muchPoint->GetDetectorID()); - int stationNumber = muchStationNumber * 3 + layerNumber; - //tracks[trackId].much[stationNumber].first.insert(j); - TrackDesc& trackDesk = tracks[trackId]; - trackDesk.muchPoints[stationNumber].insert(muchPoint); - } - } - } - - if (TrackDesc::nofTrdStations > 0) { - fTrdTracks = static_cast<TClonesArray*>(ioman->GetObject("TrdTrack")); - - if (0 == fTrdTracks) LOG(fatal) << "No trd tracks in the input file"; - - fTrdHits = static_cast<TClonesArray*>(ioman->GetObject("TrdHit")); - - if (0 == fTrdHits) LOG(fatal) << "No trd hits in the input file"; - -#ifdef TRD_IDEAL - fTrdDigis = static_cast<TClonesArray*>(ioman->GetObject("TrdDigi")); - - if (0 == fTrdDigis) LOG(fatal) << "No trd digis in the input file"; -#else //TRD_IDEAL - fTrdClusters = static_cast<TClonesArray*>(ioman->GetObject("TrdCluster")); - - if (0 == fTrdClusters) LOG(fatal) << "No global tracks in the input file"; - - fTrdDigiMatches = static_cast<TClonesArray*>(ioman->GetObject("TrdDigiMatch")); - - if (0 == fTrdDigiMatches) LOG(fatal) << "No trd hit to digi matches in the input file"; -#endif //TRD_IDEAL - - fTrdPoints = mcManager->InitBranch("TrdPoint"); - - if (0 == fTrdPoints) LOG(fatal) << "No trd MC points in the input file"; - - for (Int_t i = 0; fTrdPoints->Size(0, i) >= 0; ++i) { - Int_t nofPoints = fTrdPoints->Size(0, i); - gTrdPoints[i].resize(nofPoints, false); - vector<TrackDesc>& tracks = gTracks[i]; - - for (Int_t j = 0; j < nofPoints; ++j) { - const CbmTrdPoint* trdPoint = static_cast<const CbmTrdPoint*>(fTrdPoints->Get(0, i, j)); - Int_t trackId = trdPoint->GetTrackID(); - int stationNumber = CbmTrdAddress::GetLayerId(trdPoint->GetModuleAddress()); - //tracks[trackId].trd[stationNumber].first.insert(j); - TrackDesc& trackDesk = tracks[trackId]; - trackDesk.trdPoints[stationNumber].insert(trdPoint); - } - } - } - - if (TrackDesc::hasTof) { - fTofHits = static_cast<TClonesArray*>(ioman->GetObject("TofHit")); - - if (0 == fTofHits) LOG(fatal) << "No tof hits in the input file"; - - fTofHitDigiMatches = static_cast<TClonesArray*>(ioman->GetObject("TofDigiMatch")); - - if (0 == fTofHitDigiMatches) LOG(fatal) << "No tof hit to digi matches in the input file"; - - fTofDigiPointMatches = static_cast<TClonesArray*>(ioman->GetObject("TofDigiMatchPoints")); - - if (0 == fTofDigiPointMatches) LOG(fatal) << "No tof digi to point matches in the input file"; - - fTofDigis = static_cast<TClonesArray*>(ioman->GetObject("TofDigi")); - - if (0 == fTofDigis) LOG(fatal) << "No tof digis in the input file"; - - fTofPoints = mcManager->InitBranch("TofPoint"); - - if (0 == fTofPoints) LOG(fatal) << "No tof MC points in the input file"; - - for (Int_t i = 0; fTofPoints->Size(0, i) >= 0; ++i) { - Int_t nofPoints = fTofPoints->Size(0, i); - vector<TrackDesc>& tracks = gTracks[i]; - gTofPoints[i].resize(tracks.size(), 0); - - for (Int_t j = 0; j < nofPoints; ++j) { - const CbmTofPoint* tofPoint = static_cast<const CbmTofPoint*>(fTofPoints->Get(0, i, j)); - Int_t trackId = tofPoint->GetTrackID(); - gTofPoints[i][trackId] = 1; - } - } - } - - return kSUCCESS; -} - -void CbmBinnedTrackerQa::IterateTrdHits(std::function<void(const CbmTrdHit*, const CbmTrdPoint*)> handleData) -{ - Int_t nofTrdHits = fTrdHits->GetEntriesFast(); - - for (Int_t i = 0; i < nofTrdHits; ++i) { - const CbmTrdHit* trdHit = static_cast<const CbmTrdHit*>(fTrdHits->At(i)); - //Int_t stationNumber = trdHit->GetPlaneId(); (VF) unused - Int_t clusterId = trdHit->GetRefId(); - const CbmTrdCluster* cluster = static_cast<const CbmTrdCluster*>(fTrdClusters->At(clusterId)); - Int_t nofDigis = cluster->GetNofDigis(); - - for (Int_t j = 0; j < nofDigis; ++j) { - Int_t digiId = cluster->GetDigi(j); - const CbmMatch* match = static_cast<const CbmMatch*>(fTrdDigiMatches->At(digiId)); - Int_t nofLinks = match->GetNofLinks(); - - for (Int_t k = 0; k < nofLinks; ++k) { - const CbmLink& link = match->GetLink(k); - Int_t eventId = link.GetEntry(); - Int_t mcPointId = link.GetIndex(); - const CbmTrdPoint* trdPoint = static_cast<const CbmTrdPoint*>(fTrdPoints->Get(0, eventId, mcPointId)); - handleData(trdHit, trdPoint); - } - } - } // TRD hits -} - -static Int_t gEventNumber = 0; -static Int_t gNofRecoTracks = 0; -static Int_t gNofNonGhosts = 0; -static Int_t gNofClones = 0; -static vector<bool> gIsRecoClone; - -void CbmBinnedTrackerQa::Exec(Option_t*) -{ - gIsRecoClone.clear(); - - if (TrackDesc::nofStsStations > 0) { - Int_t nofStsHits = fStsHits->GetEntriesFast(); - - for (Int_t i = 0; i < nofStsHits; ++i) { - const CbmStsHit* stsHit = static_cast<const CbmStsHit*>(fStsHits->At(i)); - Int_t stationNumber = CbmStsSetup::Instance()->GetStationNumber(stsHit->GetAddress()); - //Int_t stationNumber = CbmStsAddress::GetElementId(stsHit->GetAddress(), kSts); - Int_t frontClusterInd = stsHit->GetFrontClusterId(); - Int_t backClusterInd = stsHit->GetBackClusterId(); - const CbmStsCluster* frontCluster = static_cast<const CbmStsCluster*>(fStsClusters->At(frontClusterInd)); - Int_t nofFrontDigis = frontCluster->GetNofDigis(); - - for (Int_t j = 0; j < nofFrontDigis; ++j) { - Int_t stsDigiInd = frontCluster->GetDigi(j); - //const CbmStsDigi* stsDigi = static_cast<const CbmStsDigi*> (fStsDigis->At(stsDigiInd)); - const CbmMatch* stsDigiMatch = static_cast<const CbmMatch*>(fStsDigiMatches->At(stsDigiInd)); - Int_t nofLinks = stsDigiMatch->GetNofLinks(); - - for (Int_t k = 0; k < nofLinks; ++k) { - const CbmLink& link = stsDigiMatch->GetLink(k); - Int_t eventId = link.GetEntry(); - Int_t mcPointId = link.GetIndex(); - gStsPoints[eventId][mcPointId] = true; - const CbmStsPoint* stsPoint = static_cast<const CbmStsPoint*>(fStsPoints->Get(0, eventId, mcPointId)); -#ifdef CBM_BINNED_QA_FILL_HISTOS - stsXResHisto->Fill(stsHit->GetX() - (stsPoint->GetXIn() + stsPoint->GetXOut()) / 2); - stsYResHisto->Fill(stsHit->GetY() - (stsPoint->GetYIn() + stsPoint->GetYOut()) / 2); - stsTResHisto->Fill(stsHit->GetTime() - stsPoint->GetTime()); -#endif //CBM_BINNED_QA_FILL_HISTOS - Int_t trackId = stsPoint->GetTrackID(); - TrackDesc& trackDesk = gTracks[eventId][trackId]; - trackDesk.sts[stationNumber].first.insert(i); - Double_t mcX = (stsPoint->GetXIn() + stsPoint->GetXOut()) / 2; - Double_t mcY = (stsPoint->GetYIn() + stsPoint->GetYOut()) / 2; - - if (trackDesk.isPrimary && !trackDesk.stsPoints[0].empty() && !trackDesk.stsPoints[1].empty()) { - Double_t dist = std::sqrt((stsHit->GetX() - mcX) * (stsHit->GetX() - mcX) - + (stsHit->GetY() - mcY) * (stsHit->GetY() - mcY)); - - if (trackDesk.nearestHitDistSts[stationNumber] < 0 || dist < trackDesk.nearestHitDistSts[stationNumber]) { - trackDesk.nearestHitDistSts[stationNumber] = dist; - trackDesk.nearestPointsSts[stationNumber] = stsPoint; - trackDesk.pullXsts[stationNumber] = (stsHit->GetX() - mcX) / stsHit->GetDx(); - trackDesk.pullYsts[stationNumber] = (stsHit->GetY() - mcY) / stsHit->GetDy(); - } - } - } - } - - const CbmStsCluster* backCluster = static_cast<const CbmStsCluster*>(fStsClusters->At(backClusterInd)); - Int_t nofBackDigis = backCluster->GetNofDigis(); - - for (Int_t j = 0; j < nofBackDigis; ++j) { - Int_t stsDigiInd = backCluster->GetDigi(j); - //const CbmStsDigi* stsDigi = static_cast<const CbmStsDigi*> (fStsDigis->At(stsDigiInd)); - const CbmMatch* stsDigiMatch = static_cast<const CbmMatch*>(fStsDigiMatches->At(stsDigiInd)); - Int_t nofLinks = stsDigiMatch->GetNofLinks(); - - for (Int_t k = 0; k < nofLinks; ++k) { - const CbmLink& link = stsDigiMatch->GetLink(k); - Int_t eventId = link.GetEntry(); - Int_t mcPointId = link.GetIndex(); - gStsPoints[eventId][mcPointId] = true; - const CbmStsPoint* stsPoint = static_cast<const CbmStsPoint*>(fStsPoints->Get(0, eventId, mcPointId)); -#ifdef CBM_BINNED_QA_FILL_HISTOS - stsXResHisto->Fill(stsHit->GetX() - (stsPoint->GetXIn() + stsPoint->GetXOut()) / 2); - stsYResHisto->Fill(stsHit->GetY() - (stsPoint->GetYIn() + stsPoint->GetYOut()) / 2); - stsTResHisto->Fill(stsHit->GetTime() - stsPoint->GetTime()); -#endif //CBM_BINNED_QA_FILL_HISTOS - Int_t trackId = stsPoint->GetTrackID(); - TrackDesc& trackDesk = gTracks[eventId][trackId]; - trackDesk.sts[stationNumber].first.insert(i); - Double_t mcX = (stsPoint->GetXIn() + stsPoint->GetXOut()) / 2; - Double_t mcY = (stsPoint->GetYIn() + stsPoint->GetYOut()) / 2; - - if (trackDesk.isPrimary && !trackDesk.stsPoints[0].empty() && !trackDesk.stsPoints[1].empty()) { - Double_t dist = std::sqrt((stsHit->GetX() - mcX) * (stsHit->GetX() - mcX) - + (stsHit->GetY() - mcY) * (stsHit->GetY() - mcY)); - - if (trackDesk.nearestHitDistSts[stationNumber] < 0 || dist < trackDesk.nearestHitDistSts[stationNumber]) { - trackDesk.nearestHitDistSts[stationNumber] = dist; - trackDesk.nearestPointsSts[stationNumber] = stsPoint; - trackDesk.pullXsts[stationNumber] = (stsHit->GetX() - mcX) / stsHit->GetDx(); - trackDesk.pullYsts[stationNumber] = (stsHit->GetY() - mcY) / stsHit->GetDy(); - } - } - } - } - } // STS hits - } - - if (TrackDesc::nofMuchStations > 0) { - Int_t nofMuchHits = fMuchHits->GetEntriesFast(); - - for (Int_t i = 0; i < nofMuchHits; ++i) { - const CbmMuchPixelHit* muchHit = static_cast<const CbmMuchPixelHit*>(fMuchHits->At(i)); - Int_t muchStationNumber = CbmMuchGeoScheme::GetStationIndex(muchHit->GetAddress()); - Int_t layerNumber = CbmMuchGeoScheme::GetLayerIndex(muchHit->GetAddress()); - Int_t stationNumber = muchStationNumber * 3 + layerNumber; - Int_t clusterId = muchHit->GetRefId(); - const CbmMuchCluster* cluster = static_cast<const CbmMuchCluster*>(fMuchClusters->At(clusterId)); - Int_t nofDigis = cluster->GetNofDigis(); - - for (Int_t j = 0; j < nofDigis; ++j) { - Int_t digiId = cluster->GetDigi(j); - //const CbmMuchDigi* digi = static_cast<const CbmMuchDigi*> (fMuchDigis->At(digiId)); - const CbmMatch* muchDigiMatch = static_cast<const CbmMatch*>(fMuchDigiMatches->At(digiId)); - Int_t nofLinks = muchDigiMatch->GetNofLinks(); - - for (Int_t k = 0; k < nofLinks; ++k) { - const CbmLink& link = muchDigiMatch->GetLink(k); - Int_t eventId = link.GetEntry(); - Int_t mcPointId = link.GetIndex(); - gMuchPoints[eventId][mcPointId] = true; - const CbmMuchPoint* muchPoint = static_cast<const CbmMuchPoint*>(fMuchPoints->Get(0, eventId, mcPointId)); - Double_t mcX = (muchPoint->GetXIn() + muchPoint->GetXOut()) / 2; - Double_t mcY = (muchPoint->GetYIn() + muchPoint->GetYOut()) / 2; - Double_t mcT = muchPoint->GetTime(); - Double_t xRes = muchHit->GetX() - mcX; - Double_t yRes = muchHit->GetY() - mcY; - Double_t tRes = muchHit->GetTime() - mcT; - Double_t xPull = xRes / muchHit->GetDx(); - Double_t yPull = yRes / muchHit->GetDy(); - Double_t tPull = tRes / muchHit->GetTimeError(); - muchHitResidualX->Fill(xRes); - muchHitResidualY->Fill(yRes); - muchHitResidualT->Fill(tRes); - muchHitPullX->Fill(xPull); - muchHitPullY->Fill(yPull); - muchHitPullT->Fill(tPull); -#ifdef CBM_BINNED_QA_FILL_HISTOS - muchXResHisto->Fill(muchHit->GetX() - (muchPoint->GetXIn() + muchPoint->GetXOut()) / 2); - muchYResHisto->Fill(muchHit->GetY() - (muchPoint->GetYIn() + muchPoint->GetYOut()) / 2); - muchTResHisto->Fill(muchHit->GetTime() - muchPoint->GetTime()); -#endif //CBM_BINNED_QA_FILL_HISTOS - Int_t trackId = muchPoint->GetTrackID(); - TrackDesc& trackDesk = gTracks[eventId][trackId]; - trackDesk.much[stationNumber].first.insert(i); - } - } - } // MUCH hits*/ - } - - if (TrackDesc::nofTrdStations > 0) { - Int_t nofTrdHits = fTrdHits->GetEntriesFast(); - - for (Int_t i = 0; i < nofTrdHits; ++i) { - const CbmTrdHit* trdHit = static_cast<const CbmTrdHit*>(fTrdHits->At(i)); - Int_t stationNumber = trdHit->GetPlaneId(); - Int_t clusterId = trdHit->GetRefId(); -#ifndef TRD_IDEAL - const CbmTrdCluster* cluster = static_cast<const CbmTrdCluster*>(fTrdClusters->At(clusterId)); - Int_t nofDigis = cluster->GetNofDigis(); - - for (Int_t j = 0; j < nofDigis; ++j) { - Int_t digiId = cluster->GetDigi(j); - const CbmMatch* match = static_cast<const CbmMatch*>(fTrdDigiMatches->At(digiId)); - Int_t nofLinks = match->GetNofLinks(); - - for (Int_t k = 0; k < nofLinks; ++k) { - const CbmLink& link = match->GetLink(k); - Int_t eventId = link.GetEntry(); - Int_t mcPointId = link.GetIndex(); - gTrdPoints[eventId][mcPointId] = true; - const CbmTrdPoint* trdPoint = static_cast<const CbmTrdPoint*>(fTrdPoints->Get(0, eventId, mcPointId)); -#ifdef CBM_BINNED_QA_FILL_HISTOS - //Double_t mcX = (trdPoint->GetXIn() + trdPoint->GetXOut()) / 2; (VF) unused - //Double_t mcY = (trdPoint->GetYIn() + trdPoint->GetYOut()) / 2; (VF) unused - trdXResHisto->Fill(trdHit->GetX() - mcX); - trdYResHisto->Fill(trdHit->GetY() - mcY); - trdTResHisto->Fill(trdHit->GetTime() - trdPoint->GetTime()); -#endif //CBM_BINNED_QA_FILL_HISTOS - Int_t trackId = trdPoint->GetTrackID(); - TrackDesc& trackDesk = gTracks[eventId][trackId]; - trackDesk.trd[stationNumber].first.insert(i); - -#ifdef CBM_BINNED_QA_FILL_HISTOS - if (trackDesk.isPrimary && !trackDesk.trdPoints[0].empty() && !trackDesk.trdPoints[1].empty() - && !trackDesk.trdPoints[2].empty() && !trackDesk.trdPoints[3].empty()) { - Double_t dist = std::sqrt((trdHit->GetX() - mcX) * (trdHit->GetX() - mcX) - + (trdHit->GetY() - mcY) * (trdHit->GetY() - mcY)); - - if (trackDesk.nearestHitDistTrd[stationNumber] < 0 || dist < trackDesk.nearestHitDistTrd[stationNumber]) { - trackDesk.nearestHitDistTrd[stationNumber] = dist; - trackDesk.nearestPointsTrd[stationNumber] = trdPoint; - trackDesk.pullXtrd[stationNumber] = (trdHit->GetX() - mcX) / trdHit->GetDx(); - trackDesk.pullYtrd[stationNumber] = (trdHit->GetY() - mcY) / trdHit->GetDy(); - } - } -#endif //CBM_BINNED_QA_FILL_HISTOS - } - } -#else //TRD_IDEAL - const CbmTrdPoint* trdPoint = static_cast<const CbmTrdPoint*>(fTrdPoints->Get(0, gEventNumber, clusterId)); - Double_t mcX = (trdPoint->GetXIn() + trdPoint->GetXOut()) / 2; - Double_t mcY = (trdPoint->GetYIn() + trdPoint->GetYOut()) / 2; - trdXResHisto->Fill(trdHit->GetX() - mcX); - trdYResHisto->Fill(trdHit->GetY() - mcY); - trdTResHisto->Fill(trdHit->GetTime() - trdPoint->GetTime()); - Int_t trackId = trdPoint->GetTrackID(); - TrackDesc& trackDesk = gTracks[gEventNumber][trackId]; - trackDesk.trd[stationNumber].first.insert(i); - - if (trackDesk.isPrimary && !trackDesk.trdPoints[0].empty() && !trackDesk.trdPoints[1].empty() - && !trackDesk.trdPoints[2].empty() && !trackDesk.trdPoints[3].empty()) { - Double_t dist = - std::sqrt((trdHit->GetX() - mcX) * (trdHit->GetX() - mcX) + (trdHit->GetY() - mcY) * (trdHit->GetY() - mcY)); - - if (trackDesk.nearestHitDist[stationNumber] < 0 || dist < trackDesk.nearestHitDist[stationNumber]) { - trackDesk.nearestHitDist[stationNumber] = dist; - trackDesk.nearestPoints[stationNumber] = trdPoint; - trackDesk.pullX[stationNumber] = (trdHit->GetX() - mcX) / trdHit->GetDx(); - trackDesk.pullY[stationNumber] = (trdHit->GetY() - mcY) / trdHit->GetDy(); - } - } -#endif //TRD_IDEAL - } // TRD hits - } - - if (TrackDesc::hasTof) { - Int_t nofTofHits = fTofHits->GetEntriesFast(); - - for (Int_t i = 0; i < nofTofHits; ++i) { - //const CbmTofHit* tofHit = static_cast<const CbmTofHit*> (fTofHits->At(i)); - const CbmMatch* tofHitMatch = static_cast<const CbmMatch*>(fTofHitDigiMatches->At(i)); - Int_t nofTofDigis = tofHitMatch->GetNofLinks(); - - for (Int_t j = 0; j < nofTofDigis; ++j) { - const CbmLink& digiLink = tofHitMatch->GetLink(j); - Int_t digiInd = digiLink.GetIndex(); - const CbmMatch* pointMatch = static_cast<const CbmMatch*>(fTofDigiPointMatches->At(digiInd)); - Int_t nofPoints = pointMatch->GetNofLinks(); - - for (Int_t k = 0; k < nofPoints; ++k) { - const CbmLink& pointLink = pointMatch->GetLink(k); - Int_t eventId = pointLink.GetEntry(); - Int_t mcPointId = pointLink.GetIndex(); - const CbmTofPoint* tofPoint = static_cast<const CbmTofPoint*>(fTofPoints->Get(0, eventId, mcPointId)); -#ifdef CBM_BINNED_QA_FILL_HISTOS - tofXResHisto->Fill(tofHit->GetX() - tofPoint->GetX()); - tofYResHisto->Fill(tofHit->GetY() - tofPoint->GetY()); - tofTResHisto->Fill(tofHit->GetTime() - tofPoint->GetTime()); -#endif //CBM_BINNED_QA_FILL_HISTOS - Int_t trackId = tofPoint->GetTrackID(); - TrackDesc& trackDesk = gTracks[eventId][trackId]; - trackDesk.tof.first.insert(i); - gTofPoints[eventId][trackId] = 2; - } - } - } // TOF hits - } - - Int_t nofStations = fSettings->GetNofStations(); - Int_t nofGlobalTracks = fGlobalTracks->GetEntriesFast(); - set<Int_t>* globalTrackMCRefs = new set<Int_t>[nofGlobalTracks * nofStations]; - Int_t* globalTracksHitInds = new Int_t[nofGlobalTracks * nofStations]; - gIsRecoClone.resize(nofGlobalTracks); - fill(gIsRecoClone.begin(), gIsRecoClone.end(), false); - - for (Int_t i = 0; i < nofGlobalTracks; ++i) { - ++gNofRecoTracks; - const CbmGlobalTrack* globalTrack = static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(i)); - Int_t stsIndex = globalTrack->GetStsTrackIndex(); - Int_t muchIndex = globalTrack->GetMuchTrackIndex(); - Int_t trdIndex = globalTrack->GetTrdTrackIndex(); - Int_t tofIndex = globalTrack->GetTofHitIndex(); - - if (TrackDesc::nofStsStations > 0 && stsIndex < 0) continue; - - if (TrackDesc::nofMuchStations > 0 && muchIndex < 0) continue; - - if (TrackDesc::nofTrdStations > 0 && trdIndex < 0) continue; - - if (TrackDesc::hasTof && tofIndex < 0) continue; - - map<Int_t, set<Int_t>> mcTrackIds; - - if (TrackDesc::nofStsStations > 0) HandleSts(stsIndex, mcTrackIds, globalTrackMCRefs, globalTracksHitInds); - - if (TrackDesc::nofMuchStations > 0) HandleMuch(muchIndex, mcTrackIds, globalTrackMCRefs, globalTracksHitInds); - - if (TrackDesc::nofTrdStations > 0) HandleTrd(trdIndex, mcTrackIds, globalTrackMCRefs, globalTracksHitInds); - - if (TrackDesc::hasTof) HandleTof(i, tofIndex, mcTrackIds, globalTrackMCRefs, globalTracksHitInds); - - map<Int_t, set<Int_t>>::const_iterator maxIter = max_element( - mcTrackIds.begin(), mcTrackIds.end(), [](const pair<Int_t, set<Int_t>>& p1, const pair<Int_t, set<Int_t>>& p2) { - return p1.second.size() < p2.second.size(); - }); - - if (maxIter->second.size() < size_t(0.7 * nofStations)) continue; - - ++gNofNonGhosts; - } - - map<Int_t, set<Int_t>>* mcToGlobalRefs = new map<Int_t, set<Int_t>>[nofStations]; - - for (Int_t i = 0; i < nofGlobalTracks; ++i) { - //map<Int_t, Int_t> matches;// The map from global track IDs, different from the current (i-th) global track ID, to the number of stations, where their hits originate from the MC tracks. - - for (Int_t j = 0; j < nofStations; ++j) { - //set<Int_t> globals;// Global track IDs, which reference the same Monte Carlo track IDs on this station as the i-th (global) track. - const set<Int_t>& mcs = globalTrackMCRefs[i * nofStations + j]; - - for (set<Int_t>::const_iterator k = mcs.begin(); k != mcs.end(); ++k) { - Int_t mc = *k; - /*map<Int_t, set<Int_t> >::const_iterator mctogIter = mcToGlobalRefs[j].find(mc); - - if (mctogIter == mcToGlobalRefs[j].end()) - continue; - - globals.insert(mctogIter->second.begin(), mctogIter->second.end());*/ - mcToGlobalRefs[j][mc].insert(i); - } - - /*for (set<Int_t>::const_iterator k = globals.begin(); k != globals.end(); ++k) - { - Int_t gl = *k; - map<Int_t, Int_t>::iterator mIter = matches.find(gl); - - if (mIter == matches.end()) - matches[gl] = 1; - else - ++mIter->second; - }*/ - } - - //map<Int_t, Int_t>::const_iterator maxIter = max_element(matches.begin(), matches.end(), - // [](const pair<Int_t, Int_t>& p1, const pair<Int_t, Int_t>& p2) - //{ - //return p1.second < p2.second; - //}); - - /*for (map<Int_t, Int_t>::const_iterator maxIter = matches.begin(); maxIter != matches.end(); ++maxIter) - { - if (maxIter->second >= int(0.7 * nofStations)) - { - ++gNofClones; - Int_t origTrackInd = maxIter->first; - int nofSameHits = 0; - - for (Int_t j = 0; j < nofStations; ++j) - { - Int_t hitInd = globalTracksHitInds[i * nofStations + j]; - Int_t origHitInd = globalTracksHitInds[origTrackInd * nofStations + j]; - - if (hitInd == origHitInd) - ++nofSameHits; - } - - clonesNofSameHits->Fill(nofSameHits); - continue; - } - } - - for (Int_t j = 0; j < nofStations; ++j) - { - const set<Int_t>& mcs = globalTrackMCRefs[i * nofStations + j]; - - for (set<Int_t>::const_iterator k = mcs.begin(); k != mcs.end(); ++k) - { - Int_t mc = *k; - mcToGlobalRefs[j][mc].insert(i); - } - }*/ - } // Filling global tracks to mc maps for furhter clones searches - - for (Int_t i = 0; i < nofGlobalTracks; ++i) { - const CbmGlobalTrack* thisTrack = static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(i)); - - //if (gIsRecoClone[i]) - //continue; - - map<Int_t, Int_t> - matches; // The map from global track IDs, different from the current (i-th) global track ID, to the number of stations, where their hits originate from the MC tracks. - - for (Int_t j = 0; j < nofStations; ++j) { - set<Int_t> - globals; // Global track IDs, which reference the same Monte Carlo track IDs on this station as the i-th (global) track. - const set<Int_t>& mcs = globalTrackMCRefs[i * nofStations + j]; - - for (set<Int_t>::const_iterator k = mcs.begin(); k != mcs.end(); ++k) { - Int_t mc = *k; - map<Int_t, set<Int_t>>::const_iterator mctogIter = mcToGlobalRefs[j].find(mc); - - if (mctogIter == mcToGlobalRefs[j].end()) continue; - - globals.insert(mctogIter->second.begin(), mctogIter->second.end()); - } - - for (set<Int_t>::const_iterator k = globals.begin(); k != globals.end(); ++k) { - Int_t gl = *k; - - if (gl == i) continue; - - map<Int_t, Int_t>::iterator mIter = matches.find(gl); - - if (mIter == matches.end()) matches[gl] = 1; - else - ++mIter->second; - } - } - - for (map<Int_t, Int_t>::const_iterator j = matches.begin(); j != matches.end(); ++j) { - if (j->second >= int(0.7 * nofStations)) { - const CbmGlobalTrack* anotherTrack = static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(j->first)); - - //if (gIsRecoClone[j->first]) - //continue; - - if (thisTrack->GetChi2() < anotherTrack->GetChi2()) gIsRecoClone[j->first] = true; - else - gIsRecoClone[i] = true; - } - } - } - - for (Int_t i = 0; i < nofGlobalTracks; ++i) { - if (gIsRecoClone[i]) ++gNofClones; - } - - delete[] mcToGlobalRefs; - delete[] globalTrackMCRefs; - delete[] globalTracksHitInds; - - ++gEventNumber; -} - -static inline void IncrementForId(map<Int_t, set<Int_t>>& ids, Int_t id, Int_t stId) { ids[id].insert(stId); } - -void CbmBinnedTrackerQa::HandleSts(Int_t stsTrackIndex, map<Int_t, set<Int_t>>& mcTrackIds, - set<Int_t>* globalTrackMCRefs, Int_t* globalTracksHitInds) -{ - int nofStations = fSettings->GetNofStations(); - const CbmStsTrack* stsTrack = static_cast<const CbmStsTrack*>(fStsTracks->At(stsTrackIndex)); - Int_t nofStsHits = stsTrack->GetNofHits(); - - for (Int_t i = 0; i < nofStsHits; ++i) { - Int_t stsHitInd = stsTrack->GetStsHitIndex(i); - const CbmStsHit* stsHit = static_cast<const CbmStsHit*>(fStsHits->At(stsHitInd)); - Int_t stationNumber = CbmStsSetup::Instance()->GetStationNumber(stsHit->GetAddress()); - globalTracksHitInds[stsTrackIndex * nofStations + TrackDesc::firstStsStationNo + stationNumber] = stsHitInd; - Double_t mcX = 0; - Double_t mcY = 0; - Double_t mcCnt = 0; - //Int_t stationNumber = CbmStsAddress::GetElementId(stsHit->GetAddress(), kSts); - Int_t frontClusterInd = stsHit->GetFrontClusterId(); - Int_t backClusterInd = stsHit->GetBackClusterId(); - const CbmStsCluster* frontCluster = static_cast<const CbmStsCluster*>(fStsClusters->At(frontClusterInd)); - Int_t nofFrontDigis = frontCluster->GetNofDigis(); - - for (Int_t j = 0; j < nofFrontDigis; ++j) { - Int_t stsDigiInd = frontCluster->GetDigi(j); - //const CbmStsDigi* stsDigi = static_cast<const CbmStsDigi*> (fStsDigis->At(stsDigiInd)); - const CbmMatch* stsDigiMatch = static_cast<const CbmMatch*>(fStsDigiMatches->At(stsDigiInd)); - Int_t nofLinks = stsDigiMatch->GetNofLinks(); - - for (Int_t k = 0; k < nofLinks; ++k) { - const CbmLink& link = stsDigiMatch->GetLink(k); - Int_t eventId = link.GetEntry(); - Int_t mcPointId = link.GetIndex(); - const CbmStsPoint* stsPoint = static_cast<const CbmStsPoint*>(fStsPoints->Get(0, eventId, mcPointId)); - mcX += (stsPoint->GetXIn() + stsPoint->GetXOut()) / 2; - mcY += (stsPoint->GetYIn() + stsPoint->GetYOut()) / 2; - ++mcCnt; - Int_t trackId = stsPoint->GetTrackID(); - IncrementForId(mcTrackIds, trackId, stationNumber); - globalTrackMCRefs[stsTrackIndex * nofStations + stationNumber].insert(trackId); - TrackDesc& trackDesk = gTracks[eventId][trackId]; - - if (trackDesk.sts[stationNumber].first.find(stsHitInd) != trackDesk.sts[stationNumber].first.end()) - trackDesk.sts[stationNumber].second.insert(stsTrackIndex); - } - } - - const CbmStsCluster* backCluster = static_cast<const CbmStsCluster*>(fStsClusters->At(backClusterInd)); - Int_t nofBackDigis = backCluster->GetNofDigis(); - - for (Int_t j = 0; j < nofBackDigis; ++j) { - Int_t stsDigiInd = backCluster->GetDigi(j); - //const CbmStsDigi* stsDigi = static_cast<const CbmStsDigi*> (fStsDigis->At(stsDigiInd)); - const CbmMatch* stsDigiMatch = static_cast<const CbmMatch*>(fStsDigiMatches->At(stsDigiInd)); - Int_t nofLinks = stsDigiMatch->GetNofLinks(); - - for (Int_t k = 0; k < nofLinks; ++k) { - const CbmLink& link = stsDigiMatch->GetLink(k); - Int_t eventId = link.GetEntry(); - Int_t mcPointId = link.GetIndex(); - const CbmStsPoint* stsPoint = static_cast<const CbmStsPoint*>(fStsPoints->Get(0, eventId, mcPointId)); - mcX += (stsPoint->GetXIn() + stsPoint->GetXOut()) / 2; - mcY += (stsPoint->GetYIn() + stsPoint->GetYOut()) / 2; - ++mcCnt; - Int_t trackId = stsPoint->GetTrackID(); - IncrementForId(mcTrackIds, trackId, stationNumber); - globalTrackMCRefs[stsTrackIndex * nofStations + stationNumber].insert(trackId); - TrackDesc& trackDesk = gTracks[eventId][trackId]; - - if (trackDesk.sts[stationNumber].first.find(stsHitInd) != trackDesk.sts[stationNumber].first.end()) - trackDesk.sts[stationNumber].second.insert(stsTrackIndex); - } - } - - if (0 == mcCnt) continue; - - mcX /= mcCnt; - mcY /= mcCnt; - - if (0 == stationNumber) { - const FairTrackParam* param = stsTrack->GetParamFirst(); - Double_t xRes = param->GetX() - mcX; - Double_t yRes = param->GetY() - mcY; - Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0)); - Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1)); - stsTrackResidualFirstX->Fill(xRes); - stsTrackResidualFirstY->Fill(yRes); - stsTrackPullFirstX->Fill(xPull); - stsTrackPullFirstY->Fill(yPull); - } - else if (TrackDesc::nofStsStations - 1 == stationNumber) { - const FairTrackParam* param = stsTrack->GetParamLast(); - Double_t xRes = param->GetX() - mcX; - Double_t yRes = param->GetY() - mcY; - Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0)); - Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1)); - stsTrackResidualLastX->Fill(xRes); - stsTrackResidualLastY->Fill(yRes); - stsTrackPullLastX->Fill(xPull); - stsTrackPullLastY->Fill(yPull); - } - } -} - -void CbmBinnedTrackerQa::HandleMuch(Int_t muchTrackIndex, map<Int_t, set<Int_t>>& mcTrackIds, - set<Int_t>* globalTrackMCRefs, Int_t* globalTracksHitInds) -{ - int nofStations = fSettings->GetNofStations(); - const CbmMuchTrack* muchTrack = static_cast<const CbmMuchTrack*>(fMuchTracks->At(muchTrackIndex)); - Int_t nofMuchHits = muchTrack->GetNofHits(); - - for (Int_t i = 0; i < nofMuchHits; ++i) { - Int_t muchHitInd = muchTrack->GetHitIndex(i); - const CbmMuchPixelHit* muchHit = static_cast<const CbmMuchPixelHit*>(fMuchHits->At(muchHitInd)); - Int_t muchStationNumber = CbmMuchGeoScheme::GetStationIndex(muchHit->GetAddress()); - Int_t layerNumber = CbmMuchGeoScheme::GetLayerIndex(muchHit->GetAddress()); - Int_t stationNumber = muchStationNumber * 3 + layerNumber; - Double_t mcX = 0; - Double_t mcY = 0; - //Double_t mcCnt = 0; (VF) unused - globalTracksHitInds[muchTrackIndex * nofStations + TrackDesc::firstMuchStationNo + stationNumber] = muchHitInd; - Int_t clusterId = muchHit->GetRefId(); - const CbmMuchCluster* cluster = static_cast<const CbmMuchCluster*>(fMuchClusters->At(clusterId)); - Int_t nofDigis = cluster->GetNofDigis(); - - for (Int_t j = 0; j < nofDigis; ++j) { - Int_t digiId = cluster->GetDigi(j); - //const CbmMuchDigi* digi = static_cast<const CbmMuchDigi*> (fMuchDigis->At(digiId)); - const CbmMatch* digiMatch = static_cast<const CbmMatch*>(fMuchDigiMatches->At(digiId)); - Int_t nofLinks = digiMatch->GetNofLinks(); - - for (Int_t k = 0; k < nofLinks; ++k) { - const CbmLink& link = digiMatch->GetLink(k); - Int_t eventId = link.GetEntry(); - Int_t mcPointId = link.GetIndex(); - const CbmMuchPoint* muchPoint = static_cast<const CbmMuchPoint*>(fMuchPoints->Get(0, eventId, mcPointId)); - //mcX += (muchPoint->GetXIn() + muchPoint->GetXOut()) / 2; - //mcY += (muchPoint->GetYIn() + muchPoint->GetYOut()) / 2; - //++mcCnt; - mcX = (muchPoint->GetXIn() + muchPoint->GetXOut()) / 2; - mcY = (muchPoint->GetYIn() + muchPoint->GetYOut()) / 2; - - if (0 == stationNumber) { - const FairTrackParam* param = muchTrack->GetParamFirst(); - Double_t xRes = param->GetX() - mcX; - Double_t yRes = param->GetY() - mcY; - Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0)); - Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1)); - muchTrackResidualFirstX->Fill(xRes); - muchTrackResidualFirstY->Fill(yRes); - muchTrackPullFirstX->Fill(xPull); - muchTrackPullFirstY->Fill(yPull); - } - else if (TrackDesc::nofMuchStations - 1 == stationNumber) { - const FairTrackParam* param = muchTrack->GetParamLast(); - Double_t xRes = param->GetX() - mcX; - Double_t yRes = param->GetY() - mcY; - Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0)); - Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1)); - muchTrackResidualLastX->Fill(xRes); - muchTrackResidualLastY->Fill(yRes); - muchTrackPullLastX->Fill(xPull); - muchTrackPullLastY->Fill(yPull); - } - - Int_t trackId = muchPoint->GetTrackID(); - IncrementForId(mcTrackIds, trackId, 100 + stationNumber); - globalTrackMCRefs[muchTrackIndex * nofStations + TrackDesc::firstMuchStationNo + stationNumber].insert(trackId); - TrackDesc& trackDesk = gTracks[eventId][trackId]; - - if (trackDesk.much[stationNumber].first.find(muchHitInd) != trackDesk.much[stationNumber].first.end()) - trackDesk.much[stationNumber].second.insert(muchTrackIndex); - } - } - - /*if (0 == mcCnt) - continue; - - mcX /= mcCnt; - mcY /= mcCnt; - - if (0 == stationNumber) - { - const FairTrackParam* param = muchTrack->GetParamFirst(); - Double_t xRes = param->GetX() - mcX; - Double_t yRes = param->GetY() - mcY; - Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0)); - Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1)); - muchTrackResidualFirstX->Fill(xRes); - muchTrackResidualFirstY->Fill(yRes); - muchTrackPullFirstX->Fill(xPull); - muchTrackPullFirstY->Fill(yPull); - } - else if (TrackDesc::nofMuchStations - 1 == stationNumber) - { - const FairTrackParam* param = muchTrack->GetParamLast(); - Double_t xRes = param->GetX() - mcX; - Double_t yRes = param->GetY() - mcY; - Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0)); - Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1)); - muchTrackResidualLastX->Fill(xRes); - muchTrackResidualLastY->Fill(yRes); - muchTrackPullLastX->Fill(xPull); - muchTrackPullLastY->Fill(yPull); - }*/ - } -} - -void CbmBinnedTrackerQa::HandleTrd(Int_t trdTrackIndex, map<Int_t, set<Int_t>>& mcTrackIds, - set<Int_t>* globalTrackMCRefs, Int_t* globalTracksHitInds) -{ - int nofStations = fSettings->GetNofStations(); - const CbmTrdTrack* trdTrack = static_cast<const CbmTrdTrack*>(fTrdTracks->At(trdTrackIndex)); - Int_t nofTrdHits = trdTrack->GetNofHits(); - - for (Int_t i = 0; i < nofTrdHits; ++i) { - Int_t trdHitInd = trdTrack->GetHitIndex(i); - const CbmTrdHit* trdHit = static_cast<const CbmTrdHit*>(fTrdHits->At(trdHitInd)); - Int_t stationNumber = trdHit->GetPlaneId(); - Double_t mcX = 0; - Double_t mcY = 0; - Double_t mcCnt = 0; - globalTracksHitInds[trdTrackIndex * nofStations + TrackDesc::firstTrdStationNo + stationNumber] = trdHitInd; - Int_t clusterId = trdHit->GetRefId(); -#ifndef TRD_IDEAL - const CbmTrdCluster* cluster = static_cast<const CbmTrdCluster*>(fTrdClusters->At(clusterId)); - Int_t nofDigis = cluster->GetNofDigis(); - - for (Int_t j = 0; j < nofDigis; ++j) { - Int_t digiId = cluster->GetDigi(j); - const CbmMatch* match = static_cast<const CbmMatch*>(fTrdDigiMatches->At(digiId)); - Int_t nofLinks = match->GetNofLinks(); - - for (Int_t k = 0; k < nofLinks; ++k) { - const CbmLink& link = match->GetLink(k); - Int_t eventId = link.GetEntry(); - Int_t mcPointId = link.GetIndex(); - const CbmTrdPoint* trdPoint = static_cast<const CbmTrdPoint*>(fTrdPoints->Get(0, eventId, mcPointId)); - mcX += (trdPoint->GetXIn() + trdPoint->GetXOut()) / 2; - mcY += (trdPoint->GetYIn() + trdPoint->GetYOut()) / 2; - ++mcCnt; - Int_t trackId = trdPoint->GetTrackID(); - IncrementForId(mcTrackIds, trackId, 200 + stationNumber); - globalTrackMCRefs[trdTrackIndex * nofStations + TrackDesc::firstTrdStationNo + stationNumber].insert(trackId); - TrackDesc& trackDesk = gTracks[eventId][trackId]; - - if (trackDesk.trd[stationNumber].first.find(trdHitInd) != trackDesk.trd[stationNumber].first.end()) - trackDesk.trd[stationNumber].second.insert(trdTrackIndex); - } - } -#else //TRD_IDEAL - const CbmTrdPoint* trdPoint = static_cast<const CbmTrdPoint*>(fTrdPoints->Get(0, gEventNumber, clusterId)); - Int_t trackId = trdPoint->GetTrackID(); - TrackDesc& trackDesk = gTracks[gEventNumber][trackId]; - - if (trackDesk.trd[stationNumber].first.find(trdHitInd) != trackDesk.trd[stationNumber].first.end()) - trackDesk.trd[stationNumber].second.insert(trdTrackIndex); -#endif //TRD_IDEAL - if (0 == mcCnt) continue; - - mcX /= mcCnt; - mcY /= mcCnt; - - if (0 == stationNumber) { - const FairTrackParam* param = trdTrack->GetParamFirst(); - Double_t xRes = param->GetX() - mcX; - Double_t yRes = param->GetY() - mcY; - Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0)); - Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1)); - trdTrackResidualFirstX->Fill(xRes); - trdTrackResidualFirstY->Fill(yRes); - trdTrackPullFirstX->Fill(xPull); - trdTrackPullFirstY->Fill(yPull); - } - else if (TrackDesc::nofTrdStations - 1 == stationNumber) { - const FairTrackParam* param = trdTrack->GetParamLast(); - Double_t xRes = param->GetX() - mcX; - Double_t yRes = param->GetY() - mcY; - Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0)); - Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1)); - trdTrackResidualLastX->Fill(xRes); - trdTrackResidualLastY->Fill(yRes); - trdTrackPullLastX->Fill(xPull); - trdTrackPullLastY->Fill(yPull); - } - } -} - -void CbmBinnedTrackerQa::HandleTof(Int_t globalTrackIndex, Int_t tofHitIndex, map<Int_t, set<Int_t>>& mcTrackIds, - set<Int_t>* globalTrackMCRefs, Int_t* globalTracksHitInds) -{ - const CbmGlobalTrack* globalTrack = static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(globalTrackIndex)); - Double_t mcX = 0; - Double_t mcY = 0; - Double_t mcCnt = 0; - int nofStations = fSettings->GetNofStations(); - globalTracksHitInds[globalTrackIndex * nofStations + TrackDesc::tofStationNo] = tofHitIndex; - const CbmMatch* tofHitMatch = static_cast<const CbmMatch*>(fTofHitDigiMatches->At(tofHitIndex)); - Int_t nofTofDigis = tofHitMatch->GetNofLinks(); - - for (Int_t i = 0; i < nofTofDigis; ++i) { - const CbmLink& digiLink = tofHitMatch->GetLink(i); - Int_t digiInd = digiLink.GetIndex(); - const CbmMatch* pointMatch = static_cast<const CbmMatch*>(fTofDigiPointMatches->At(digiInd)); - Int_t nofPoints = pointMatch->GetNofLinks(); - - for (Int_t j = 0; j < nofPoints; ++j) { - const CbmLink& pointLink = pointMatch->GetLink(j); - Int_t eventId = pointLink.GetEntry(); - Int_t pointId = pointLink.GetIndex(); - const CbmTofPoint* tofPoint = static_cast<const CbmTofPoint*>(fTofPoints->Get(0, eventId, pointId)); - mcX += tofPoint->GetX(); - mcY += tofPoint->GetY(); - ++mcCnt; - Int_t trackId = tofPoint->GetTrackID(); - IncrementForId(mcTrackIds, trackId, 300); - globalTrackMCRefs[globalTrackIndex * nofStations + TrackDesc::tofStationNo].insert(trackId); - TrackDesc& trackDesk = gTracks[eventId][trackId]; - - if (trackDesk.tof.first.find(tofHitIndex) != trackDesk.tof.first.end()) trackDesk.tof.second.insert(tofHitIndex); - } - } - - if (0 == mcCnt) return; - - mcX /= mcCnt; - mcY /= mcCnt; - const FairTrackParam* param = globalTrack->GetParamLast(); - Double_t xRes = param->GetX() - mcX; - Double_t yRes = param->GetY() - mcY; - Double_t xPull = xRes / TMath::Sqrt(param->GetCovariance(0, 0)); - Double_t yPull = yRes / TMath::Sqrt(param->GetCovariance(1, 1)); - globalTrackResidualLastX->Fill(xRes); - globalTrackResidualLastY->Fill(yRes); - globalTrackPullLastX->Fill(xPull); - globalTrackPullLastY->Fill(yPull); -} - -static void SaveHisto(TH1* histo) -{ - TFile* curFile = TFile::CurrentFile(); - TString histoName = histo->GetName(); - histoName += ".root"; - TFile fh(histoName.Data(), "RECREATE"); - histo->Write(); - fh.Close(); - delete histo; - TFile::CurrentFile() = curFile; -} - -template<typename T> -void NumberToFile(const char* name, T number) -{ - char buf[256]; - sprintf(buf, "%s.txt", name); - ofstream fileStream(buf, ios_base::out | ios_base::trunc); - fileStream << number; -} - -static void effOfMCPoints(const char* name, const vector<vector<bool>>& points) -{ - int nofAllMCPoints = 0; - int nofRecoMCPoints = 0; - - for (const auto& i : points) { - for (auto j : i) { - ++nofAllMCPoints; - - if (j) ++nofRecoMCPoints; - } - } - - double eff = 100 * nofRecoMCPoints; - - if (0 == nofAllMCPoints) eff = 100; - else - eff /= nofAllMCPoints; - - cout << "Reconstructed of the " << name << " points: " << eff << "% " << nofRecoMCPoints << "/" << nofAllMCPoints - << endl; -} - -static void effOfMCPoints(const char* name, const vector<vector<char>>& points) -{ - int nofAllMCPoints = 0; - int nofRecoMCPoints = 0; - - for (const auto& i : points) { - for (auto j : i) { - if (j > 0) ++nofAllMCPoints; - - if (j > 1) ++nofRecoMCPoints; - } - } - - double eff = 100 * nofRecoMCPoints; - - if (0 == nofAllMCPoints) eff = 100; - else - eff /= nofAllMCPoints; - - cout << "Reconstructed of the " << name << " points: " << eff << "% " << nofRecoMCPoints << "/" << nofAllMCPoints - << endl; -} - -void CbmBinnedTrackerQa::Finish() -{ - int nofAllTracks = 0; - int nofRefTracks = 0; - int nofMatchedRefTracks = 0; - int nofRefPrimTracks = 0; - int nofMatchedRefPrimTracks = 0; - int nofRefNonPrimTracks = 0; - int nofMatchedRefNonPrimTracks = 0; - //int nofSts[2] = { 0, 0 }; - //int nofTrd[4] = { 0, 0, 0, 0 }; - //int nofMuch[3] = { 0, 0, 0 }; - //int nofTof = 0; - - for (vector<vector<TrackDesc>>::iterator i = gTracks.begin(); i != gTracks.end(); ++i) { - vector<TrackDesc>& evTracks = *i; - - for (vector<TrackDesc>::iterator j = evTracks.begin(); j != evTracks.end(); ++j) { - ++nofAllTracks; - TrackDesc& trackDesc = *j; - - if (fIsOnlyPrimary && !trackDesc.isPrimary) continue; - - bool isRef = true; - - for (int k = 0; k < TrackDesc::nofStsStations; ++k) { - if (trackDesc.sts[k].first.empty()) { - isRef = false; - break; - } - } - - if (!isRef) continue; - -#ifdef CBM_BINNED_QA_FILL_HISTOS - for (set<const CbmStsPoint*>::const_iterator k = trackDesc.stsPoints[0].begin(); - k != trackDesc.stsPoints[0].end(); ++k) { - const CbmStsPoint* p0 = *k; - Double_t x0 = (p0->GetXIn() + p0->GetXOut()) / 2; - Double_t y0 = (p0->GetYIn() + p0->GetYOut()) / 2; - Double_t z0 = (p0->GetZIn() + p0->GetZOut()) / 2; - Double_t tx = (x0 - trackDesc.ptr->GetStartX()) / (z0 - trackDesc.ptr->GetStartZ()); - Double_t ty = (y0 - trackDesc.ptr->GetStartY()) / (z0 - trackDesc.ptr->GetStartZ()); - - for (set<const CbmStsPoint*>::const_iterator l = trackDesc.stsPoints[1].begin(); - l != trackDesc.stsPoints[1].end(); ++l) { - const CbmStsPoint* p1 = *l; - Double_t x1 = (p1->GetXIn() + p1->GetXOut()) / 2; - Double_t y1 = (p1->GetYIn() + p1->GetYOut()) / 2; - Double_t z1 = (p1->GetZIn() + p1->GetZOut()) / 2; - - extrStsXHisto->Fill(x1 - tx * z1); - extrStsYHisto->Fill(y1 - ty * z1); - } - } -#endif //CBM_BINNED_QA_FILL_HISTOS - - for (int k = 0; k < TrackDesc::nofMuchStations; ++k) { - if (trackDesc.much[k].first.empty()) { - isRef = false; - break; - } - } - - if (!isRef) continue; - - for (int k = 0; k < TrackDesc::nofTrdStations; ++k) { - if (trackDesc.trd[k].first.empty()) { - isRef = false; - break; - } - } - - if (!isRef) continue; - -#ifdef CBM_BINNED_QA_FILL_HISTOS - for (set<const CbmStsPoint*>::const_iterator k = trackDesc.stsPoints[0].begin(); - k != trackDesc.stsPoints[0].end(); ++k) { - const CbmStsPoint* p1 = *k; - Double_t x1 = (p1->GetXIn() + p1->GetXOut()) / 2; - Double_t y1 = (p1->GetYIn() + p1->GetYOut()) / 2; - Double_t z1 = (p1->GetZIn() + p1->GetZOut()) / 2; - - for (set<const CbmStsPoint*>::const_iterator l = trackDesc.stsPoints[1].begin(); - l != trackDesc.stsPoints[1].end(); ++l) { - const CbmStsPoint* p2 = *l; - Double_t x2 = (p2->GetXIn() + p2->GetXOut()) / 2; - Double_t y2 = (p2->GetYIn() + p2->GetYOut()) / 2; - Double_t z2 = (p2->GetZIn() + p2->GetZOut()) / 2; - Double_t tx = (x2 - x1) / (z2 - z1); - Double_t ty = (y2 - y1) / (z2 - z1); - - for (set<const CbmTrdPoint*>::const_iterator m = trackDesc.trdPoints[0].begin(); - m != trackDesc.trdPoints[0].end(); ++m) { - const CbmTrdPoint* p = *m; - Double_t x = (p->GetXIn() + p->GetXOut()) / 2; - Double_t y = (p->GetYIn() + p->GetYOut()) / 2; - Double_t z = (p->GetZIn() + p->GetZOut()) / 2; - Double_t deltaZ = z - z2; - extrTrdXHistos[0]->Fill(x - x2 - tx * deltaZ); - extrTrdYHistos[0]->Fill(y - y2 - ty * deltaZ); - } - } - } - - for (set<const CbmStsPoint*>::const_iterator k = trackDesc.stsPoints[1].begin(); - k != trackDesc.stsPoints[1].end(); ++k) { - const CbmStsPoint* p1 = *k; - Double_t x1 = (p1->GetXIn() + p1->GetXOut()) / 2; - Double_t y1 = (p1->GetYIn() + p1->GetYOut()) / 2; - Double_t z1 = (p1->GetZIn() + p1->GetZOut()) / 2; - - for (set<const CbmTrdPoint*>::const_iterator l = trackDesc.trdPoints[0].begin(); - l != trackDesc.trdPoints[0].end(); ++l) { - const CbmTrdPoint* p2 = *l; - Double_t x2 = (p2->GetXIn() + p2->GetXOut()) / 2; - Double_t y2 = (p2->GetYIn() + p2->GetYOut()) / 2; - Double_t z2 = (p2->GetZIn() + p2->GetZOut()) / 2; - Double_t tx = (x2 - x1) / (z2 - z1); - Double_t ty = (y2 - y1) / (z2 - z1); - - for (set<const CbmTrdPoint*>::const_iterator m = trackDesc.trdPoints[1].begin(); - m != trackDesc.trdPoints[1].end(); ++m) { - const CbmTrdPoint* p = *m; - Double_t x = (p->GetXIn() + p->GetXOut()) / 2; - Double_t y = (p->GetYIn() + p->GetYOut()) / 2; - Double_t z = (p->GetZIn() + p->GetZOut()) / 2; - Double_t deltaZ = z - z2; - extrTrdXHistos[1]->Fill(x - x2 - tx * deltaZ); - extrTrdYHistos[1]->Fill(y - y2 - ty * deltaZ); - } - } - } - - for (set<const CbmTrdPoint*>::const_iterator k = trackDesc.trdPoints[0].begin(); - k != trackDesc.trdPoints[0].end(); ++k) { - const CbmTrdPoint* p1 = *k; - Double_t x1 = (p1->GetXIn() + p1->GetXOut()) / 2; - Double_t y1 = (p1->GetYIn() + p1->GetYOut()) / 2; - Double_t z1 = (p1->GetZIn() + p1->GetZOut()) / 2; - - for (set<const CbmTrdPoint*>::const_iterator l = trackDesc.trdPoints[1].begin(); - l != trackDesc.trdPoints[1].end(); ++l) { - const CbmTrdPoint* p2 = *l; - Double_t x2 = (p2->GetXIn() + p2->GetXOut()) / 2; - Double_t y2 = (p2->GetYIn() + p2->GetYOut()) / 2; - Double_t z2 = (p2->GetZIn() + p2->GetZOut()) / 2; - Double_t tx = (x2 - x1) / (z2 - z1); - Double_t ty = (y2 - y1) / (z2 - z1); - - for (set<const CbmTrdPoint*>::const_iterator m = trackDesc.trdPoints[2].begin(); - m != trackDesc.trdPoints[2].end(); ++m) { - const CbmTrdPoint* p = *m; - Double_t x = (p->GetXIn() + p->GetXOut()) / 2; - Double_t y = (p->GetYIn() + p->GetYOut()) / 2; - Double_t z = (p->GetZIn() + p->GetZOut()) / 2; - Double_t deltaZ = z - z2; - extrTrdXHistos[2]->Fill(x - x2 - tx * deltaZ); - extrTrdYHistos[2]->Fill(y - y2 - ty * deltaZ); - } - } - } - - for (set<const CbmTrdPoint*>::const_iterator k = trackDesc.trdPoints[1].begin(); - k != trackDesc.trdPoints[1].end(); ++k) { - const CbmTrdPoint* p1 = *k; - Double_t x1 = (p1->GetXIn() + p1->GetXOut()) / 2; - Double_t y1 = (p1->GetYIn() + p1->GetYOut()) / 2; - Double_t z1 = (p1->GetZIn() + p1->GetZOut()) / 2; - - for (set<const CbmTrdPoint*>::const_iterator l = trackDesc.trdPoints[2].begin(); - l != trackDesc.trdPoints[2].end(); ++l) { - const CbmTrdPoint* p2 = *l; - Double_t x2 = (p2->GetXIn() + p2->GetXOut()) / 2; - Double_t y2 = (p2->GetYIn() + p2->GetYOut()) / 2; - Double_t z2 = (p2->GetZIn() + p2->GetZOut()) / 2; - Double_t tx = (x2 - x1) / (z2 - z1); - Double_t ty = (y2 - y1) / (z2 - z1); - - for (set<const CbmTrdPoint*>::const_iterator m = trackDesc.trdPoints[3].begin(); - m != trackDesc.trdPoints[3].end(); ++m) { - const CbmTrdPoint* p = *m; - Double_t x = (p->GetXIn() + p->GetXOut()) / 2; - Double_t y = (p->GetYIn() + p->GetYOut()) / 2; - Double_t z = (p->GetZIn() + p->GetZOut()) / 2; - Double_t deltaZ = z - z2; - extrTrdXHistos[3]->Fill(x - x2 - tx * deltaZ); - extrTrdYHistos[3]->Fill(y - y2 - ty * deltaZ); - } - } - } -#endif //CBM_BINNED_QA_FILL_HISTOS - - /*for (int k = 0; k < NOF_MUCH_STATIONS * NOF_MUCH_LAYERS; ++k) - { - if (trackDesc.much[k].first.empty()) - { - isRef = false; - break; - } - } - - if (!isRef) - continue;*/ - - if (TrackDesc::hasTof && trackDesc.tof.first.empty()) continue; - - trackDesc.isReference = true; - ++nofRefTracks; - - if (trackDesc.isPrimary) ++nofRefPrimTracks; - else - ++nofRefNonPrimTracks; - - map<Int_t, Int_t> matchedReco; - - for (int k = 0; k < TrackDesc::nofStsStations; ++k) { - for (set<Int_t>::const_iterator l = trackDesc.sts[k].second.begin(); l != trackDesc.sts[k].second.end(); ++l) { - map<Int_t, Int_t>::iterator mrIter = matchedReco.find(*l); - - if (mrIter != matchedReco.end()) ++mrIter->second; - else - matchedReco[*l] = 1; - } - } - - for (int k = 0; k < TrackDesc::nofMuchStations; ++k) { - for (set<Int_t>::const_iterator l = trackDesc.much[k].second.begin(); l != trackDesc.much[k].second.end(); - ++l) { - map<Int_t, Int_t>::iterator mrIter = matchedReco.find(*l); - - if (mrIter != matchedReco.end()) ++mrIter->second; - else - matchedReco[*l] = 1; - } - } - - for (int k = 0; k < TrackDesc::nofTrdStations; ++k) { - for (set<Int_t>::const_iterator l = trackDesc.trd[k].second.begin(); l != trackDesc.trd[k].second.end(); ++l) { - map<Int_t, Int_t>::iterator mrIter = matchedReco.find(*l); - - if (mrIter != matchedReco.end()) ++mrIter->second; - else - matchedReco[*l] = 1; - } - } - -#ifdef CBM_BINNED_QA_FILL_HISTOS - for (int k = 0; k < NOF_STS_STATIONS; ++k) { - if (trackDesc.nearestHitDistSts[k] >= 0) { - stsXPullHistos[k]->Fill(trackDesc.pullXsts[k]); - stsYPullHistos[k]->Fill(trackDesc.pullYsts[k]); - } - } - - for (int k = 0; k < NOF_TRD_LAYERS; ++k) { - if (trackDesc.nearestHitDistTrd[k] >= 0) { - trdNearestHitDistHistos[k]->Fill(trackDesc.nearestHitDistTrd[k]); - trdXPullHistos[k]->Fill(trackDesc.pullXtrd[k]); - trdYPullHistos[k]->Fill(trackDesc.pullYtrd[k]); - } - } -#endif //CBM_BINNED_QA_FILL_HISTOS - - /*for (int k = 0; k < NOF_MUCH_STATIONS * NOF_MUCH_LAYERS; ++k) - { - for (set<Int_t>::const_iterator l = trackDesc.much[k].second.begin(); l != trackDesc.much[k].second.end(); ++l) - { - map<Int_t, Int_t>::iterator mrIter = matchedReco.find(*l); - - if (mrIter != matchedReco.end()) - ++mrIter->second; - else - matchedReco[*l] = 1; - } - - if (!trackDesc.much[k].second.empty()) - ++nofMuch[k]; - }*/ - - /*for (set<Int_t>::const_iterator k = trackDesc.tof.second.begin(); k != trackDesc.tof.second.end(); ++k) - { - map<Int_t, Int_t>::iterator mrIter = matchedReco.find(*k); - - if (mrIter != matchedReco.end()) - ++mrIter->second; - else - matchedReco[*k] = 1; - } - - if (!trackDesc.tof.second.empty()) - ++nofTof;*/ - - TVector3 mom; - trackDesc.ptr->GetMomentum(mom); - Double_t momV = trackDesc.ptr->GetP(); - Double_t momX = mom.X(); - Double_t momY = mom.Y(); - Double_t momZ = mom.Z(); - Double_t polarAng = 180 * TMath::ACos(momZ / momV) / TMath::Pi(); - Double_t xAng = 180 * TMath::ASin(momX / momV) / TMath::Pi(); - Double_t yAng = 180 * TMath::ASin(momY / momV) / TMath::Pi(); - - if (matchedReco.empty()) { - if (trackDesc.isPrimary) { - effByMomPrimary->Fill(momV, 0.); - effByPolarAnglePrimary->Fill(polarAng, 0.); - effByXAnglePrimary->Fill(xAng, 0.); - effByYAnglePrimary->Fill(yAng, 0.); - } - else { - effByMomNonPrimary->Fill(momV, 0.); - effByPolarAngleNonPrimary->Fill(polarAng, 0.); - effByXAngleNonPrimary->Fill(xAng, 0.); - effByYAngleNonPrimary->Fill(yAng, 0.); - } - - effByMom->Fill(momV, 0.); - effByPolarAngle->Fill(polarAng, 0.); - effByXAngle->Fill(xAng, 0.); - effByYAngle->Fill(yAng, 0.); - continue; - } - - map<Int_t, Int_t>::const_iterator maxIter = - max_element(matchedReco.begin(), matchedReco.end(), - [](const pair<Int_t, Int_t>& p1, const pair<Int_t, Int_t>& p2) { return p1.second < p2.second; }); - - if (maxIter->second < int(0.7 * fSettings->GetNofStations())) { - if (trackDesc.isPrimary) { - effByMomPrimary->Fill(momV, 0.); - effByPolarAnglePrimary->Fill(polarAng, 0.); - effByXAnglePrimary->Fill(xAng, 0.); - effByYAnglePrimary->Fill(yAng, 0.); - } - else { - effByMomNonPrimary->Fill(momV, 0.); - effByPolarAngleNonPrimary->Fill(polarAng, 0.); - effByXAngleNonPrimary->Fill(xAng, 0.); - effByYAngleNonPrimary->Fill(yAng, 0.); - } - - effByMom->Fill(momV, 0.); - effByPolarAngle->Fill(polarAng, 0.); - effByXAngle->Fill(xAng, 0.); - effByYAngle->Fill(yAng, 0.); - continue; - } - - effByMom->Fill(momV, 100.); - effByPolarAngle->Fill(polarAng, 100.); - effByXAngle->Fill(xAng, 100.); - effByYAngle->Fill(yAng, 100.); - trackDesc.isReconstructed = true; - ++nofMatchedRefTracks; - - if (trackDesc.isPrimary) { - effByMomPrimary->Fill(momV, 100.); - effByPolarAnglePrimary->Fill(polarAng, 100.); - effByXAnglePrimary->Fill(xAng, 100.); - effByYAnglePrimary->Fill(yAng, 100.); - ++nofMatchedRefPrimTracks; - } - else { - effByMomNonPrimary->Fill(momV, 100.); - effByPolarAngleNonPrimary->Fill(polarAng, 100.); - effByXAngleNonPrimary->Fill(xAng, 100.); - effByYAngleNonPrimary->Fill(yAng, 100.); - ++nofMatchedRefNonPrimTracks; - } - } - } - - cout << "Total tracks: " << nofAllTracks << endl; - - double eff = 100 * nofMatchedRefTracks; - - if (0 == nofRefTracks) eff = 100; - else - eff /= nofRefTracks; - - cout << "The track reconstruction efficiency: " << eff << "%: " << nofMatchedRefTracks << "/" << nofRefTracks << endl; - NumberToFile("nofRefTracks", nofRefTracks); - NumberToFile("nofMatchedRefTracks", nofMatchedRefTracks); - - eff = 100 * nofMatchedRefPrimTracks; - - if (0 == nofRefPrimTracks) eff = 100; - else - eff /= nofRefPrimTracks; - - cout << "The track reconstruction efficiency for primary tracks: " << eff << "%: " << nofMatchedRefPrimTracks << "/" - << nofRefPrimTracks << endl; - NumberToFile("nofMatchedRefPrimTracks", nofMatchedRefPrimTracks); - - eff = 100 * nofMatchedRefNonPrimTracks; - - if (0 == nofRefNonPrimTracks) eff = 100; - else - eff /= nofRefNonPrimTracks; - - cout << "The track reconstruction efficiency for non primary tracks: " << eff << "%: " << nofMatchedRefNonPrimTracks - << "/" << nofRefNonPrimTracks << endl; - NumberToFile("nofMatchedRefNonPrimTracks", nofMatchedRefNonPrimTracks); - - eff = 100 * (gNofRecoTracks - gNofNonGhosts); - - if (0 == gNofRecoTracks) eff = 100; - else - eff /= gNofRecoTracks; - - cout << "The number of ghosts: " << eff << "%: " << gNofRecoTracks - gNofNonGhosts << "/" << gNofRecoTracks << endl; - NumberToFile("nofRecoTracks", gNofRecoTracks); - NumberToFile("nofGhosts", gNofRecoTracks - gNofNonGhosts); - - eff = 100 * gNofClones; - - if (0 == gNofRecoTracks) eff = 100; - else - eff /= gNofRecoTracks; - - cout << "The number of clones: " << eff << "%: " << gNofClones << "/" << gNofRecoTracks << endl; - NumberToFile("nofClones", gNofClones); - //cout << "Nof STS[0]: " << nofSts[0] << endl; - //cout << "Nof STS[1]: " << nofSts[1] << endl; - //cout << "Nof TRD[0]: " << nofTrd[0] << endl; - //cout << "Nof TRD[1]: " << nofTrd[1] << endl; - //cout << "Nof TRD[2]: " << nofTrd[2] << endl; - //cout << "Nof TRD[3]: " << nofTrd[3] << endl; - //cout << "Nof MUCH[0]: " << nofMuch[0] << endl; - //cout << "Nof MUCH[1]: " << nofMuch[1] << endl; - //cout << "Nof MUCH[2]: " << nofMuch[2] << endl; - //cout << "Nof TOF: " << nofTof << endl; - - //cout << "Nof stranger hits on TRD stations: "; - - //for (int i = 0; i < 4; ++i) - //cout << "[" << trdNofStrangerHits[i] << "]"; - - //cout << endl; - - int nofLambdas = lambdaList.size(); - int nofLambdasInAcc = 0; - int nofRecoLambdas = 0; - cout << "The number of Lambda baryons: " << nofLambdas << endl; - - for (list<TrackDesc*>::const_iterator i = lambdaList.begin(); i != lambdaList.end(); ++i) { - const TrackDesc* lambdaTrack = *i; - bool isInAcc = !lambdaTrack->children.empty(); - bool isReco = isInAcc; - - for (list<TrackDesc*>::const_iterator j = lambdaTrack->children.begin(); j != lambdaTrack->children.end(); ++j) { - const TrackDesc* childTrack = *j; - Double_t p = childTrack->ptr->GetP(); - lambdaChildrenMoms->Fill(p); - - if (!childTrack->isReference) isInAcc = false; - else { - if (childTrack->isReconstructed) lambdaChildrenEffByMom->Fill(p, 100.); - else - lambdaChildrenEffByMom->Fill(p, 0.); - } - - if (!childTrack->isReconstructed) isReco = false; - } - - if (isInAcc) { - ++nofLambdasInAcc; - - if (isReco) ++nofRecoLambdas; - } - } - - eff = 100 * nofLambdasInAcc; - - if (0 == nofLambdas) eff = 100; - else - eff /= nofLambdas; - - cout << "Lambda baryons in the acceptance: " << eff << "% " << nofLambdasInAcc << "/" << nofLambdas << endl; - - eff = 100 * nofRecoLambdas; - - if (0 == nofLambdas) eff = 100; - else - eff /= nofLambdas; - - cout << "Reconstructed of all the Lambda baryons: " << eff << "% " << nofRecoLambdas << "/" << nofLambdas << endl; - - eff = 100 * nofRecoLambdas; - - if (0 == nofLambdasInAcc) eff = 100; - else - eff /= nofLambdasInAcc; - - cout << "Reconstructed of the Lambda baryons in the acceptance: " << eff << "% " << nofRecoLambdas << "/" - << nofLambdasInAcc << endl; - - effOfMCPoints("STS", gStsPoints); - effOfMCPoints("MuCh", gMuchPoints); - effOfMCPoints("TRD", gTrdPoints); - effOfMCPoints("ToF", gTofPoints); - - SaveHisto(effByMom); - SaveHisto(effByMomPrimary); - SaveHisto(effByMomNonPrimary); - - SaveHisto(effByPolarAngle); - SaveHisto(effByPolarAnglePrimary); - SaveHisto(effByPolarAngleNonPrimary); - - SaveHisto(effByXAngle); - SaveHisto(effByXAnglePrimary); - SaveHisto(effByXAngleNonPrimary); - - SaveHisto(effByYAngle); - SaveHisto(effByYAnglePrimary); - SaveHisto(effByYAngleNonPrimary); - - SaveHisto(lambdaChildrenMoms); - SaveHisto(lambdaChildrenEffByMom); - SaveHisto(clonesNofSameHits); - - SaveHisto(muchHitResidualX); - SaveHisto(muchHitResidualY); - SaveHisto(muchHitResidualT); - SaveHisto(muchHitPullX); - SaveHisto(muchHitPullY); - SaveHisto(muchHitPullT); - - SaveHisto(stsTrackResidualFirstX); - SaveHisto(stsTrackResidualFirstY); - SaveHisto(stsTrackPullFirstX); - SaveHisto(stsTrackPullFirstY); - SaveHisto(stsTrackResidualLastX); - SaveHisto(stsTrackResidualLastY); - SaveHisto(stsTrackPullLastX); - SaveHisto(stsTrackPullLastY); - - SaveHisto(muchTrackResidualFirstX); - SaveHisto(muchTrackResidualFirstY); - SaveHisto(muchTrackPullFirstX); - SaveHisto(muchTrackPullFirstY); - SaveHisto(muchTrackResidualLastX); - SaveHisto(muchTrackResidualLastY); - SaveHisto(muchTrackPullLastX); - SaveHisto(muchTrackPullLastY); - - SaveHisto(trdTrackResidualFirstX); - SaveHisto(trdTrackResidualFirstY); - SaveHisto(trdTrackPullFirstX); - SaveHisto(trdTrackPullFirstY); - SaveHisto(trdTrackResidualLastX); - SaveHisto(trdTrackResidualLastY); - SaveHisto(trdTrackPullLastX); - SaveHisto(trdTrackPullLastY); - - SaveHisto(globalTrackResidualFirstX); - SaveHisto(globalTrackResidualFirstY); - SaveHisto(globalTrackPullFirstX); - SaveHisto(globalTrackPullFirstY); - SaveHisto(globalTrackResidualLastX); - SaveHisto(globalTrackResidualLastY); - SaveHisto(globalTrackPullLastX); - SaveHisto(globalTrackPullLastY); - -#ifdef CBM_BINNED_QA_FILL_HISTOS - SaveHisto(stsXResHisto); - SaveHisto(stsYResHisto); - SaveHisto(stsTResHisto); - SaveHisto(trdXResHisto); - SaveHisto(trdYResHisto); - SaveHisto(trdTResHisto); - SaveHisto(muchXResHisto); - SaveHisto(muchYResHisto); - SaveHisto(muchTResHisto); - SaveHisto(tofXResHisto); - SaveHisto(tofYResHisto); - SaveHisto(tofTResHisto); - - SaveHisto(extrStsXHisto); - SaveHisto(extrStsYHisto); - - SaveHisto(vtxXHisto); - SaveHisto(vtxYHisto); - SaveHisto(vtxZHisto); - - for (int i = 0; i < 2; ++i) { - SaveHisto(stsXPullHistos[i]); - SaveHisto(stsYPullHistos[i]); - } - - for (int i = 0; i < 4; ++i) { - SaveHisto(extrTrdXHistos[i]); - SaveHisto(extrTrdYHistos[i]); - - SaveHisto(trdNearestHitDistHistos[i]); - - SaveHisto(trdXPullHistos[i]); - SaveHisto(trdYPullHistos[i]); - } -#endif //CBM_BINNED_QA_FILL_HISTOS -} - -void CbmBinnedTrackerQa::SetParContainers() -{ - fSettings = static_cast<CbmBinnedSettings*>(FairRun::Instance()->GetRuntimeDb()->getContainer("CbmBinnedSettings")); -} - -ClassImp(CbmBinnedTrackerQa) diff --git a/reco/tracking/BinnedTracker/CbmBinnedTrackerQa.h b/reco/tracking/BinnedTracker/CbmBinnedTrackerQa.h deleted file mode 100644 index 3cdbd58119b3897d7c51f78b5aca7d0663051b3d..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/CbmBinnedTrackerQa.h +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright (C) 2017-2019 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#ifndef CBMBINNEDTRACKERQA_H -#define CBMBINNEDTRACKERQA_H - -#include "CbmMCDataArray.h" -#include "CbmMuchTrack.h" -#include "CbmStsTrack.h" -#include "CbmTofHit.h" -#include "CbmTrdHit.h" -#include "CbmTrdPoint.h" -#include "CbmTrdTrack.h" - -#include "FairTask.h" - -#include "TClonesArray.h" - -#include <functional> - -#include "Settings.h" - -class CbmBinnedTrackerQa : public FairTask { -public: - CbmBinnedTrackerQa(); - CbmBinnedTrackerQa(const CbmBinnedTrackerQa&) = delete; - CbmBinnedTrackerQa& operator=(const CbmBinnedTrackerQa&) = delete; - InitStatus Init(); // Overridden from FairTask - void Exec(Option_t* opt); // Overridden from FairTask - void Finish(); // Overridden from FairTask - void SetParContainers(); - - void SetPrimaryParticle(EPrimaryParticleId v) - { - fPrimaryParticleIds.clear(); - fPrimaryParticleIds.push_back(v); - } - - void AddPrimaryParticle(EPrimaryParticleId v) { fPrimaryParticleIds.push_back(v); } - -private: - void HandleSts(Int_t stsTrackIndex, std::map<Int_t, std::set<Int_t>>& mcTrackIds, std::set<Int_t>* globalTrackMCRefs, - Int_t* globalTracksHitInds); - void HandleMuch(Int_t muchTrackIndex, std::map<Int_t, std::set<Int_t>>& mcTrackIds, - std::set<Int_t>* globalTrackMCRefs, Int_t* globalTracksHitInds); - void HandleTrd(Int_t trdTrackIndex, std::map<Int_t, std::set<Int_t>>& mcTrackIds, std::set<Int_t>* globalTrackMCRefs, - Int_t* globalTracksHitInds); - void HandleTof(Int_t globalTrackIndex, Int_t tofHitIndex, std::map<Int_t, std::set<Int_t>>& mcTrackIds, - std::set<Int_t>* globalTrackMCRefs, Int_t* globalTracksHitInds); - void IterateTrdHits(std::function<void(const CbmTrdHit*, const CbmTrdPoint*)> handleData); - -private: - std::list<EPrimaryParticleId> fPrimaryParticleIds; - bool fIsOnlyPrimary; - CbmBinnedSettings* fSettings; - TClonesArray* fGlobalTracks; - TClonesArray* fStsTracks; - TClonesArray* fMuchTracks; - TClonesArray* fTrdTracks; - TClonesArray* fStsHits; - TClonesArray* fMuchHits; - TClonesArray* fTrdHits; - TClonesArray* fTofHits; - TClonesArray* fStsClusters; - TClonesArray* fMuchClusters; - TClonesArray* fTrdClusters; - - TClonesArray* fTrdDigiMatches; - TClonesArray* fTofHitDigiMatches; - TClonesArray* fTofDigiPointMatches; - - TClonesArray* fStsDigis; - TClonesArray* fStsDigiMatches; - TClonesArray* fMuchDigis; - TClonesArray* fMuchDigiMatches; - TClonesArray* fTrdDigis; - TClonesArray* fTofDigis; - - CbmMCDataArray* fMCTracks; - CbmMCDataArray* fStsPoints; - CbmMCDataArray* fMuchPoints; - CbmMCDataArray* fTrdPoints; - CbmMCDataArray* fTofPoints; - ClassDef(CbmBinnedTrackerQa, 1) -}; - -#endif /* CBMBINNEDTRACKERQA_H */ diff --git a/reco/tracking/BinnedTracker/CbmBinnedTrackerQaNew.cxx b/reco/tracking/BinnedTracker/CbmBinnedTrackerQaNew.cxx deleted file mode 100644 index 9723d680488a4fb58aefaf72af12c07390e9fc54..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/CbmBinnedTrackerQaNew.cxx +++ /dev/null @@ -1,502 +0,0 @@ -/* Copyright (C) 2018-2020 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer], Florian Uhlig */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#include "CbmBinnedTrackerQaNew.h" - -#include "CbmMCDataManager.h" -#include "CbmMCTrack.h" -#include "CbmMatch.h" -#include "CbmMuchCluster.h" -#include "CbmMuchDigi.h" -#include "CbmMuchGeoScheme.h" -#include "CbmMuchPixelHit.h" -#include "CbmMuchPoint.h" -#include "CbmStsCluster.h" -#include "CbmStsDigi.h" -#include "CbmStsHit.h" -#include "CbmStsPoint.h" -#include "CbmStsSetup.h" -#include "CbmTofPoint.h" -#include "CbmTrdCluster.h" -#include "global/CbmGlobalTrack.h" - -#include "FairRun.h" -#include "FairRuntimeDb.h" - -using namespace std; - -struct MCTrackDesc { - map<pair<ECbmModuleId, Int_t>, pair<UInt_t, set<Int_t>>> - mcPointMap; // = map<pair<ECbmModuleId, Int_t>, pair<UInt_t, set<Int_t> > > ();// Map an MC point index to TRD station number and a set of reconstructed global track indices. - Int_t pdg = -1; - Int_t parentInd = -1; -}; - -static vector<vector<MCTrackDesc>> gMCTracks; - -CbmBinnedTrackerQaNew::CbmBinnedTrackerQaNew() {} - -InitStatus CbmBinnedTrackerQaNew::Init() -{ - CbmStsSetup* stsSetup = CbmStsSetup::Instance(); - - if (!stsSetup->IsInit()) stsSetup->Init(); - - fSettings = CbmBinnedSettings::Instance(); - - fMinTrackLength += fSettings->Use(ECbmModuleId::kSts) ? fSettings->GetNofStsStations() : 0; - fMinTrackLength += fSettings->Use(ECbmModuleId::kMuch) ? fSettings->GetNofMuchStations() : 0; - fMinTrackLength += fSettings->Use(ECbmModuleId::kTrd) ? fSettings->GetNofTrdStations() : 0; - fMinTrackLength += fSettings->Use(ECbmModuleId::kTof) ? 1 : 0; - int canSkipHits = 0.3 * fMinTrackLength; - fMinTrackLength -= canSkipHits; - - FairRootManager* ioman = FairRootManager::Instance(); - - if (0 == ioman) LOG(fatal) << "No FairRootManager"; - - CbmMCDataManager* mcManager = static_cast<CbmMCDataManager*>(ioman->GetObject("MCDataManager")); - - if (0 == mcManager) LOG(fatal) << "No MC data manager"; - - fMCTracks = mcManager->InitBranch("MCTrack"); - - if (0 == fMCTracks) LOG(fatal) << "No MC tracks in the input file"; - - for (int i = 0; fMCTracks->Size(0, i) >= 0; ++i) { - gMCTracks.push_back(vector<MCTrackDesc>()); - - auto nofMcTracks = fMCTracks->Size(0, i); - auto& eventTracks = gMCTracks.back(); - eventTracks.resize(nofMcTracks); - - for (Int_t j = 0; j < nofMcTracks; ++j) { - MCTrackDesc& track = eventTracks[j]; - const CbmMCTrack* mcTrack = static_cast<const CbmMCTrack*>(fMCTracks->Get(0, i, j)); - track.pdg = mcTrack->GetPdgCode(); - track.parentInd = mcTrack->GetMotherId(); - } - } // for (Int_t i = 0; fMCTracks->Size(0, i) >= 0; ++i) - - fGlobalTracks = static_cast<TClonesArray*>(ioman->GetObject("GlobalTrack")); - - if (0 == fGlobalTracks) LOG(fatal) << "No global tracks in the input file"; - - if (fSettings->Use(ECbmModuleId::kSts)) { - fStsTracks = static_cast<TClonesArray*>(ioman->GetObject("StsTrack")); - - if (0 == fStsTracks) LOG(fatal) << "No sts tracks in the input file"; - - fStsHits = static_cast<TClonesArray*>(ioman->GetObject("StsHit")); - - if (0 == fStsHits) LOG(fatal) << "No sts hits in the input file"; - - fStsClusters = static_cast<TClonesArray*>(ioman->GetObject("StsCluster")); - - if (0 == fStsClusters) LOG(fatal) << "No sts clusters in the input file"; - - fStsDigis = static_cast<TClonesArray*>(ioman->GetObject("StsDigi")); - - if (0 == fStsDigis) LOG(fatal) << "No sts digis in the input file"; - - fStsDigiMatches = static_cast<TClonesArray*>(ioman->GetObject("StsDigiMatch")); - - if (0 == fStsDigiMatches) LOG(fatal) << "No sts digi matches in the input file"; - - fStsPoints = mcManager->InitBranch("StsPoint"); - - if (0 == fStsPoints) LOG(fatal) << "No sts MC points in the input file"; - - for (Int_t i = 0; fStsPoints->Size(0, i) >= 0; ++i) { - Int_t nofPoints = fStsPoints->Size(0, i); - vector<MCTrackDesc>& tracks = gMCTracks[i]; - - for (Int_t j = 0; j < nofPoints; ++j) { - const CbmStsPoint* stsPoint = static_cast<const CbmStsPoint*>(fStsPoints->Get(0, i, j)); - Int_t trackId = stsPoint->GetTrackID(); - Int_t stationNumber = CbmStsSetup::Instance()->GetStationNumber(stsPoint->GetDetectorID()); - auto& trackDesk = tracks[trackId]; - trackDesk.mcPointMap[make_pair(ECbmModuleId::kSts, j)] = {stationNumber, set<Int_t>()}; - } - } - } // if (fSettings->Use(kSts)) - - if (fSettings->Use(ECbmModuleId::kMuch)) { - fMuchTracks = static_cast<TClonesArray*>(ioman->GetObject("MuchTrack")); - - if (0 == fMuchTracks) LOG(fatal) << "No much tracks in the input file"; - - fMuchHits = static_cast<TClonesArray*>(ioman->GetObject("MuchPixelHit")); - - if (0 == fMuchHits) LOG(fatal) << "No much hits in the input file"; - - fMuchClusters = static_cast<TClonesArray*>(ioman->GetObject("MuchCluster")); - - if (0 == fMuchClusters) LOG(fatal) << "No much clusters in the input file"; - - fMuchDigis = static_cast<TClonesArray*>(ioman->GetObject("MuchDigi")); - - if (0 == fMuchDigis) LOG(fatal) << "No much digis in the input file"; - - fMuchDigiMatches = static_cast<TClonesArray*>(ioman->GetObject("MuchDigiMatch")); - - if (0 == fMuchDigiMatches) LOG(fatal) << "No much digi matches in the input file"; - - fMuchPoints = mcManager->InitBranch("MuchPoint"); - - if (0 == fMuchPoints) LOG(fatal) << "No much MC points in the input file"; - - for (Int_t i = 0; fMuchPoints->Size(0, i) >= 0; ++i) { - Int_t nofPoints = fMuchPoints->Size(0, i); - vector<MCTrackDesc>& tracks = gMCTracks[i]; - - for (Int_t j = 0; j < nofPoints; ++j) { - const CbmMuchPoint* muchPoint = static_cast<const CbmMuchPoint*>(fMuchPoints->Get(0, i, j)); - Int_t trackId = muchPoint->GetTrackID(); - int muchStationNumber = CbmMuchGeoScheme::GetStationIndex(muchPoint->GetDetectorID()); - int layerNumber = CbmMuchGeoScheme::GetLayerIndex(muchPoint->GetDetectorID()); - int stationNumber = muchStationNumber * 3 + layerNumber; - auto& trackDesk = tracks[trackId]; - trackDesk.mcPointMap[make_pair(ECbmModuleId::kMuch, j)] = {stationNumber, set<Int_t>()}; - } - } - } // if (fSettings->Use(kMuch)) - - if (fSettings->Use(ECbmModuleId::kTrd)) { - fTrdTracks = static_cast<TClonesArray*>(ioman->GetObject("TrdTrack")); - - if (0 == fTrdTracks) LOG(fatal) << "No trd tracks in the input file"; - - fTrdHits = static_cast<TClonesArray*>(ioman->GetObject("TrdHit")); - - if (0 == fTrdHits) LOG(fatal) << "No trd hits in the input file"; - - fTrdClusters = static_cast<TClonesArray*>(ioman->GetObject("TrdCluster")); - - if (0 == fTrdClusters) LOG(fatal) << "No global tracks in the input file"; - - fTrdDigiMatches = static_cast<TClonesArray*>(ioman->GetObject("TrdDigiMatch")); - - if (0 == fTrdDigiMatches) LOG(fatal) << "No trd hit to digi matches in the input file"; - - fTrdPoints = mcManager->InitBranch("TrdPoint"); - - if (0 == fTrdPoints) LOG(fatal) << "No trd MC points in the input file"; - - for (Int_t i = 0; fTrdPoints->Size(0, i) >= 0; ++i) { - Int_t nofPoints = fTrdPoints->Size(0, i); - vector<MCTrackDesc>& tracks = gMCTracks[i]; - - for (Int_t j = 0; j < nofPoints; ++j) { - const CbmTrdPoint* trdPoint = static_cast<const CbmTrdPoint*>(fTrdPoints->Get(0, i, j)); - Int_t trackId = trdPoint->GetTrackID(); - int stationNumber = CbmTrdAddress::GetLayerId(trdPoint->GetModuleAddress()); - auto& trackDesk = tracks[trackId]; - trackDesk.mcPointMap[make_pair(ECbmModuleId::kTrd, j)] = {stationNumber, set<Int_t>()}; - } - } - } // if (fSettings->Use(kTrd)) - - if (fSettings->Use(ECbmModuleId::kTof)) { - fTofHits = static_cast<TClonesArray*>(ioman->GetObject("TofHit")); - - if (0 == fTofHits) LOG(fatal) << "No tof hits in the input file"; - - fTofHitDigiMatches = static_cast<TClonesArray*>(ioman->GetObject("TofDigiMatch")); - - if (0 == fTofHitDigiMatches) LOG(fatal) << "No tof hit to digi matches in the input file"; - - fTofDigiPointMatches = static_cast<TClonesArray*>(ioman->GetObject("TofDigiMatchPoints")); - - if (0 == fTofDigiPointMatches) LOG(fatal) << "No tof digi to point matches in the input file"; - - fTofDigis = static_cast<TClonesArray*>(ioman->GetObject("TofDigi")); - - if (0 == fTofDigis) LOG(fatal) << "No tof digis in the input file"; - - fTofPoints = mcManager->InitBranch("TofPoint"); - - if (0 == fTofPoints) LOG(fatal) << "No tof MC points in the input file"; - - for (Int_t i = 0; fTofPoints->Size(0, i) >= 0; ++i) { - Int_t nofPoints = fTofPoints->Size(0, i); - vector<MCTrackDesc>& tracks = gMCTracks[i]; - - for (Int_t j = 0; j < nofPoints; ++j) { - const CbmTofPoint* tofPoint = static_cast<const CbmTofPoint*>(fTofPoints->Get(0, i, j)); - Int_t trackId = tofPoint->GetTrackID(); - auto& trackDesk = tracks[trackId]; - trackDesk.mcPointMap[make_pair(ECbmModuleId::kTof, j)] = {0, set<Int_t>()}; - } - } - } // if (fSettings->Use(kTof)) - - return kSUCCESS; -} - -static Int_t gEventNumber = 0; -static int gNofRecoTracks = 0; -static int gNofMatchedRecoTracks = 0; -static int gNofClones = 0; - -void CbmBinnedTrackerQaNew::Exec(Option_t*) -{ - auto& eventMCTracks = gMCTracks[gEventNumber]; - Int_t nofGlobalTracks = fGlobalTracks->GetEntriesFast(); - - for (Int_t i = 0; i < nofGlobalTracks; ++i) { - const CbmGlobalTrack* globalTrack = static_cast<const CbmGlobalTrack*>(fGlobalTracks->At(i)); - Int_t stsTrackIndex = globalTrack->GetStsTrackIndex(); - Int_t muchTrackIndex = globalTrack->GetMuchTrackIndex(); - Int_t trdTrackIndex = globalTrack->GetTrdTrackIndex(); - Int_t tofHitIndex = globalTrack->GetTofHitIndex(); - - map<void*, set<pair<ECbmModuleId, Int_t>>> mcTrackPtrs; - Int_t nofTrackHits = 0; - - if (fSettings->Use(ECbmModuleId::kSts) && stsTrackIndex >= 0) { - const CbmStsTrack* stsTrack = static_cast<const CbmStsTrack*>(fStsTracks->At(stsTrackIndex)); - Int_t nofStsHits = stsTrack->GetNofHits(); - nofTrackHits += nofStsHits; - - for (Int_t j = 0; j < nofStsHits; ++j) { - Int_t stsHitInd = stsTrack->GetStsHitIndex(j); - const CbmStsHit* stsHit = static_cast<const CbmStsHit*>(fStsHits->At(stsHitInd)); - //Int_t stationNumber = CbmStsSetup::Instance()->GetStationNumber(stsHit->GetAddress()); - Int_t frontClusterInd = stsHit->GetFrontClusterId(); - Int_t backClusterInd = stsHit->GetBackClusterId(); - const CbmStsCluster* frontCluster = static_cast<const CbmStsCluster*>(fStsClusters->At(frontClusterInd)); - Int_t nofFrontDigis = frontCluster->GetNofDigis(); - - for (Int_t k = 0; k < nofFrontDigis; ++k) { - Int_t stsDigiInd = frontCluster->GetDigi(k); - //const CbmStsDigi* stsDigi = static_cast<const CbmStsDigi*> (fStsDigis->At(stsDigiInd)); - const CbmMatch* stsDigiMatch = static_cast<const CbmMatch*>(fStsDigiMatches->At(stsDigiInd)); - Int_t nofLinks = stsDigiMatch->GetNofLinks(); - - for (Int_t m = 0; m < nofLinks; ++m) { - const CbmLink& link = stsDigiMatch->GetLink(m); - Int_t eventId = link.GetEntry(); - Int_t mcPointId = link.GetIndex(); - const CbmStsPoint* stsPoint = static_cast<const CbmStsPoint*>(fStsPoints->Get(0, eventId, mcPointId)); - Int_t trackId = stsPoint->GetTrackID(); - auto& mcTrack = eventMCTracks[trackId]; - auto recoIter = mcTrack.mcPointMap.find(make_pair(ECbmModuleId::kSts, mcPointId)); - - if (recoIter != mcTrack.mcPointMap.end()) recoIter->second.second.insert(i); - - mcTrackPtrs[&mcTrack].insert(make_pair(ECbmModuleId::kSts, j)); - } - } - - const CbmStsCluster* backCluster = static_cast<const CbmStsCluster*>(fStsClusters->At(backClusterInd)); - Int_t nofBackDigis = backCluster->GetNofDigis(); - - for (Int_t k = 0; k < nofBackDigis; ++k) { - Int_t stsDigiInd = backCluster->GetDigi(k); - //const CbmStsDigi* stsDigi = static_cast<const CbmStsDigi*> (fStsDigis->At(stsDigiInd)); - const CbmMatch* stsDigiMatch = static_cast<const CbmMatch*>(fStsDigiMatches->At(stsDigiInd)); - Int_t nofLinks = stsDigiMatch->GetNofLinks(); - - for (Int_t m = 0; m < nofLinks; ++m) { - const CbmLink& link = stsDigiMatch->GetLink(m); - Int_t eventId = link.GetEntry(); - Int_t mcPointId = link.GetIndex(); - const CbmStsPoint* stsPoint = static_cast<const CbmStsPoint*>(fStsPoints->Get(0, eventId, mcPointId)); - Int_t trackId = stsPoint->GetTrackID(); - auto& mcTrack = eventMCTracks[trackId]; - auto recoIter = mcTrack.mcPointMap.find(make_pair(ECbmModuleId::kSts, mcPointId)); - - if (recoIter != mcTrack.mcPointMap.end()) recoIter->second.second.insert(i); - - mcTrackPtrs[&mcTrack].insert(make_pair(ECbmModuleId::kSts, j)); - } - } - } // for (Int_t i = 0; i < nofStsHits; ++i) - } // if (fSettings->Use(kSts) && stsTrackIndex >= 0) - - if (fSettings->Use(ECbmModuleId::kMuch) && muchTrackIndex >= 0) { - const CbmMuchTrack* muchTrack = static_cast<const CbmMuchTrack*>(fMuchTracks->At(muchTrackIndex)); - Int_t nofMuchHits = muchTrack->GetNofHits(); - nofTrackHits += nofMuchHits; - - for (Int_t j = 0; j < nofMuchHits; ++j) { - Int_t muchHitInd = muchTrack->GetHitIndex(j); - const CbmMuchPixelHit* muchHit = static_cast<const CbmMuchPixelHit*>(fMuchHits->At(muchHitInd)); - //Int_t muchStationNumber = CbmMuchGeoScheme::GetStationIndex(muchHit->GetAddress()); - //Int_t layerNumber = CbmMuchGeoScheme::GetLayerIndex(muchHit->GetAddress()); - //Int_t stationNumber = muchStationNumber * 3 + layerNumber; - Int_t clusterId = muchHit->GetRefId(); - const CbmMuchCluster* cluster = static_cast<const CbmMuchCluster*>(fMuchClusters->At(clusterId)); - Int_t nofDigis = cluster->GetNofDigis(); - - for (Int_t k = 0; k < nofDigis; ++k) { - Int_t digiId = cluster->GetDigi(k); - //const CbmMuchDigi* digi = static_cast<const CbmMuchDigi*> (fMuchDigis->At(digiId)); - const CbmMatch* digiMatch = static_cast<const CbmMatch*>(fMuchDigiMatches->At(digiId)); - Int_t nofLinks = digiMatch->GetNofLinks(); - - for (Int_t m = 0; m < nofLinks; ++m) { - const CbmLink& link = digiMatch->GetLink(m); - Int_t eventId = link.GetEntry(); - Int_t mcPointId = link.GetIndex(); - const CbmMuchPoint* muchPoint = static_cast<const CbmMuchPoint*>(fMuchPoints->Get(0, eventId, mcPointId)); - Int_t trackId = muchPoint->GetTrackID(); - auto& mcTrack = eventMCTracks[trackId]; - auto recoIter = mcTrack.mcPointMap.find(make_pair(ECbmModuleId::kMuch, mcPointId)); - - if (recoIter != mcTrack.mcPointMap.end()) recoIter->second.second.insert(i); - - mcTrackPtrs[&mcTrack].insert(make_pair(ECbmModuleId::kMuch, j)); - } - } - } - } // if (fSettings->Use(ECbmModuleId::kMuch) && muchTrackIndex >= 0) - - if (fSettings->Use(ECbmModuleId::kTrd) && trdTrackIndex >= 0) { - const CbmTrdTrack* trdTrack = static_cast<const CbmTrdTrack*>(fTrdTracks->At(trdTrackIndex)); - Int_t nofTrdHits = trdTrack->GetNofHits(); - nofTrackHits += nofTrdHits; - - for (Int_t j = 0; j < nofTrdHits; ++j) { - Int_t trdHitInd = trdTrack->GetHitIndex(j); - const CbmTrdHit* trdHit = static_cast<const CbmTrdHit*>(fTrdHits->At(trdHitInd)); - Int_t clusterId = trdHit->GetRefId(); - const CbmTrdCluster* cluster = static_cast<const CbmTrdCluster*>(fTrdClusters->At(clusterId)); - Int_t nofDigis = cluster->GetNofDigis(); - - for (Int_t k = 0; k < nofDigis; ++k) { - Int_t digiId = cluster->GetDigi(k); - const CbmMatch* match = static_cast<const CbmMatch*>(fTrdDigiMatches->At(digiId)); - Int_t nofLinks = match->GetNofLinks(); - - for (Int_t m = 0; m < nofLinks; ++m) { - const CbmLink& link = match->GetLink(m); - Int_t eventId = link.GetEntry(); - Int_t mcPointId = link.GetIndex(); - const CbmTrdPoint* trdPoint = static_cast<const CbmTrdPoint*>(fTrdPoints->Get(0, eventId, mcPointId)); - Int_t trackId = trdPoint->GetTrackID(); - auto& mcTrack = eventMCTracks[trackId]; - auto recoIter = mcTrack.mcPointMap.find(make_pair(ECbmModuleId::kTrd, mcPointId)); - - if (recoIter != mcTrack.mcPointMap.end()) recoIter->second.second.insert(i); - - mcTrackPtrs[&mcTrack].insert(make_pair(ECbmModuleId::kTrd, j)); - } - } - } // for (Int_t j = 0; j < nofTrdHits; ++j) - } // if (fSettings->Use(kTrd) && trdTrackIndex >= 0) - - if (fSettings->Use(ECbmModuleId::kTof) && tofHitIndex >= 0) { - ++nofTrackHits; - const CbmMatch* tofHitMatch = static_cast<const CbmMatch*>(fTofHitDigiMatches->At(tofHitIndex)); - Int_t nofTofDigis = tofHitMatch->GetNofLinks(); - - for (Int_t j = 0; j < nofTofDigis; ++j) { - const CbmLink& digiLink = tofHitMatch->GetLink(j); - Int_t digiInd = digiLink.GetIndex(); - const CbmMatch* pointMatch = static_cast<const CbmMatch*>(fTofDigiPointMatches->At(digiInd)); - Int_t nofPoints = pointMatch->GetNofLinks(); - - for (Int_t k = 0; k < nofPoints; ++k) { - const CbmLink& pointLink = pointMatch->GetLink(k); - Int_t mcEventId = pointLink.GetEntry(); - Int_t mcPointId = pointLink.GetIndex(); - const CbmTofPoint* tofPoint = static_cast<const CbmTofPoint*>(fTofPoints->Get(0, mcEventId, mcPointId)); - Int_t trackId = tofPoint->GetTrackID(); - auto& mcTrack = eventMCTracks[trackId]; - auto recoIter = mcTrack.mcPointMap.find(make_pair(ECbmModuleId::kTof, mcPointId)); - - if (recoIter != mcTrack.mcPointMap.end()) recoIter->second.second.insert(i); - - mcTrackPtrs[&mcTrack].insert(make_pair(ECbmModuleId::kTof, 0)); - } - } - } // if (fSettings->Use(kTof) && tofHitIndex >= 0) - - ++gNofRecoTracks; - - for (const auto& j : mcTrackPtrs) { - if (j.second.size() >= size_t(0.7 * nofTrackHits)) { - ++gNofMatchedRecoTracks; - break; - } - } - } // for (Int_t i = 0; i < nofGlobalTracks; ++i) - - ++gEventNumber; -} //Exec() - -void CbmBinnedTrackerQaNew::Finish() -{ - int nofRefMCTRacks = 0; - int nofMatchedRefMCTracks = 0; - uint maxTrackLength = 0; - - for (const auto& i : gMCTracks) { - for (const auto& j : i) { - set<pair<ECbmModuleId, UInt_t>> stationNofs; - - for (const auto& k : j.mcPointMap) - stationNofs.insert(make_pair(k.first.first, k.second.first)); - - if (stationNofs.size() > static_cast<size_t>(maxTrackLength)) maxTrackLength = stationNofs.size(); - - if (stationNofs.size() < static_cast<size_t>(fMinTrackLength)) continue; - - map<Int_t, set<pair<ECbmModuleId, UInt_t>>> recoToStationMatches; - - for (const auto& k : j.mcPointMap) { - for (const auto& m : k.second.second) - recoToStationMatches[m].insert(make_pair(k.first.first, k.second.first)); - } - - int nofMatchedReco = 0; - - for (const auto& k : recoToStationMatches) { - if (k.second.size() >= size_t(stationNofs.size() * 0.7)) ++nofMatchedReco; - } - - if (nofMatchedReco > 1) gNofClones += nofMatchedReco - 1; - - //if (abs(j.pdg) != 11) - //continue; - - if (fPrimaryParticlePdg >= 0 && (j.parentInd < 0 || i[j.parentInd].pdg != fPrimaryParticlePdg)) continue; - - ++nofRefMCTRacks; - - if (nofMatchedReco > 0) ++nofMatchedRefMCTracks; - } - } - - cout << "Maximum MC track length: " << maxTrackLength << endl; - - double res = 100 * nofMatchedRefMCTracks; - res /= nofRefMCTRacks; - cout << "The reconstruction efficiency: " << res << " % = 100 * " << nofMatchedRefMCTracks << " / " << nofRefMCTRacks - << endl; - - res = 100 * (gNofRecoTracks - gNofMatchedRecoTracks); - res /= gNofRecoTracks; - cout << "The share of ghosts: " << res << " % = 100 * (" << gNofRecoTracks << " - " << gNofMatchedRecoTracks << ") / " - << gNofRecoTracks << endl; - - res = 100 * gNofClones; - res /= gNofRecoTracks; - cout << "The share of clones: " << res << " % = 100 * " << gNofClones << " / " << gNofRecoTracks << endl; -} - -void CbmBinnedTrackerQaNew::SetParContainers() -{ - fSettings = static_cast<CbmBinnedSettings*>(FairRun::Instance()->GetRuntimeDb()->getContainer("CbmBinnedSettings")); -} - -ClassImp(CbmBinnedTrackerQaNew) diff --git a/reco/tracking/BinnedTracker/CbmBinnedTrackerQaNew.h b/reco/tracking/BinnedTracker/CbmBinnedTrackerQaNew.h deleted file mode 100644 index 1ecc88d39a3ec3710f511c4ef0ffe81cfb2b8aa3..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/CbmBinnedTrackerQaNew.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright (C) 2018-2019 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#ifndef CBMBINNEDTRACKERQANEW_H -#define CBMBINNEDTRACKERQANEW_H - -#include "CbmMCDataArray.h" -#include "CbmMuchTrack.h" -#include "CbmStsTrack.h" -#include "CbmTofHit.h" -#include "CbmTrdHit.h" -#include "CbmTrdPoint.h" -#include "CbmTrdTrack.h" - -#include "FairTask.h" - -#include "TClonesArray.h" - -#include "Settings.h" - -class CbmBinnedTrackerQaNew : public FairTask { -public: - CbmBinnedTrackerQaNew(); - CbmBinnedTrackerQaNew(const CbmBinnedTrackerQaNew&) = delete; - CbmBinnedTrackerQaNew& operator=(const CbmBinnedTrackerQaNew&) = delete; - InitStatus Init(); // Overridden from FairTask - void Exec(Option_t*); // Overridden from FairTask - void Finish(); // Overridden from FairTask - void SetParContainers(); - - void SetPrimaryParticlePdg(Int_t v) { fPrimaryParticlePdg = v; } - -private: - Int_t fPrimaryParticlePdg = - -1; // Negative value means 'true' primary particles (not 'daugthers' of J/psi and other 'interesting' particles). - CbmBinnedSettings* fSettings = nullptr; - CbmMCDataArray* fMCTracks = nullptr; - CbmMCDataArray* fStsPoints = nullptr; - CbmMCDataArray* fMuchPoints = nullptr; - CbmMCDataArray* fTrdPoints = nullptr; - CbmMCDataArray* fTofPoints = nullptr; - - TClonesArray* fStsDigis = nullptr; - TClonesArray* fStsDigiMatches = nullptr; - TClonesArray* fMuchDigis = nullptr; - TClonesArray* fMuchDigiMatches = nullptr; - TClonesArray* fTrdDigis = nullptr; - TClonesArray* fTofDigis = nullptr; - - TClonesArray* fTrdDigiMatches = nullptr; - TClonesArray* fTofHitDigiMatches = nullptr; - TClonesArray* fTofDigiPointMatches = nullptr; - - TClonesArray* fStsClusters = nullptr; - TClonesArray* fMuchClusters = nullptr; - TClonesArray* fTrdClusters = nullptr; - - TClonesArray* fStsHits = nullptr; - TClonesArray* fMuchHits = nullptr; - TClonesArray* fTrdHits = nullptr; - TClonesArray* fTofHits = nullptr; - - TClonesArray* fStsTracks = nullptr; - TClonesArray* fMuchTracks = nullptr; - TClonesArray* fTrdTracks = nullptr; - - TClonesArray* fGlobalTracks = nullptr; - - uint fMinTrackLength = 0; - - ClassDef(CbmBinnedTrackerQaNew, 1) -}; - -#endif /* CBMBINNEDTRACKERQANEW_H */ diff --git a/reco/tracking/BinnedTracker/CbmBinnedTrackerTask.cxx b/reco/tracking/BinnedTracker/CbmBinnedTrackerTask.cxx deleted file mode 100644 index 4ca3d1c02f9cacac6e02d441574294e83a88df96..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/CbmBinnedTrackerTask.cxx +++ /dev/null @@ -1,417 +0,0 @@ -/* Copyright (C) 2017-2020 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#include "CbmBinnedTrackerTask.h" - -#include "CbmMuchTrack.h" -#include "CbmStsTrack.h" -#include "CbmTrdTrack.h" -#include "global/CbmGlobalTrack.h" - -#include "FairRunAna.h" -#include "FairRuntimeDb.h" -#include <Logger.h> - -#include "GeoReader.h" - -#ifdef __MACH__ -#include <mach/mach_time.h> -#include <sys/time.h> -#ifndef CLOCK_REALTIME -#define CLOCK_REALTIME 0 -#endif -#ifndef CLOCK_MONOTONIC -#define CLOCK_MONOTONIC 0 -#endif -inline int clock_gettime(int /*clk_id*/, struct timespec* t) -{ - mach_timebase_info_data_t timebase; - mach_timebase_info(&timebase); - uint64_t time; - time = mach_absolute_time(); - double nseconds = ((double) time * (double) timebase.numer) / ((double) timebase.denom); - double seconds = ((double) time * (double) timebase.numer) / ((double) timebase.denom * 1e9); - t->tv_sec = seconds; - t->tv_nsec = nseconds; - return 0; -} -#else -#include <time.h> -#endif - -using std::copy; -using std::fill_n; - -CbmBinnedTrackerTask* CbmBinnedTrackerTask::fInstance = 0; - -CbmBinnedTrackerTask::CbmBinnedTrackerTask(bool useAllDetectors, Double_t beamWidthX, Double_t beamWidthY) - : fUseAllDetectors(useAllDetectors) - , fIsOnlyPrimary(false) - , fChiSqCut(0) - , fCanSkipHits(-1 /*Negative value means: calculate the value*/) - , fSettings(0) - , fBeamDx(beamWidthX) - , fBeamDy(beamWidthY) - , fTracker(0) - , fGlobalTracks(0) - , fStsTracks(0) - , fMuchTracks(0) - , fTrdTracks(0) -{ - fInstance = this; - fill_n(fUseModules, int(ECbmModuleId::kLastModule), fUseAllDetectors); - fUseModules[ToIntegralType(ECbmModuleId::kRich)] = false; // Temporary hack -} - -CbmBinnedTrackerTask::~CbmBinnedTrackerTask() { delete fTracker; } - -InitStatus CbmBinnedTrackerTask::Init() -{ - fSettings = CbmBinnedSettings::Instance(); - fSettings->SetConfiguring(false); - fSettings->SetOnlyPrimary(fIsOnlyPrimary); - fSettings->SetUse(fUseModules); - fSettings->SetNofStsStations(0); - fSettings->SetNofMuchStations(0); - fSettings->SetNofTrdStations(0); - fSettings->SetNofStations(0); - CbmBinnedGeoReader* geoReader = CbmBinnedGeoReader::Instance(); - - if (0 == geoReader) LOG(fatal) << "Couldn't instantiate CbmBinnedGeoReader"; - - geoReader->Read(); - fTracker = CbmBinnedTracker::Instance(); - fTracker->Init(); - - if (fChiSqCut) fTracker->SetChiSqCut(fChiSqCut); - - if (fCanSkipHits >= 0) fTracker->SetCanSkipHits(fCanSkipHits); - - FairRootManager* ioman = FairRootManager::Instance(); - - if (0 == ioman) LOG(fatal) << "No FairRootManager"; - - fGlobalTracks = new TClonesArray("CbmGlobalTrack", 100); - ioman->Register("GlobalTrack", "Global", fGlobalTracks, IsOutputBranchPersistent("GlobalTrack")); - - LOG(info) << "Use STS detector: " << (fSettings->Use(ECbmModuleId::kSts) ? "true" : "false"); - ; - LOG(info) << "The number of STS stations: " << fSettings->GetNofStsStations(); - LOG(info) << "Use MuCh detector: " << (fSettings->Use(ECbmModuleId::kMuch) ? "true" : "false"); - LOG(info) << "The number of MuCh stations: " << fSettings->GetNofMuchStations(); - LOG(info) << "Use TRD detector: " << (fSettings->Use(ECbmModuleId::kTrd) ? "true" : "false"); - LOG(info) << "The number of TRD stations: " << fSettings->GetNofTrdStations(); - LOG(info) << "Use ToF detector: " << (fSettings->Use(ECbmModuleId::kTof) ? "true" : "false"); - - if (fSettings->Use(ECbmModuleId::kSts)) { - fStsTracks = new TClonesArray("CbmStsTrack", 100); - ioman->Register("StsTrack", "STS", fStsTracks, IsOutputBranchPersistent("StsTrack")); - } - - if (fSettings->Use(ECbmModuleId::kMuch)) { - fMuchTracks = new TClonesArray("CbmMuchTrack", 100); - ioman->Register("MuchTrack", "Much", fMuchTracks, IsOutputBranchPersistent("MuchTrack")); - } - - if (fSettings->Use(ECbmModuleId::kTrd)) { - fTrdTracks = new TClonesArray("CbmTrdTrack", 100); - ioman->Register("TrdTrack", "Trd", fTrdTracks, IsOutputBranchPersistent("TrdTrack")); - } - - fSettings->setChanged(); - fSettings->setInputVersion(-2, 1); - - return kSUCCESS; -} - -static long fullDuration = 0; - -void CbmBinnedTrackerTask::Exec(Option_t*) -{ - timespec ts; - clock_gettime(CLOCK_REALTIME, &ts); - long beginTime = ts.tv_sec * 1000000000 + ts.tv_nsec; - fTracker->Reconstruct(-100); - - if (fSettings->Use(ECbmModuleId::kSts)) fStsTracks->Clear(); - - if (fSettings->Use(ECbmModuleId::kMuch)) fMuchTracks->Clear(); - - if (fSettings->Use(ECbmModuleId::kTrd)) fTrdTracks->Clear(); - - fGlobalTracks->Clear(); - int globalTrackNumber = 0; - int stsTrackNumber = 0; - int muchTrackNumber = 0; - int trdTrackNumber = 0; - std::list<CbmBinnedTracker::Track*>::const_iterator tracksEnd = fTracker->GetTracksEnd(); - - for (std::list<CbmBinnedTracker::Track*>::const_iterator trackIter = fTracker->GetTracksBegin(); - trackIter != tracksEnd; ++trackIter) { - const CbmBinnedTracker::Track* recoTrack = *trackIter; - - if (recoTrack->fIsClone) continue; - - //int previousGlobalTrackId = -1; (VF) unused - //int previousStsTrackId = -1; (VF) unused - //int previousMuchTrackId = -1; (VF) unused - //int previousTrdTrackId = -1; (VF) unused - int stsStationNumber = 0; - int muchStationNumber = 0; - int trdStationNumber = 0; - int tofStationNumber = 0; - Double_t cov[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - //Double_t parCov[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - FairTrackParam trackParam; - CbmGlobalTrack* globalTrack = new ((*fGlobalTracks)[globalTrackNumber++]) CbmGlobalTrack(); - CbmStsTrack* stsTrack = 0; - CbmMuchTrack* muchTrack = 0; - CbmTrdTrack* trdTrack = 0; - - for (int hitNo = 0; hitNo < recoTrack->fLength; ++hitNo) { - CbmTBin::HitHolder* hitHolder = recoTrack->fHits[hitNo]; - - switch (hitHolder->type) { - case ECbmModuleId::kSts: - if (0 == stsTrack) { - stsTrack = new ((*fStsTracks)[stsTrackNumber]) CbmStsTrack(); - globalTrack->SetStsTrackIndex(stsTrackNumber++); - } - - ++stsStationNumber; - stsTrack->AddStsHit(hitHolder->index); - break; - - case ECbmModuleId::kMuch: - if (0 == muchTrack) { - muchTrack = new ((*fMuchTracks)[muchTrackNumber]) CbmMuchTrack(); - globalTrack->SetMuchTrackIndex(muchTrackNumber++); - } - - ++muchStationNumber; - muchTrack->AddHit(hitHolder->index, kMUCHPIXELHIT); - break; - - case ECbmModuleId::kTrd: - if (0 == trdTrack) { - trdTrack = new ((*fTrdTracks)[trdTrackNumber]) CbmTrdTrack(); - globalTrack->SetTrdTrackIndex(trdTrackNumber++); - } - - ++trdStationNumber; - trdTrack->AddHit(hitHolder->index, kTRDHIT); - break; - - case ECbmModuleId::kTof: - globalTrack->SetTofHitIndex(hitHolder->index); - ++tofStationNumber; - break; - default: - LOG(fatal) << "This hit type is not accepted. Only sts, much, trd " - "and tof hits are accepted."; - } - } - - int lastStationNumber = stsStationNumber + muchStationNumber + trdStationNumber + tofStationNumber - 1; - - trackParam.SetX(recoTrack->fParams[0].GetX()); - trackParam.SetY(recoTrack->fParams[0].GetY()); - trackParam.SetZ(recoTrack->fHits[0]->hit->GetZ()); - trackParam.SetTx(recoTrack->fParams[0].GetTx()); - trackParam.SetTy(recoTrack->fParams[0].GetTy()); - cov[0] = recoTrack->fParams[0].GetCovXX(); //parCov[0]; - cov[5] = recoTrack->fParams[0].GetCovYY(); //parCov[6]; - trackParam.SetCovMatrix(cov); - globalTrack->SetParamFirst(&trackParam); - - trackParam.SetX(recoTrack->fParams[lastStationNumber].GetX()); - trackParam.SetY(recoTrack->fParams[lastStationNumber].GetY()); - trackParam.SetZ(recoTrack->fHits[lastStationNumber]->hit->GetZ()); - trackParam.SetTx(recoTrack->fParams[lastStationNumber].GetTx()); - trackParam.SetTy(recoTrack->fParams[lastStationNumber].GetTy()); - cov[0] = recoTrack->fParams[lastStationNumber].GetCovXX(); //parCov[0]; - cov[5] = recoTrack->fParams[lastStationNumber].GetCovYY(); //parCov[6]; - trackParam.SetCovMatrix(cov); - globalTrack->SetParamLast(&trackParam); - - globalTrack->SetNDF((lastStationNumber + 1) * 2); - globalTrack->SetChi2(recoTrack->fChiSq); - - /*if (fSettings->Use(kSts)) - { - globalTrack->SetStsTrackIndex(trackNumber); - CbmStsTrack* stsTrack = new ((*fStsTracks)[trackNumber]) CbmStsTrack(); - stsTrack->SetNDF(fSettings->GetNofStsStations() * 2); - stsTrack->SetChiSq(1); - stsTrack->SetPreviousTrackId(previousTrackId); - previousTrackId = trackNumber; - nofStations += fSettings->GetNofStsStations(); - - trackParam.SetX(recoTrack->fParams[stationNumber].GetX()); - trackParam.SetY(recoTrack->fParams[stationNumber].GetY()); - trackParam.SetZ(recoTrack->fHits[stationNumber]->hit->GetZ()); - trackParam.SetTx(recoTrack->fParams[stationNumber].GetTx()); - trackParam.SetTy(recoTrack->fParams[stationNumber].GetTy()); - //recoTrack->fParams[stationNumber].CovMatrix(parCov); - cov[0] = recoTrack->fParams[stationNumber].GetCovXX();//parCov[0]; - cov[5] = recoTrack->fParams[stationNumber].GetCovYY();//parCov[6]; - trackParam.SetCovMatrix(cov); - stsTrack->SetParamFirst(&trackParam); - - trackParam.SetX(recoTrack->fParams[nofStations - 1].GetX()); - trackParam.SetY(recoTrack->fParams[nofStations - 1].GetY()); - trackParam.SetZ(recoTrack->fHits[nofStations - 1]->hit->GetZ()); - trackParam.SetTx(recoTrack->fParams[nofStations - 1].GetTx()); - trackParam.SetTy(recoTrack->fParams[nofStations - 1].GetTy()); - //recoTrack->fParams[stationNumber - 1].CovMatrix(parCov); - cov[0] = recoTrack->fParams[nofStations - 1].GetCovXX();//parCov[0]; - cov[5] = recoTrack->fParams[nofStations - 1].GetCovYY();//parCov[6]; - stsTrack->SetParamLast(&trackParam); - - for (; stationNumber < nofStations; ++stationNumber) - { - CbmTBin::HitHolder* hh = recoTrack->fHits[stationNumber]; - stsTrack->AddStsHit(hh->index); - } - } - - if (fSettings->Use(kMuch)) - { - globalTrack->SetMuchTrackIndex(trackNumber); - CbmMuchTrack* muchTrack = new ((*fMuchTracks)[trackNumber]) CbmMuchTrack(); - muchTrack->SetNDF(fSettings->GetNofMuchStations() * 2); - muchTrack->SetChiSq(1); - muchTrack->SetPreviousTrackId(previousTrackId); - previousTrackId = trackNumber; - nofStations += fSettings->GetNofMuchStations(); - - trackParam.SetX(recoTrack->fParams[stationNumber].GetX()); - trackParam.SetY(recoTrack->fParams[stationNumber].GetY()); - trackParam.SetZ(recoTrack->fHits[stationNumber]->hit->GetZ()); - trackParam.SetTx(recoTrack->fParams[stationNumber].GetTx()); - trackParam.SetTy(recoTrack->fParams[stationNumber].GetTy()); - //recoTrack->fParams[stationNumber].CovMatrix(parCov); - cov[0] = recoTrack->fParams[stationNumber].GetCovXX();//parCov[0]; - cov[5] = recoTrack->fParams[stationNumber].GetCovYY();//parCov[6]; - trackParam.SetCovMatrix(cov); - muchTrack->SetParamFirst(&trackParam); - - trackParam.SetX(recoTrack->fParams[nofStations - 1].GetX()); - trackParam.SetY(recoTrack->fParams[nofStations - 1].GetY()); - trackParam.SetZ(recoTrack->fHits[nofStations - 1]->hit->GetZ()); - trackParam.SetTx(recoTrack->fParams[nofStations - 1].GetTx()); - trackParam.SetTy(recoTrack->fParams[nofStations - 1].GetTy()); - //recoTrack->fParams[stationNumber - 1].CovMatrix(parCov); - cov[0] = recoTrack->fParams[nofStations - 1].GetCovXX();//parCov[0]; - cov[5] = recoTrack->fParams[nofStations - 1].GetCovYY();//parCov[6]; - trackParam.SetCovMatrix(cov); - muchTrack->SetParamLast(&trackParam); - - for (; stationNumber < nofStations; ++stationNumber) - { - CbmTBin::HitHolder* hh = recoTrack->fHits[stationNumber]; - muchTrack->AddHit(hh->index, kMUCHPIXELHIT); - } - } - - if (fSettings->Use(kTrd)) - { - globalTrack->SetTrdTrackIndex(trackNumber); - CbmTrdTrack* trdTrack = new ((*fTrdTracks)[trackNumber]) CbmTrdTrack(); - trdTrack->SetNDF(fSettings->GetNofTrdStations() * 2); - trdTrack->SetChiSq(1); - trdTrack->SetPreviousTrackId(previousTrackId); - previousTrackId = trackNumber; - nofStations += fSettings->GetNofTrdStations(); - - trackParam.SetX(recoTrack->fParams[stationNumber].GetX()); - trackParam.SetY(recoTrack->fParams[stationNumber].GetY()); - trackParam.SetZ(recoTrack->fHits[stationNumber]->hit->GetZ()); - trackParam.SetTx(recoTrack->fParams[stationNumber].GetTx()); - trackParam.SetTy(recoTrack->fParams[stationNumber].GetTy()); - //recoTrack->fParams[stationNumber].CovMatrix(parCov); - cov[0] = recoTrack->fParams[stationNumber].GetCovXX();//parCov[0]; - cov[5] = recoTrack->fParams[stationNumber].GetCovYY();//parCov[6]; - trackParam.SetCovMatrix(cov); - trdTrack->SetParamFirst(&trackParam); - - trackParam.SetX(recoTrack->fParams[nofStations - 1].GetX()); - trackParam.SetY(recoTrack->fParams[nofStations - 1].GetY()); - trackParam.SetZ(recoTrack->fHits[nofStations - 1]->hit->GetZ()); - trackParam.SetTx(recoTrack->fParams[nofStations - 1].GetTx()); - trackParam.SetTy(recoTrack->fParams[nofStations - 1].GetTy()); - //recoTrack->fParams[stationNumber - 1].CovMatrix(parCov); - cov[0] = recoTrack->fParams[nofStations - 1].GetCovXX();//parCov[0]; - cov[5] = recoTrack->fParams[nofStations - 1].GetCovYY();//parCov[6]; - trackParam.SetCovMatrix(cov); - trdTrack->SetParamLast(&trackParam); - - for (; stationNumber < nofStations; ++stationNumber) - { - CbmTBin::HitHolder* hh = recoTrack->fHits[stationNumber]; - trdTrack->AddHit(hh->index, kTRDHIT); - } - } - - if (fSettings->Use(kTof)) - globalTrack->SetTofHitIndex(recoTrack->fHits[nofStations++]->index); - - trackParam.SetX(recoTrack->fParams[0].GetX()); - trackParam.SetY(recoTrack->fParams[0].GetY()); - trackParam.SetZ(recoTrack->fHits[0]->hit->GetZ()); - trackParam.SetTx(recoTrack->fParams[0].GetTx()); - trackParam.SetTy(recoTrack->fParams[0].GetTy()); - //recoTrack->fParams[stationNumber].CovMatrix(parCov); - cov[0] = recoTrack->fParams[0].GetCovXX();//parCov[0]; - cov[5] = recoTrack->fParams[0].GetCovYY();//parCov[6]; - trackParam.SetCovMatrix(cov); - globalTrack->SetParamFirst(&trackParam); - - trackParam.SetX(recoTrack->fParams[nofStations - 1].GetX()); - trackParam.SetY(recoTrack->fParams[nofStations - 1].GetY()); - trackParam.SetZ(recoTrack->fHits[nofStations - 1]->hit->GetZ()); - trackParam.SetTx(recoTrack->fParams[nofStations - 1].GetTx()); - trackParam.SetTy(recoTrack->fParams[nofStations - 1].GetTy()); - //recoTrack->fParams[stationNumber - 1].CovMatrix(parCov); - cov[0] = recoTrack->fParams[nofStations - 1].GetCovXX();//parCov[0]; - cov[5] = recoTrack->fParams[nofStations - 1].GetCovYY();//parCov[6]; - trackParam.SetCovMatrix(cov); - globalTrack->SetParamLast(&trackParam); - - globalTrack->SetNDF(nofStations * 2); - globalTrack->SetChi2(recoTrack->fChiSq);*/ - } - - clock_gettime(CLOCK_REALTIME, &ts); - long endTime = ts.tv_sec * 1000000000 + ts.tv_nsec; - fullDuration += endTime - beginTime; -} - -void CbmBinnedTrackerTask::Finish() -{ - CbmBinnedHitReader::Instance()->Finish(); - double segTrue = 100 * fTracker->fNofTrueSegments; - segTrue /= fTracker->fNofTrueSegments + fTracker->fNofWrongSegments; - double segWrong = 100 * fTracker->fNofWrongSegments; - segWrong /= fTracker->fNofTrueSegments + fTracker->fNofWrongSegments; - cout << "True segments = " << segTrue << " [" << fTracker->fNofTrueSegments << "/" - << fTracker->fNofTrueSegments + fTracker->fNofWrongSegments << "]" << endl; - cout << "Wrong segments = " << segWrong << " [" << fTracker->fNofWrongSegments << "/" - << fTracker->fNofTrueSegments + fTracker->fNofWrongSegments << "]" << endl; - cout << "Full reconstruction duration: " << fullDuration << " nanoseconds" << endl; -} - -void CbmBinnedTrackerTask::SetParContainers() -{ - fSettings = - static_cast<CbmBinnedSettings*>(FairRunAna::Instance()->GetRuntimeDb()->getContainer("CbmBinnedSettings")); -} - -ClassImp(CbmBinnedTrackerTask) diff --git a/reco/tracking/BinnedTracker/CbmBinnedTrackerTask.h b/reco/tracking/BinnedTracker/CbmBinnedTrackerTask.h deleted file mode 100644 index f6a0dfe2dcc0fbad2eda5cc0352edee61531ccdd..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/CbmBinnedTrackerTask.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright (C) 2017-2020 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#ifndef CBMBINNEDTRACKERTASK_H -#define CBMBINNEDTRACKERTASK_H - -#include "CbmPixelHit.h" - -#include "FairTask.h" - -#include "Tracker.h" - -class CbmBinnedTrackerTask : public FairTask { -public: - static CbmBinnedTrackerTask* Instance() { return fInstance; } - -public: - CbmBinnedTrackerTask(bool useAllDetectors, Double_t beamWidthX, Double_t beamWidthY); - CbmBinnedTrackerTask(const CbmBinnedTrackerTask&) = delete; - CbmBinnedTrackerTask& operator=(const CbmBinnedTrackerTask&) = delete; - ~CbmBinnedTrackerTask(); - - InitStatus Init(); // Overridden from FairTask - void Exec(Option_t* opt); // Overridden from FairTask - void Finish(); // Overridden from FairTask - void SetParContainers(); - - bool IsOnlyPrimary() const { return fIsOnlyPrimary; } - void SetOnlyPrimary(bool v) { fIsOnlyPrimary = v; } - Double_t GetBeamDx() const { return fBeamDx; } - Double_t GetBeamDy() const { return fBeamDy; } - void SetUse(ECbmModuleId m, bool v) { fUseModules[ToIntegralType(m)] = v; } - void SetChiSqCut(Double_t v) { fChiSqCut = v; } - void SetCanSkipHits(Int_t v) { fCanSkipHits = v; } - -private: - static CbmBinnedTrackerTask* fInstance; - -private: - bool fUseAllDetectors; - bool fIsOnlyPrimary; - bool fUseModules[ToIntegralType(ECbmModuleId::kLastModule)]; - Double_t fChiSqCut; - Int_t fCanSkipHits; - CbmBinnedSettings* fSettings; - Double_t fBeamDx; - Double_t fBeamDy; - CbmBinnedTracker* fTracker; - TClonesArray* fGlobalTracks; - TClonesArray* fStsTracks; - TClonesArray* fMuchTracks; - TClonesArray* fTrdTracks; - ClassDef(CbmBinnedTrackerTask, 1) -}; - -#endif /* CBMBINNEDTRACKERTASK_H */ diff --git a/reco/tracking/BinnedTracker/CbmTrackParam2.cxx b/reco/tracking/BinnedTracker/CbmTrackParam2.cxx deleted file mode 100644 index 57225629535f37c774f16f0a5c8d747daeb3b3e2..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/CbmTrackParam2.cxx +++ /dev/null @@ -1,13 +0,0 @@ -/* Copyright (C) 2018 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#include "CbmTrackParam2.h" - -ClassImp(CbmTrackParam2) diff --git a/reco/tracking/BinnedTracker/CbmTrackParam2.h b/reco/tracking/BinnedTracker/CbmTrackParam2.h deleted file mode 100644 index 284a1143887120a8b060ecfb11c894aa7e238747..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/CbmTrackParam2.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Copyright (C) 2018 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#ifndef CBM_TRACK_PARAM2 -#define CBM_TRACK_PARAM2 - -#include "FairTrackParam.h" -//#include "TMatrixD.h" -#include <type_traits> - -#include <algorithm> -#include <iostream> -#include <iterator> - -/*static inline std::ostream& operator<< (std::ostream& os, const TMatrixD& matrix) -{ - for (int i = 0; i < matrix.GetNrows(); ++i) - { - for (int j = 0; j < matrix.GetNcols(); ++j) - os << matrix(i, j) << " "; - - os << std::endl; - } - - return os; -}*/ - -/*class CbmTrackParam2 -{ -public: - CbmTrackParam2() : fZ(0), fVector(5, 1), fCovMatrix(5, 5) {} - - Double_t GetX() const { return fVector(0, 0); } - void SetX(Double_t v) { fVector(0, 0) = v; } - Double_t GetY() const { return fVector(1, 0); } - void SetY(Double_t v) { fVector(1, 0) = v; } - Double_t GetZ() const { return fZ; } - void SetZ(Double_t v) { fZ = v; } - Double_t GetTx() const { return fVector(2, 0); } - void SetTx(Double_t v) { fVector(2, 0) = v; } - Double_t GetTy() const { return fVector(3, 0); } - void SetTy(Double_t v) { fVector(3, 0) = v; } - Double_t GetTime() const { return fVector(4, 0); } - void SetTime(Double_t time) { fVector(4, 0) = time; } - - TMatrixD& GetVector() { return fVector; } - const TMatrixD& GetVector() const { return fVector; } - - - //void CovMatrix(Double_t cov[]) const { std::copy(std::begin(fCovMatrix), std::end(fCovMatrix), cov); } - //void SetCovMatrix(Double_t cov[]) { std::copy(cov, cov + 21, std::begin(fCovMatrix)); } - //Double_t GetCovariance(Int_t i, Int_t j) const { return fCovMatrix[i * (13 - i) / 2 + j - i]; } - //void SetCovariance(Int_t i, Int_t j, Double_t val) { fCovMatrix[i * (13 - i) / 2 + j - i] = val; } - Double_t GetCov(int i, int j) const { return fCovMatrix(i, j); } - void SetCov(int i, int j, Double_t v) { fCovMatrix(i, j) = v; fCovMatrix(j, i) = v; } - - TMatrixD& GetCovMatrix() { return fCovMatrix; } - const TMatrixD& GetCovMatrix() const { return fCovMatrix; } - -private: - Double_t fZ; - TMatrixD fVector; - TMatrixD fCovMatrix; -};*/ - -class CbmTrackParam2 : public FairTrackParam { -public: - Double_t GetTime() const { return GetQp(); } - void SetTime(Double_t time) { SetQp(time); } - - Double_t GetCovXX() const { return GetCovariance(0, 0); } - void SetCovXX(Double_t v) { SetCovariance(0, 0, v); } - Double_t GetCovYY() const { return GetCovariance(1, 1); } - void SetCovYY(Double_t v) { SetCovariance(1, 1, v); } - Double_t GetCovXY() const { return GetCovariance(0, 1); } - void SetCovXY(Double_t v) { SetCovariance(0, 1, v); } - Double_t GetCovTxTx() const { return GetCovariance(2, 2); } - void SetCovTxTx(Double_t v) { SetCovariance(2, 2, v); } - Double_t GetCovTyTy() const { return GetCovariance(3, 3); } - void SetCovTyTy(Double_t v) { SetCovariance(3, 3, v); } - Double_t GetCovTT() const { return GetCovariance(4, 4); } - void SetCovTT(Double_t v) { SetCovariance(4, 4, v); } - -private: - Double_t GetCovariance(Int_t i, Int_t j) const { return FairTrackParam::GetCovariance(i, j); } - void SetCovariance(Int_t i, Int_t j, Double_t val) { FairTrackParam::SetCovariance(i, j, val); } - -private: - ClassDef(CbmTrackParam2, 1); -}; - -#endif //CBM_TRACK_PARAM2 diff --git a/reco/tracking/BinnedTracker/ContFactory.cxx b/reco/tracking/BinnedTracker/ContFactory.cxx deleted file mode 100644 index a7762271c94504b1d0595bdf1836c2daa2739ea5..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/ContFactory.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (C) 2017 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#include "ContFactory.h" - -#include "FairRuntimeDb.h" - -#include <iostream> - -#include "Settings.h" - -using std::cout; -using std::endl; - -ClassImp(CbmBinnedContFactory) - - static CbmBinnedContFactory gCbmBinnedContFactory; - -CbmBinnedContFactory::CbmBinnedContFactory() -{ - fName = "CbmBinnedContFactory"; - fTitle = "Factory for parameter containers in libBinnedTracker"; - setAllContainers(); - FairRuntimeDb::instance()->addContFactory(this); -} - -void CbmBinnedContFactory::setAllContainers() -{ - FairContainer* p1 = new FairContainer("CbmBinnedSettings", "Binned tracker reconstruction parameters", "Default"); - p1->addContext("Default"); - containers->Add(p1); -} - -FairParSet* CbmBinnedContFactory::createContainer(FairContainer* c) -{ - const char* name = c->GetName(); - cout << " -I container name " << name << endl; - FairParSet* p = 0; - - if (0 == strcmp(name, "CbmBinnedSettings")) p = CbmBinnedSettings::Instance(); - - return p; -} diff --git a/reco/tracking/BinnedTracker/ContFactory.h b/reco/tracking/BinnedTracker/ContFactory.h deleted file mode 100644 index be97bfb7d44fed84978ad426448fb82f42513e38..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/ContFactory.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 2017 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#ifndef CBM_BINNED_CONT_FACTORY_H -#define CBM_BINNED_CONT_FACTORY_H - -#include "FairContFact.h" - -class FairContainer; - -class CbmBinnedContFactory : public FairContFact { -public: - CbmBinnedContFactory(); - FairParSet* createContainer(FairContainer*); - -private: - void setAllContainers(); - ClassDef(CbmBinnedContFactory, 1) -}; - -#endif /* CBM_BINNED_CONT_FACTORY_H */ diff --git a/reco/tracking/BinnedTracker/Debug.h b/reco/tracking/BinnedTracker/Debug.h deleted file mode 100644 index 5c6f2e69b7279a46a212aa0b85c6ce45cf3759d5..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/Debug.h +++ /dev/null @@ -1,209 +0,0 @@ -/* Copyright (C) 2017 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#ifndef DEBUG_H -#define DEBUG_H - -#include "CbmMCDataArray.h" -#include "CbmMCDataManager.h" -#include "CbmMCTrack.h" -#include "CbmMatch.h" -#include "CbmStsDigi.h" -#include "CbmStsHit.h" -#include "CbmStsPoint.h" -#include "CbmTrdCluster.h" -#include "CbmTrdHit.h" -#include "CbmTrdPoint.h" -#include "setup/CbmStsSetup.h" - -#include "FairRootManager.h" - -struct CbmBinnedDebug { - Int_t fEventNumber; - FairRootManager* fIoman; - CbmMCDataArray* fMCTrackArray; - TClonesArray* fStsHitArray; - TClonesArray* fStsClusterArray; - TClonesArray* fStsDigiArray; - CbmMCDataArray* fStsPointArray; - TClonesArray* fTrdHitArray; - TClonesArray* fTrdClusterArray; - TClonesArray* fTrdDigiMatchArray; - CbmMCDataArray* fTrdPointArray; - - struct MCTrack { - bool isRef; - std::set<Int_t> stsHits[2]; - std::set<Int_t> trdHits[4]; - - MCTrack() : isRef(false) {} - }; - - std::vector<MCTrack> fMCTracks; - - CbmBinnedDebug() - : fEventNumber(0) - , fIoman(0) - , fMCTrackArray(0) - , fStsHitArray(0) - , fStsClusterArray(0) - , fStsDigiArray(0) - , fStsPointArray(0) - , fTrdHitArray(0) - , fTrdClusterArray(0) - , fTrdDigiMatchArray(0) - , fTrdPointArray(0) - , fMCTracks() - { - fIoman = FairRootManager::Instance(); - CbmMCDataManager* mcManager = static_cast<CbmMCDataManager*>(fIoman->GetObject("MCDataManager")); - fMCTrackArray = mcManager->InitBranch("MCTrack"); - fStsHitArray = static_cast<TClonesArray*>(fIoman->GetObject("StsHit")); - fStsClusterArray = static_cast<TClonesArray*>(fIoman->GetObject("StsCluster")); - fStsDigiArray = static_cast<TClonesArray*>(fIoman->GetObject("StsDigi")); - fStsPointArray = mcManager->InitBranch("StsPoint"); - fTrdHitArray = static_cast<TClonesArray*>(fIoman->GetObject("TrdHit")); - fTrdClusterArray = static_cast<TClonesArray*>(fIoman->GetObject("TrdCluster")); - fTrdDigiMatchArray = static_cast<TClonesArray*>(fIoman->GetObject("TrdDigiMatch")); - fTrdPointArray = mcManager->InitBranch("TrdPoint"); - } - - CbmBinnedDebug(const CbmBinnedDebug&) = delete; - CbmBinnedDebug& operator=(const CbmBinnedDebug&) = delete; - - void Exec() - { - fMCTracks.clear(); - Int_t nofMCTracks = fMCTrackArray->Size(0, fEventNumber); - fMCTracks.resize(nofMCTracks); - Int_t nofStsHits = fStsHitArray->GetEntriesFast(); - - for (Int_t i = 0; i < nofStsHits; ++i) { - const CbmStsHit* stsHit = static_cast<const CbmStsHit*>(fStsHitArray->At(i)); - Int_t stationNumber = CbmStsSetup::Instance()->GetStationNumber(stsHit->GetAddress()); - Int_t frontClusterInd = stsHit->GetFrontClusterId(); - Int_t backClusterInd = stsHit->GetBackClusterId(); - const CbmStsCluster* frontCluster = static_cast<const CbmStsCluster*>(fStsClusterArray->At(frontClusterInd)); - Int_t nofFrontDigis = frontCluster->GetNofDigis(); - - for (Int_t j = 0; j < nofFrontDigis; ++j) { - Int_t stsDigiInd = frontCluster->GetDigi(j); - const CbmStsDigi* stsDigi = static_cast<const CbmStsDigi*>(fStsDigiArray->At(stsDigiInd)); - const CbmMatch* match = stsDigi->GetMatch(); - Int_t nofLinks = match->GetNofLinks(); - - for (Int_t k = 0; k < nofLinks; ++k) { - const CbmLink& link = match->GetLink(k); - Int_t eventId = link.GetEntry(); - Int_t mcPointId = link.GetIndex(); - const CbmStsPoint* stsPoint = static_cast<const CbmStsPoint*>(fStsPointArray->Get(0, eventId, mcPointId)); - Int_t trackId = stsPoint->GetTrackID(); - MCTrack& mcTrack = fMCTracks[trackId]; - mcTrack.stsHits[stationNumber].insert(i); - } - } - - const CbmStsCluster* backCluster = static_cast<const CbmStsCluster*>(fStsClusterArray->At(backClusterInd)); - Int_t nofBackDigis = backCluster->GetNofDigis(); - - for (Int_t j = 0; j < nofBackDigis; ++j) { - Int_t stsDigiInd = backCluster->GetDigi(j); - const CbmStsDigi* stsDigi = static_cast<const CbmStsDigi*>(fStsDigiArray->At(stsDigiInd)); - const CbmMatch* match = stsDigi->GetMatch(); - Int_t nofLinks = match->GetNofLinks(); - - for (Int_t k = 0; k < nofLinks; ++k) { - const CbmLink& link = match->GetLink(k); - Int_t eventId = link.GetEntry(); - Int_t mcPointId = link.GetIndex(); - const CbmStsPoint* stsPoint = static_cast<const CbmStsPoint*>(fStsPointArray->Get(0, eventId, mcPointId)); - Int_t trackId = stsPoint->GetTrackID(); - MCTrack& mcTrack = fMCTracks[trackId]; - mcTrack.stsHits[stationNumber].insert(i); - } - } - } - - Int_t nofTrdHits = fTrdHitArray->GetEntriesFast(); - - for (Int_t i = 0; i < nofTrdHits; ++i) { - const CbmTrdHit* trdHit = static_cast<const CbmTrdHit*>(fTrdHitArray->At(i)); - Int_t stationNumber = trdHit->GetPlaneId(); - Int_t clusterId = trdHit->GetRefId(); - const CbmTrdCluster* cluster = static_cast<const CbmTrdCluster*>(fTrdClusterArray->At(clusterId)); - Int_t nofDigis = cluster->GetNofDigis(); - - for (Int_t j = 0; j < nofDigis; ++j) { - Int_t digiId = cluster->GetDigi(j); - const CbmMatch* match = static_cast<const CbmMatch*>(fTrdDigiMatchArray->At(digiId)); - Int_t nofLinks = match->GetNofLinks(); - - for (Int_t k = 0; k < nofLinks; ++k) { - const CbmLink& link = match->GetLink(k); - Int_t eventId = link.GetEntry(); - Int_t mcPointId = link.GetIndex(); - const CbmTrdPoint* trdPoint = static_cast<const CbmTrdPoint*>(fTrdPointArray->Get(0, eventId, mcPointId)); - Int_t trackId = trdPoint->GetTrackID(); - MCTrack& mcTrack = fMCTracks[trackId]; - mcTrack.trdHits[stationNumber].insert(i); - } - } - } - - for (int i = 0; i < nofMCTracks; ++i) { - MCTrack& mcTrack = fMCTracks[i]; - const CbmMCTrack* track = static_cast<const CbmMCTrack*>(fMCTrackArray->Get(0, fEventNumber, i)); - mcTrack.isRef = track->GetMotherId() < 0; - - if (!mcTrack.isRef) continue; - - for (int j = 0; j < 2; ++j) { - if (mcTrack.stsHits[j].empty()) { - mcTrack.isRef = false; - break; - } - } - - if (!mcTrack.isRef) continue; - - for (int j = 0; j < 4; ++j) { - if (mcTrack.trdHits[j].empty()) { - mcTrack.isRef = false; - break; - } - } - } - - ++fEventNumber; - } - - bool TrackHasHit(int stNo, Int_t trackInd, Int_t hitInd) - { - if (stNo < 0) return -1; - else if (stNo < 2) - return TrackHasHitSts(stNo, trackInd, hitInd); - else if (stNo < 6) - return TrackHasHitTrd(stNo - 2, trackInd, hitInd); - else - return -1; - } - - bool TrackHasHitSts(int stNo, Int_t trackInd, Int_t hitInd) - { - return fMCTracks[trackInd].stsHits[stNo].find(hitInd) != fMCTracks[trackInd].stsHits[stNo].end(); - } - - bool TrackHasHitTrd(int stNo, Int_t trackInd, Int_t hitInd) - { - return fMCTracks[trackInd].trdHits[stNo].find(hitInd) != fMCTracks[trackInd].trdHits[stNo].end(); - } -}; - -#endif /* DEBUG_H */ diff --git a/reco/tracking/BinnedTracker/GeoReader.cxx b/reco/tracking/BinnedTracker/GeoReader.cxx deleted file mode 100644 index 2c68caeeb7f572a642e414fe94c10e4b9ebfbcae..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/GeoReader.cxx +++ /dev/null @@ -1,391 +0,0 @@ -/* Copyright (C) 2017-2020 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#include "GeoReader.h" - -#include "TClonesArray.h" -#include "TGeoBBox.h" -#include "TMath.h" -#include "Tracker.h" - -#include "Station3D.h" -#include "Station4D.h" - -using namespace std; - -CbmBinnedGeoReader* CbmBinnedGeoReader::Instance() -{ - static CbmBinnedGeoReader* theInstance = 0; - - if (0 != theInstance) return theInstance; - - FairRootManager* ioman = FairRootManager::Instance(); - - if (0 == ioman) return 0; - - theInstance = new CbmBinnedGeoReader(ioman, CbmBinnedTracker::Instance()); - return theInstance; -} - -CbmBinnedGeoReader::CbmBinnedGeoReader(FairRootManager*, CbmBinnedTracker* tracker) - : fNavigator(0) - , fDetectorReaders() - , fTracker(tracker) - , fLastStationNumber(0) -{ - Int_t nofChildren = gGeoManager->GetTopNode()->GetNdaughters(); - - for (Int_t i = 0; i < nofChildren; ++i) { - TGeoNode* child = gGeoManager->GetTopNode()->GetDaughter(i); - TString childName(child->GetName()); - cout << "Have detecting system: " << childName.Data() << endl; - } - - fNavigator = gGeoManager->GetCurrentNavigator(); - CbmBinnedSettings* settings = CbmBinnedSettings::Instance(); - - if (settings->Use(ECbmModuleId::kSts)) { - fDetectorReaders["sts"] = &CbmBinnedGeoReader::ReadSts; - - if (settings->IsConfiguring()) CbmBinnedHitReader::AddReader("stsmc"); - else - CbmBinnedHitReader::AddReader("sts"); - } - - if (settings->Use(ECbmModuleId::kRich)) { - fDetectorReaders["rich"] = &CbmBinnedGeoReader::ReadRich; - - if (settings->IsConfiguring()) CbmBinnedHitReader::AddReader("richmc"); - else - CbmBinnedHitReader::AddReader("rich"); - } - - if (settings->Use(ECbmModuleId::kMuch)) { - fDetectorReaders["much"] = &CbmBinnedGeoReader::ReadMuch; - - if (settings->IsConfiguring()) CbmBinnedHitReader::AddReader("muchmc"); - else - CbmBinnedHitReader::AddReader("much"); - } - - if (settings->Use(ECbmModuleId::kTrd)) { - fDetectorReaders["trd"] = &CbmBinnedGeoReader::ReadTrd; - - if (settings->IsConfiguring()) CbmBinnedHitReader::AddReader("trdmc"); - else - CbmBinnedHitReader::AddReader("trd"); - } - - if (settings->Use(ECbmModuleId::kTof)) { - fDetectorReaders["tof"] = &CbmBinnedGeoReader::ReadTof; - - if (settings->IsConfiguring()) CbmBinnedHitReader::AddReader("tofmc"); - else - CbmBinnedHitReader::AddReader("tof"); - } -} - -void CbmBinnedGeoReader::FindGeoChild(TGeoNode* node, const char* name, list<TGeoNode*>& results) -{ - Int_t nofChildren = node->GetNdaughters(); - - for (Int_t i = 0; i < nofChildren; ++i) { - TGeoNode* child = node->GetDaughter(i); - TString childName(child->GetName()); - - if (childName.Contains(name, TString::kIgnoreCase)) results.push_back(child); - } -} - -Double_t cbmBinnedSOL = 0; - -void CbmBinnedGeoReader::Read() -{ - CbmBinnedSettings* settings = CbmBinnedSettings::Instance(); - CbmBinnedHitReader::SetSettings(settings); - - if (settings->Use(ECbmModuleId::kSts)) ReadDetector("sts"); - - if (settings->Use(ECbmModuleId::kRich)) ReadDetector("rich"); - - if (settings->Use(ECbmModuleId::kMuch)) ReadDetector("much"); - - if (settings->Use(ECbmModuleId::kTrd)) ReadDetector("trd"); - - if (settings->Use(ECbmModuleId::kTof)) ReadDetector("tof"); - - ReadTarget(); - cbmBinnedSOL = 1.e-7 * TMath::C(); // Speed of light in cm/ns -} - -void CbmBinnedGeoReader::ReadDetector(const char* name) { (this->*fDetectorReaders[name])(); } - -static const int gNofZbins = 5; -static const int gNofYbins = 20; -static const int gNofXbins = 20; -static const int gNofTbins = 1; - -void CbmBinnedGeoReader::SearchStation(ECbmModuleId stationType, TGeoNode* node, CbmBinnedHitReader* hitReader, - list<const char*>::const_iterator stationPath, - list<const char*>::const_iterator stationPathEnd, - const std::list<const char*>& geoPath, bool is4d) -{ - if (stationPath == stationPathEnd) { - //Double_t localCoords[3] = { 0, 0, 0 }; - //Double_t globalCoords[3]; - //gGeoManager->LocalToMaster(localCoords, globalCoords); - //Double_t z = globalCoords[2]; - //const char* name1 = node->GetName(); - //const char* name2 = gGeoManager->GetCurrentNode()->GetName(); - Double_t left = 10000; - Double_t right = -10000; - Double_t top = -10000; - Double_t bottom = 10000; - Double_t front = 10000; - Double_t back = -10000; - HandleStation(node, geoPath.begin(), geoPath.end(), left, right, top, bottom, front, back); - CbmBinnedStation* station = 0; - - if (is4d) { - CbmBinned4DStation* station4d = - new CbmBinned4DStation(stationType, front, back, gNofZbins, gNofYbins, gNofXbins, gNofTbins); - station = station4d; - } - else { - CbmBinned3DStation* station3d = new CbmBinned3DStation(stationType, front, back, gNofYbins, gNofXbins, gNofTbins); - station = station3d; - } - - station->SetMinY(bottom); - station->SetMaxY(top); - station->SetMinX(left); - station->SetMaxX(right); - CbmBinnedSettings* settings = CbmBinnedSettings::Instance(); - - if (!settings->IsConfiguring()) { - Double_t xScat = settings->GetXScat(fLastStationNumber); - station->SetScatX(xScat); - Double_t yScat = settings->GetYScat(fLastStationNumber); - station->SetScatY(yScat); - } - - /*if (!CbmBinnedSettings::Instance()->IsConfiguring()) - { - station->SetDx(CbmBinnedSettings::Instance()->GetXError(fLastStationNumber)); - station->SetDy(CbmBinnedSettings::Instance()->GetYError(fLastStationNumber)); - station->SetDt(CbmBinnedSettings::Instance()->GetTError(fLastStationNumber)); - }*/ - - //station->SetScatX(gStationScats[fLastStationNumber][0]); - //station->SetScatY(gStationScats[fLastStationNumber][1]); - - //station->SetNofSigmaX(gStationNofSigmas[stationNumber][0]); - //station->SetNofSigmaY(gStationNofSigmas[stationNumber][1]); - - station->Init(); - fTracker->AddStation(station); - hitReader->AddStation(station); - ++fLastStationNumber; - settings->SetNofStations(fLastStationNumber); - } - else { - const char* name = *stationPath++; - list<TGeoNode*> subNodes; - FindGeoChild(node, name, subNodes); - - for (list<TGeoNode*>::iterator i = subNodes.begin(); i != subNodes.end(); ++i) { - fNavigator->CdDown(*i); - SearchStation(stationType, *i, hitReader, stationPath, stationPathEnd, geoPath); - fNavigator->CdUp(); - } - } -} - -void CbmBinnedGeoReader::HandleStation(TGeoNode* node, list<const char*>::const_iterator geoPath, - list<const char*>::const_iterator geoPathEnd, Double_t& left, Double_t& right, - Double_t& top, Double_t& bottom, Double_t& front, Double_t& back) -{ - if (geoPath == geoPathEnd) HandleActive(node, left, right, top, bottom, front, back); - else { - const char* name = *geoPath++; - list<TGeoNode*> subNodes; - FindGeoChild(node, name, subNodes); - - for (list<TGeoNode*>::iterator i = subNodes.begin(); i != subNodes.end(); ++i) { - fNavigator->CdDown(*i); - HandleStation(*i, geoPath, geoPathEnd, left, right, top, bottom, front, back); - fNavigator->CdUp(); - } - } -} - -void CbmBinnedGeoReader::HandleActive(TGeoNode* node, Double_t& left, Double_t& right, Double_t& top, Double_t& bottom, - Double_t& front, Double_t& back) -{ - TGeoBBox* pBox = static_cast<TGeoBBox*>(node->GetVolume()->GetShape()); - pBox->ComputeBBox(); - - for (int i = -1; i <= 1; i += 2) { - for (int j = -1; j <= 1; j += 2) { - for (int k = -1; k <= 1; k += 2) { - Double_t localCoords[3] = {i * pBox->GetDX(), j * pBox->GetDY(), k * pBox->GetDZ()}; - Double_t globalCoords[3]; - gGeoManager->LocalToMaster(localCoords, globalCoords); - - if (left > globalCoords[0]) left = globalCoords[0]; - - if (right < globalCoords[0]) right = globalCoords[0]; - - if (bottom > globalCoords[1]) bottom = globalCoords[1]; - - if (top < globalCoords[1]) top = globalCoords[1]; - - if (front > globalCoords[2]) front = globalCoords[2]; - - if (back < globalCoords[2]) back = globalCoords[2]; - } - } - } -} - -void CbmBinnedGeoReader::ReadSts() -{ - list<const char*> stationPath = {"sts", "Station"}; - list<const char*> geoPath = {"Ladder", "HalfLadder", "Module", "Sensor"}; - gGeoManager->cd("/cave_1"); - int firstStationNumber = fLastStationNumber; - const char* readerName = CbmBinnedSettings::Instance()->IsConfiguring() ? "stsmc" : "sts"; - SearchStation(ECbmModuleId::kSts, gGeoManager->GetCurrentNode(), CbmBinnedHitReader::Instance(readerName), - stationPath.begin(), stationPath.end(), geoPath); - CbmBinnedSettings::Instance()->SetNofStsStations(fLastStationNumber - firstStationNumber); -} - -void CbmBinnedGeoReader::ReadRich() -{ - list<const char*> stationPath = {"rich"}; - list<const char*> geoPath = {"rich_smallprototype", "Box", "Gas", "PmtContainer", "Pmt", "pmt_pixel"}; - gGeoManager->cd("/cave_1"); - const char* readerName = CbmBinnedSettings::Instance()->IsConfiguring() ? "richmc" : "rich"; - SearchStation(ECbmModuleId::kRich, gGeoManager->GetCurrentNode(), CbmBinnedHitReader::Instance(readerName), - stationPath.begin(), stationPath.end(), geoPath); -} - -void CbmBinnedGeoReader::ReadMuch() -{ - list<const char*> stationPath = {"much", "station", "muchstation", "layer"}; - list<const char*> geoPath = {"active"}; - gGeoManager->cd("/cave_1"); - int firstStationNumber = fLastStationNumber; - const char* readerName = CbmBinnedSettings::Instance()->IsConfiguring() ? "muchmc" : "much"; - SearchStation(ECbmModuleId::kMuch, gGeoManager->GetCurrentNode(), CbmBinnedHitReader::Instance(readerName), - stationPath.begin(), stationPath.end(), geoPath); - CbmBinnedSettings::Instance()->SetNofMuchStations(fLastStationNumber - firstStationNumber); -} - -void CbmBinnedGeoReader::ReadTrd() -{ - list<const char*> stationPath = {"trd", "layer"}; - list<const char*> geoPath = {"module", "gas"}; - gGeoManager->cd("/cave_1"); - int firstStationNumber = fLastStationNumber; - const char* readerName = CbmBinnedSettings::Instance()->IsConfiguring() ? "trdmc" : "trd"; - SearchStation(ECbmModuleId::kTrd, gGeoManager->GetCurrentNode(), CbmBinnedHitReader::Instance(readerName), - stationPath.begin(), stationPath.end(), geoPath); - CbmBinnedSettings::Instance()->SetNofTrdStations(fLastStationNumber - firstStationNumber); -} - -void CbmBinnedGeoReader::ReadTof() -{ - list<const char*> stationPath = {"tof"}; - list<const char*> geoPath = {"module", "gas_box", "counter"}; - gGeoManager->cd("/cave_1"); - const char* readerName = CbmBinnedSettings::Instance()->IsConfiguring() ? "tofmc" : "tof"; - SearchStation(ECbmModuleId::kTof, gGeoManager->GetCurrentNode(), CbmBinnedHitReader::Instance(readerName), - stationPath.begin(), stationPath.end(), geoPath, true); -} - -void CbmBinnedGeoReader::ReadTarget() -{ - gGeoManager->cd("/cave_1"); - list<TGeoNode*> pipeNodes; - FindGeoChild(gGeoManager->GetCurrentNode(), "pipe", pipeNodes); - - for (list<TGeoNode*>::iterator i = pipeNodes.begin(); i != pipeNodes.end(); ++i) { - TGeoNode* pipeNode = *i; - fNavigator->CdDown(pipeNode); - list<TGeoNode*> pipeVacNodes; - FindGeoChild(pipeNode, "pipevac", pipeVacNodes); - - for (list<TGeoNode*>::iterator j = pipeVacNodes.begin(); j != pipeVacNodes.end(); ++j) { - TGeoNode* pipeVacNode = *j; - fNavigator->CdDown(pipeVacNode); - list<TGeoNode*> targetNodes; - FindGeoChild(pipeVacNode, "target", targetNodes); - - for (list<TGeoNode*>::iterator k = targetNodes.begin(); k != targetNodes.end(); ++k) { - TGeoNode* targetNode = *k; - fNavigator->CdDown(targetNode); - Double_t localCoords[3] = {0, 0, 0}; - Double_t globalCoords[3]; - gGeoManager->LocalToMaster(localCoords, globalCoords); - //Double_t targetX = globalCoords[0]; (VF) unused - //Double_t targetY = globalCoords[1]; (VF) unused - //Double_t targetZ = globalCoords[2]; (VF) unused - TGeoBBox* targetBox = static_cast<TGeoBBox*>(targetNode->GetVolume()->GetShape()); - targetBox->ComputeBBox(); - //Double_t targetDx = targetBox->GetDX(); (VF) unused - //Double_t targetDy = targetBox->GetDY(); (VF) unused - //Double_t targetDz = targetBox->GetDZ(); (VF) unused - fNavigator->CdUp(); - } - - fNavigator->CdUp(); - } - - fNavigator->CdUp(); - } - - list<const char*> stsTest = {"sts", "station", "ladder", "halfladder", "module", "sensor"}; - list<TGeoNode*> stsTestResults; - FindNode(stsTest, stsTestResults); - //int nofStsSensors = stsTestResults.size(); (VF) unused - - /* - for (list<TGeoNode*>::iterator i = stsTestResults.begin(); i != stsTestResults.end(); ++i) - { - //TGeoNode* node = *i; (VF) unused - //const char* name = node->GetName(); (VF) unused - //TGeoVolume* vol = node->GetVolume(); (VF) unused - } -*/ -} - -void CbmBinnedGeoReader::FindNode(list<const char*> nodePath, list<TGeoNode*>& results, TGeoNode* rootNode) -{ - if (0 == rootNode) { - rootNode = gGeoManager->GetTopNode(); - gGeoManager->CdTop(); - } - - results.push_back(rootNode); - - for (list<const char*>::const_iterator i = nodePath.begin(); i != nodePath.end(); ++i) { - const char* name = *i; - list<TGeoNode*> work; - - for (list<TGeoNode*>::iterator j = results.begin(); j != results.end(); ++j) { - TGeoNode* node = *j; - FindGeoChild(node, name, work); - } - - results.clear(); - results.splice(results.begin(), work); - } -} diff --git a/reco/tracking/BinnedTracker/GeoReader.h b/reco/tracking/BinnedTracker/GeoReader.h deleted file mode 100644 index 624f0db43bb342f2cf6cc080f8174eb82b2f5ef9..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/GeoReader.h +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright (C) 2017-2019 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#ifndef GEOREADER_H -#define GEOREADER_H - -#include "FairRootManager.h" - -#include "TGeoManager.h" -#include "Tracker.h" - -#include <list> -#include <map> -#include <string> - -#include "HitReader.h" - -class CbmBinnedTracker; - -class CbmBinnedGeoReader { -public: - static CbmBinnedGeoReader* Instance(); - -public: - CbmBinnedGeoReader(FairRootManager*, CbmBinnedTracker* tracker); - CbmBinnedGeoReader(const CbmBinnedGeoReader&) = delete; - CbmBinnedGeoReader& operator=(const CbmBinnedGeoReader&) = delete; - void FindGeoChild(TGeoNode* node, const char* name, std::list<TGeoNode*>& results); - void Read(); - -private: - void ReadDetector(const char* name); - void SearchStation(ECbmModuleId stationType, TGeoNode* node, CbmBinnedHitReader* hitReader, - std::list<const char*>::const_iterator stationPath, - std::list<const char*>::const_iterator stationPathEnd, const std::list<const char*>& geoPath, - bool is4d = false); - void HandleStation(TGeoNode* node, std::list<const char*>::const_iterator geoPath, - std::list<const char*>::const_iterator geoPathEnd, Double_t& left, Double_t& right, Double_t& top, - Double_t& bottom, Double_t& front, Double_t& back); - void HandleActive(TGeoNode* node, Double_t& left, Double_t& right, Double_t& top, Double_t& bottom, Double_t& front, - Double_t& back); - void ReadSts(); - void ReadRich(); - void ReadMuch(); - void ReadTrd(); - void ReadTof(); - void ReadTarget(); - void FindNode(std::list<const char*> nodePath, std::list<TGeoNode*>& results, TGeoNode* rootNode = 0); - -private: - //FairRootManager* fIoman; (VF) unused - TGeoNavigator* fNavigator; - std::map<std::string, void (CbmBinnedGeoReader::*)()> fDetectorReaders; - CbmBinnedTracker* fTracker; - int fLastStationNumber; -}; - -#endif /* GEOREADER_H */ diff --git a/reco/tracking/BinnedTracker/HitReader.cxx b/reco/tracking/BinnedTracker/HitReader.cxx deleted file mode 100644 index 029d3b654c5ad8c5a82201e5155ded3d3a2f90c7..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/HitReader.cxx +++ /dev/null @@ -1,833 +0,0 @@ -/* Copyright (C) 2017-2020 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#include "HitReader.h" - -#include "CbmMuchGeoScheme.h" -#include "CbmMuchPixelHit.h" -#include "CbmStsSetup.h" -#include "CbmTrdHit.h" - -#include "FairRootManager.h" - -#include "TClonesArray.h" - -#include "Station.h" - -using namespace std; - -//#define DO_ERROR_STAT - -#ifdef DO_ERROR_STAT -static map<string, map<int, Double_t>> maxDx; -static map<string, map<int, Double_t>> maxDy; -static map<string, map<int, Double_t>> maxDt; -static Double_t maxTofDtx = 0; -static Double_t maxTofDty = 0; - -static void UpdateMax(map<string, map<int, Double_t>>& errorMap, string stationName, int stationNumber, Double_t v) -{ - map<string, map<int, Double_t>>::iterator i = errorMap.find(stationName); - - if (i == errorMap.end()) { - errorMap[stationName][stationNumber] = v; - return; - } - - map<int, Double_t>::iterator j = i->second.find(stationNumber); - - if (j == i->second.end()) { - i->second[stationNumber] = v; - return; - } - - if (j->second < v) j->second = v; -} - -static void UpdateMax(string stationName, int stationNumber, const CbmPixelHit* hit) -{ - UpdateMax(maxDx, stationName, stationNumber, hit->GetDx()); - UpdateMax(maxDy, stationName, stationNumber, hit->GetDy()); - UpdateMax(maxDt, stationName, stationNumber, hit->GetTimeError()); - - if (stationName == "Tof") { - Double_t dtx = hit->GetDx() / hit->GetZ(); - - if (maxTofDtx < dtx) maxTofDtx = dtx; - - Double_t dty = hit->GetDy() / hit->GetZ(); - - if (maxTofDty < dty) maxTofDty = dty; - } -} - -#include <iostream> - -static void DumpMax(map<string, map<int, Double_t>>& errorMap, const char* errorName) -{ - cout << errorName << ":" << endl; - - for (map<string, map<int, Double_t>>::const_iterator i = errorMap.begin(); i != errorMap.end(); ++i) { - for (map<int, Double_t>::const_iterator j = i->second.begin(); j != i->second.end(); ++j) - cout << i->first << "[" << j->first << "] = " << j->second << endl; - } - - cout << endl; -} - -static void DumpMax() -{ - DumpMax(maxDx, "Dx"); - DumpMax(maxDy, "Dy"); - DumpMax(maxDt, "Dt"); - cout << "ToF dtx: " << maxTofDtx << endl; - cout << "ToF dty: " << maxTofDty << endl; -} - -#endif //DO_ERROR_STAT - -CbmBinnedSettings* CbmBinnedHitReader::fSettings = 0; - -CbmBinnedHitReader::CbmBinnedHitReader() : fStations(), fHitArray(0) {} - -CbmBinnedHitReader::~CbmBinnedHitReader() {} - -class CbmBinnedStsHitReader : public CbmBinnedHitReader { -public: - CbmBinnedStsHitReader() : CbmBinnedHitReader() - { - FairRootManager* ioman = FairRootManager::Instance(); - fHitArray = static_cast<TClonesArray*>(ioman->GetObject("StsHit")); - } - - void Read() - { - Int_t nofHits = fHitArray->GetEntriesFast(); - - for (Int_t i = 0; i < nofHits; ++i) { - const CbmPixelHit* hit = static_cast<const CbmPixelHit*>(fHitArray->At(i)); - int stationNumber = CbmStsSetup::Instance()->GetStationNumber(hit->GetAddress()); - fStations[stationNumber]->AddHit(ECbmModuleId::kSts, hit, i); -#ifdef DO_ERROR_STAT - UpdateMax("Sts", stationNumber, hit); -#endif //DO_ERROR_STAT - } - } -}; - -#include "CbmMCTrack.h" - -class CbmBinnedMCPointReader; - -class CbmBinnedMCTrackReader : public CbmBinnedHitReader { -private: - struct Point { - Double_t x; - Double_t y; - Double_t z; - }; - - struct Track { - Int_t pdg; - Int_t motherInd; - Double_t x; - Double_t y; - Double_t z; - map<Double_t, list<Point>> points; - - Track() : pdg(-1), motherInd(-1), x(0), y(0), z(0), points() {} - - void Init(Int_t pdgCode, Int_t mi, Double_t vx, Double_t vy, Double_t vz, const set<Double_t>& stationZs) - { - pdg = pdgCode; - motherInd = mi; - x = vx; - y = vy; - z = vz; - - for (set<Double_t>::const_iterator i = stationZs.begin(); i != stationZs.end(); ++i) - points[*i] = list<Point>(); - } - }; - -public: - static CbmBinnedMCTrackReader* Instance() - { - static CbmBinnedMCTrackReader* instance = 0; - - if (0 == instance) { - AddReader("mctrack"); - instance = static_cast<CbmBinnedMCTrackReader*>(CbmBinnedHitReader::Instance("mctrack")); - } - - return instance; - } - -public: - CbmBinnedMCTrackReader() : CbmBinnedHitReader(), fStationZs(), fTracks(), fXScats(), fYScats() - { - FairRootManager* ioman = FairRootManager::Instance(); - fHitArray = static_cast<TClonesArray*>(ioman->GetObject("MCTrack")); - } - - void AddStation(CbmBinnedStation* station) - { - fStationZs.insert(station->GetMinZ()); - fXScats.push_back(list<Double_t>()); - fYScats.push_back(list<Double_t>()); - } - - void Read() - { - fTracks.clear(); - Int_t nofTracks = fHitArray->GetEntriesFast(); - fTracks.resize(nofTracks); - - for (Int_t i = 0; i < nofTracks; ++i) { - const CbmMCTrack* mcTrack = static_cast<const CbmMCTrack*>(fHitArray->At(i)); - Int_t motherInd = mcTrack->GetMotherId(); - Double_t x = mcTrack->GetStartX(); - Double_t y = mcTrack->GetStartY(); - Double_t z = mcTrack->GetStartZ(); - fTracks[i].Init(mcTrack->GetPdgCode(), motherInd, x, y, z, fStationZs); - } - } - - void Handle() - { - const list<EPrimaryParticleId> ppids = CbmBinnedSettings::Instance()->GetPrimaryParticles(); - - for (vector<Track>::const_iterator i = fTracks.begin(); i != fTracks.end(); ++i) { - const Track& track = *i; - - bool isPrimary = false; - - for (EPrimaryParticleId ppi : ppids) { - switch (ppi) { - case ppiJpsi: { - if (track.motherInd >= 0) isPrimary = 443 == fTracks[track.motherInd].pdg; - - break; - } - - default: isPrimary = track.motherInd < 0; - } - - if (isPrimary) break; - } - - if (!isPrimary) continue; - - bool isRef = true; - - for (map<Double_t, list<Point>>::const_iterator j = track.points.begin(); j != track.points.end(); ++j) { - if (j->second.empty()) { - isRef = false; - break; - } - } - - if (!isRef) continue; - - Point vertexPoint = {track.x, track.y, track.z}; - list<Point> vertexList; - vertexList.push_back(vertexPoint); - map<Double_t, list<Point>>::const_iterator jPrev = track.points.end(); - vector<list<Double_t>>::iterator xScIter = fXScats.begin(); - ++xScIter; - vector<list<Double_t>>::iterator yScIter = fYScats.begin(); - ++yScIter; - - for (map<Double_t, list<Point>>::const_iterator j = track.points.begin(); j != track.points.end(); ++j) { - map<Double_t, list<Point>>::const_iterator jNext = j; - ++jNext; - - if (jNext == track.points.end()) break; - - const list<Point>& points0 = (j == track.points.begin()) ? vertexList : jPrev->second; - const list<Point>& points1 = j->second; - const list<Point>& points2 = jNext->second; - list<Double_t>& xScats = *xScIter; - list<Double_t>& yScats = *yScIter; - - for (list<Point>::const_iterator k = points0.begin(); k != points0.end(); ++k) { - const Point& p0 = *k; - - for (list<Point>::const_iterator l = points1.begin(); l != points1.end(); ++l) { - const Point& p1 = *l; - Double_t deltaZ01 = p1.z - p0.z; - Double_t tx = (p1.x - p0.x) / deltaZ01; - Double_t ty = (p1.y - p0.y) / deltaZ01; - - for (list<Point>::const_iterator m = points2.begin(); m != points2.end(); ++m) { - const Point& p2 = *m; - Double_t deltaZ12 = p2.z - p1.z; - Double_t x = p1.x + tx * deltaZ12; - Double_t y = p1.y + ty * deltaZ12; - xScats.push_back(p2.x - x); - yScats.push_back(p2.y - y); - } - } - } - - jPrev = j; - ++xScIter; - ++yScIter; - } - } - } - - Double_t Sigma(const list<Double_t>& values) - { - if (values.empty()) return 0; - - Double_t mean = 0; - - for (list<Double_t>::const_iterator i = values.begin(); i != values.end(); ++i) { - Double_t v = *i; - mean += v; - } - - mean /= values.size(); - Double_t var = 0; - - for (list<Double_t>::const_iterator i = values.begin(); i != values.end(); ++i) { - Double_t v = *i; - Double_t delta = v - mean; - var += delta * delta; - } - - var /= values.size(); - - return TMath::Sqrt(var); - } - - void Finish() - { - vector<list<Double_t>>::const_iterator i2 = fYScats.begin(); - - for (vector<list<Double_t>>::const_iterator i = fXScats.begin(); i != fXScats.end(); ++i) { - const list<Double_t>& xScats = *i; - const list<Double_t>& yScats = *i2; - Double_t xSigma = Sigma(xScats); - Double_t ySigma = Sigma(yScats); - fSettings->AddStationScats(xSigma, ySigma); - ++i2; - } - - fSettings->setChanged(); - fSettings->setInputVersion(-2, 1); - } - - void AddPoint(Int_t trackInd, Double_t stationZ, Double_t x, Double_t y, Double_t z) - { - Track& track = fTracks[trackInd]; - Point point = {x, y, z}; - track.points[stationZ].push_back(point); - } - -private: - set<Double_t> fStationZs; - vector<Track> fTracks; - vector<list<Double_t>> fXScats; - vector<list<Double_t>> fYScats; -}; - -class CbmBinnedMCPointReader : public CbmBinnedHitReader { -protected: - CbmBinnedMCPointReader() : CbmBinnedHitReader(), fTrackReader(CbmBinnedMCTrackReader::Instance()), fStationZs() {} - CbmBinnedMCPointReader(const CbmBinnedMCPointReader&) = delete; - CbmBinnedMCPointReader& operator=(const CbmBinnedMCPointReader&) = delete; - -public: - void AddStation(CbmBinnedStation* station) - { - fTrackReader->AddStation(station); - fStationZs.push_back(station->GetMinZ()); - } - -protected: - CbmBinnedMCTrackReader* fTrackReader; - vector<Double_t> fStationZs; -}; - -#include "CbmStsPoint.h" - -class CbmBinnedStsMCReader : public CbmBinnedMCPointReader { -public: - CbmBinnedStsMCReader() : CbmBinnedMCPointReader() - { - FairRootManager* ioman = FairRootManager::Instance(); - fHitArray = static_cast<TClonesArray*>(ioman->GetObject("StsPoint")); - } - - void Read() - { - Int_t nofPoints = fHitArray->GetEntriesFast(); - - for (Int_t i = 0; i < nofPoints; ++i) { - const CbmStsPoint* point = static_cast<const CbmStsPoint*>(fHitArray->At(i)); - Int_t trackInd = point->GetTrackID(); - - if (trackInd < 0) continue; - - Int_t stationNumber = CbmStsSetup::Instance()->GetStationNumber(point->GetDetectorID()); - Double_t stationZ = fStationZs[stationNumber]; - fTrackReader->AddPoint(trackInd, stationZ, (point->GetXIn() + point->GetXOut()) / 2, - (point->GetYIn() + point->GetYOut()) / 2, (point->GetZIn() + point->GetZOut()) / 2); - } - } -}; - -#include "CbmLink.h" -#include "CbmMatch.h" -#include "rich/CbmRichDigi.h" -#include "rich/CbmRichPoint.h" - -class CbmBinnedRichHitReader : public CbmBinnedHitReader { -public: - CbmBinnedRichHitReader() : CbmBinnedHitReader() - { - FairRootManager* ioman = FairRootManager::Instance(); - fHitArray = static_cast<TClonesArray*>(ioman->GetObject("RichHit")); - } - - CbmBinnedRichHitReader(const CbmBinnedRichHitReader&) = delete; - CbmBinnedRichHitReader& operator=(const CbmBinnedRichHitReader&) = delete; - - void Read() - { - Int_t nofHits = fHitArray->GetEntriesFast(); - - for (Int_t i = 0; i < nofHits; ++i) { - /*const */ CbmPixelHit* hit = static_cast</*const */ CbmPixelHit*>(fHitArray->At(i)); - - /*int digiIndex = hit->GetRefId(); - const CbmRichDigi* digi = static_cast<const CbmRichDigi*>(fDigiArray->At(digiIndex)); - CbmMatch* digiMatch = digi->GetMatch(); - - vector<CbmLink> links = digiMatch->GetLinks(); - Double_t t = 0; - int cnt = 0; - - for (int j = 0; j < links.size(); ++j) - { - const CbmRichPoint* point = static_cast<const CbmRichPoint*> (fPointArray->Get(links[j])); - t += point->GetTime(); - ++cnt; - } - - if (0 < cnt) - t /= cnt;*/ - - hit->SetTime(0); - hit->SetTimeError(4); - hit->SetDx(0.175); - hit->SetDy(0.175); - fStations[0]->AddHit(ECbmModuleId::kRich, hit, i); -#ifdef DO_ERROR_STAT - UpdateMax("Rich", 0, hit); -#endif //DO_ERROR_STAT - } - } - -private: - //TClonesArray* fDigiArray; - //CbmMCDataArray* fPointArray; -}; - -class CbmBinnedRichMCReader : public CbmBinnedMCPointReader { -public: - CbmBinnedRichMCReader() : CbmBinnedMCPointReader() - { - FairRootManager* ioman = FairRootManager::Instance(); - fHitArray = static_cast<TClonesArray*>(ioman->GetObject("RichPoint")); - } - - void Read() - { - Int_t nofPoints = fHitArray->GetEntriesFast(); - - for (Int_t i = 0; i < nofPoints; ++i) { - const CbmRichPoint* point = static_cast<const CbmRichPoint*>(fHitArray->At(i)); - Int_t trackInd = point->GetTrackID(); - - if (trackInd < 0) continue; - - Double_t stationZ = fStationZs[0]; - fTrackReader->AddPoint(trackInd, stationZ, point->GetX(), point->GetY(), point->GetZ()); - } - } -}; - -#include "CbmMuchCluster.h" -#include "CbmMuchDigi.h" -#include "CbmMuchPoint.h" -#include "CbmTrdPoint.h" - -#include "TH1.h" - -class CbmBinnedMuchHitReader : public CbmBinnedHitReader { -private: - /*TClonesArray* fMuchClusters; - TClonesArray* fMuchDigis; - TClonesArray* fMuchPoints; - TH1F* fHitResidualXHisto; - TH1F* fHitResidualYHisto; - TH1F* fHitResidualTHisto; - TH1F* fHitPullTHisto;*/ - -public: - CbmBinnedMuchHitReader() : CbmBinnedHitReader() - /*, fMuchClusters(nullptr) - , fMuchDigis(nullptr) - , fMuchPoints(nullptr) - , fHitResidualXHisto(nullptr) - , fHitResidualYHisto(nullptr) - , fHitResidualTHisto(nullptr) - , fHitPullTHisto(nullptr)*/ - { - FairRootManager* ioman = FairRootManager::Instance(); - fHitArray = static_cast<TClonesArray*>(ioman->GetObject("MuchPixelHit")); - - /*fMuchClusters = static_cast<TClonesArray*> (ioman->GetObject("MuchCluster")); - fMuchDigis = static_cast<TClonesArray*> (ioman->GetObject("MuchDigi")); - fMuchPoints = static_cast<TClonesArray*> (ioman->GetObject("MuchPoint")); - fHitResidualXHisto = new TH1F("muchHitResidualXHisto", "muchHitResidualXHisto", 200, -10., 10.); - fHitResidualYHisto = new TH1F("muchHitResidualYHisto", "muchHitResidualYHisto", 200, -10., 10.); - fHitResidualTHisto = new TH1F("muchHitResidualTHisto", "muchHitResidualTHisto", 1000, -20., 80.); - fHitPullTHisto = new TH1F("muchHitPullTHisto", "muchHitPullTHisto", 200, -10., 10.);*/ - } - - /*void SaveHisto(TH1* histo) - { - TFile* curFile = TFile::CurrentFile(); - TString histoName = histo->GetName(); - histoName += ".root"; - TFile fh(histoName.Data(), "RECREATE"); - histo->Write(); - fh.Close(); - delete histo; - TFile::CurrentFile() = curFile; - } - - void Finish() - { - SaveHisto(fHitResidualXHisto); - SaveHisto(fHitResidualYHisto); - SaveHisto(fHitResidualTHisto); - SaveHisto(fHitPullTHisto); - }*/ - - CbmBinnedMuchHitReader(const CbmBinnedMuchHitReader&) = delete; - CbmBinnedMuchHitReader& operator=(const CbmBinnedMuchHitReader&) = delete; - - void Read() - { - Int_t nofHits = fHitArray->GetEntriesFast(); - - for (Int_t i = 0; i < nofHits; ++i) { - /*const */ CbmMuchPixelHit* hit = static_cast</*const */ CbmMuchPixelHit*>(fHitArray->At(i)); - int muchStationNumber = CbmMuchGeoScheme::GetStationIndex(hit->GetAddress()); - int layerNumber = CbmMuchGeoScheme::GetLayerIndex(hit->GetAddress()); - int stationNumber = muchStationNumber * 3 + layerNumber; - - /*Double_t t = 0; - int cnt = 0; - Int_t clusterId = hit->GetRefId(); - const CbmMuchCluster* cluster = static_cast<const CbmMuchCluster*> (fMuchClusters->At(clusterId)); - Int_t nofDigis = cluster->GetNofDigis(); - - for (Int_t j = 0; j < nofDigis; ++j) - { - Int_t digiId = cluster->GetDigi(j); - const CbmMuchDigi* digi = static_cast<const CbmMuchDigi*> (fMuchDigis->At(digiId)); - const CbmMatch* match = digi->GetMatch(); - Int_t nofLinks = match->GetNofLinks(); - - for (Int_t k = 0; k < nofLinks; ++k) - { - const CbmLink& link = match->GetLink(k); - const CbmMuchPoint* muchPoint = static_cast<const CbmMuchPoint*> (fMuchPoints->At(link.GetIndex())); - fHitResidualXHisto->Fill(hit->GetX() - (muchPoint->GetXIn() + muchPoint->GetXOut()) / 2); - fHitResidualYHisto->Fill(hit->GetY() - (muchPoint->GetYIn() + muchPoint->GetYOut()) / 2); - fHitResidualTHisto->Fill(hit->GetTime() - muchPoint->GetTime()); - fHitPullTHisto->Fill((hit->GetTime() - muchPoint->GetTime() - 17.23) / hit->GetTimeError()); - t += muchPoint->GetTime(); - ++cnt; - } - } - - if (0 < cnt) - t /= cnt;*/ - - //hit->SetTime(0); - - hit->SetTime(hit->GetTime() - 17.23); - //hit->SetTimeError(10); - fStations[stationNumber]->AddHit(ECbmModuleId::kMuch, hit, i); -#ifdef DO_ERROR_STAT - UpdateMax("Much", stationNumber, hit); -#endif //DO_ERROR_STAT - } - } -}; - -class CbmBinnedMuchMCReader : public CbmBinnedMCPointReader { -public: - CbmBinnedMuchMCReader() : CbmBinnedMCPointReader() - { - FairRootManager* ioman = FairRootManager::Instance(); - fHitArray = static_cast<TClonesArray*>(ioman->GetObject("MuchPoint")); - } - - void Read() - { - Int_t nofPoints = fHitArray->GetEntriesFast(); - - for (Int_t i = 0; i < nofPoints; ++i) { - const CbmMuchPoint* point = static_cast<const CbmMuchPoint*>(fHitArray->At(i)); - Int_t trackInd = point->GetTrackID(); - - if (trackInd < 0) continue; - - Int_t muchStationNumber = CbmMuchGeoScheme::GetStationIndex(point->GetDetectorID()); - Int_t layerNumber = CbmMuchGeoScheme::GetLayerIndex(point->GetDetectorID()); - Int_t stationNumber = muchStationNumber * 3 + layerNumber; - Double_t stationZ = fStationZs[stationNumber]; - fTrackReader->AddPoint(trackInd, stationZ, (point->GetXIn() + point->GetXOut()) / 2, - (point->GetYIn() + point->GetYOut()) / 2, (point->GetZIn() + point->GetZOut()) / 2); - } - } -}; - -class CbmBinnedTrdHitReader : public CbmBinnedHitReader { -public: - CbmBinnedTrdHitReader() : CbmBinnedHitReader() - { - FairRootManager* ioman = FairRootManager::Instance(); - fHitArray = static_cast<TClonesArray*>(ioman->GetObject("TrdHit")); - } - - CbmBinnedTrdHitReader(const CbmBinnedTrdHitReader&) = delete; - CbmBinnedTrdHitReader& operator=(const CbmBinnedTrdHitReader&) = delete; - - void Read() - { - Int_t nofHits = fHitArray->GetEntriesFast(); - - for (Int_t i = 0; i < nofHits; ++i) { - /*const */ CbmTrdHit* hit = static_cast</*const */ CbmTrdHit*>(fHitArray->At(i)); - int stationNumber = hit->GetPlaneId(); - /*Int_t clusterId = hit->GetRefId(); - const CbmCluster* cluster = static_cast<const CbmCluster*> (fClusterArray->At(clusterId)); - Int_t nDigis = cluster->GetNofDigis(); - Double_t t = 0; - Double_t x = 0; - Double_t y = 0; - int cnt = 0; - int nofNegs = 0; - - for (Int_t j = 0; j < nDigis; ++j) - { - const CbmMatch* digiMatch = static_cast<const CbmMatch*> (fDigiMatchArray->At(cluster->GetDigi(j))); - Int_t nMCs = digiMatch->GetNofLinks(); - - for (Int_t k = 0; k < nMCs; ++k) - { - const CbmLink& lnk = digiMatch->GetLink(k); - const CbmTrdPoint* point = static_cast<const CbmTrdPoint*> (fPointArray->Get(lnk)); - t += point->GetTime(); - x += (point->GetXIn() + point->GetXOut()) / 2; - y += (point->GetYIn() + point->GetYOut()) / 2; - ++cnt; - } - } - - if (0 < cnt) - { - t /= cnt; - x /= cnt; - //hit->SetX(x); - y /= cnt; - //hit->SetY(y); - } - else - x = 1;*/ - - //hit->SetTime(t); - hit->SetTime(0); - hit->SetTimeError(10000); - //hit->SetDx(hit->GetDx() * 4); - //hit->SetDy(hit->GetDy() * 4); - fStations[stationNumber]->AddHit(ECbmModuleId::kTrd, hit, i); -#ifdef DO_ERROR_STAT - UpdateMax("Trd", stationNumber, hit); -#endif //DO_ERROR_STAT - } - } -}; - -class CbmBinnedTrdMCReader : public CbmBinnedMCPointReader { -public: - CbmBinnedTrdMCReader() : CbmBinnedMCPointReader() - { - FairRootManager* ioman = FairRootManager::Instance(); - fHitArray = static_cast<TClonesArray*>(ioman->GetObject("TrdPoint")); - } - - void Read() - { - Int_t nofPoints = fHitArray->GetEntriesFast(); - - for (Int_t i = 0; i < nofPoints; ++i) { - const CbmTrdPoint* point = static_cast<const CbmTrdPoint*>(fHitArray->At(i)); - Int_t trackInd = point->GetTrackID(); - - if (trackInd < 0) continue; - - Int_t stationNumber = CbmTrdAddress::GetLayerId(point->GetDetectorID()); - Double_t stationZ = fStationZs[stationNumber]; - fTrackReader->AddPoint(trackInd, stationZ, (point->GetXIn() + point->GetXOut()) / 2, - (point->GetYIn() + point->GetYOut()) / 2, (point->GetZIn() + point->GetZOut()) / 2); - } - } -}; - -class CbmBinnedTofHitReader : public CbmBinnedHitReader { -public: - CbmBinnedTofHitReader() : CbmBinnedHitReader() - { - FairRootManager* ioman = FairRootManager::Instance(); - fHitArray = static_cast<TClonesArray*>(ioman->GetObject("TofHit")); - } - - void Read() - { - Int_t nofHits = fHitArray->GetEntriesFast(); - - for (Int_t i = 0; i < nofHits; ++i) { - /*const */ CbmPixelHit* hit = static_cast</*const */ CbmPixelHit*>(fHitArray->At(i)); - - if (hit->GetTimeError() <= 0) hit->SetTimeError(4); - - fStations[0]->AddHit(ECbmModuleId::kTof, hit, i); -#ifdef DO_ERROR_STAT - UpdateMax("Tof", 0, hit); -#endif //DO_ERROR_STAT - } - } -}; - -#include "CbmTofPoint.h" - -class CbmBinnedTofMCReader : public CbmBinnedMCPointReader { -public: - CbmBinnedTofMCReader() : CbmBinnedMCPointReader() - { - FairRootManager* ioman = FairRootManager::Instance(); - fHitArray = static_cast<TClonesArray*>(ioman->GetObject("TofPoint")); - } - - void Read() - { - Int_t nofPoints = fHitArray->GetEntriesFast(); - - for (Int_t i = 0; i < nofPoints; ++i) { - const CbmTofPoint* point = static_cast<const CbmTofPoint*>(fHitArray->At(i)); - Int_t trackInd = point->GetTrackID(); - - if (trackInd < 0) continue; - - Double_t stationZ = fStationZs[0]; - fTrackReader->AddPoint(trackInd, stationZ, point->GetX(), point->GetY(), point->GetZ()); - } - } -}; - -class CbmBinnedAllHitReader : public CbmBinnedHitReader { -public: - CbmBinnedAllHitReader() : CbmBinnedHitReader() {} - - void Read() - { - for (map<string, CbmBinnedHitReader*>::iterator i = fReaders.begin(); i != fReaders.end(); ++i) - i->second->Read(); -#ifdef DO_ERROR_STAT - DumpMax(); -#endif //DO_ERROR_STAT - } - - void Handle() - { - for (map<string, CbmBinnedHitReader*>::iterator i = fReaders.begin(); i != fReaders.end(); ++i) - i->second->Handle(); - } - - void Finish() - { - for (map<string, CbmBinnedHitReader*>::iterator i = fReaders.begin(); i != fReaders.end(); ++i) - i->second->Finish(); - } -}; - -CbmBinnedHitReader* CbmBinnedHitReader::Instance() -{ - static CbmBinnedAllHitReader* allReader = 0; - - if (0 == allReader) allReader = new CbmBinnedAllHitReader; - - return allReader; -} - -map<string, CbmBinnedHitReader*> CbmBinnedHitReader::fReaders; - -CbmBinnedHitReader* CbmBinnedHitReader::Instance(const char* name) -{ - map<string, CbmBinnedHitReader*>::iterator i = fReaders.find(name); - - if (i != fReaders.end()) return i->second; - else - return 0; -} - -void CbmBinnedHitReader::AddReader(const char* name) -{ - map<string, CbmBinnedHitReader*>::iterator i = fReaders.find(name); - - if (i != fReaders.end()) return; - - string nameStr(name); - CbmBinnedHitReader* newReader = 0; - - if (nameStr == "sts") newReader = new CbmBinnedStsHitReader; - else if (nameStr == "rich") - newReader = new CbmBinnedRichHitReader; - else if (nameStr == "much") - newReader = new CbmBinnedMuchHitReader; - else if (nameStr == "trd") - newReader = new CbmBinnedTrdHitReader; - else if (nameStr == "tof") - newReader = new CbmBinnedTofHitReader; - else if (nameStr == "mctrack") - newReader = new CbmBinnedMCTrackReader; - else if (nameStr == "stsmc") - newReader = new CbmBinnedStsMCReader; - else if (nameStr == "richmc") - newReader = new CbmBinnedRichMCReader; - else if (nameStr == "muchmc") - newReader = new CbmBinnedMuchMCReader; - else if (nameStr == "trdmc") - newReader = new CbmBinnedTrdMCReader; - else if (nameStr == "tofmc") - newReader = new CbmBinnedTofMCReader; - - if (0 != newReader) fReaders[name] = newReader; -} diff --git a/reco/tracking/BinnedTracker/HitReader.h b/reco/tracking/BinnedTracker/HitReader.h deleted file mode 100644 index 8697db6cfa3835b8e90ea22f6092cd11d0c8e833..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/HitReader.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (C) 2017 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#ifndef HITREADER_H -#define HITREADER_H - -#include "CbmPixelHit.h" - -#include "TClonesArray.h" - -#include <map> -#include <string> -#include <vector> - -#include "Settings.h" - -class CbmBinnedStation; - -class CbmBinnedHitReader { -public: - static CbmBinnedHitReader* Instance(); - static CbmBinnedHitReader* Instance(const char* name); - static void AddReader(const char* name); - static void SetSettings(CbmBinnedSettings* v) { fSettings = v; } - -public: - CbmBinnedHitReader(); - CbmBinnedHitReader(const CbmBinnedHitReader&) = delete; - CbmBinnedHitReader& operator=(const CbmBinnedHitReader&) = delete; - virtual ~CbmBinnedHitReader(); - virtual void AddStation(CbmBinnedStation* station) { fStations.push_back(station); } - virtual void Read() = 0; - virtual void Handle() {} // Called optionally and is not implemented by the most of readers. - virtual void Finish() {} // Called optionally and is not implemented by the most of readers. - -protected: - std::vector<CbmBinnedStation*> fStations; - TClonesArray* fHitArray; - -protected: - static std::map<std::string, CbmBinnedHitReader*> fReaders; - static CbmBinnedSettings* fSettings; -}; - -#endif /* HITREADER_H */ diff --git a/reco/tracking/BinnedTracker/Settings.cxx b/reco/tracking/BinnedTracker/Settings.cxx deleted file mode 100644 index 99ef98a132b1dc159fb33e9e408c42112d14b165..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/Settings.cxx +++ /dev/null @@ -1,13 +0,0 @@ -/* Copyright (C) 2017 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#include "Settings.h" - -ClassImp(CbmBinnedSettings) diff --git a/reco/tracking/BinnedTracker/Settings.h b/reco/tracking/BinnedTracker/Settings.h deleted file mode 100644 index 99ba18283c69a62d45b1562c9fe1e09343c06ff9..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/Settings.h +++ /dev/null @@ -1,240 +0,0 @@ -/* Copyright (C) 2017-2020 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#ifndef CBM_BINNED_SETTINGS_H -#define CBM_BINNED_SETTINGS_H - -#include "CbmDefs.h" -#include "CbmSetup.h" - -#include "FairParGenericSet.h" -#include "FairParamList.h" - -#include "TArrayD.h" -#include <tuple> - -#include <list> - -enum EPrimaryParticleId -{ - ppiNone, - ppiJpsi -}; - -class CbmBinnedSettings : public FairParGenericSet { -public: - static CbmBinnedSettings* Instance() - { - static CbmBinnedSettings* theInstance = 0; - - if (0 == theInstance) theInstance = new CbmBinnedSettings; - - return theInstance; - } - -public: - CbmBinnedSettings() - : FairParGenericSet("CbmBinnedSettings", "Binned tracker reconstruction parameters", "Default") - , fIsConfiguring(false) - , fIsOnlyPrimary(true) - , fNofStsStations(0) - , fNofMuchStations(0) - , fNofTrdStations(0) /*, fStationErrors()*/ - , fNofStations(0) - , fXScats() - , fYScats() - , fPrimaryParticleIds() - { - std::fill_n(fUseModules, int(ECbmModuleId::kLastModule), true); - fPrimaryParticleIds.push_back(ppiNone); - } - - CbmBinnedSettings(const CbmBinnedSettings&) = delete; - CbmBinnedSettings& operator=(const CbmBinnedSettings&) = delete; - - void clear() - { - status = kFALSE; - resetInputVersions(); - } - - // Overridden virtual methods - void putParams(FairParamList* l) - { - if (0 == l) return; - - l->add("OnlyPrimary", fIsOnlyPrimary); - - TArrayC detFlags(ToIntegralType(ECbmModuleId::kLastModule)); - - for (int i = 0; i < ToIntegralType(ECbmModuleId::kLastModule); ++i) - detFlags[i] = fUseModules[i]; - - l->add("UseModules", detFlags); - l->add("NofStsStations", fNofStsStations); - l->add("NofMuchStations", fNofMuchStations); - l->add("NofTrdStations", fNofTrdStations); - - /*Int_t nofStations = fStationErrors.size(); - l->add("NofStations", nofStations); - TArrayD stationErrorArray(3 * nofStations); - - for (int i = 0; i < nofStations; ++i) - { - stationErrorArray[3 * i] = std::get<0> (fStationErrors[i]); - stationErrorArray[3 * i + 1] = std::get<1> (fStationErrors[i]); - stationErrorArray[3 * i + 2] = std::get<2> (fStationErrors[i]); - } - - l->add("StationErrors", stationErrorArray);*/ - - l->add("NofStations", fNofStations); - TArrayD stationXScatArray(fNofStations); - TArrayD stationYScatArray(fNofStations); - - for (int i = 0; i < fNofStations; ++i) { - stationXScatArray[i] = fXScats[i]; - stationYScatArray[i] = fYScats[i]; - } - - l->add("StationXScats", stationXScatArray); - l->add("StationYScats", stationYScatArray); - } - - Bool_t getParams(FairParamList* l) - { - if (0 == l) return kFALSE; - - Int_t op = 0; - - if (!l->fill("OnlyPrimary", &op)) return kFALSE; - - fIsOnlyPrimary = op != 0; - - TArrayC detFlags(ToIntegralType(ECbmModuleId::kLastModule)); - - if (!l->fill("UseModules", &detFlags)) return kFALSE; - - for (int i = 0; i < ToIntegralType(ECbmModuleId::kLastModule); ++i) - fUseModules[i] = detFlags[i]; - - if (!l->fill("NofStsStations", &fNofStsStations)) return kFALSE; - - if (!l->fill("NofMuchStations", &fNofMuchStations)) return kFALSE; - - if (!l->fill("NofTrdStations", &fNofTrdStations)) return kFALSE; - - if (!l->fill("NofStations", &fNofStations)) return kFALSE; - - /*TArrayD stationErrorArray(3 * nofStations); - - if (!l->fill("StationErrors", &stationErrorArray)) - return kFALSE; - - fStationErrors.resize(nofStations); - - for (int i = 0; i < nofStations; ++i) - { - std::get<0> (fStationErrors[i]) = stationErrorArray[3 * i]; - std::get<1> (fStationErrors[i]) = stationErrorArray[3 * i + 1]; - std::get<2> (fStationErrors[i]) = stationErrorArray[3 * i + 2]; - }*/ - - TArrayD stationXScats(fNofStations); - - if (!l->fill("StationXScats", &stationXScats)) return kFALSE; - - TArrayD stationYScats(fNofStations); - - if (!l->fill("StationYScats", &stationYScats)) return kFALSE; - - for (int i = 0; i < fNofStations; ++i) { - fXScats[i] = stationXScats[i]; - fYScats[i] = stationYScats[i]; - } - - return kTRUE; - } - // ~Overridded virtual methods - - bool IsConfiguring() const { return fIsConfiguring; } - void SetConfiguring(bool v) { fIsConfiguring = v; } - bool IsOnlyPrimary() const { return fIsOnlyPrimary; } - void SetOnlyPrimary(bool v) { fIsOnlyPrimary = v; } - bool Use(ECbmModuleId m) const { return fUseModules[ToIntegralType(m)] && CbmSetup::Instance()->IsActive(m); } - void SetUse(Int_t m, bool v) { fUseModules[m] = v; } - void SetUse(bool v) { std::fill_n(fUseModules, int(ECbmModuleId::kLastModule), v); } - void SetUse(bool useModules[ToIntegralType(ECbmModuleId::kLastModule)]) - { - std::copy(useModules, useModules + ToIntegralType(ECbmModuleId::kLastModule), fUseModules); - } - Int_t GetNofStsStations() const { return fNofStsStations; } - void SetNofStsStations(Int_t v) { fNofStsStations = v; } - Int_t GetNofMuchStations() const { return fNofMuchStations; } - void SetNofMuchStations(Int_t v) { fNofMuchStations = v; } - Int_t GetNofTrdStations() const { return fNofTrdStations; } - void SetNofTrdStations(Int_t v) { fNofTrdStations = v; } - Int_t GetNofStations() const { return fNofStations; } - void SetNofStations(Int_t v) { fNofStations = v; } - /*void AddStationErrors(Double_t xErr, Double_t yErr, Double_t tErr) { fStationErrors.push_back(std::make_tuple(xErr, yErr, tErr)); } - Int_t GetNofStations() const { return fStationErrors.size(); } - Double_t GetXError(int stationNumber) const { return std::get<0> (fStationErrors[stationNumber]); } - Double_t GetYError(int stationNumber) const { return std::get<1> (fStationErrors[stationNumber]); } - Double_t GetTError(int stationNumber) const { return std::get<2> (fStationErrors[stationNumber]); }*/ - - void AddStationScats(Double_t x, Double_t y) - { - fXScats.push_back(x); - fYScats.push_back(y); - ++fNofStations; - } - - Double_t GetXScat(size_t stationNumber) const { return stationNumber < fXScats.size() ? fXScats[stationNumber] : 0; } - Double_t GetYScat(size_t stationNumber) const { return stationNumber < fYScats.size() ? fYScats[stationNumber] : 0; } - - void ResetScats() - { - fXScats.clear(); - fYScats.clear(); - } - - const std::list<EPrimaryParticleId> GetPrimaryParticles() const { return fPrimaryParticleIds; } - - void SetPrimaryParticle(EPrimaryParticleId v) - { - fPrimaryParticleIds.clear(); - fPrimaryParticleIds.push_back(v); - } - - void AddPrimaryParticle(EPrimaryParticleId v) { fPrimaryParticleIds.push_back(v); } - - void SetPrimaryParticles(const std::list<EPrimaryParticleId> v) { fPrimaryParticleIds = v; } - void AddPrimaryParticles(const std::list<EPrimaryParticleId> v) - { - fPrimaryParticleIds.insert(fPrimaryParticleIds.end(), v.begin(), v.end()); - } - -private: - bool fIsConfiguring; - bool fIsOnlyPrimary; - bool fUseModules[ToIntegralType(ECbmModuleId::kLastModule)]; - Int_t fNofStsStations; - Int_t fNofMuchStations; - Int_t fNofTrdStations; - //std::vector<std::tuple<Double_t, Double_t, Double_t> > fStationErrors; - Int_t fNofStations; - std::vector<Double_t> fXScats; - std::vector<Double_t> fYScats; - std::list<EPrimaryParticleId> fPrimaryParticleIds; - - ClassDef(CbmBinnedSettings, 8) -}; - -#endif /* CBM_BINNED_SETTINGS_H */ diff --git a/reco/tracking/BinnedTracker/Station.cxx b/reco/tracking/BinnedTracker/Station.cxx deleted file mode 100644 index 9720a533b423154c5e6aa76dca733596617a2a65..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/Station.cxx +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (C) 2017-2020 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Volker Friese, Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#include "Tracker.h" - -CbmBinnedStation::CbmBinnedStation(ECbmModuleId stationType, Double_t minZ, Double_t maxZ, int nofYBins, int nofXBins, - int nofTBins) - : fStationType(stationType) - , fMinZ(minZ) - , fMaxZ(maxZ) - , fNofYBins(nofYBins) - , fNofXBins(nofXBins) - , fNofTBins(nofTBins) - , fYBinSize(0) - , fXBinSize(0) - , fTBinSize(500) - , fMinY(0) - , fMaxY(0) - , fMinX(0) - , fMaxX(0) - , fMinT(0) - , fMaxT(0) - , fDx(0) - , fDxSq(0) - , fDy(0) - , fDySq(0) - , fDt(0) - , fDtSq(0) - , fDefaultUse(false) - , fScatX(0) - , fScatXSq(0) - , fScatY(0) - , fScatYSq(0) - , fSegments() - , fVertexBin(0) - , fVertexHolder({ECbmModuleId::kRef, - &CbmBinnedTracker::Instance()->GetVertex(), - -1, - true, - fVertexBin, - std::numeric_limits<char>::max(), - {}}) - , fNofSigmasX(cbmBinnedSigma) - , fNofSigmasXSq(cbmBinnedSigmaSq) - , fNofSigmasY(cbmBinnedSigma) - , fNofSigmasYSq(cbmBinnedSigmaSq) - , fStage(0) -{ -} diff --git a/reco/tracking/BinnedTracker/Station.h b/reco/tracking/BinnedTracker/Station.h deleted file mode 100644 index ec5ed57fc1338bd45e8d573b50e73dad00a3e208..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/Station.h +++ /dev/null @@ -1,638 +0,0 @@ -/* Copyright (C) 2017-2019 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#ifndef STATION_H -#define STATION_H - -#include "CbmTrackParam2.h" - -#include <functional> -#include <iostream> -#include <set> - -#include "Bins.h" -#include "HitReader.h" - -const Double_t cbmBinnedSigma = 4; -const Double_t cbmBinnedSigmaSq = cbmBinnedSigma * cbmBinnedSigma; -extern Double_t cbmBinnedSOL; -const Double_t cbmBinnedCrazyChiSq = 1000000; - -class CbmBinnedStation { -public: - struct Segment { - CbmTBin::HitHolder* begin; - CbmTBin::HitHolder* end; - Double_t chiSq; - std::list<Segment*> children; - Segment* bestBranch; - - Segment(CbmTBin::HitHolder* beginHit, CbmTBin::HitHolder* endHit) - : begin(beginHit) - , end(endHit) - , chiSq(cbmBinnedCrazyChiSq) - , children() - , bestBranch(0) - { - } - Segment(const Segment&) = default; - Segment& operator=(const Segment&) = default; - }; - - struct SegmentComp { - bool operator()(const Segment& s1, const Segment& s2) const - { - if (&s1.begin < &s2.begin) return true; - else if (&s1.end < &s2.end) - return true; - else - return false; - } - }; - - /*struct KFParamsCoord - { - Double_t coord, tg, C11, C12, C21, C22; - }; - - struct KFParams - { - KFParamsCoord xParams; - KFParamsCoord yParams; - Double_t chi2; - };*/ - - struct KFStation { - struct Q { - Double_t Q11, Q12, Q21, Q22; - }; - - Q qs[2]; - }; - -public: - /*static KFParams Extrapolate(const KFParams& params, Double_t deltaZ) - { - KFParams result = params; - - result.xParams.coord += params.xParams.tg * deltaZ; - result.xParams.C12 += params.xParams.C22 * deltaZ; - result.xParams.C11 += params.xParams.C12 * deltaZ + result.xParams.C12 * deltaZ; - - result.yParams.coord += params.yParams.tg * deltaZ; - result.yParams.C12 += params.yParams.C22 * deltaZ; - result.yParams.C11 += params.yParams.C12 * deltaZ + result.yParams.C12 * deltaZ; - - return result; - }*/ - - CbmTrackParam2 Extrapolate(const CbmTrackParam2& parIn, Double_t zOut) - { - CbmTrackParam2 parOut; - parOut.SetZ(zOut); - Double_t dz = zOut - parIn.GetZ(); - Double_t tx = parIn.GetTx(); - Double_t ty = parIn.GetTy(); - Double_t timeCoeff = dz / std::sqrt(1 + tx * tx + ty * ty) / cbmBinnedSOL; - - parOut.SetX(parIn.GetX() + tx * dz); - parOut.SetY(parIn.GetY() + ty * dz); - parOut.SetTx(parIn.GetTx()); - parOut.SetTy(parIn.GetTy()); - parOut.SetTime(parIn.GetTime() + tx * timeCoeff + ty * timeCoeff); - - Double_t covIn[15]; - parIn.CovMatrix(covIn); - - Double_t covOut[15]; - - Double_t t1 = covIn[2]; - Double_t t4 = covIn[9]; - Double_t t6 = dz * t4 + t1; - covOut[0] = dz * t1 + t6 * dz + covIn[0] + fScatXSq; - Double_t t8 = covIn[6]; - Double_t t11 = covIn[10]; - Double_t t12 = dz * t11; - Double_t t14 = t12 + covIn[3]; - Double_t covOut2 = t6; - Double_t covOut3 = t14; - Double_t t18 = covIn[11]; - covOut[1] = t14 * dz + dz * t8 + covIn[1]; - Double_t t21 = covIn[7]; - Double_t t24 = covIn[12]; - Double_t t26 = dz * t24 + t21; - covOut[5] = dz * t21 + t26 * dz + covIn[5] + fScatYSq; - Double_t covOut5 = t12 + t8; - Double_t covOut6 = t26; - Double_t t30 = covIn[13]; - covOut[2] = covOut2; - covOut[6] = covOut5; - covOut[9] = t4; - Double_t covOut8 = t11; - Double_t t34 = timeCoeff * covOut8; - covOut[3] = covOut3; - covOut[7] = covOut6; - covOut[10] = covOut8; - covOut[12] = t24; - covOut[4] = covOut2 * timeCoeff + covOut3 * timeCoeff + dz * t18 + covIn[4]; - covOut[8] = covOut5 * timeCoeff + covOut6 * timeCoeff + dz * t30 + covIn[8]; - covOut[11] = timeCoeff * covOut[9] + t18 + t34; - covOut[13] = timeCoeff * covOut[12] + t30 + t34; - covOut[14] = timeCoeff * t18 + timeCoeff * t30 + covOut[11] * timeCoeff + covOut[13] * timeCoeff + covIn[14]; - - parOut.SetCovMatrix(covOut); - - return parOut; - } - /*static CbmTrackParam2 Extrapolate(const CbmTrackParam2& parIn, Double_t zOut) - { - CbmTrackParam2 parOut = parIn; - - Double_t dz = zOut - parIn.GetZ(); - Double_t timeCoeff = dz / std::sqrt(1 + parIn.GetTx() * parIn.GetTx() + parIn.GetTy() * parIn.GetTy()) / cbmBinnedSOL; - - Double_t F_ini[5][5] = { - { 1, 0, dz, 0, 0 }, - { 0, 1, 0, dz, 0 }, - { 0, 0, 1, 0, 0 }, - { 0, 0, 0, 1, 0 }, - { 0, 0, timeCoeff, timeCoeff, 1 } - }; - - TMatrixD F(5, 5); - - for (int i = 0; i < 5; ++i) - { - for (int j = 0; j < 5; ++j) - F(i, j) = F_ini[i][j]; - } - - TMatrixD& X = parOut.GetVector(); - TMatrixD Xtmp = X; - X.Mult(F, Xtmp); - - TMatrixD F_t(5, 5); - F_t.Transpose(F); - - TMatrixD& P = parOut.GetCovMatrix(); - TMatrixD PF_t(5, 5); - PF_t.Mult(P, F_t); - P.Mult(F, PF_t); - - parOut.SetZ(zOut); - - return parOut; - }*/ - - static void Update(CbmTrackParam2& par, const CbmPixelHit* hit, Double_t& chiSq) - { - Double_t xIn = par.GetX(); - Double_t yIn = par.GetY(); - Double_t txIn = par.GetTx(); - Double_t tyIn = par.GetTy(); - Double_t timeIn = par.GetTime(); - - Double_t covIn[15]; - par.CovMatrix(covIn); - - Double_t xMes = hit->GetX(); - Double_t yMes = hit->GetY(); - Double_t timeMes = hit->GetTime(); - - Double_t dx = hit->GetDx(); - Double_t dy = hit->GetDy(); - Double_t dxy = hit->GetDxy(); - Double_t dt = hit->GetTimeError(); - - Double_t xOut; - Double_t yOut; - Double_t txOut; - Double_t tyOut; - Double_t timeOut; - Double_t covOut[15]; - - Double_t t1 = covIn[0]; - Double_t t2 = dt * dt; - Double_t t3 = dy * dy; - Double_t t4 = t2 * t3; - Double_t t5 = covIn[5]; - Double_t t7 = covIn[14]; - Double_t t10 = covIn[8]; - Double_t t11 = t10 * t10; - Double_t t12 = t2 * t5 + t3 * t7 + t5 * t7 - t11 + t4; - Double_t t14 = dx * dx; - Double_t t15 = t2 * t14; - Double_t t19 = t14 * t3; - Double_t t21 = dxy * dxy; - Double_t t23 = t2 * dxy; - Double_t t24 = covIn[1]; - Double_t t27 = t2 * t1; - Double_t t29 = t24 * t24; - Double_t t31 = t14 * t5; - Double_t t34 = t3 * t1; - Double_t t36 = covIn[4]; - Double_t t37 = t36 * t36; - Double_t t40 = dxy * t24; - Double_t t43 = dxy * t36; - Double_t t46 = t1 * t5; - Double_t t50 = t24 * t36; - Double_t t54 = -t1 * t11 + t4 * t1 + 2 * t43 * t10 + 2 * t50 * t10 - t14 * t11 + t15 * t3 + t15 * t5 + t19 * t7 - - t2 * t21 - t2 * t29 - t21 * t7 - 2 * t23 * t24 + t27 * t5 - t29 * t7 - t3 * t37 + t31 * t7 - + t34 * t7 - t37 * t5 - 2 * t40 * t7 + t46 * t7; - Double_t t55 = 1 / t54; - Double_t t61 = dxy * t7 - t36 * t10 + t2 * t24 + t24 * t7 + t23; - Double_t t63 = t24 * t61 * t55; - Double_t t68 = dxy * t10 + t24 * t10 - t3 * t36 - t36 * t5; - Double_t t70 = t36 * t68 * t55; - Double_t t71 = t1 * t12 * t55 - t63 + t70; - Double_t t72 = xMes - xIn; - Double_t t78 = t1 * t7 + t14 * t7 + t15 + t27 - t37; - Double_t t83 = t1 * t10 + t14 * t10 - t43 - t50; - Double_t t86 = -t1 * t61 * t55 + t24 * t78 * t55 - t36 * t83 * t55; - Double_t t87 = yMes - yIn; - Double_t t94 = t19 + t31 + t34 - t21 - 2 * t40 + t46 - t29; - Double_t t97 = t1 * t68 * t55 - t24 * t83 * t55 + t36 * t94 * t55; - Double_t t98 = timeMes - timeIn; - xOut = t71 * t72 + t86 * t87 + t97 * t98 + xIn; - Double_t t106 = t10 * t68 * t55 + t24 * t12 * t55 - t5 * t61 * t55; - Double_t t111 = t10 * t83 * t55; - Double_t t112 = t5 * t78 * t55 - t111 - t63; - Double_t t120 = t10 * t94 * t55 + t24 * t68 * t55 - t5 * t83 * t55; - yOut = t106 * t72 + t112 * t87 + t120 * t98 + yIn; - Double_t t122 = covIn[2]; - Double_t t125 = covIn[6]; - Double_t t128 = covIn[11]; - Double_t t131 = t122 * t12 * t55 - t125 * t61 * t55 + t128 * t68 * t55; - Double_t t139 = -t122 * t61 * t55 + t125 * t78 * t55 - t128 * t83 * t55; - Double_t t147 = t122 * t68 * t55 - t125 * t83 * t55 + t128 * t94 * t55; - txOut = t131 * t72 + t139 * t87 + t147 * t98 + txIn; - Double_t t149 = covIn[3]; - Double_t t152 = covIn[7]; - Double_t t155 = covIn[13]; - Double_t t158 = t149 * t12 * t55 - t152 * t61 * t55 + t155 * t68 * t55; - Double_t t166 = -t149 * t61 * t55 + t152 * t78 * t55 - t155 * t83 * t55; - Double_t t174 = t149 * t68 * t55 - t152 * t83 * t55 + t155 * t94 * t55; - tyOut = t158 * t72 + t166 * t87 + t174 * t98 + tyIn; - Double_t t182 = -t10 * t61 * t55 + t36 * t12 * t55 + t7 * t68 * t55; - Double_t t190 = t10 * t78 * t55 - t36 * t61 * t55 - t7 * t83 * t55; - Double_t t194 = t7 * t94 * t55 - t111 + t70; - timeOut = t182 * t72 + t190 * t87 + t194 * t98 + timeIn; - covOut[0] = -t71 * t1 - t86 * t24 - t97 * t36 + t1; - covOut[1] = -t97 * t10 - t71 * t24 - t86 * t5 + t24; - covOut[5] = -t120 * t10 - t106 * t24 - t112 * t5 + t5; - covOut[2] = -t71 * t122 - t86 * t125 - t97 * t128 + t122; - covOut[6] = -t106 * t122 - t112 * t125 - t120 * t128 + t125; - covOut[9] = -t131 * t122 - t139 * t125 - t147 * t128 + covIn[9]; - covOut[3] = -t71 * t149 - t86 * t152 - t97 * t155 + t149; - covOut[7] = -t106 * t149 - t112 * t152 - t120 * t155 + t152; - covOut[10] = -t131 * t149 - t139 * t152 - t147 * t155 + covIn[10]; - covOut[12] = -t158 * t149 - t166 * t152 - t174 * t155 + covIn[12]; - covOut[4] = -t86 * t10 - t71 * t36 - t97 * t7 + t36; - covOut[8] = -t112 * t10 - t106 * t36 - t120 * t7 + t10; - covOut[11] = -t139 * t10 - t131 * t36 - t147 * t7 + t128; - covOut[13] = -t166 * t10 - t158 * t36 - t174 * t7 + t155; - covOut[14] = -t190 * t10 - t182 * t36 - t194 * t7 + t7; - - t1 = xMes - xOut; - t2 = dy * dy - covOut[5]; - t3 = dt * dt; - t4 = covOut[8] * covOut[8]; - t5 = dxy * dxy; - Double_t t6 = dx * dx; - t7 = covOut[1] * covOut[1]; - Double_t t8 = t2 * t6; - Double_t t9 = t2 * covOut[0]; - t10 = -t8 + t7 + t9 + t5; - t6 = -covOut[0] + t6; - t11 = covOut[4] * covOut[4]; - t12 = -dxy + covOut[1]; - Double_t t13 = dxy * covOut[1]; - t14 = t12 * covOut[8]; - t15 = 2; - t5 = -t15 * (t14 * covOut[4] + t13 * (covOut[14] - t3)) - t10 * t3 - t11 * t2 - t4 * t6 - - (t8 - t7 - t9 - t5) * covOut[14]; - t7 = yMes - yOut; - t8 = -t12 * t3 + t12 * covOut[14] - covOut[4] * covOut[8]; - t9 = timeMes - timeOut; - t14 = -t2 * covOut[4] - t14; - t5 = 1 / t5; - t12 = -t12 * covOut[4] - t6 * covOut[8]; - - par.SetX(xOut); - par.SetY(yOut); - par.SetTx(txOut); - par.SetTy(tyOut); - par.SetTime(timeOut); - par.SetCovMatrix(covOut); - - chiSq += t1 * (t1 * (t2 * t3 - t2 * covOut[14] - t4) - t7 * t8 - t9 * t14) * t5 - - t7 * (t1 * t8 - t7 * (t3 * t6 - t6 * covOut[14] - t11) + t9 * t12) * t5 - - t9 * (t1 * t14 + t12 * t7 - t9 * (t13 * t15 - t10)) * t5; - } - /*static void Update(CbmTrackParam2& par, const CbmPixelHit* hit, Double_t& chiSq) - { - TMatrixD& X = par.GetVector(); - TMatrixD& P = par.GetCovMatrix(); - TMatrixD H(3, 5); - H(0, 0) = 1; - H(1, 1) = 1; - H(2, 4) = 1; - - TMatrixD Z(3, 1); - Z(0, 0) = hit->GetX(); - Z(1, 0) = hit->GetY(); - Z(2, 0) = hit->GetTime(); - - TMatrixD Y = Z; - TMatrixD HX(3, 1); - HX.Mult(H, X); - Y.Minus(Z, HX); - - TMatrixD H_t(5, 3); - H_t.Transpose(H); - - TMatrixD R(3, 3); - R(0, 0) = hit->GetDx() * hit->GetDx(); - R(0, 1) = hit->GetDxy(); - R(1, 1) = hit->GetDy() * hit->GetDy(); - R(1, 0) = hit->GetDxy(); - R(2, 2) = hit->GetTimeError() * hit->GetTimeError(); - - TMatrixD HP(3, 5); - HP.Mult(H, P); - - TMatrixD HPH_t(3, 3); - HPH_t.Mult(HP, H_t); - - TMatrixD S(3, 3); - S.Plus(R, HPH_t); - - TMatrixD S_1 = S; - S_1.InvertFast(); - - TMatrixD H_tS_1(5, 3); - H_tS_1.Mult(H_t, S_1); - - TMatrixD K(5, 3);// Optimal Kalman gain - K.Mult(P, H_tS_1); - - TMatrixD KY(5, 1); - KY.Mult(K, Y); - - X += KY; - - TMatrixD KHP(5, 5); - KHP.Mult(K, HP); - - P -= KHP; - - // - HX.Mult(H, X); - Y.Minus(Z, HX); - - HP.Mult(H, P); - HPH_t.Mult(HP, H_t); - - TMatrixD V = R; - V -= HPH_t; - - TMatrixD V_1 = V; - V_1.InvertFast(); - - TMatrixD Y_t(1, 3); - Y_t.Transpose(Y); - - TMatrixD V_1Y(3, 1); - V_1Y.Mult(V_1, Y); - - TMatrixD Y_tV_1Y(1, 1); - Y_tV_1Y.Mult(Y_t, V_1Y); - - chiSq += Y_tV_1Y(0, 0); - }*/ - -public: - CbmBinnedStation(ECbmModuleId stationType, Double_t minZ, Double_t maxZ, int nofYBins, int nofXBins, int nofTBins); - CbmBinnedStation(const CbmBinnedStation&) = delete; - CbmBinnedStation& operator=(const CbmBinnedStation&) = delete; - - virtual ~CbmBinnedStation() {} - ECbmModuleId GetStationType() const { return fStationType; } - Double_t GetMinZ() const { return fMinZ; } - Double_t GetMaxZ() const { return fMaxZ; } - void SetMinZ(Double_t v) { fMinZ = v; } - void SetMaxZ(Double_t v) { fMaxZ = v; } - void SetMinY(Double_t v) { fMinY = v; } - void SetMaxY(Double_t v) { fMaxY = v; } - void SetMinX(Double_t v) { fMinX = v; } - void SetMaxX(Double_t v) { fMaxX = v; } - - void SetTBinSize(Double_t v) { fTBinSize = v; } - - void SetMinT(Double_t v) - { - fMinT = v; - fMaxT = fMinT + fNofTBins * fTBinSize; - } - - void SetDefaultUse() { fDefaultUse = true; } - - Double_t GetDx() const { return fDx; } - - void SetDx(Double_t v) - { - if (v > fDx) { - fDx = v; - fDxSq = v * v; - } - } - - Double_t GetDy() const { return fDy; } - - void SetDy(Double_t v) - { - if (v > fDy) { - fDy = v; - fDySq = v * v; - } - } - - Double_t GetDt() const { return fDt; } - - void SetDt(Double_t v) - { - if (v > fDt) { - fDt = v; - fDtSq = v * v; - } - } - - Double_t GetScatX() const { return fScatX; } - Double_t GetScatXSq() const { return fScatXSq; } - - void SetScatX(Double_t v) - { - fScatX = v; - fScatXSq = v * v; - } - - Double_t GetScatY() const { return fScatY; } - Double_t GetScatYSq() const { return fScatYSq; } - - void SetScatY(Double_t v) - { - fScatY = v; - fScatYSq = v * v; - } - - Double_t GetNofSigmaX() const { return fNofSigmasX; } - Double_t GetNofSigmaXSq() const { return fNofSigmasXSq; } - - void SetNofSigmaX(Double_t v) - { - fNofSigmasX = v; - fNofSigmasXSq = v * v; - } - - Double_t GetNofSigmaY() const { return fNofSigmasY; } - Double_t GetNofSigmaYSq() const { return fNofSigmasYSq; } - - void SetNofSigmaY(Double_t v) - { - fNofSigmasY = v; - fNofSigmasYSq = v * v; - } - - int GetXInd(Double_t v) const - { - int ind = (v - fMinX) / fXBinSize; - - if (ind < 0) ind = 0; - else if (ind >= fNofXBins) - ind = fNofXBins - 1; - - return ind; - } - - int GetYInd(Double_t v) const - { - int ind = (v - fMinY) / fYBinSize; - - if (ind < 0) ind = 0; - else if (ind >= fNofYBins) - ind = fNofYBins - 1; - - return ind; - } - - int GetTInd(Double_t v) const - { - int ind = (v - fMinT) / fTBinSize; - - if (ind < 0) ind = 0; - else if (ind >= fNofTBins) - ind = fNofTBins - 1; - - return ind; - } - - void SetStage(char v) { fStage = v; } - - virtual void Init() - { - fYBinSize = (fMaxY - fMinY) / fNofYBins; - fXBinSize = (fMaxX - fMinX) / fNofXBins; - } - - virtual void Clear() - { - fDx = 0; - fDxSq = 0; - fDy = 0; - fDySq = 0; - fDt = 0; - fDtSq = 0; - fStage = 0; - fVertexHolder.stage = std::numeric_limits<char>::max(); - fSegments.clear(); - } - - virtual void AddHit(ECbmModuleId type, const CbmPixelHit* hit, Int_t index) = 0; - virtual void IterateHits(std::function<void(CbmTBin::HitHolder&)> handleHit) = 0; - virtual void SearchHits(const CbmTrackParam2& stateVec, Double_t stateZ, - std::function<void(CbmTBin::HitHolder&)> handleHit) = 0; - virtual void SearchHits(Segment& segment, std::function<void(CbmTBin::HitHolder&)> handleHit) = 0; - virtual void SearchHits(Double_t minZ, Double_t maxZ, Double_t minY, Double_t maxY, Double_t minX, Double_t maxX, - Double_t minT, Double_t maxT, std::function<void(CbmTBin::HitHolder&)> handleHit) = 0; - - void IterateSegments(std::function<void(Segment&)> handleSegment) - { - for (std::set<Segment, SegmentComp>::iterator i = fSegments.begin(); i != fSegments.end(); ++i) - handleSegment(const_cast<Segment&>(*i)); - } - - void CreateSegmentsFromHits() - { - IterateHits([&](CbmTBin::HitHolder& hitHolder) -> void { - Segment segment(&fVertexHolder, &hitHolder); - fSegments.insert(segment); - }); - } - - void NulifySegments() - { - for (std::set<Segment, SegmentComp>::iterator i = fSegments.begin(); i != fSegments.end(); ++i) { - Segment& segment = const_cast<Segment&>(*i); - segment.chiSq = 0; - } - } - -protected: - ECbmModuleId fStationType; - Double_t fMinZ; - Double_t fMaxZ; - int fNofYBins; - int fNofXBins; - int fNofTBins; - Double_t fYBinSize; - Double_t fXBinSize; - Double_t fTBinSize; - Double_t fMinY; - Double_t fMaxY; - Double_t fMinX; - Double_t fMaxX; - Double_t fMinT; - Double_t fMaxT; - Double_t fDx; - Double_t fDxSq; - Double_t fDy; - Double_t fDySq; - Double_t fDt; - Double_t fDtSq; - bool fDefaultUse; - Double_t fScatX; - Double_t fScatXSq; - Double_t fScatY; - Double_t fScatYSq; - -public: - std::set<Segment, SegmentComp> fSegments; - CbmTBin fVertexBin; - CbmTBin::HitHolder fVertexHolder; - -protected: - Double_t fNofSigmasX; - Double_t fNofSigmasXSq; - Double_t fNofSigmasY; - Double_t fNofSigmasYSq; - char fStage; -}; - -#endif /* STATION_H */ diff --git a/reco/tracking/BinnedTracker/Station3D.cxx b/reco/tracking/BinnedTracker/Station3D.cxx deleted file mode 100644 index 3f5673d83260b0f6be5b596e520901abd9897880..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/Station3D.cxx +++ /dev/null @@ -1,222 +0,0 @@ -/* Copyright (C) 2017-2019 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#include "Station3D.h" - -#include "Tracker.h" - -#include <set> - -void CbmBinned3DStation::SearchHits(const CbmTrackParam2& stateVec, Double_t, - std::function<void(CbmTBin::HitHolder&)> handleHit) -{ - CbmTrackParam2 minParams = Extrapolate(stateVec, fMinZ); - //Double_t minC[21]; - //minParams.CovMatrix(minC); - CbmTrackParam2 maxParams = Extrapolate(stateVec, fMaxZ); - //Double_t maxC[21]; - //maxParams.CovMatrix(maxC); - Double_t wXmin = fNofSigmasX * std::sqrt(minParams.GetCovXX() + fDxSq + fScatXSq); - Double_t wXmax = fNofSigmasX * std::sqrt(maxParams.GetCovXX() + fDxSq + fScatXSq); - Double_t wYmin = fNofSigmasY * std::sqrt(minParams.GetCovYY() + fDySq + fScatYSq); - Double_t wYmax = fNofSigmasY * std::sqrt(maxParams.GetCovYY() + fDySq + fScatYSq); - - Double_t xMin = stateVec.GetTx() > 0 ? minParams.GetX() - wXmin : maxParams.GetX() - wXmax; - Double_t xMax = stateVec.GetTx() > 0 ? maxParams.GetX() + wXmax : minParams.GetX() + wXmin; - - Double_t yMin = stateVec.GetTy() > 0 ? minParams.GetY() - wYmin : maxParams.GetY() - wYmax; - Double_t yMax = stateVec.GetTy() > 0 ? maxParams.GetY() + wYmax : minParams.GetY() + wYmin; - - int lowerXind = GetXInd(xMin); - int upperXind = GetXInd(xMax); - int lowerYind = GetYInd(yMin); - int upperYind = GetYInd(yMax); - int lowerTind = GetTInd(0); - int upperTind = GetTInd(0); - - for (int i = lowerYind; i <= upperYind; ++i) { - CbmYBin& yBin = fYBins[i]; - - for (int j = lowerXind; j <= upperXind; ++j) { - CbmXBin& xBin = yBin[j]; - - for (int k = lowerTind; k <= upperTind; ++k) { - CbmTBin& tBin = xBin[k]; - std::list<CbmTBin::HitHolder>::iterator hitIter = tBin.HitsBegin(); - std::list<CbmTBin::HitHolder>::iterator hitIterEnd = tBin.HitsEnd(); - - for (; hitIter != hitIterEnd; ++hitIter) { - CbmTBin::HitHolder& hitHolder = *hitIter; - - if (fStage > hitHolder.stage) continue; - - handleHit(hitHolder); - } - } - } - } -} - -void CbmBinned3DStation::SearchHits(Segment& segment, std::function<void(CbmTBin::HitHolder&)>) -{ - const CbmPixelHit* hit1 = segment.begin->hit; - Double_t x1 = hit1->GetX(); - Double_t y1 = hit1->GetY(); - Double_t dx1Sq = hit1->GetDx() * hit1->GetDx(); - Double_t dy1Sq = hit1->GetDy() * hit1->GetDy(); - const CbmPixelHit* hit2 = segment.end->hit; - Double_t x2 = hit2->GetX(); - Double_t y2 = hit2->GetY(); - Double_t dx2Sq = hit2->GetDx() * hit2->GetDx(); - Double_t dy2Sq = hit2->GetDy() * hit2->GetDy(); - Double_t segDeltaZ = hit2->GetZ() - hit1->GetZ(); - Double_t tx = (x2 - x1) / segDeltaZ; - Double_t ty = (y2 - y1) / segDeltaZ; - Double_t middleZ = (hit1->GetZ() + hit2->GetZ()) / 2; - Double_t deltaZmin = fMinZ - middleZ; - Double_t deltaZmax = fMaxZ - middleZ; - Double_t coeff1Min = (0.5 - deltaZmin / segDeltaZ); - Double_t coeff1MinSq = coeff1Min * coeff1Min; - Double_t coeff1Max = (0.5 - deltaZmax / segDeltaZ); - Double_t coeff1MaxSq = coeff1Max * coeff1Max; - Double_t coeff2Min = (0.5 + deltaZmin / segDeltaZ); - Double_t coeff2MinSq = coeff2Min * coeff2Min; - Double_t coeff2Max = (0.5 + deltaZmax / segDeltaZ); - Double_t coeff2MaxSq = coeff2Max * coeff2Max; - Double_t tCoeff = std::sqrt(1 + tx * tx + ty * ty) / cbmBinnedSOL; - - Double_t searchT; - Double_t dtSq; - Double_t wT; - Double_t tMin; - Double_t tMax; - - if (0 == hit1->GetTimeError()) { - searchT = hit2->GetTime(); - dtSq = hit2->GetTimeError() * hit2->GetTimeError(); - wT = cbmBinnedSigma * std::sqrt(dtSq + fDtSq); - tMin = searchT + tCoeff * (fMinZ - hit2->GetZ()) - wT; - tMax = searchT + tCoeff * (fMaxZ - hit2->GetZ()) + wT; - } - else { - searchT = (hit1->GetTime() + hit2->GetTime()) / 2; - dtSq = (hit1->GetTimeError() * hit1->GetTimeError() + hit2->GetTimeError() * hit2->GetTimeError()) / 2; - wT = cbmBinnedSigma * std::sqrt(dtSq + fDtSq); - tMin = searchT + tCoeff * deltaZmin - wT; - tMax = searchT + tCoeff * deltaZmax + wT; - } - - Double_t wXmin = fNofSigmasX * std::sqrt(coeff1MinSq * dx1Sq + coeff2MinSq * dx2Sq + fDxSq + fScatXSq); - Double_t wXmax = fNofSigmasX * std::sqrt(coeff1MaxSq * dx1Sq + coeff2MaxSq * dx2Sq + fDxSq + fScatXSq); - Double_t wYmin = fNofSigmasY * std::sqrt(coeff1MinSq * dy1Sq + coeff2MinSq * dy2Sq + fDySq + fScatYSq); - Double_t wYmax = fNofSigmasY * std::sqrt(coeff1MaxSq * dy1Sq + coeff2MaxSq * dy2Sq + fDySq + fScatYSq); - - Double_t xMin = tx > 0 ? coeff1Min * x1 + coeff2Min * x2 - wXmin : coeff1Max * x1 + coeff2Max * x2 - wXmax; - Double_t xMax = tx > 0 ? coeff1Max * x1 + coeff2Max * x2 + wXmax : coeff1Min * x1 + coeff2Min * x2 + wXmin; - - Double_t yMin = ty > 0 ? coeff1Min * y1 + coeff2Min * y2 - wYmin : coeff1Max * y1 + coeff2Max * y2 - wYmax; - Double_t yMax = ty > 0 ? coeff1Max * y1 + coeff2Max * y2 + wYmax : coeff1Min * y1 + coeff2Min * y2 + wYmin; - - int lowerXind = GetXInd(xMin); - int upperXind = GetXInd(xMax); - int lowerYind = GetYInd(yMin); - int upperYind = GetYInd(yMax); - int lowerTind = GetTInd(tMin); - int upperTind = GetTInd(tMax); - - for (int i = lowerYind; i <= upperYind; ++i) { - CbmYBin& yBin = fYBins[i]; - - for (int j = lowerXind; j <= upperXind; ++j) { - CbmXBin& xBin = yBin[j]; - - for (int k = lowerTind; k <= upperTind; ++k) { - CbmTBin& tBin = xBin[k]; - std::list<CbmTBin::HitHolder>::iterator hitIter = tBin.HitsBegin(); - std::list<CbmTBin::HitHolder>::iterator hitIterEnd = tBin.HitsEnd(); - - for (; hitIter != hitIterEnd; ++hitIter) { - const CbmPixelHit* hit = hitIter->hit; - Double_t deltaZ = hit->GetZ() - middleZ; - Double_t coeff1 = (0.5 - deltaZ / segDeltaZ); - Double_t coeff1Sq = coeff1 * coeff1; - Double_t coeff2 = (0.5 + deltaZ / segDeltaZ); - Double_t coeff2Sq = coeff2 * coeff2; - Double_t y = coeff1 * y1 + coeff2 * y2; - Double_t deltaY = hit->GetY() - y; - - if (deltaY * deltaY - > fNofSigmasYSq * (coeff1Sq * dy1Sq + coeff2Sq * dy2Sq + hit->GetDy() * hit->GetDy() + fScatYSq)) - continue; - - Double_t x = coeff1 * x1 + coeff2 * x2; - Double_t deltaX = hit->GetX() - x; - - if (deltaX * deltaX - > fNofSigmasXSq * (coeff1Sq * dx1Sq + coeff2Sq * dx2Sq + hit->GetDx() * hit->GetDx() + fScatXSq)) - continue; - - /*Double_t t = 0 == hit1->GetTimeError() ? searchT + tCoeff * (hit->GetZ() - hit2->GetZ()) : searchT + tCoeff * deltaZ; - Double_t deltaT = hit->GetTime() - t; - - if (deltaT * deltaT > cbmBinnedSigmaSq * (dtSq + hit->GetTimeError() * hit->GetTimeError())) - continue;*/ - - Segment newSegment(segment.end, &(*hitIter)); - pair<set<Segment, SegmentComp>::iterator, bool> ir = fSegments.insert(newSegment); - segment.children.push_back(const_cast<Segment*>(&(*ir.first))); - //handleHit(*hitIter); - } - } - } - } -} - -void CbmBinned3DStation::SearchHits(Double_t, Double_t, Double_t minY, Double_t maxY, Double_t minX, Double_t maxX, - Double_t minT, Double_t maxT, std::function<void(CbmTBin::HitHolder&)> handleHit) -{ - int lowerXind = GetXInd(minX); - int upperXind = GetXInd(maxX); - int lowerYind = GetYInd(minY); - int upperYind = GetYInd(maxY); - int lowerTind = GetTInd(minT); - int upperTind = GetTInd(maxT); - - for (int i = lowerYind; i <= upperYind; ++i) { - CbmYBin& yBin = fYBins[i]; - - for (int j = lowerXind; j <= upperXind; ++j) { - CbmXBin& xBin = yBin[j]; - - for (int k = lowerTind; k <= upperTind; ++k) { - CbmTBin& tBin = xBin[k]; - std::list<CbmTBin::HitHolder>::iterator hitIter = tBin.HitsBegin(); - std::list<CbmTBin::HitHolder>::iterator hitIterEnd = tBin.HitsEnd(); - - for (; hitIter != hitIterEnd; ++hitIter) { - const CbmPixelHit* hit = hitIter->hit; - Double_t y = hit->GetY(); - - if (y < minY || y >= maxY) continue; - - Double_t x = hit->GetX(); - - if (x < minX || x >= maxX) continue; - - Double_t t = hit->GetTime(); - - if (t < minT || t >= maxT) continue; - - handleHit(*hitIter); - } - } - } - } -} diff --git a/reco/tracking/BinnedTracker/Station3D.h b/reco/tracking/BinnedTracker/Station3D.h deleted file mode 100644 index 185b67ac8f6a1bc8f67f21d6e37e3b803e249347..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/Station3D.h +++ /dev/null @@ -1,133 +0,0 @@ -/* Copyright (C) 2017-2018 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#ifndef STATION3D_H -#define STATION3D_H - -#include <list> -#include <utility> - -#include "Station.h" - -class CbmBinned3DStation : public CbmBinnedStation { -public: - CbmBinned3DStation(ECbmModuleId stationType, Double_t minZ, Double_t maxZ, int nofYBins, int nofXBins, int nofTBins) - : CbmBinnedStation(stationType, minZ, maxZ, nofYBins, nofXBins, nofTBins) - , fYBins(reinterpret_cast<CbmYBin*>(new unsigned char[nofYBins * sizeof(CbmYBin)])) - { - for (int i = 0; i < nofYBins; ++i) - new (&fYBins[i]) CbmYBin(0, nofXBins, nofTBins); - } - - void Clear() - { - CbmBinnedStation::Clear(); - - for (int i = 0; i < fNofYBins; ++i) { - CbmYBin& yBin = fYBins[i]; - yBin.SetUse(false); - - for (int j = 0; j < fNofXBins; ++j) { - CbmXBin& xBin = yBin[j]; - xBin.SetUse(false); - - for (int k = 0; k < fNofTBins; ++k) { - CbmTBin& tBin = xBin[k]; - tBin.SetUse(false); - tBin.Clear(); - } - } - } - } - - void AddHit(ECbmModuleId type, const CbmPixelHit* hit, Int_t index) - { - Double_t y = hit->GetY(); - - if (y < fMinY || y >= fMaxY) return; - - Double_t x = hit->GetX(); - - if (x < fMinX || x >= fMaxX) return; - - Double_t t = hit->GetTime(); - - //if (t < fMinT || t >= fMaxT) - //return; - - int yInd = (y - fMinY) / fYBinSize; - int xInd = (x - fMinX) / fXBinSize; - int tInd = (t - fMinT) / fTBinSize; - - if (tInd < 0) tInd = 0; - else if (tInd >= fNofTBins) - tInd = fNofTBins - 1; - - CbmYBin& yBin = fYBins[yInd]; - CbmXBin& xBin = yBin[xInd]; - CbmTBin& tBin = xBin[tInd]; - tBin.AddHit(type, hit, index, fDefaultUse); - SetDx(hit->GetDx()); - SetDy(hit->GetDy()); - SetDt(hit->GetTimeError()); - - if (fDefaultUse) { - yBin.SetUse(true); - xBin.SetUse(true); - tBin.SetUse(true); - } - } - - void IterateHits(std::function<void(CbmTBin::HitHolder&)> handleHit) - { - for (int i = 0; i < fNofYBins; ++i) { - CbmYBin& yBin = fYBins[i]; - - //if (!yBin.Use()) - //continue; - - for (int j = 0; j < fNofXBins; ++j) { - CbmXBin& xBin = yBin[j]; - - //if (!xBin.Use()) - //continue; - - for (int k = 0; k < fNofTBins; ++k) { - CbmTBin& tBin = xBin[k]; - - //if (!tBin.Use()) - //continue; - - for (std::list<CbmTBin::HitHolder>::iterator hi = tBin.HitsBegin(); hi != tBin.HitsEnd(); ++hi) { - CbmTBin::HitHolder& hitHolder = *hi; - - if (fStage > hitHolder.stage) continue; - - handleHit(hitHolder); - } - } - } - } - } - - void SearchHits(const CbmTrackParam2& stateVec, Double_t stateZ, std::function<void(CbmTBin::HitHolder&)> handleHit); - void SearchHits(Segment& segment, std::function<void(CbmTBin::HitHolder&)> handleHit); - void SearchHits(Double_t minZ, Double_t maxZ, Double_t minY, Double_t maxY, Double_t minX, Double_t maxX, - Double_t minT, Double_t maxT, std::function<void(CbmTBin::HitHolder&)> handleHit); - -private: - CbmBinned3DStation(const CbmBinned3DStation&) = delete; - CbmBinned3DStation& operator=(const CbmBinned3DStation&) = delete; - -private: - CbmYBin* fYBins; -}; - -#endif /* STATION3D_H */ diff --git a/reco/tracking/BinnedTracker/Station4D.cxx b/reco/tracking/BinnedTracker/Station4D.cxx deleted file mode 100644 index 502e3a2ebd1c15fe33ef9a7cb832ac63c94c2b5b..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/Station4D.cxx +++ /dev/null @@ -1,13 +0,0 @@ -/* Copyright (C) 2017 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#include "Station4D.h" - -#include "Tracker.h" diff --git a/reco/tracking/BinnedTracker/Station4D.h b/reco/tracking/BinnedTracker/Station4D.h deleted file mode 100644 index ae6f2e08cc7634143ad1f006a7cbc78b295cf391..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/Station4D.h +++ /dev/null @@ -1,542 +0,0 @@ -/* Copyright (C) 2017-2019 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#ifndef STATION4D_H -#define STATION4D_H - -#include "Station.h" - -class CbmBinned4DStation : public CbmBinnedStation { -public: - CbmBinned4DStation(ECbmModuleId stationType, Double_t minZ, Double_t maxZ, int nofZBins, int nofYBins, int nofXBins, - int nofTBins) - : CbmBinnedStation(stationType, minZ, maxZ, nofYBins, nofXBins, nofTBins) - , fZBins(reinterpret_cast<CbmZBin*>(new unsigned char[nofZBins * sizeof(CbmZBin)])) - , fNofZBins(nofZBins) - , fZBinSize(0) - , fDtx(0) - , fDtxSq(0) - , fDty(0) - , fDtySq(0) - { - for (int i = 0; i < nofZBins; ++i) - new (&fZBins[i]) CbmZBin(nofYBins, nofXBins, nofTBins); - } - - void SetDtx(Double_t v) - { - if (v > fDtx) { - fDtx = v; - fDtxSq = v * v; - } - } - - void SetDty(Double_t v) - { - if (v > fDty) { - fDty = v; - fDtySq = v * v; - } - } - - void Clear() - { - fDtx = 0; - fDtxSq = 0; - fDty = 0; - fDtySq = 0; - CbmBinnedStation::Clear(); - - for (int i = 0; i < fNofZBins; ++i) { - CbmZBin& zBin = fZBins[i]; - zBin.SetUse(false); - - for (int j = 0; j < fNofYBins; ++j) { - CbmYBin& yBin = zBin[j]; - yBin.SetUse(false); - - for (int k = 0; k < fNofXBins; ++k) { - CbmXBin& xBin = yBin[k]; - xBin.SetUse(false); - - for (int l = 0; l < fNofTBins; ++l) { - CbmTBin& tBin = xBin[l]; - tBin.SetUse(false); - tBin.Clear(); - } - } - } - } - } - - void AddHit(ECbmModuleId type, const CbmPixelHit* hit, Int_t index) - { - Double_t z = hit->GetZ(); - - if (z < fMinZ || z >= fMaxZ) return; - - Double_t y = hit->GetY(); - - if (y < fMinY || y >= fMaxY) return; - - Double_t x = hit->GetX(); - - if (x < fMinX || x >= fMaxX) return; - - Double_t t = hit->GetTime(); - - if (t < fMinT || t >= fMaxT) return; - - int zInd = (z - fMinZ) / fZBinSize; - int yInd = (y - fMinY) / fYBinSize; - int xInd = (x - fMinX) / fXBinSize; - int tInd = (t - fMinT) / fTBinSize; - - CbmZBin& zBin = fZBins[zInd]; - CbmYBin& yBin = zBin[yInd]; - CbmXBin& xBin = yBin[xInd]; - CbmTBin& tBin = xBin[tInd]; - tBin.AddHit(type, hit, index, fDefaultUse); - SetDx(hit->GetDx()); - SetDy(hit->GetDy()); - SetDt(hit->GetTimeError()); - SetDtx(hit->GetDx() / hit->GetZ()); - SetDty(hit->GetDy() / hit->GetZ()); - - if (fDefaultUse) { - zBin.SetUse(true); - yBin.SetUse(true); - xBin.SetUse(true); - tBin.SetUse(true); - } - } - - void IterateHits(std::function<void(CbmTBin::HitHolder&)> handleHit) - { - for (int i = 0; i < fNofZBins; ++i) { - CbmZBin& zBin = fZBins[i]; - - if (!zBin.Use()) continue; - - for (int j = 0; j < fNofYBins; ++j) { - CbmYBin& yBin = zBin[j]; - - if (!yBin.Use()) continue; - - for (int k = 0; k < fNofXBins; ++k) { - CbmXBin& xBin = yBin[k]; - - if (!xBin.Use()) continue; - - for (int l = 0; l < fNofTBins; ++l) { - CbmTBin& tBin = xBin[l]; - - if (!tBin.Use()) continue; - - for (std::list<CbmTBin::HitHolder>::iterator hi = tBin.HitsBegin(); hi != tBin.HitsEnd(); ++hi) { - CbmTBin::HitHolder& hitHolder = *hi; - - if (fStage > hitHolder.stage) continue; - - handleHit(hitHolder); - } - } - } - } - } - } - - int GetZInd(Double_t v) const - { - int ind = (v - fMinZ) / fZBinSize; - - if (ind < 0) ind = 0; - else if (ind >= fNofZBins) - ind = fNofZBins - 1; - - return ind; - } - - Double_t GetYEnterZ(int yInd, Double_t ty) const - { - if (ty > 0) return (fMinY + yInd * fYBinSize) / ty; - else - return (fMinY + (yInd + 1) * fYBinSize) / ty; - } - - Double_t GetYExitZ(int yInd, Double_t ty) const - { - if (ty > 0) return (fMinY + (yInd + 1) * fYBinSize) / ty; - else - return (fMinY + yInd * fYBinSize) / ty; - } - - Double_t GetXEnterZ(int xInd, Double_t tx) const - { - if (tx > 0) return (fMinX + xInd * fXBinSize) / tx; - else - return (fMinX + (xInd + 1) * fXBinSize) / tx; - } - - Double_t GetXExitZ(int xInd, Double_t tx) const - { - if (tx > 0) return (fMinX + (xInd + 1) * fXBinSize) / tx; - else - return (fMinX + xInd * fXBinSize) / tx; - } - - void Init() - { - fZBinSize = (fMaxZ - fMinZ) / fNofZBins; - CbmBinnedStation::Init(); - } - - void SearchHits(const CbmTrackParam2& stateVec, Double_t stateZ, std::function<void(CbmTBin::HitHolder&)> handleHit) - { - Double_t deltaZmin = stateZ - fMinZ; - Double_t tx = stateVec.GetTx(); - Double_t ty = stateVec.GetTy(); - //Double_t C[21]; - //stateVec.CovMatrix(C); - Double_t wTx = cbmBinnedSigma * std::sqrt(stateVec.GetCovTxTx() + fDtxSq); - Double_t minTx = tx - wTx; - Double_t maxTx = tx + wTx; - Double_t wTy = cbmBinnedSigma * std::sqrt(stateVec.GetCovTyTy() + fDtySq); - Double_t minTy = ty - wTy; - Double_t maxTy = ty + wTy; - - if (minTy > 0 && stateVec.GetY() + minTy * deltaZmin >= fMaxY) return; - else if (maxTy < 0 && stateVec.GetY() + maxTy * deltaZmin < fMinY) - return; - - if (minTx > 0 && stateVec.GetX() + minTx * deltaZmin >= fMaxX) return; - else if (maxTx < 0 && stateVec.GetX() + minTx * deltaZmin < fMinX) - return; - - Double_t minZ = fMinZ; - Double_t maxZ = fMaxZ; - - Double_t searchZ = stateZ; - Double_t searchX = stateVec.GetX(); - Double_t searchY = stateVec.GetY(); - - if (minTy > 0) { - if ((fMaxY - searchY) / minTy + searchZ < maxZ) maxZ = (fMaxY - searchY) / minTy + searchZ; - } - else if (maxTy < 0) { - if ((fMinY - searchY) / maxTy + searchZ < maxZ) maxZ = (fMinY - searchY) / maxTy + searchZ; - } - - if (minTx > 0) { - if ((fMaxX - searchX) / minTx + searchZ < maxZ) maxZ = (fMaxX - searchX) / minTx + searchZ; - } - else if (maxTx < 0) { - if ((fMinX - searchX) / maxTx + searchZ < maxZ) maxZ = (fMinX - searchX) / maxTx + searchZ; - } - - int maxZind = GetZInd(maxZ); - - for (int i = 0; i <= maxZind; ++i) { - CbmZBin& zBin = fZBins[i]; - Double_t minZi = minZ + i * fZBinSize; - Double_t maxZi = minZ + (i + 1) * fZBinSize; - Double_t minY = minTy > 0 ? minTy * (minZi - searchZ) + searchY : minTy * (maxZi - searchZ) + searchY; - int minYind = GetYInd(minY); - Double_t maxY = maxTy > 0 ? maxTy * (maxZi - searchZ) + searchY : maxTy * (minZi - searchZ) + searchY; - int maxYind = GetYInd(maxY); - - for (int j = minYind; j <= maxYind; ++j) { - CbmYBin& yBin = zBin[j]; - Double_t minZj = maxZi; - Double_t maxZj = minZi; - Double_t tmp = GetYEnterZ(j, minTy); - - if (tmp < minZj && tmp > minZi) minZj = tmp; - - tmp = GetYEnterZ(j, maxTy); - - if (tmp < minZj && tmp > minZi) minZj = tmp; - - if (minZj == maxZi) minZj = minZi; - - tmp = GetYExitZ(j, minTy); - - if (tmp > maxZj && tmp < maxZi) maxZj = tmp; - - tmp = GetYExitZ(j, maxTy); - - if (tmp > maxZj && tmp < maxZi) maxZj = tmp; - - if (maxZj == minZi) maxZj = maxZi; - - Double_t minX = minTx > 0 ? minTx * (minZj - searchZ) + searchX : minTx * (maxZj - searchZ) + searchX; - Double_t maxX = maxTx > 0 ? maxTx * (maxZj - searchZ) + searchX : maxTx * (minZj - searchZ) + searchX; - int minXind = GetXInd(minX); - int maxXind = GetXInd(maxX); - - for (int k = minXind; k <= maxXind; ++k) { - CbmXBin& xBin = yBin[k]; - Double_t minZk = maxZj; - Double_t maxZk = minZj; - Double_t tmp2 = GetXEnterZ(k, minTx); - - if (tmp2 < minZk && tmp2 > minZj) minZk = tmp2; - - tmp2 = GetXEnterZ(k, maxTx); - - if (tmp2 < minZk && tmp2 > minZj) minZk = tmp2; - - if (minZk == maxZj) minZk = minZj; - - tmp2 = GetXExitZ(k, minTx); - - if (tmp2 > maxZk && tmp2 < maxZj) maxZk = tmp2; - - tmp2 = GetXExitZ(k, maxTx); - - if (tmp2 > maxZk && tmp2 < maxZj) maxZk = tmp2; - - if (maxZk == minZj) maxZk = maxZj; - - //Double_t minT = searchT + (minZk - searchZ) * timeCoeff - wT; - //Double_t maxT = searchT + (maxZk - searchZ) * timeCoeff + wT; - int minTind = 0; //GetTInd(minT); - int maxTind = 0; //fNofTBins - 1;//GetTInd(maxT); - - for (int l = minTind; l <= maxTind; ++l) { - CbmTBin& tBin = xBin[l]; - std::list<CbmTBin::HitHolder>::iterator hitIter = tBin.HitsBegin(); - std::list<CbmTBin::HitHolder>::iterator hitIterEnd = tBin.HitsEnd(); - - for (; hitIter != hitIterEnd; ++hitIter) { - /*const CbmPixelHit* hit = hitIter->hit; - Double_t z = hit->GetZ(); - Double_t zSq = z * z; - Double_t deltaY = hit->GetY() - ty * z; - - if (deltaY * deltaY > cbmBinnedSigmaSq * (dTySq * zSq + hit->GetDy() * hit->GetDy())) - continue; - - Double_t deltaX = hit->GetX() - tx * z; - - if (deltaX * deltaX > cbmBinnedSigmaSq * (dTxSq * zSq + hit->GetDx() * hit->GetDx())) - continue;*/ - - /*Double_t deltaT = hit->GetTime() - searchT - (z - searchZ) * timeCoeff; - - if (deltaT * deltaT > cbmBinnedSigmaSq * (dtSq + hit->GetTimeError() * hit->GetTimeError())) - continue;*/ - - CbmTBin::HitHolder& hitHolder = *hitIter; - - if (fStage > hitHolder.stage) continue; - - handleHit(hitHolder); - } - } - } - } - } - } - - void SearchHits(Segment& segment, std::function<void(CbmTBin::HitHolder&)>) - { - const CbmPixelHit* hit1 = segment.begin->hit; - Double_t x1 = hit1->GetX(); - Double_t y1 = hit1->GetY(); - Double_t dx1Sq = hit1->GetDx() * hit1->GetDx(); - Double_t dy1Sq = hit1->GetDy() * hit1->GetDy(); - - const CbmPixelHit* hit2 = segment.end->hit; - Double_t x2 = hit2->GetX(); - Double_t y2 = hit2->GetY(); - Double_t dx2Sq = hit2->GetDx() * hit2->GetDx(); - Double_t dy2Sq = hit2->GetDy() * hit2->GetDy(); - - Double_t segDeltaZ = hit2->GetZ() - hit1->GetZ(); - Double_t segDeltaZSq = segDeltaZ * segDeltaZ; - Double_t searchZ; - //Double_t searchT; (VF) not used - //Double_t dtSq; (VF) not used - - if (0 == hit1->GetTimeError()) { - searchZ = hit2->GetZ(); - // searchT = hit2->GetTime(); (VF) not used - // dtSq = hit2->GetTimeError() * hit2->GetTimeError(); (VF) not used - } - else { - searchZ = (hit1->GetZ() + hit2->GetZ()) / 2; - // searchT = (hit1->GetTime() + hit2->GetTime()) / 2; (VF) not used - // dtSq = (hit1->GetTimeError() * hit1->GetTimeError() + hit2->GetTimeError() * hit2->GetTimeError()) / 2; (VF) not used - } - - Double_t searchX = (x1 + x2) / 2; - Double_t searchY = (y1 + y2) / 2; - Double_t deltaZmin = searchZ - fMinZ; - //Double_t wT = cbmBinnedSigma * std::sqrt(dtSq + fDt * fDt); (VF) unused - Double_t tx = (x2 - x1) / segDeltaZ; - Double_t ty = (y2 - y1) / segDeltaZ; - //Double_t timeCoeff = std::sqrt(1 + tx * tx + ty * ty) / cbmBinnedSOL; (VF) unused - Double_t dTxSq = (dx1Sq + dx2Sq) / segDeltaZSq; - Double_t wTx = cbmBinnedSigma * std::sqrt(dTxSq + fDtxSq); - Double_t minTx = tx - wTx; - Double_t maxTx = tx + wTx; - Double_t dTySq = (dy1Sq + dy2Sq) / segDeltaZSq; - Double_t wTy = cbmBinnedSigma * std::sqrt(dTySq + fDtySq); - Double_t minTy = ty - wTy; - Double_t maxTy = ty + wTy; - - if (minTy > 0 && searchY + minTy * deltaZmin >= fMaxY) return; - else if (maxTy < 0 && searchY + maxTy * deltaZmin < fMinY) - return; - - if (minTx > 0 && searchX + minTx * deltaZmin >= fMaxX) return; - else if (maxTx < 0 && searchX + minTx * deltaZmin < fMinX) - return; - - Double_t minZ = fMinZ; - Double_t maxZ = fMaxZ; - - if (minTy > 0) { - if ((fMaxY - searchY) / minTy + searchZ < maxZ) maxZ = (fMaxY - searchY) / minTy + searchZ; - } - else if (maxTy < 0) { - if ((fMinY - searchY) / maxTy + searchZ < maxZ) maxZ = (fMinY - searchY) / maxTy + searchZ; - } - - if (minTx > 0) { - if ((fMaxX - searchX) / minTx + searchZ < maxZ) maxZ = (fMaxX - searchX) / minTx + searchZ; - } - else if (maxTx < 0) { - if ((fMinX - searchX) / maxTx + searchZ < maxZ) maxZ = (fMinX - searchX) / maxTx + searchZ; - } - - int maxZind = GetZInd(maxZ); - - for (int i = 0; i <= maxZind; ++i) { - CbmZBin& zBin = fZBins[i]; - Double_t minZi = minZ + i * fZBinSize; - Double_t maxZi = minZ + (i + 1) * fZBinSize; - Double_t minY = minTy > 0 ? minTy * (minZi - searchZ) + searchY : minTy * (maxZi - searchZ) + searchY; - int minYind = GetYInd(minY); - Double_t maxY = maxTy > 0 ? maxTy * (maxZi - searchZ) + searchY : maxTy * (minZi - searchZ) + searchY; - int maxYind = GetYInd(maxY); - - for (int j = minYind; j <= maxYind; ++j) { - CbmYBin& yBin = zBin[j]; - Double_t minZj = maxZi; - Double_t maxZj = minZi; - Double_t tmp = GetYEnterZ(j, minTy); - - if (tmp < minZj && tmp > minZi) minZj = tmp; - - tmp = GetYEnterZ(j, maxTy); - - if (tmp < minZj && tmp > minZi) minZj = tmp; - - if (minZj == maxZi) minZj = minZi; - - tmp = GetYExitZ(j, minTy); - - if (tmp > maxZj && tmp < maxZi) maxZj = tmp; - - tmp = GetYExitZ(j, maxTy); - - if (tmp > maxZj && tmp < maxZi) maxZj = tmp; - - if (maxZj == minZi) maxZj = maxZi; - - Double_t minX = minTx > 0 ? minTx * (minZj - searchZ) + searchX : minTx * (maxZj - searchZ) + searchX; - Double_t maxX = maxTx > 0 ? maxTx * (maxZj - searchZ) + searchX : maxTx * (minZj - searchZ) + searchX; - int minXind = GetXInd(minX); - int maxXind = GetXInd(maxX); - - for (int k = minXind; k <= maxXind; ++k) { - CbmXBin& xBin = yBin[k]; - Double_t minZk = maxZj; - Double_t maxZk = minZj; - Double_t tmp2 = GetXEnterZ(k, minTx); - - if (tmp2 < minZk && tmp2 > minZj) minZk = tmp2; - - tmp2 = GetXEnterZ(k, maxTx); - - if (tmp2 < minZk && tmp2 > minZj) minZk = tmp2; - - if (minZk == maxZj) minZk = minZj; - - tmp2 = GetXExitZ(k, minTx); - - if (tmp2 > maxZk && tmp2 < maxZj) maxZk = tmp2; - - tmp2 = GetXExitZ(k, maxTx); - - if (tmp2 > maxZk && tmp2 < maxZj) maxZk = tmp2; - - if (maxZk == minZj) maxZk = maxZj; - - //Double_t minT = searchT + (minZk - searchZ) * timeCoeff - wT; (VF) unused - //Double_t maxT = searchT + (maxZk - searchZ) * timeCoeff + wT; (VF) unused - int minTind = 0; //GetTInd(minT); - int maxTind = fNofTBins - 1; //GetTInd(maxT); - - for (int l = minTind; l <= maxTind; ++l) { - CbmTBin& tBin = xBin[l]; - std::list<CbmTBin::HitHolder>::iterator hitIter = tBin.HitsBegin(); - std::list<CbmTBin::HitHolder>::iterator hitIterEnd = tBin.HitsEnd(); - - for (; hitIter != hitIterEnd; ++hitIter) { - const CbmPixelHit* hit = hitIter->hit; - Double_t z = hit->GetZ(); - Double_t zSq = z * z; - Double_t deltaY = hit->GetY() - ty * z; - - if (deltaY * deltaY > cbmBinnedSigmaSq * (dTySq * zSq + hit->GetDy() * hit->GetDy())) continue; - - Double_t deltaX = hit->GetX() - tx * z; - - if (deltaX * deltaX > cbmBinnedSigmaSq * (dTxSq * zSq + hit->GetDx() * hit->GetDx())) continue; - - /*Double_t deltaT = hit->GetTime() - searchT - (z - searchZ) * timeCoeff; - - if (deltaT * deltaT > cbmBinnedSigmaSq * (dtSq + hit->GetTimeError() * hit->GetTimeError())) - continue;*/ - - Segment newSegment(segment.end, &(*hitIter)); - std::pair<std::set<Segment, SegmentComp>::iterator, bool> ir = fSegments.insert(newSegment); - segment.children.push_back(const_cast<Segment*>(&(*ir.first))); - //handleHit(*hitIter); - } - } - } - } - } - } - - void SearchHits(Double_t, Double_t, Double_t, Double_t, Double_t, Double_t, Double_t, Double_t, - std::function<void(CbmTBin::HitHolder&)>) - { - } - -private: - CbmBinned4DStation(const CbmBinned4DStation&) = delete; - CbmBinned4DStation& operator=(const CbmBinned4DStation&) = delete; - -private: - CbmZBin* fZBins; - int fNofZBins; - Double_t fZBinSize; - Double_t fDtx; - Double_t fDtxSq; - Double_t fDty; - Double_t fDtySq; -}; - -#endif /* STATION4D_H */ diff --git a/reco/tracking/BinnedTracker/Tracker.cxx b/reco/tracking/BinnedTracker/Tracker.cxx deleted file mode 100644 index b5fb8e88265c1ee68572dea75c1242d713c6c115..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/Tracker.cxx +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (C) 2017 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#include "CbmBinnedTrackerTask.h" - -CbmBinnedTracker* CbmBinnedTracker::Instance() -{ - static CbmBinnedTracker* theInstance = 0; - - if (0 == theInstance) { - if (CbmBinnedTrackerTask::Instance()) - theInstance = new CbmBinnedTracker(CbmBinnedTrackerTask::Instance()->GetBeamDx(), - CbmBinnedTrackerTask::Instance()->GetBeamDy()); - else - theInstance = new CbmBinnedTracker(0.1, 0.1); - } - - return theInstance; -} diff --git a/reco/tracking/BinnedTracker/Tracker.h b/reco/tracking/BinnedTracker/Tracker.h deleted file mode 100644 index 910a94c00c9d0cb33518208c7d6ffbc557e135b1..0000000000000000000000000000000000000000 --- a/reco/tracking/BinnedTracker/Tracker.h +++ /dev/null @@ -1,905 +0,0 @@ -/* Copyright (C) 2017-2020 Laboratory of Information Technologies, Joint Institute for Nuclear Research, Dubna - SPDX-License-Identifier: GPL-3.0-only - Authors: Timur Ablyazimov [committer] */ - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -#ifndef TRACKER_H -#define TRACKER_H - -#include <iostream> - -#include "Station.h" -#include "Station3D.h" - -//#define CBM_BINNED_DEBUG - -#ifdef CBM_BINNED_DEBUG -#include "Debug.h" -#endif //CBM_BINNED_DEBUG - -using namespace std; - -class CbmBinnedTracker { -public: - int fNofTrueSegments; - int fNofWrongSegments; - struct Track { - Track(CbmTBin::HitHolder** hits, int length, const CbmTrackParam2& lastParam, Double_t chiSq) - : fHits(new CbmTBin::HitHolder*[length]) - , fLength(0) - , fParams(new CbmTrackParam2[length]) - , fIsClone(false) - , fChiSq(chiSq) - { - for (int i = 0; i < length; ++i) { - if (ECbmModuleId::kRef == hits[i]->type) continue; - - hits[i]->stage = CbmBinnedTracker::Instance()->GetStage(); - fHits[fLength] = hits[i]; - fHits[fLength++]->tracks.push_back(this); - } - - fParams[fLength - 1] = lastParam; - Double_t chiSq2 = chiSq; - - CbmBinnedTracker* tracker = CbmBinnedTracker::Instance(); - - for (int i = fLength - 2; i >= 0; --i) { - fParams[i] = tracker->fStationArray[i + 1]->Extrapolate(fParams[i + 1], fHits[i]->hit->GetZ()); - CbmBinnedStation::Update(fParams[i], fHits[i]->hit, chiSq2); - } - } - - ~Track() - { - delete[] fHits; - delete[] fParams; - } - - Track(const Track&) = delete; - Track& operator=(const Track&) = delete; - CbmTBin::HitHolder** fHits; - int fLength; - //CbmBinnedStation::KFParams* fParams; - CbmTrackParam2* fParams; - bool fIsClone; - Double_t fChiSq; - }; - -public: - static CbmBinnedTracker* Instance(); - -public: - CbmBinnedTracker(Double_t beamDx, Double_t beamDy) - : fNofTrueSegments(0) - , fNofWrongSegments(0) - , fStations() - , fStationArray() - , fNofStations(0) - , fBeforeLastLevel(0) - , fChiSqCut(0) - , fTracks() - , fBeamDx(beamDx) - , fBeamDxSq(beamDx * beamDx) - , fBeamDy(beamDy) - , fBeamDySq(beamDy * beamDy) - , fVertex() - , fVertexPseudoStation(0) - , fCanSkipHits(-1 /* Indicates: calculate the default value*/) - , fStage(0) -#ifdef CBM_BINNED_DEBUG - , fDebug() -#endif //CBM_BINNED_DEBUG - { - fVertex.SetX(0); - fVertex.SetY(0); - fVertex.SetZ(0); - fVertex.SetDx(beamDx); - fVertex.SetDy(beamDy); - fVertex.SetDxy(0); - fVertex.SetZ(0); - fVertex.SetTime(0); - fVertex.SetTimeError(1000000000000); - } - - ~CbmBinnedTracker() { delete fVertexPseudoStation; } - - CbmBinnedTracker(const CbmBinnedTracker&) = delete; - CbmBinnedTracker& operator=(const CbmBinnedTracker&) = delete; - - void Init() - { - fVertexPseudoStation = new CbmBinned3DStation(ECbmModuleId::kRef, -0.1, 0.1, 1, 1, 1); - fVertexPseudoStation->SetMinY(-0.1); - fVertexPseudoStation->SetMaxY(0.1); - fVertexPseudoStation->SetMinX(-0.1); - fVertexPseudoStation->SetMaxX(0.1); - fVertexPseudoStation->Init(); - fVertexPseudoStation->AddHit(ECbmModuleId::kRef, &fVertex, -1); - - for (std::map<Double_t, CbmBinnedStation*>::const_iterator i = fStations.begin(); i != fStations.end(); ++i) { - fStationArray.push_back(i->second); - std::cout << "Station min and max Zs: " << i->second->GetMinZ() << ", " << i->second->GetMaxZ() << std::endl; - } - - if (fCanSkipHits < 0) fCanSkipHits = 0.3 * fStationArray.size(); - - fChiSqCut = (fStations.size() - fCanSkipHits) * cbmBinnedSigmaSq * 3; - } - - Double_t GetBeamDxSq() const { return fBeamDxSq; } - Double_t GetBeamDySq() const { return fBeamDySq; } - CbmPixelHit& GetVertex() { return fVertex; } - - void AddStation(CbmBinnedStation* station) - { - if (fStations.empty()) station->SetDefaultUse(); - - fStations[station->GetMinZ()] = station; - fNofStations = fStations.size(); - fBeforeLastLevel = fNofStations - 2; - } - - void SetChiSqCut(Double_t v) { fChiSqCut = v; } - - char GetStage() const { return fStage; } - - void SetStage(char v) - { - fStage = v; - fVertexPseudoStation->SetStage(v); - - for (std::vector<CbmBinnedStation*>::iterator i = fStationArray.begin(); i != fStationArray.end(); ++i) { - CbmBinnedStation* aStation = *i; - aStation->SetStage(v); - } - } - - void SetCanSkipHits(Int_t v) { fCanSkipHits = v; } - - void Reconstruct(Double_t startTime) - { - Clear(); - - for (std::map<Double_t, CbmBinnedStation*>::iterator i = fStations.begin(); i != fStations.end(); ++i) { - CbmBinnedStation* aStation = i->second; - aStation->SetMinT(startTime); - } - - CbmBinnedHitReader::Instance()->Read(); - //ReconstructLocal(); - //ReconstructGlobal(); - - for (int i = -1; i <= fCanSkipHits; ++i) { - SetStage(i + 1); - - for (int j = 0; j <= (i == fCanSkipHits ? 0 : 1); ++j) - SeedTracks(i, i + j + 1); - } - - FindClones(); - - std::cout << "Reconstructed " - << count_if(fTracks.begin(), fTracks.end(), [](const Track* t) { return !t->fIsClone; }) << " tracks" - << std::endl; - } - - std::list<Track*>::const_iterator GetTracksBegin() const { return fTracks.begin(); } - std::list<Track*>::const_iterator GetTracksEnd() const { return fTracks.end(); } - -private: - void Clear() - { - fVertexPseudoStation->SetStage(0); - - for (std::map<Double_t, CbmBinnedStation*>::iterator i = fStations.begin(); i != fStations.end(); ++i) { - CbmBinnedStation* aStation = i->second; - aStation->Clear(); - } - - for (std::list<Track*>::iterator i = fTracks.begin(); i != fTracks.end(); ++i) - delete *i; - - fTracks.clear(); - } - - void ReconstructLocal() - { - std::map<Double_t, CbmBinnedStation*>::iterator i = fStations.begin(); - i->second->CreateSegmentsFromHits(); - - for (; true;) { - CbmBinnedStation* curStation = i->second; - ++i; - - if (i == fStations.end()) break; - - CbmBinnedStation* nextStation = i->second; - curStation->IterateSegments([&](CbmBinnedStation::Segment& segment) -> void { - nextStation->SearchHits(segment, [&](CbmTBin::HitHolder& /*hitHolder*/) -> void {}); - }); - } - -#if 0 //def CBM_BINNED_DEBUG - static int nofRefTracks = 0; - static int nofRecoRefHits[] = { 0, 0, 0, 0, 0, 0 }; - fDebug.Exec(); - int stNo = 0; - CbmBinnedStation* firstStation = fStations.begin()->second; - - for (int i = 0; i < fDebug.fMCTracks.size(); ++i) - { - const CbmBinnedDebug::MCTrack& mcTrack = fDebug.fMCTracks[i]; - - if (!mcTrack.isRef) - continue; - - ++nofRefTracks; - bool found[] = { false, false, false, false, false, false }; - firstStation->IterateSegments( - [&](CbmBinnedStation::Segment& segment)->void - { - CbmTBin::HitHolder* hitHolder = segment.end; - - if (fDebug.TrackHasHit(stNo, i, hitHolder->index)) - found[stNo] = true; - - std::list<CbmBinnedStation::Segment*> tmp(segment.children); - - while(!tmp.empty()) - { - ++stNo; - std::list<CbmBinnedStation::Segment*> tmp2; - - for (std::list<CbmBinnedStation::Segment*>::const_iterator j = tmp.begin(); j != tmp.end(); ++j) - { - const CbmBinnedStation::Segment* s = *j; - tmp2.insert(tmp2.end(), s->children.begin(), s->children.end()); - CbmTBin::HitHolder* hh = s->end; - - if (fDebug.TrackHasHit(stNo, i, hh->index)) - found[stNo] = true; - } - - tmp.clear(); - tmp.splice(tmp.end(), tmp2); - } - - stNo = 0; - } - ); - - std::cout << "Reco hits: "; - - for (int j = 0; j < sizeof(nofRecoRefHits) / sizeof(int); ++j) - { - if (found[j]) - ++nofRecoRefHits[j]; - - double proc = 100 * nofRecoRefHits[j]; - proc /= nofRefTracks; - std::cout << "[" << proc << "%=" << nofRecoRefHits[j] << "/" << nofRefTracks << "]"; - } - - std::cout << std::endl << std::endl << std::endl; - } -#endif //CBM_BINNED_DEBUG - } - - Double_t GetChiSq(Double_t scatXSq, Double_t scatYSq, CbmBinnedStation::Segment& segment1, - CbmBinnedStation::Segment& segment2) const - { - const CbmPixelHit* hit1 = segment1.begin->hit; - const CbmPixelHit* hit2 = segment1.end->hit; - - if (hit2 != segment2.begin->hit) return cbmBinnedCrazyChiSq; - - /*Double_t chiSqCoeffX1 = stationNumber < 1 ? 1 : fStations[stationNumber - 1]->GetNofSigmaXSq() / cbmBinnedSigmaSq; - Double_t chiSqCoeffY1 = stationNumber < 1 ? 1 : fStations[stationNumber - 1]->GetNofSigmaYSq() / cbmBinnedSigmaSq; - Double_t chiSqCoeffX2 = fStations[stationNumber]->GetNofSigmaXSq() / cbmBinnedSigmaSq; - Double_t chiSqCoeffY2 = fStations[stationNumber]->GetNofSigmaYSq() / cbmBinnedSigmaSq; - Double_t chiSqCoeffX = fStations[stationNumber + 1]->GetNofSigmaXSq() / cbmBinnedSigmaSq; - Double_t chiSqCoeffY = fStations[stationNumber + 1]->GetNofSigmaYSq() / cbmBinnedSigmaSq;*/ - - const CbmPixelHit* hit = segment2.end->hit; - Double_t x1 = hit1->GetX(); - Double_t y1 = hit1->GetY(); - Double_t z1 = hit1->GetZ(); - // Double_t t1 = hit1->GetTime(); (FU) not used - Double_t dx1 = hit1->GetDx(); - Double_t dx1Sq = dx1 * dx1; - Double_t dy1 = hit1->GetDy(); - Double_t dy1Sq = dy1 * dy1; - // Double_t dt1 = hit1->GetTimeError(); (FU) not used - // Double_t dt1Sq = dt1 * dt1; (FU) not used - - Double_t x2 = hit2->GetX(); - Double_t y2 = hit2->GetY(); - Double_t z2 = hit2->GetZ(); - // Double_t t2 = hit2->GetTime(); (FU) not used - Double_t dx2 = hit2->GetDx(); - Double_t dx2Sq = dx2 * dx2; - Double_t dy2 = hit2->GetDy(); - Double_t dy2Sq = dy2 * dy2; - // Double_t dt2 = hit2->GetTimeError(); (FU) not used - // Double_t dt2Sq = dt2 * dt2; (FU) not used - - Double_t x = hit->GetX(); - Double_t y = hit->GetY(); - Double_t z = hit->GetZ(); - //Double_t t = hit->GetTime(); (VF) unused - Double_t dx = hit->GetDx(); - Double_t dxSq = dx * dx; - Double_t dy = hit->GetDy(); - Double_t dySq = dy * dy; - //Double_t dt = hit->GetTimeError(); (VF) unused - //Double_t dtSq = dt * dt; (VF) unused - - - /*dx1Sq *= chiSqCoeffX1; - dy1Sq *= chiSqCoeffY1; - dx2Sq *= chiSqCoeffX2; - dy2Sq *= chiSqCoeffY2; - dxSq *= chiSqCoeffX; - dySq *= chiSqCoeffY;*/ - - Double_t deltaZ12 = z2 - z1; - Double_t deltaZ = z - (z1 + z2) / 2; - Double_t coeff1 = (0.5 - deltaZ / deltaZ12); - Double_t coeff1Sq = coeff1 * coeff1; - Double_t coeff2 = (0.5 + deltaZ / deltaZ12); - Double_t coeff2Sq = coeff2 * coeff2; - - Double_t x12 = coeff1 * x1 + coeff2 * x2; - Double_t dx12Sq = coeff1Sq * dx1Sq + coeff2Sq * dx2Sq; - Double_t y12 = coeff1 * y1 + coeff2 * y2; - Double_t dy12Sq = coeff1Sq * dy1Sq + coeff2Sq * dy2Sq; - - // Double_t tx = (x2 - x1) / deltaZ12; (FU) not used - // Double_t ty = (y2 - y1) / deltaZ12; (FU) not used - - /* (VF) not used. - Double_t t12; - Double_t dt12Sq; - - if (0 == dt1) - { - t12 = t2 + std::sqrt(1 + tx * tx + ty * ty) * (z - z2) / cbmBinnedSOL; - dt12Sq = dt2Sq; - } - else - { - t12 = (t1 + t2) /2 + std::sqrt(1 + tx * tx + ty * ty) * deltaZ12 / cbmBinnedSOL; - dt12Sq = (dt1Sq + dt2Sq) / 2; - } - */ - - return (x - x12) * (x - x12) / (dx12Sq + dxSq + scatXSq) + (y - y12) * (y - y12) / (dy12Sq + dySq + scatYSq) - //+ (t - t12) * (t - t12) / (dt12Sq + dtSq) - ; - } - - Double_t GetChiSqWithoutTime(CbmBinnedStation::Segment& segment1, CbmBinnedStation::Segment& segment2) const - { - const CbmPixelHit* hit1 = segment1.begin->hit; - const CbmPixelHit* hit2 = segment1.end->hit; - - if (hit2 != segment2.begin->hit) return cbmBinnedCrazyChiSq; - - const CbmPixelHit* hit = segment2.end->hit; - Double_t x1 = hit1->GetX(); - Double_t y1 = hit1->GetY(); - Double_t z1 = hit1->GetZ(); - //Double_t t1 = hit1->GetTime(); (VF) unused - Double_t dx1 = hit1->GetDx(); - Double_t dx1Sq = dx1 * dx1; - Double_t dy1 = hit1->GetDy(); - Double_t dy1Sq = dy1 * dy1; - - Double_t x2 = hit2->GetX(); - Double_t y2 = hit2->GetY(); - Double_t z2 = hit2->GetZ(); - //Double_t t2 = hit2->GetTime(); (VF) unused - Double_t dx2 = hit2->GetDx(); - Double_t dx2Sq = dx2 * dx2; - Double_t dy2 = hit2->GetDy(); - Double_t dy2Sq = dy2 * dy2; - - Double_t x = hit->GetX(); - Double_t y = hit->GetY(); - Double_t z = hit->GetZ(); - //Double_t t = hit->GetTime(); (VF) unused - Double_t dx = hit->GetDx(); - Double_t dxSq = dx * dx; - Double_t dy = hit->GetDy(); - Double_t dySq = dy * dy; - - Double_t deltaZ12 = z2 - z1; - Double_t deltaZ = z - (z1 + z2) / 2; - Double_t coeff1 = (0.5 - deltaZ / deltaZ12); - Double_t coeff1Sq = coeff1 * coeff1; - Double_t coeff2 = (0.5 + deltaZ / deltaZ12); - Double_t coeff2Sq = coeff2 * coeff2; - - Double_t x12 = coeff1 * x1 + coeff2 * x2; - Double_t dx12Sq = coeff1Sq * dx1Sq + coeff2Sq * dx2Sq; - Double_t y12 = coeff1 * y1 + coeff2 * y2; - Double_t dy12Sq = coeff1Sq * dy1Sq + coeff2Sq * dy2Sq; - - //Double_t tx = (x2 - x1) / deltaZ12; (VF) unused - //Double_t ty = (y2 - y1) / deltaZ12; (VF) unused - - return (x - x12) * (x - x12) / (dx12Sq + dxSq) + (y - y12) * (y - y12) / (dy12Sq + dySq); - } - - /*void ReconstructGlobal() - { - std::map<Double_t, CbmBinnedStation*>::reverse_iterator stationIter = fStations.rbegin(); - CbmBinnedStation* lastStation = (stationIter++)->second; - lastStation->NulifySegments(); - - int stN = 4; - CbmBinnedStation* nextStation = lastStation; - - for (; stationIter != fStations.rend(); ++stationIter) - { - CbmBinnedStation* station = stationIter->second; - station->IterateSegments( - [&](CbmBinnedStation::Segment& segment)->void - { - CbmBinnedStation::Segment* closest = 0; - Double_t clDist = 0; - CbmBinnedStation::Segment* segChiSq = 0; - Double_t minSegChiSq = 0; - - for (std::list<CbmBinnedStation::Segment*>::iterator i = segment.children.begin(); i != segment.children.end(); ++i) - { - CbmBinnedStation::Segment* child = *i; - - if (child->chiSq > fChiSqCut) - continue; - - Double_t chiSq = GetChiSq(nextStation->GetScatXSq(), nextStation->GetScatYSq(), segment, *child) + child->chiSq; - - if (chiSq > fChiSqCut) - continue; - - if (segment.chiSq > chiSq) - { - segment.bestBranch = child; - segment.chiSq = chiSq; - } - } - } - ); - --stN; - nextStation = station; - } - - fStations.begin()->second->IterateSegments( - [&](CbmBinnedStation::Segment& segment)->void - { - if (segment.chiSq > fChiSqCut) - return; - - CbmTBin::HitHolder* trackHolders[fNofStations]; - CbmBinnedStation::Segment* segChain = &segment; - int i = 0; - - while (0 != segChain) - { - trackHolders[i++] = &segChain->end; - segChain = segChain->bestBranch; - } - - Track* aCandidate = new Track(trackHolders, fNofStations, segment.chiSq); - fTracks.push_back(aCandidate); - } - ); - }*/ - /*void TraverseTrackCandidates(int level, CbmBinnedStation::Segment** trackStart, CbmTBin::HitHolder** hhs, Double_t chiSq, std::list<Track*>& candidates, Double_t scatXSqs[6], Double_t scatYSqs[6]) - { - CbmBinnedStation::Segment* segment = trackStart[level]; - - for (std::list<CbmBinnedStation::Segment*>::iterator i = segment->children.begin(); i != segment->children.end(); ++i) - { - CbmBinnedStation::Segment* childSegment = *i; - Double_t deltaChiSq = GetChiSq(scatXSqs[level + 1], scatYSqs[level + 1], *segment, *childSegment); - Double_t chiSq2 = chiSq + deltaChiSq; - trackStart[level + 1] = childSegment; - hhs[level + 1] = childSegment->end; - - if (level == 4) - { - Track* aCandidate = new Track(hhs, 6, chiSq2); - candidates.push_back(aCandidate); - } - else - TraverseTrackCandidates(level + 1, trackStart, hhs, chiSq2, candidates, scatXSqs, scatYSqs); - } - }*/ - - //KFStation fKFStations[6]; - - /*void KFAddPointCoord(int stationNumber, CbmBinnedStation::KFParamsCoord& param, const CbmBinnedStation::KFParamsCoord& prevParam, - Double_t m, Double_t V, Double_t& chi2, Double_t z, Double_t prevZ, int coordNumber) - { - //const KFStation& station = fKFStations[stationNumber]; - const CbmBinnedStation* station = fStationArray[stationNumber]; - CbmBinnedStation::KFStation::Q Q = { 0 == coordNumber ? station->GetScatXSq() : station->GetScatYSq(), 0, 0, 0 }; - Double_t deltaZ = z - prevZ; - Double_t deltaZSq = deltaZ * deltaZ; - - // Extrapolate. - param.coord += prevParam.tg * deltaZ; // params[k].tg is unchanged. - - // Filter. - param.C11 += prevParam.C12 * deltaZ + prevParam.C21 * deltaZ + prevParam.C22 * deltaZSq + Q.Q11; - param.C12 += prevParam.C22 * deltaZ + Q.Q12; - param.C21 += prevParam.C22 * deltaZ + Q.Q21; - param.C22 += Q.Q22; - - Double_t S = 1.0 / (V + param.C11); - Double_t Kcoord = param.C11 * S; - Double_t Ktg = param.C21 * S; - Double_t dzeta = m - param.coord; - param.coord += Kcoord * dzeta; - param.tg += Ktg * dzeta; - param.C21 -= param.C11 * Ktg; - param.C22 -= param.C12 * Ktg; - param.C11 *= 1.0 - Kcoord; - param.C12 *= 1.0 - Kcoord; - chi2 += dzeta * S * dzeta; - } - - void KFAddPoint(int stationNumber, CbmBinnedStation::KFParams& param, const CbmBinnedStation::KFParams& prevParam, Double_t m[2], Double_t V[2], Double_t z, Double_t prevZ) - { - KFAddPointCoord(stationNumber, param.xParams, prevParam.xParams, m[0], V[0], param.chi2, z, prevZ, 0); - KFAddPointCoord(stationNumber, param.yParams, prevParam.yParams, m[1], V[1], param.chi2, z, prevZ, 1); - }*/ - - void TraverseTrackCandidates(int level, CbmBinnedStation::Segment** trackStart, CbmTBin::HitHolder** hhs, - ECbmModuleId* hts, std::list<Track*>& candidates, CbmTrackParam2 kfParamsPrev, - Double_t chiSqPrev) - { - CbmBinnedStation::Segment* segment = trackStart[level]; - const CbmPixelHit* hit = segment->end->hit; - CbmTrackParam2 kfParams = fStationArray[level]->Extrapolate(kfParamsPrev, hit->GetZ()); - Double_t chiSq = chiSqPrev; - CbmBinnedStation::Update(kfParams, hit, chiSq); - - //CbmBinnedSettings* settings = CbmBinnedSettings::Instance(); (VF) unused - - if (level == fNofStations - 1) { - Track* aCandidate = new Track(hhs, fNofStations, kfParams, chiSq); - candidates.push_back(aCandidate); - return; - } - - for (std::list<CbmBinnedStation::Segment*>::iterator i = segment->children.begin(); i != segment->children.end(); - ++i) { - CbmBinnedStation::Segment* childSegment = *i; - trackStart[level + 1] = childSegment; - hhs[level + 1] = childSegment->end; - TraverseTrackCandidates(level + 1, trackStart, hhs, hts, candidates, kfParams, chiSq); - } - } - - void ReconstructGlobal() - { - std::map<Double_t, CbmBinnedStation*>::iterator startStationIter = fStations.begin(); - CbmBinnedStation* startStation = startStationIter->second; - CbmBinnedStation* secondStation = fStationArray[1]; - startStation->IterateSegments([&](CbmBinnedStation::Segment& segment) -> void { - CbmBinnedStation::Segment* segments[fNofStations]; - segments[0] = &segment; - CbmTBin::HitHolder* trackHolders[fNofStations]; - ECbmModuleId hitTypes[fNofStations]; - trackHolders[0] = segment.end; - hitTypes[0] = secondStation->GetStationType(); - std::list<Track*> candidates; - - //TraverseTrackCandidates(0, segments, trackHolders, 0, candidates, scatXSqs, scatYSqs); - const CbmPixelHit* p1 = segment.begin->hit; - //const CbmPixelHit* p2 = segment.end->hit; (VF) unused - CbmTrackParam2 kfParams; - kfParams.SetX(p1->GetX()); - kfParams.SetTx(0); - kfParams.SetY(p1->GetY()); - kfParams.SetTy(0); - //kfParams.SetQp(1); - kfParams.SetZ(p1->GetZ()); - kfParams.SetTime(p1->GetTime()); - /*Double_t C[21]; - std::fill_n(C, 21, 0); - C[0] = p1->GetDx() * p1->GetDx();// Cxx - C[6] = p1->GetDy() * p1->GetDy();// Cyy - C[11] = 1;// Ctxtx - C[15] = 1;// Ctyty - C[18] = 1;// Cqpqp - C[20] = p1->GetTimeError() * p1->GetTimeError();// Ctt - kfParams.SetCovMatrix(C);*/ - kfParams.SetCovXX(p1->GetDx() * p1->GetDx()); - kfParams.SetCovYY(p1->GetDy() * p1->GetDy()); - kfParams.SetCovTxTx(1); - kfParams.SetCovTyTy(1); - kfParams.SetCovTT(p1->GetTimeError() * p1->GetTimeError()); - Double_t chiSq = 0; - TraverseTrackCandidates(0, segments, trackHolders, hitTypes, candidates, kfParams, chiSq); - Track* bestCandidate = 0; - - for (std::list<Track*>::iterator i = candidates.begin(); i != candidates.end(); ++i) { - Track* aCandidate = *i; - - if (0 == bestCandidate || aCandidate->fChiSq < bestCandidate->fChiSq) { - delete bestCandidate; - bestCandidate = aCandidate; - } - else - delete aCandidate; - } - - if (0 != bestCandidate) fTracks.push_back(bestCandidate); - }); - -#ifdef CBM_BINNED_DEBUG - static int nofRefTracks = 0; - static int nofRecoRefHits[] = {0, 0, 0, 0, 0, 0}; - fDebug.Exec(); - CbmBinnedStation* firstStation = fStations.begin()->second; - - for (int i = 0; i < fDebug.fMCTracks.size(); ++i) { - const CbmBinnedDebug::MCTrack& mcTrack = fDebug.fMCTracks[i]; - - if (!mcTrack.isRef) continue; - - for (std::list<Track*>::const_iterator j = fTracks.begin(); j != fTracks.end(); ++j) { - const Track* recoTrack = *j; - const CbmTBin::HitHolder* firstHit = recoTrack->fHits[0]; - - if (!fDebug.TrackHasHit(0, i, firstHit->index)) continue; - - ++nofRecoRefHits[0]; - ++nofRefTracks; - - for (int k = 1; k < 6; ++k) { - if (fDebug.TrackHasHit(k, i, recoTrack->fHits[k]->index)) ++nofRecoRefHits[k]; - } - } - } - - std::cout << "Reco hits: "; - - for (int j = 0; j < sizeof(nofRecoRefHits) / sizeof(int); ++j) { - double proc = 100 * nofRecoRefHits[j]; - proc /= nofRefTracks; - std::cout << "[" << proc << "%=" << nofRecoRefHits[j] << "/" << nofRefTracks << "]"; - } - - std::cout << std::endl << std::endl << std::endl; -#endif //CBM_BINNED_DEBUG - } - - void SeedTracks(int leftStationNo, int rightStationNo) - { - int skippedHits = rightStationNo - leftStationNo - 1; - CbmBinnedStation* leftStation = 0 > leftStationNo ? fVertexPseudoStation : fStationArray[leftStationNo]; - leftStation->IterateHits( - [this, &leftStationNo, &rightStationNo, &skippedHits](CbmTBin::HitHolder& leftHitHolder) -> void { -#ifdef __MACH__ - CbmTBin::HitHolder* trackHoldersBuf[fNofStations + 1]; - CbmTBin::HitHolder** trackHolders = trackHoldersBuf; - CbmTBin::HitHolder* tmpTrackHoldersBuf[fNofStations + 1]; - CbmTBin::HitHolder** tmpTrackHolders = tmpTrackHoldersBuf; -#else //__MACH__ - CbmTBin::HitHolder* trackHolders[fNofStations + 1]; - CbmTBin::HitHolder* tmpTrackHolders[fNofStations + 1]; -#endif //__MACH__ - tmpTrackHolders[0] = &leftHitHolder; - const CbmPixelHit* leftHit = leftHitHolder.hit; - CbmTrackParam2 kfParams; - kfParams.SetX(leftHit->GetX()); - kfParams.SetTx(0); - kfParams.SetY(leftHit->GetY()); - kfParams.SetTy(0); - kfParams.SetZ(leftHit->GetZ()); - kfParams.SetTime(leftHit->GetTime()); - kfParams.SetCovXX(leftHit->GetDx() * leftHit->GetDx()); - kfParams.SetCovYY(leftHit->GetDy() * leftHit->GetDy()); - kfParams.SetCovTxTx(1); - kfParams.SetCovTyTy(1); - kfParams.SetCovTT(leftHit->GetTimeError() * leftHit->GetTimeError()); - Double_t chiSq = 0; - int bestLength = 2; - CbmTrackParam2 bestKfParams = kfParams; - Double_t bestChiSq = cbmBinnedCrazyChiSq; - CbmBinnedStation* rightStation = fStationArray[rightStationNo]; - rightStation->IterateHits( - [this, &leftStationNo, &rightStationNo, &skippedHits, &trackHolders, &tmpTrackHolders, &kfParams, &chiSq, - &bestLength, &bestKfParams, &bestChiSq, &rightStation](CbmTBin::HitHolder& rightHitHolder) -> void { - tmpTrackHolders[1] = &rightHitHolder; - const CbmPixelHit* rightHit = rightHitHolder.hit; - CbmTrackParam2 updKfParams = rightStation->Extrapolate(kfParams, rightHit->GetZ()); - Double_t updChiSq = chiSq; - CbmBinnedStation::Update(updKfParams, rightHit, updChiSq); - - if (updChiSq > fChiSqCut) return; - - if (0 > leftStationNo) // Have to reset parameters here - { - bestChiSq = cbmBinnedCrazyChiSq; - bestLength = 2; - bestKfParams = kfParams; - } - - FollowTracks(0 > leftStationNo, skippedHits, rightStationNo, 3, tmpTrackHolders, updKfParams, updChiSq, - bestLength, trackHolders, bestKfParams, bestChiSq); - - if (0 > leftStationNo) // Have to save track here - { - if (bestLength - 1 >= fNofStations - fCanSkipHits) { - Track* aTrack = new Track(trackHolders, bestLength, bestKfParams, bestChiSq); - fTracks.push_back(aTrack); - } - } - } // Lambda - ); // rightStation->IterateHits() - - if (0 <= leftStationNo) // Have to save track here - { - if (bestLength >= fNofStations - fCanSkipHits) { - Track* aTrack = new Track(trackHolders, bestLength, bestKfParams, bestChiSq); - fTracks.push_back(aTrack); - } - } - }); - } - - void FollowTracks(bool isPrimary, int skippedHits, int prevStationNo, int length, CbmTBin::HitHolder** trackHolders, - CbmTrackParam2 kfParams, Double_t chiSq, int& bestLength, CbmTBin::HitHolder** bestTrackHolders, - CbmTrackParam2& bestKfParams, Double_t& bestChiSq) - { - Double_t prevZ = trackHolders[length - 2]->hit->GetZ(); - - for (char i = 0; i <= (prevStationNo < fNofStations - 2 ? 1 : 0) && skippedHits + i <= fCanSkipHits; ++i) { - Int_t stationNo = prevStationNo + i + 1; - CbmBinnedStation* aStation = fStationArray[stationNo]; - bool save = true; - aStation->SearchHits( - kfParams, prevZ, - [this, &isPrimary, &skippedHits, &length, &trackHolders, &kfParams, &chiSq, &bestLength, &bestTrackHolders, - &bestKfParams, &bestChiSq, &i, &stationNo, &aStation, &save](CbmTBin::HitHolder& hitHolder) -> void { - trackHolders[length - 1] = &hitHolder; - const CbmPixelHit* hit = hitHolder.hit; - CbmTrackParam2 updKfParams = aStation->Extrapolate(kfParams, hit->GetZ()); - Double_t updChiSq = chiSq; - CbmBinnedStation::Update(updKfParams, hit, updChiSq); - - Double_t chiSqCut = fChiSqCut; - - if (length - (isPrimary ? 1 : 0) > fNofStations - fCanSkipHits) - chiSqCut += (length - (isPrimary ? 1 : 0) - fNofStations + fCanSkipHits) * cbmBinnedSigmaSq * 3; - - if (updChiSq > chiSqCut || updChiSq > bestChiSq) return; - else { - save = false; - - if (stationNo < fNofStations - 1) { - FollowTracks(isPrimary, skippedHits + i, stationNo, length + 1, trackHolders, updKfParams, updChiSq, - bestLength, bestTrackHolders, bestKfParams, bestChiSq); - } - else { - if (length - (isPrimary ? 1 : 0) >= fNofStations - fCanSkipHits - && (length > bestLength || (length == bestLength && updChiSq < bestChiSq))) { - for (int j = 0; j < length; ++j) - bestTrackHolders[j] = trackHolders[j]; - - bestKfParams = updKfParams; - bestLength = length; - bestChiSq = chiSq; - } - } - } - } // Lambda - ); // SearchHits - - if (save) { - --length; - - if (length - (isPrimary ? 1 : 0) >= fNofStations - fCanSkipHits - && (length > bestLength || (length == bestLength && chiSq < bestChiSq))) { - for (int j = 0; j < length; ++j) - bestTrackHolders[j] = trackHolders[j]; - - bestKfParams = kfParams; - bestLength = length; - bestChiSq = chiSq; - } - } - } - } - - void FindClones() - { - for (std::list<Track*>::iterator i = fTracks.begin(); i != fTracks.end(); ++i) { - Track* track = *i; - - if (track->fIsClone) continue; - - std::map<Track*, int> cloneNofs; - - for (int j = 0; j < track->fLength; ++j) { - CbmTBin::HitHolder* hit = track->fHits[j]; - std::set<Track*> neighbourTracks; - - for (std::list<void*>::iterator k = hit->tracks.begin(); k != hit->tracks.end(); ++k) { - Track* track2 = static_cast<Track*>(*k); - - if (track2 == track || track2->fIsClone) continue; - - neighbourTracks.insert(track2); - } - - for (std::set<Track*>::iterator k = neighbourTracks.begin(); k != neighbourTracks.end(); ++k) { - Track* track2 = *k; - std::map<Track*, int>::iterator cni = cloneNofs.find(track2); - - if (cni == cloneNofs.end()) cloneNofs[track2] = 1; - else - ++cni->second; - } - } - - for (std::map<Track*, int>::iterator j = cloneNofs.begin(); j != cloneNofs.end(); ++j) { - Track* track2 = j->first; - auto minLength = track->fLength < track2->fLength ? track->fLength : track2->fLength; - - if (j->second < int(0.7 * minLength)) continue; - - if (track2->fLength > track->fLength) { - track->fIsClone = true; - break; - } - else if (track2->fLength == track->fLength) { - if (track2->fChiSq < track->fChiSq) { - track->fIsClone = true; - break; - } - else - track2->fIsClone = true; - } - else - track2->fIsClone = true; - } - } - } - -private: - std::map<Double_t, CbmBinnedStation*> fStations; - std::vector<CbmBinnedStation*> fStationArray; - int fNofStations; - int fBeforeLastLevel; - Double_t fChiSqCut; - std::list<Track*> fTracks; - Double_t fBeamDx; - Double_t fBeamDxSq; - Double_t fBeamDy; - Double_t fBeamDySq; - CbmPixelHit fVertex; - CbmBinnedStation* fVertexPseudoStation; - Int_t fCanSkipHits; - char fStage; -#ifdef CBM_BINNED_DEBUG - CbmBinnedDebug fDebug; -#endif - - friend class CbmBinnedTrackerQa; - friend struct CbmBinnedTracker::Track; -}; - -#endif /* TRACKER_H */ diff --git a/reco/tracking/CMakeLists.txt b/reco/tracking/CMakeLists.txt index 6d50463016d5b392f954deef234b7c82a97eaf3f..1581466c115bdf0b759d3577629102cefa37e5b4 100644 --- a/reco/tracking/CMakeLists.txt +++ b/reco/tracking/CMakeLists.txt @@ -1,4 +1,3 @@ Add_subdirectory(lx) #Add_subdirectory(lxTriplet) Add_subdirectory(global) -Add_subdirectory(BinnedTracker)