Commit 12342e51 authored by Sergey Gorbunov's avatar Sergey Gorbunov Committed by Sergey Gorbunov
Browse files

L1: fix memory allocation for large input

parent a3456d4e
......@@ -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());
......
......@@ -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;
......
......@@ -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());
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment