diff --git a/macro/run/run_reco_tb_track.C b/macro/run/run_reco_tb_track.C index 518cf39ce92a0d48357298ada55807b74a538127..b288146cee64923a9b80f93aa3581a862fc4a365 100644 --- a/macro/run/run_reco_tb_track.C +++ b/macro/run/run_reco_tb_track.C @@ -41,7 +41,8 @@ using std::endl; void run_reco_tb_track(TString dataSet = "test", Int_t nSlices = -1, - TString setup = "sis100_electron") { + TString setup = "sis100_electron", + Bool_t useMC = kFALSE) { // ========================================================================= // === Settings === @@ -53,6 +54,7 @@ void run_reco_tb_track(TString dataSet = "test", TString inFile = dataSet + ".raw.root"; // Input file (digis) TString parFile = dataSet + ".par.root"; // Parameter file TString outFile = dataSet + ".tb.rec.root"; // Output file + TString traFile = dataSet + ".tra.root"; // Transport file // Log level TString logLevel = "INFO"; // switch to DEBUG or DEBUG1,... for more info @@ -83,6 +85,13 @@ void run_reco_tb_track(TString dataSet = "test", FairMonitor::GetMonitor()->EnableMonitor(kTRUE, monitorFile); // ------------------------------------------------------------------------ + // ----- MC manager ------------------------------------------- + + if (useMC) { + CbmMCDataManager* mcManager = new CbmMCDataManager("MCDataManager", 0); + mcManager->AddFile(traFile); + run->AddTask(mcManager); + } // ---- Set the log level ----------------------------------------------- FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data()); @@ -170,14 +179,38 @@ void run_reco_tb_track(TString dataSet = "test", // run->AddTask(ECbmModuleId::psdHit); // std::cout << "-I- : Added task CbmPsdHitProducer" << std::endl; + if (useMC) { + // --- STS MC matching ---------------------------------------------- + CbmMatchRecoToMC* matchTask = new CbmMatchRecoToMC(); + matchTask->SetIncludeMvdHitsInStsTrack(0); + run->AddTask(matchTask); + } + // --- STS track finder - run->AddTask(new CbmKF()); - CbmL1* l1 = new CbmL1(); - l1->SetDataMode(1); - run->AddTask(l1); - CbmStsTrackFinder* stsTrackFinder = new CbmL1StsTrackFinder(); - FairTask* stsFindTracks = new CbmStsFindTracks(0, stsTrackFinder); - run->AddTask(stsFindTracks); + { + TString geoTag; + CbmSetup::Instance()->GetGeoTag(ECbmModuleId::kSts, geoTag); + + TString parFile1 = gSystem->Getenv("VMCWORKDIR"); + parFile1 = + parFile1 + "/parameters/sts/sts_matbudget_" + geoTag(0, 4) + ".root"; + LOG(info) << "CA: Using material budget file " << parFile1; + bool err = gSystem->AccessPathName(parFile1); + if (!err) { + run->AddTask(new CbmKF()); + CbmL1* l1 = new CbmL1("CbmL1", 2, (useMC ? 3 : 0)); + l1->SetStsMaterialBudgetFileName(parFile1.Data()); + l1->SetDataMode(1); + l1->SetUseHitErrors(1); + run->AddTask(l1); + CbmStsTrackFinder* stsTrackFinder = new CbmL1StsTrackFinder(); + FairTask* stsFindTracks = new CbmStsFindTracks(0, stsTrackFinder); + run->AddTask(stsFindTracks); + } else { + LOG(warning) + << "CA: STS material budget file doesn't exist, L1 reco stops"; + } + } // // // --- Event builder (track-based) // run->AddTask(new CbmBuildEventsFromTracksReal()); diff --git a/reco/L1/CbmL1Def.h b/reco/L1/CbmL1Def.h index 807f15cc521e3c591f3eab48ca5b13e2cb159790..ca650b6d650e4ce196a7d9f815c2d6b4d13db56d 100644 --- a/reco/L1/CbmL1Def.h +++ b/reco/L1/CbmL1Def.h @@ -99,12 +99,15 @@ public: T& operator[](const size_t index) { + + //assert(index <= fSize); // allow auto-resize by 1 element only + if (index >= std::vector<T>::size()) { #ifdef _OPENMP #pragma omp critical #endif std::vector<T>::resize(index + 1); - std::cout << index << " index " << std::endl; + std::cout << "Warning: L1Vector autoresize to " << index + 1 << std::endl; } if (index >= fSize) fSize = index + 1; diff --git a/reco/L1/L1Algo/L1Algo.cxx b/reco/L1/L1Algo/L1Algo.cxx index 0c5fff580ae9fc5328b5cc9941077d49918e2c33..facebf72028b97faefde1c8e65430e33dea6a3f7 100644 --- a/reco/L1/L1Algo/L1Algo.cxx +++ b/reco/L1/L1Algo/L1Algo.cxx @@ -192,14 +192,44 @@ void L1Algo::SetData(const vector<L1StsHit>& StsHits_, vSFlag = &SFlag_; vSFlagB = &SFlagB_; - StsHitsStartIndex = StsHitsStartIndex_; StsHitsStopIndex = StsHitsStopIndex_; + // TODO: maximal array sizes need to be adjusted + + int nHits = vStsHits->size(); + + vStsDontUsedHits_A.resize(nHits); + vStsDontUsedHits_B.resize(nHits); + vStsDontUsedHits_Buf.resize(nHits); + vStsDontUsedHitsxy_A.resize(nHits); + vStsDontUsedHitsxy_buf.resize(nHits); + vStsDontUsedHitsxy_B.resize(nHits); + RealIHit_v.resize(nHits); + RealIHit_v_buf.resize(nHits); + RealIHit_v_buf2.resize(nHits); + +#ifdef _OPENMP + hitToBestTrackF.resize(nHits); + hitToBestTrackB.resize(nHits); +#endif + vStripToTrack.resize(nHits); + vStripToTrackB.resize(nHits); + + TripForHit[0].resize(nHits); + TripForHit[1].resize(nHits); + NHitsIsecAll = nHits; + n_g1.resize(2 * nHits); + + for (int i = 0; i < fNThreads; i++) { + vTracks_local[i].resize(nHits / 10); + vRecoHits_local[i].resize(nHits); + CandidatesTrack[i].resize(nHits / 10); + for (int j = 0; j < MaxNStations; j++) + TripletsLocal1[j][i].resize(2 * nHits); + } - /* - - + /* vStsHits.resize(StsHits_.size()); vStsStrips.resize(StsStrips_.size()); vStsStripsB.resize(StsStripsB_.size()); diff --git a/reco/L1/L1Algo/L1CATrackFinder.cxx b/reco/L1/L1Algo/L1CATrackFinder.cxx index 34f74f9ea80308c14516ee8378960f3fec36895d..8036b862084058c868cc6781bb73cea1d685b8d2 100644 --- a/reco/L1/L1Algo/L1CATrackFinder.cxx +++ b/reco/L1/L1Algo/L1CATrackFinder.cxx @@ -1694,7 +1694,7 @@ L1Algo::TripletsStaPort( /// creates triplets: input: @istal - start station nu L1_assert(hitsr_3[i] < StsHitsUnusedStopIndex[istar] - StsHitsUnusedStartIndex[istar]); - // if (n3 >= MaxPortionTriplets) cout << "isec: " << isec << " stantion: " << istal << " portion number: " << ip << " CATrackFinder: Warning: Too many Triplets created in portion" << endl; + // if (n3 >= MaxPortionTriplets) cout << "isec: " << isec << " station: " << istal << " portion number: " << ip << " CATrackFinder: Warning: Too many Triplets created in portion" << endl; /// Add the right hits to parameters estimation. f31( // input @@ -2101,7 +2101,7 @@ void L1Algo::CATrackFinder() { MaxDZ = 0.1; if (NStations > MaxNStations) - cout << " CATrackFinder: Error: Too many Stantions" << endl; + cout << " CATrackFinder: Error: Too many Stations" << endl; } #ifndef L1_NO_ASSERT