diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index 3b4896bee58f7f48015bf080b4e253ba0d792ecc..eb0b058a86c83f408e36f12d2ae800787c8243d3 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -948,7 +948,7 @@ void CbmL1::Reconstruct(CbmEvent* event) if (event) { - fpData->fStripFlag.clear(); + //fpData->fStripFlag.clear(); areDataLeft = false; TsStart = 0; @@ -958,12 +958,15 @@ void CbmL1::Reconstruct(CbmEvent* event) } if (fSTAPDataMode >= 2) { // 2,3 - fpData->ReadHitsFromFile(fSTAPDataDir.Data(), 1, fVerbose); + // TODO: Rewrite it: + //fpData->ReadHitsFromFile(fSTAPDataDir.Data(), 1, fVerbose); - fpAlgo->SetData(fpData->GetHits(), fpData->GetNstrips(), fpData->GetSFlag(), fpData->GetHitsStartIndex(), - fpData->GetHitsStopIndex()); + // TODO: Rewrite it: + //fpAlgo->SetData(fpData->GetHits(), fpData->GetNstrips(), fpData->GetSFlag(), fpData->GetHitsStartIndex(), + // fpData->GetHitsStopIndex()); } else { + // TODO: There is no use in passing fpData into the ReadEvent function -> remove (S.Zharko) ReadEvent(fpData, TsStart, TsLength, TsOverlap, FstHitinTs, areDataLeft, event); } @@ -1033,8 +1036,7 @@ void CbmL1::Reconstruct(CbmEvent* event) WriteSTAPPerfData(); }; if (fSTAPDataMode >= 2) { // 2,3 - //ReadSTAPAlgoData(); - + ReadSTAPAlgoData(); ReadSTAPPerfData(); }; @@ -1044,17 +1046,17 @@ void CbmL1::Reconstruct(CbmEvent* event) // FieldIntegralCheck(); // TODO: Remove code below (S.Zharko) - for (unsigned int iH = 0; iH < (*fpAlgo->vHits).size(); ++iH) { -#ifdef USE_EVENT_NUMBER - L1Hit& h = const_cast<L1Hit&>((*fpAlgo->vHits)[iH]); - h.n = -1; -#endif - if (fvExternalHits[iH].mcPointIds.size() == 0) continue; -#ifdef USE_EVENT_NUMBER - const CbmL1MCPoint& mcp = fvMCPoints[fvExternalHits[iH].mcPointIds[0]]; - h.n = mcp.event; -#endif - } + // for (unsigned int iH = 0; iH < (*fpAlgo->vHits).size(); ++iH) { + // #ifdef USE_EVENT_NUMBER + // L1Hit& h = const_cast<L1Hit&>((*fpAlgo->vHits)[iH]); + // h.n = -1; + // #endif + // if (fvExternalHits[iH].mcPointIds.size() == 0) continue; + // #ifdef USE_EVENT_NUMBER + // const CbmL1MCPoint& mcp = fvMCPoints[fvExternalHits[iH].mcPointIds[0]]; + // h.n = mcp.event; + // #endif + // } if (fVerbose > 1) { cout << "L1 Track finder..." << endl; } fpAlgo->CATrackFinder(); @@ -1116,7 +1118,7 @@ void CbmL1::Reconstruct(CbmEvent* event) int start_hit1 = start_hit; if (fpAlgo->fRecoHits[start_hit1] > fvExternalHits.size() - 1) start_hit++; else if (!fLegacyEventMode) { - t.Hits.push_back(((*fpAlgo->vHits)[fpAlgo->fRecoHits[start_hit]]).ID); + t.Hits.push_back((fpAlgo->GetInputData()->GetHit(fpAlgo->fRecoHits[start_hit]).ID)); } else { t.Hits.push_back(fpAlgo->fRecoHits[start_hit]); @@ -1162,10 +1164,10 @@ void CbmL1::Reconstruct(CbmEvent* event) continue; ///Discard tracks from overlap region /// set strips as unused - for (unsigned int i = 0; i < HitsLocal.size(); i++) { - fpAlgo->SetFUnUsed(const_cast<unsigned char&>((*fpAlgo->fStripFlag)[fvExternalHits[HitsLocal[i]].f])); - fpAlgo->SetFUnUsed(const_cast<unsigned char&>((*fpAlgo->fStripFlag)[fvExternalHits[HitsLocal[i]].b])); - } + //for (unsigned int i = 0; i < HitsLocal.size(); i++) { + // fpAlgo->SetFUnUsed(const_cast<unsigned char&>((*fpAlgo->fStripFlag)[fvExternalHits[HitsLocal[i]].f])); + // fpAlgo->SetFUnUsed(const_cast<unsigned char&>((*fpAlgo->fStripFlag)[fvExternalHits[HitsLocal[i]].b])); + //} } vRTracksCur.push_back(t); } @@ -1225,18 +1227,18 @@ void CbmL1::Reconstruct(CbmEvent* event) if ((fPerformance) && (fSTAPDataMode < 2)) { InputPerformance(); } - - for (unsigned int iH = 0; iH < (*fpAlgo->vHits).size(); ++iH) { -#ifdef USE_EVENT_NUMBER - L1Hit& h = const_cast<L1Hit&>((*fpAlgo->vHits)[iH]); - h.n = -1; -#endif - if (fvExternalHits[iH].mcPointIds.size() == 0) continue; -#ifdef USE_EVENT_NUMBER - const CbmL1MCPoint& mcp = fvMCPoints[fvExternalHits[iH].mcPointIds[0]]; - h.n = mcp.event; -#endif - } + // TODO: Remove this code (S.Zharko) + // for (unsigned int iH = 0; iH < (*fpAlgo->vHits).size(); ++iH) { + //#ifdef USE_EVENT_NUMBER + // L1Hit& h = const_cast<L1Hit&>((*fpAlgo->vHits)[iH]); + // h.n = -1; + //#endif + // if (fvExternalHits[iH].mcPointIds.size() == 0) continue; + //#ifdef USE_EVENT_NUMBER + // const CbmL1MCPoint& mcp = fvMCPoints[fvExternalHits[iH].mcPointIds[0]]; + // h.n = mcp.event; + //#endif + // } // output performance if (fPerformance) { @@ -1371,536 +1373,35 @@ void CbmL1::IdealTrackFinder() /// ----- STandAlone Package service-functions ----------------------------- -void CbmL1::WriteSTAPGeoData(const L1Vector<float>& geo_) +void CbmL1::WriteSTAPGeoData(const L1Vector<float>& /*geo_*/) { - // write geo in file - TString fgeo_name = fSTAPDataDir + "geo_algo.txt"; - std::ofstream fgeo(fgeo_name); - fgeo.setf(ios::scientific, ios::floatfield); - fgeo.precision(20); - int size = geo_.size(); - for (int i = 0; i < size; i++) { - fgeo << geo_[i] << endl; - }; - fgeo.close(); - cout << "-I- CbmL1: Geometry data has been written in " << fgeo_name << endl; -} // void CbmL1::WriteSTAPGeoData(void* geo_, int size) - + LOG(fatal) << "CbmL1: Running in standalone mode is not available at the moment. It will be updated soon..."; +} void CbmL1::WriteSTAPAlgoData() // must be called after ReadEvent { - // write algo data in file - static int vNEvent = 1; - std::fstream fadata; - - TString fadata_name = fSTAPDataDir + "data_algo.txt"; - // if ( vNEvent <= maxNEvent ) { - if (1) { - - if (vNEvent == 1) fadata.open(fadata_name, std::fstream::out); // begin new file - else - fadata.open(fadata_name, std::fstream::out | std::fstream::app); - - fadata << "Event:" - << " "; - fadata << vNEvent << endl; - // write vStrips - int n = fpAlgo->fNstrips; - fadata << n << endl; - if (fVerbose >= 4) { - cout << "vStrips[" << n << "]" - << " have been written." << endl; - } - // write fStripFlag - n = (*fpAlgo->fStripFlag).size(); - fadata << n << endl; - unsigned char element; - for (int i = 0; i < n; i++) { - element = (*fpAlgo->fStripFlag)[i]; - fadata << static_cast<int>(element) << endl; - }; - if (fVerbose >= 4) { - cout << "fStripFlag[" << n << "]" - << " have been written." << endl; - } - if (fVerbose >= 4) { - cout << "fStripFlagB[" << n << "]" - << " have been written." << endl; - } - // write vHits - n = (*fpAlgo->vHits).size(); - fadata << n << endl; - for (int i = 0; i < n; i++) { - const L1Hit& h = (*fpAlgo->vHits)[i]; - fadata << static_cast<int>(h.f) << " "; - fadata << static_cast<int>(h.b) << " "; -#ifdef USE_EVENT_NUMBER - fadata << static_cast<unsigned short int>(h.n) << " "; -#endif - fadata << h.z << " "; - fadata << h.u << " "; - fadata << h.v << " "; - // fadata << (*fpAlgo->vHits)[i].time << endl; - fadata << h.t << endl; - }; - if (fVerbose >= 4) { - cout << "vHits[" << n << "]" - << " have been written." << endl; - } - // write HitsStartIndex and HitsStopIndex - n = 20; - for (int i = 0; i < n; i++) { - if (int(L1Constants::size::kMaxNstations) + 1 > i) { fadata << fpAlgo->HitsStartIndex[i] << endl; } - else { - fadata << 0 << endl; - } - }; - for (int i = 0; i < n; i++) { - if (int(L1Constants::size::kMaxNstations) + 1 > i) fadata << fpAlgo->HitsStopIndex[i] << endl; - else - fadata << 0 << endl; - }; - - - fadata.close(); - } - cout << "-I- CbmL1: CATrackFinder data for event number " << vNEvent << " have been written in file " << fadata_name - << endl; - vNEvent++; -} // void CbmL1::WriteSTAPAlgoData() - + LOG(fatal) << "CbmL1: Running in standalone mode is not available at the moment. It will be updated soon..."; +} void CbmL1::WriteSTAPPerfData() // must be called after ReadEvent { - std::fstream fpdata; - fpdata << std::setprecision(8); - - static int vNEvent = 1; - - TString fpdata_name = fSTAPDataDir + "data_perfo.txt"; - // write data for performance in file - // if ( vNEvent <= maxNEvent ) { - if (1) { - - if (vNEvent == 1) fpdata.open(fpdata_name, std::fstream::out); // begin new file - else - fpdata.open(fpdata_name, std::fstream::out | std::fstream::app); - - fpdata << "Event: "; - fpdata << vNEvent << endl; - // write fvMCPoints - Int_t n = fvMCPoints.size(); // number of elements - fpdata << n << endl; - for (int i = 0; i < n; i++) { - fpdata << fvMCPoints[i].xIn << " "; - fpdata << fvMCPoints[i].yIn << " "; - fpdata << fvMCPoints[i].zIn << " "; - fpdata << fvMCPoints[i].pxIn << " "; - fpdata << fvMCPoints[i].pyIn << " "; - fpdata << fvMCPoints[i].pzIn << " " << endl; - fpdata << fvMCPoints[i].xOut << " "; - fpdata << fvMCPoints[i].yOut << " "; - fpdata << fvMCPoints[i].zOut << " "; - fpdata << fvMCPoints[i].pxOut << " "; - fpdata << fvMCPoints[i].pyOut << " "; - fpdata << fvMCPoints[i].pzOut << " " << endl; - - fpdata << fvMCPoints[i].p << " "; - fpdata << fvMCPoints[i].q << " "; - fpdata << fvMCPoints[i].mass << " "; - fpdata << fvMCPoints[i].time << " "; - - fpdata << fvMCPoints[i].pdg << " "; - fpdata << fvMCPoints[i].ID << " "; - fpdata << fvMCPoints[i].mother_ID << " "; - fpdata << fvMCPoints[i].iStation << endl; - - const int nhits = fvMCPoints[i].hitIds.size(); - fpdata << nhits << endl << " "; - for (int k = 0; k < nhits; k++) { - fpdata << fvMCPoints[i].hitIds[k] << " "; - }; - fpdata << endl; - }; - if (fVerbose >= 4) { - cout << "fvMCPoints[" << n << "]" - << " have been written." << endl; - } - // write fvMCTracks . without Points - n = fvMCTracks.size(); // number of elements - fpdata << n << endl; - for (int i = 0; i < n; i++) { - fpdata << fvMCTracks[i].x << " "; - fpdata << fvMCTracks[i].y << " "; - fpdata << fvMCTracks[i].z << " "; - fpdata << fvMCTracks[i].px << " "; - fpdata << fvMCTracks[i].py << " "; - fpdata << fvMCTracks[i].pz << " "; - fpdata << fvMCTracks[i].p << " "; - fpdata << fvMCTracks[i].q << " "; - fpdata << fvMCTracks[i].mass << " "; - fpdata << fvMCTracks[i].time << " "; - - fpdata << fvMCTracks[i].pdg << " "; - fpdata << fvMCTracks[i].ID << " "; - fpdata << fvMCTracks[i].mother_ID << endl; - - int nhits = fvMCTracks[i].Hits.size(); - fpdata << " " << nhits << endl << " "; - for (int k = 0; k < nhits; k++) { - fpdata << fvMCTracks[i].Hits[k] << " "; - }; - fpdata << endl; - - const int nPoints = fvMCTracks[i].Points.size(); - fpdata << nPoints << endl << " "; - for (int k = 0; k < nPoints; k++) { - fpdata << fvMCTracks[i].Points[k] << " "; - }; - fpdata << endl; - - fpdata << fvMCTracks[i].nMCContStations << " "; - fpdata << fvMCTracks[i].nHitContStations << " "; - fpdata << fvMCTracks[i].maxNStaMC << " "; - fpdata << fvMCTracks[i].maxNSensorMC << " "; - fpdata << fvMCTracks[i].maxNStaHits << " "; - fpdata << fvMCTracks[i].nStations << endl; - }; - if (fVerbose >= 4) { - cout << "fvMCTracks[" << n << "]" - << " have been written." << endl; - } - // write fvHitPointIndexes - n = fvHitPointIndexes.size(); // number of elements - fpdata << n << endl; - for (int i = 0; i < n; i++) { - fpdata << fvHitPointIndexes[i] << endl; - }; - if (fVerbose >= 4) { - cout << "fvHitPointIndexes[" << n << "]" - << " have been written." << endl; - } - // write fvHitStore - n = fvHitStore.size(); // number of elements - fpdata << n << endl; - for (int i = 0; i < n; i++) { - fpdata << fvHitStore[i].ExtIndex << " "; - fpdata << fvHitStore[i].iStation << " "; - - fpdata << fvHitStore[i].x << " "; - fpdata << fvHitStore[i].y << endl; - }; - if (fVerbose >= 4) { - cout << "fvHitStore[" << n << "]" - << " have been written." << endl; - } - // write fvExternalHits - n = fvExternalHits.size(); // number of elements - fpdata << n << endl; - for (int i = 0; i < n; i++) { - fpdata << fvExternalHits[i].hitId << " "; - fpdata << fvExternalHits[i].extIndex << endl; - - const int nPoints = fvExternalHits[i].mcPointIds.size(); - fpdata << nPoints << endl << " "; - for (int k = 0; k < nPoints; k++) { - fpdata << fvExternalHits[i].mcPointIds[k] << " "; - }; - fpdata << endl; - }; - if (fVerbose >= 4) { - cout << "fvExternalHits[" << n << "]" - << " have been written." << endl; - } - fpdata.close(); - } - cout << "-I- CbmL1: Data for performance of event number " << vNEvent << " have been written in file " << fpdata_name - << endl; - vNEvent++; + LOG(fatal) << "CbmL1: Running in standalone mode is not available at the moment. It will be updated soon..."; } // void CbmL1::WriteSTAPPerfData() -std::istream& CbmL1::eatwhite(std::istream& is) // skip spaces +void CbmL1::ReadSTAPGeoData(L1Vector<fscal>& /*geo_*/, int& /*size*/) { - char c; - while (is.get(c)) { - if (isspace(c) == 0) { - is.putback(c); - break; - } - } - return is; -} - -//void CbmL1::ReadSTAPGeoData(L1Vector<float> geo_, int &size) -//void CbmL1::ReadSTAPGeoData(L1Vector<fscal> geo_, int &size) -void CbmL1::ReadSTAPGeoData(L1Vector<fscal>& geo_, int& size) -{ - TString fgeo_name = fSTAPDataDir + "geo_algo.txt"; - std::ifstream fgeo(fgeo_name); - - cout << "-I- CbmL1: Read geometry from file " << fgeo_name << endl; - int i; - for (i = 0; !fgeo.eof(); i++) { - fscal tmp; - fgeo >> tmp >> eatwhite; - cout << " geo_[" << i << "]=" << geo_[i] << " tmp= " << tmp << endl; - geo_[i] = tmp; - }; - size = i; - fgeo.close(); + LOG(fatal) << "CbmL1: Running in standalone mode is not available at the moment. It will be updated soon..."; } // void CbmL1::ReadSTAPGeoData(void* geo_, int &size) void CbmL1::ReadSTAPAlgoData() { - static int nEvent = 1; - static std::fstream fadata; - TString fadata_name = fSTAPDataDir + "data_algo.txt"; - // if (nEvent <= maxNEvent){ - if (1) { - if (nEvent == 1) fadata.open(fadata_name, std::fstream::in); - - if (fpAlgo->vHits) fpAlgo->vHits->clear(); - fpAlgo->fNstrips = 0; - if (fpAlgo->fStripFlag) fpAlgo->fStripFlag->clear(); - - // check correct position in file - char s[] = "Event: "; - int nEv; - fadata >> s; - fadata >> nEv; - if (nEv != nEvent) cout << "-E- CbmL1: Can't read event number " << nEvent << " from file " << fadata_name << endl; - - int n; // number of elements - // read fpAlgo->vStrips - fadata >> n; - cout << " n " << n << endl; - fpAlgo->fNstrips = n; - if (fVerbose >= 4) { - cout << "vStrips[" << n << "]" - << " have been read." << endl; - } - // read fpAlgo->fStripFlag - fadata >> n; - for (int i = 0; i < n; i++) { - int element; - fadata >> element; - fpAlgo->fStripFlag->push_back(static_cast<unsigned char>(element)); - } - if (fVerbose >= 4) { - cout << "fStripFlag[" << n << "]" - << " have been read." << endl; - } - // read fpAlgo->vHits - fadata >> n; - int element_f; // for convert - int element_b; - int element_n; - for (int i = 0; i < n; i++) { - L1Hit element; - fadata >> element_f >> element_b >> element_n >> element.z >> element.u >> element.v >> element.t; - element.f = static_cast<L1HitIndex_t>(element_f); - element.b = static_cast<L1HitIndex_t>(element_b); - fpAlgo->vHits->push_back(element); - } - if (fVerbose >= 4) { - cout << "vHits[" << n << "]" - << " have been read." << endl; - } - // read HitsStartIndex and HitsStopIndex - n = 20; // TODO: Why 20? (S.Zh.) - for (int i = 0; i < n; i++) { - int tmp; - fadata >> tmp; - if (int(L1Constants::size::kMaxNstations) + 1 > i) (const_cast<unsigned int&>(fpAlgo->HitsStartIndex[i]) = tmp); - } - for (int i = 0; i < n; i++) { - int tmp; - fadata >> tmp; - if (int(L1Constants::size::kMaxNstations) + 1 > i) (const_cast<unsigned int&>(fpAlgo->HitsStopIndex[i]) = tmp); - } - - cout << "-I- CbmL1: CATrackFinder data for event " << nEvent << " has been read from file " << fadata_name - << " successfully." << endl; - } - nEvent++; -} // void CbmL1::ReadSTAPAlgoData() + LOG(fatal) << "CbmL1: Running in standalone mode is not available at the moment. It will be updated soon..."; +} void CbmL1::ReadSTAPPerfData() { - static int nEvent = 1; - static std::fstream fpdata; - TString fpdata_name = fSTAPDataDir + "data_perfo.txt"; - // if (nEvent <= maxNEvent){ - if (1) { - if (nEvent == 1) { fpdata.open(fpdata_name, std::fstream::in); }; - - fvMCPoints.clear(); - fvMCTracks.clear(); - fvHitPointIndexes.clear(); - fvHitStore.clear(); - fvExternalHits.clear(); - dFEI2vMCPoints.clear(); - dFEI2vMCTracks.clear(); - // check if it is right position in file - char s[] = "EVENT: "; // buffer - int nEv = 0; // event number - fpdata >> s; - fpdata >> nEv; - - if (nEv != nEvent) - cout << "-E- CbmL1: Performance: can't read event number " << nEvent << " from file " - << "data_perfo.txt" << endl; - // fvMCPoints - int n; // number of elements - fpdata >> n; - for (int i = 0; i < n; i++) { - CbmL1MCPoint element; - - fpdata >> element.xIn; - fpdata >> element.yIn; - fpdata >> element.zIn; - fpdata >> element.pxIn; - fpdata >> element.pyIn; - fpdata >> element.pzIn; - - fpdata >> element.xOut; - fpdata >> element.yOut; - fpdata >> element.zOut; - fpdata >> element.pxOut; - fpdata >> element.pyOut; - fpdata >> element.pzOut; - - fpdata >> element.p; - fpdata >> element.q; - fpdata >> element.mass; - fpdata >> element.time; - - fpdata >> element.pdg; - fpdata >> element.ID; - fpdata >> element.mother_ID; - fpdata >> element.iStation; - - int nhits; - fpdata >> nhits; - for (int k = 0; k < nhits; k++) { - int helement; - fpdata >> helement; - element.hitIds.push_back(helement); - }; - - fvMCPoints.push_back(element); - }; - if (fVerbose >= 4) { - cout << "fvMCPoints[" << n << "]" - << " have been read." << endl; - } - // fvMCTracks . without Points - fpdata >> n; - for (int i = 0; i < n; i++) { - CbmL1MCTrack element; - - fpdata >> element.x; - fpdata >> element.y; - fpdata >> element.z; - fpdata >> element.px; - fpdata >> element.py; - fpdata >> element.pz; - fpdata >> element.p; - fpdata >> element.q; - fpdata >> element.mass; - fpdata >> element.time; - - fpdata >> element.pdg; - fpdata >> element.ID; - fpdata >> element.mother_ID; - - int nhits; - fpdata >> nhits; - for (int k = 0; k < nhits; k++) { - int helement; - fpdata >> helement; - element.Hits.push_back(helement); - }; - fpdata >> nhits; - for (int k = 0; k < nhits; k++) { - int helement; - fpdata >> helement; - element.Points.push_back(helement); - }; - - fpdata >> element.nMCContStations; - fpdata >> element.nHitContStations; - fpdata >> element.maxNStaMC; - fpdata >> element.maxNSensorMC; - fpdata >> element.maxNStaHits; - fpdata >> element.nStations; - - element.CalculateIsReconstructable(); - fvMCTracks.push_back(element); - }; - if (fVerbose >= 4) { - cout << "fvMCTracks[" << n << "]" - << " have been read." << endl; - } - // fvHitPointIndexes - fpdata >> n; - fvHitPointIndexes.reserve(n); - for (int i = 0; i < n; i++) { - int element; - fpdata >> element; - fvHitPointIndexes.push_back(element); - }; - if (fVerbose >= 4) { - cout << "fvHitPointIndexes[" << n << "]" - << " have been read." << endl; - } - // fvHitStore - fpdata >> n; - fvHitStore.reserve(n); - for (int i = 0; i < n; i++) { - CbmL1HitStore element; - fpdata >> element.ExtIndex; - fpdata >> element.iStation; - - fpdata >> element.x; - fpdata >> element.y; - fvHitStore.push_back(element); - }; - if (fVerbose >= 4) { - cout << "fvHitStore[" << n << "]" - << " have been read." << endl; - } - // fvExternalHits - fpdata >> n; - for (int i = 0; i < n; i++) { - CbmL1Hit element; - fpdata >> element.hitId; - fpdata >> element.extIndex; - - int nPoints; - fpdata >> nPoints; - for (int k = 0; k < nPoints; k++) { - int id; - fpdata >> id; - element.mcPointIds.push_back(id); - }; - fvExternalHits.push_back(element); - }; - if (fVerbose >= 4) { - cout << "fvExternalHits[" << n << "]" - << " have been read." << endl; - } - - // if (nEvent == maxNEvent) { // file open on begin of all work class and close at end - // fpdata.close(); - // cout << " -I- Performance: data read from file " << "data_perfo.txt" << " successfully"<< endl; - // } - cout << "-I- CbmL1: L1Performance data for event " << nEvent << " has been read from file " << fpdata_name - << " successfully." << endl; - - } // if (nEvent <= maxNEvent) - nEvent++; -} // void CbmL1::ReadSTAPPerfData() + LOG(fatal) << "CbmL1: Running in standalone mode is not available at the moment. It will be updated soon..."; +} void CbmL1::WriteSIMDKFData() { diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h index c97afc589c5e0bf4a744dc35614ee9da30c1fccc..3e0204c03442d74269b87a5e77a6d49f4b46ac6a 100644 --- a/reco/L1/CbmL1.h +++ b/reco/L1/CbmL1.h @@ -238,6 +238,13 @@ public: if (fpInitManager) { fpInitManager->SetOutputConfigName(std::string(filename)); } } + /// Sets flag: to correct input hits on MC or not + /// \param flag: true - hits will be corrected on MC information + void SetCorrectHitsOnMC(bool flag) { fIfCorrectHitsOnMC = flag; } + + /// Gets flag: to correct input hits on MC or not + bool GetCorrectHitsOnMC() const { return fIfCorrectHitsOnMC; } + /// Correction function for the material budget map /// It fills bins with no statistics template<L1DetectorID detID> @@ -461,6 +468,8 @@ private: bool fUseTRD = false; ///< if Trd data should be processed bool fUseTOF = false; ///< if Tof data should be processed + bool fIfCorrectHitsOnMC = false; ///< if correct input hits on MC information (debug) + // ** Raw input data ** CbmTimeSlice* fTimeSlice = nullptr; ///< Pointer to the TS object diff --git a/reco/L1/CbmL1Hit.h b/reco/L1/CbmL1Hit.h index 92e83bc98cb27ecf28165746643186514fe84c17..4f7e645b46c00b50ea26092872ae401a7d4eb2ad 100644 --- a/reco/L1/CbmL1Hit.h +++ b/reco/L1/CbmL1Hit.h @@ -16,7 +16,7 @@ public: CbmL1Hit(int hitId_, int extIndex_, int Det_) : hitId(hitId_), extIndex(extIndex_), Det(Det_) {}; - int hitId = 0; ///< index of L1Hit in algo->vHits array. Should be equal to index of this in L1->vHits + int hitId = 0; ///< index of L1Hit in fInputData::fvHits array. Should be equal to index of this in L1->vHits int extIndex = 0; ///< index of hit in the TClonesArray array int Det = 0; ///< station index float x = 0.f; ///< measured X coordinate diff --git a/reco/L1/CbmL1MCTrack.cxx b/reco/L1/CbmL1MCTrack.cxx index cb065fef292ae40b8f9c245cdf357c9a31d5e54f..46e57059b34376da94741eefd8216dc5348d73fb 100644 --- a/reco/L1/CbmL1MCTrack.cxx +++ b/reco/L1/CbmL1MCTrack.cxx @@ -124,7 +124,7 @@ void CbmL1MCTrack::CalculateHitCont() { for (int ih = 0; ih < nhits; ih++) { int jh = Hits[ih]; - const L1Hit& h = (*algo->vHits)[jh]; + const L1Hit& h = algo->GetInputData()->GetHit(jh); int ista = h.iSt; if (ista - istaold == 1) ncont++; diff --git a/reco/L1/CbmL1Performance.cxx b/reco/L1/CbmL1Performance.cxx index 6c972c209cd7aeda7747949ce85889dba332926e..c4ead6cfeeb75b255554b9f6ecde35dcb21b91d9 100644 --- a/reco/L1/CbmL1Performance.cxx +++ b/reco/L1/CbmL1Performance.cxx @@ -1065,17 +1065,17 @@ void CbmL1::HistoPerformance() // TODO: check if works correctly. Change vHitRe } // for mcTracks int NFakes = 0; - for (unsigned int ih = 0; ih < fpAlgo->vHits->size(); ih++) { + for (unsigned int ih = 0; ih < fpAlgo->GetInputData()->GetNhits(); ih++) { int iMC = fvHitPointIndexes[ih]; // TODO2: adapt to linking if (iMC < 0) NFakes++; } h_reco_time->Fill(fTrackingTime); h_reco_timeNtr->Fill(mc_total, fTrackingTime); - h_reco_timeNhit->Fill(fpAlgo->vHits->size(), fTrackingTime); + h_reco_timeNhit->Fill(fpAlgo->GetInputData()->GetNhits(), fTrackingTime); h_reco_fakeNtr->Fill(mc_total, NFakes); - h_reco_fakeNhit->Fill(fpAlgo->vHits->size() - NFakes, NFakes); + h_reco_fakeNhit->Fill(fpAlgo->GetInputData()->GetNhits() - NFakes, NFakes); h_reg_MCmom->Scale(1.f / NEvents); diff --git a/reco/L1/CbmL1ReadEvent.cxx b/reco/L1/CbmL1ReadEvent.cxx index 89d3ab69160a7ee7b74838eb3082f3fc39aea944..52acdeebcc50bfed3f94a5e93606afbf809374ab 100644 --- a/reco/L1/CbmL1ReadEvent.cxx +++ b/reco/L1/CbmL1ReadEvent.cxx @@ -49,7 +49,6 @@ #include "TDatabasePDG.h" #include "TRandom.h" - #include <iostream> using std::cout; @@ -1147,9 +1146,10 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, fIODataManager.ReserveNhits(nHits); fIODataManager.SetNhitKeys(NStrips); + // ----- Fill - for (int i = 0; i < nHits; i++) { - TmpHit& th = tmpHits[i]; + for (int iHit = 0; iHit < nHits; ++iHit) { + TmpHit& th = tmpHits[iHit]; CbmL1HitStore s; s.Det = th.Det; @@ -1162,7 +1162,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, s.dxy = th.dxy; s.time = th.time; - fvSortedHitsIndexes[th.id] = i; + fvSortedHitsIndexes[th.id] = iHit; assert(th.iStripF >= 0 || th.iStripF < NStrips); assert(th.iStripB >= 0 || th.iStripB < NStrips); @@ -1180,19 +1180,19 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, h.z = th.z; h.iSt = th.iStation; - // save hit - fvExternalHits.push_back(CbmL1Hit(fpData->vHits.size(), th.ExtIndex, th.Det)); + fvExternalHits.push_back(CbmL1Hit(iHit, th.ExtIndex, th.Det)); - fvExternalHits[fvExternalHits.size() - 1].x = th.x; - fvExternalHits[fvExternalHits.size() - 1].y = th.y; - fvExternalHits[fvExternalHits.size() - 1].t = th.time; + fvExternalHits[iHit].x = th.x; + fvExternalHits[iHit].y = th.y; + fvExternalHits[iHit].t = th.time; - fvExternalHits[fvExternalHits.size() - 1].ID = th.id; + fvExternalHits[iHit].ID = th.id; - fvExternalHits[fvExternalHits.size() - 1].f = th.iStripF; - fvExternalHits[fvExternalHits.size() - 1].b = th.iStripB; + fvExternalHits[iHit].f = th.iStripF; + fvExternalHits[iHit].b = th.iStripB; + // TODO: Here one should fill in the fvExternalHits[iHit].mcPointIds fData_->vHits.push_back(h); fIODataManager.PushBackHit(h); @@ -1200,7 +1200,6 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, int iSt = th.iStation; if (fData_->HitsStartIndex[iSt] == static_cast<L1HitIndex_t>(-1)) { fData_->HitsStartIndex[iSt] = nEffHits; } - assert(nEffHits == i); nEffHits++; fData_->HitsStopIndex[iSt] = nEffHits; diff --git a/reco/L1/L1Algo/L1Algo.cxx b/reco/L1/L1Algo/L1Algo.cxx index 667b28ea4522fe74f65a08b9da37fee4a553f337..3f9c221c391c13f0f3ebfc1979fb8165fb3bdf55 100644 --- a/reco/L1/L1Algo/L1Algo.cxx +++ b/reco/L1/L1Algo/L1Algo.cxx @@ -104,8 +104,12 @@ void L1Algo::Init(const bool UseHitErrors, const TrackingMode mode, const bool M // void L1Algo::ReceiveInputData(L1InputData&& inputData) { + // ----- Get input data ---------------------------------------------------------------------------------------------- fInputData = std::move(inputData); // TODO: Reset here internal data (probably, we should have additional class for internal data) + + // ----- Reset data arrays ------------------------------------------------------------------------------------------- + fvHitKeyFlags.reset(fInputData.GetNhitKeys()); } @@ -113,7 +117,7 @@ void L1Algo::ReceiveInputData(L1InputData&& inputData) void L1Algo::SetData(L1Vector<L1Hit>& Hits_, int nStrips_, L1Vector<unsigned char>& SFlag_, const L1HitIndex_t* HitsStartIndex_, const L1HitIndex_t* HitsStopIndex_) { - + // TODO: Remove (S.Zharko) vHits = &Hits_; fNstrips = nStrips_; fStripFlag = &SFlag_; @@ -122,7 +126,7 @@ void L1Algo::SetData(L1Vector<L1Hit>& Hits_, int nStrips_, L1Vector<unsigned cha HitsStopIndex = HitsStopIndex_; // TODO: maximal array sizes need to be adjusted - + // TODO: move to ReceiveInputData function (S.Zharko) int nHits = vHits->size(); NHitsIsecAll = nHits; // TODO: Is it needed? diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h index fcbf372edeae273f99887e39c8fef2c2bbd97729..bd609a58a9fe591cc9b86e263e7c37d9dc38cfad 100644 --- a/reco/L1/L1Algo/L1Algo.h +++ b/reco/L1/L1Algo/L1Algo.h @@ -175,6 +175,8 @@ public: /// Receives input data void ReceiveInputData(L1InputData&& inputData); + /// Gets pointer to input data object for external access + const L1InputData* GetInputData() const { return &fInputData; } /// ----- Hit-point-strips conversion routines ------ @@ -456,12 +458,12 @@ private: // ** Member variables list ** // *************************** + L1InputData fInputData; ///< Tracking input data + L1Vector<unsigned char> fvHitKeyFlags { "L1Algo::fvHitKeyFlags"}; ///< List of key flags: has been this hit or cluster already used public: - L1InputData fInputData; ///< Tracking input data - int fNstrips {0}; ///< number of strips L1Vector<L1Hit>* vHits {nullptr}; ///< hits as a combination of front and back strips and z-position L1Grid vGrid[L1Constants::size::kMaxNstations]; ///< diff --git a/reco/L1/L1Algo/L1CATrackFinder.cxx b/reco/L1/L1Algo/L1CATrackFinder.cxx index 0747f42398b64e709d0f4826c6bf9c4e021b2603..5ce6bf683a0f86586685d0f91f1161fa36e1dcbf 100644 --- a/reco/L1/L1Algo/L1CATrackFinder.cxx +++ b/reco/L1/L1Algo/L1CATrackFinder.cxx @@ -1055,7 +1055,7 @@ inline void L1Algo::findTripletsStep2( // input // TODO not updated after gaps fscal u[NHits], v[NHits], x[NHits], y[NHits], z[NHits]; for (int ih = 0; ih < NHits; ++ih) { - const L1Hit& hit = (*vHits)[ihit[ih]]; + const L1Hit& hit = fInputData.GetHit(ihit[ih]); u[ih] = hit.u; v[ih] = hit.v; std::tie(x[ih], y[ih]) = sta[ih].ConvUVtoXY<fscal>(u[ih], v[ih]); @@ -1789,8 +1789,8 @@ void L1Algo::CATrackFinder() fTracks.clear(); fRecoHits.clear(); - fRecoHits.reserve(2 * vHits->size()); - fTracks.reserve(2 * vHits->size() / fNstations); + fRecoHits.reserve(2 * fInputData.GetNhits()); + fTracks.reserve(2 * fInputData.GetNhits() / fNstations); int nNotUsedHits = 0; @@ -1807,7 +1807,7 @@ void L1Algo::CATrackFinder() for (int ist = 0; ist < fNstations; ++ist) for (L1HitIndex_t ih = HitsStartIndex[ist]; ih < HitsStopIndex[ist]; ++ih) { - const float& time = (*vHits)[ih].t; + const float& time = fInputData.GetHit(ih).t; if ((lasttime < time) && (!std::isinf(time))) lasttime = time; if ((starttime > time) && (time > 0)) starttime = time; } @@ -1843,8 +1843,8 @@ void L1Algo::CATrackFinder() int start = HitsUnusedStartIndex[iS]; int nhits = HitsUnusedStopIndex[iS] - start; if (nhits > 0) { - vGridTime[iS].StoreHits(nhits, &((*vHits)[start]), iS, *this, start, &(vNotUsedHits_Buf[start]), - &((*vHits)[start]), &(RealIHit_v[start])); + vGridTime[iS].StoreHits(nhits, &(fInputData.GetHit(start)), iS, *this, start, &(vNotUsedHits_Buf[start]), + &(fInputData.GetHit(start)), &(RealIHit_v[start])); } else { // to avoid out-of-range crash in array[start] vGridTime[iS].StoreHits(nhits, nullptr, iS, *this, start, nullptr, nullptr, nullptr); @@ -1854,9 +1854,15 @@ void L1Algo::CATrackFinder() for (int ist = 0; ist < fNstations; ++ist) for (L1HitIndex_t ih = HitsStartIndex[ist]; ih < HitsStopIndex[ist]; ++ih) { - L1Hit& h = (*vHits)[ih]; - SetFUnUsed((*fStripFlag)[h.f]); - SetFUnUsed((*fStripFlag)[h.b]); + const L1Hit& h = fInputData.GetHit(ih); + //SetFUnUsed((*fStripFlag)[h.f]); + //SetFUnUsed((*fStripFlag)[h.b]); + //L1_SHOW(fInputData.GetNhitKeys()); + //L1_SHOW(fvHitKeyFlags.size()); + //L1_SHOW(h.f); + //L1_SHOW(h.b); + fvHitKeyFlags[h.f] = 0; + fvHitKeyFlags[h.b] = 0; } for (int ista = 0; ista < fNstations; ++ista) { @@ -2235,8 +2241,8 @@ void L1Algo::CATrackFinder() int thread_num = 0; #endif L1Triplet& first_trip = (fTriplets[istaF][iThread][itrip]); - if (GetFUsed((*fStripFlag)[(*vHitsUnused)[first_trip.GetLHit()].f] - | (*fStripFlag)[(*vHitsUnused)[first_trip.GetLHit()].b])) { + if (fvHitKeyFlags[(*vHitsUnused)[first_trip.GetLHit()].f] + || fvHitKeyFlags[(*vHitsUnused)[first_trip.GetLHit()].b]) { continue; } // ghost supression !!! @@ -2344,7 +2350,7 @@ void L1Algo::CATrackFinder() if (tr.fIsAlive) continue; for (int iHit = 0; iHit < (int) tr.fHits.size(); ++iHit) { - const L1Hit& h = (*vHits)[tr.fHits[iHit]]; + const L1Hit& h = fInputData.GetHit(tr.fHits[iHit]); bool isAlive = true; { // front strip #ifdef _OPENMP @@ -2400,13 +2406,13 @@ void L1Algo::CATrackFinder() tr.fIsAlive = true; for (int iHit = 0; tr.fIsAlive && (iHit < (int) tr.fHits.size()); ++iHit) { - const L1Hit& h = (*vHits)[tr.fHits[iHit]]; + const L1Hit& h = fInputData.GetHit(tr.fHits[iHit]); tr.fIsAlive = tr.fIsAlive && ((fStripToTrack)[h.f] == tr.fID) && ((fStripToTrack)[h.b] == tr.fID); } if (!tr.fIsAlive) { // release strips for (int iHit = 0; (iHit < (int) tr.fHits.size()); ++iHit) { - const L1Hit& h = (*vHits)[tr.fHits[iHit]]; + const L1Hit& h = fInputData.GetHit(tr.fHits[iHit]); if (fStripToTrack[h.f] == tr.fID) { fStripToTrack[h.f] = -1; } if (fStripToTrack[h.b] == tr.fID) { fStripToTrack[h.b] = -1; } } @@ -2459,13 +2465,10 @@ void L1Algo::CATrackFinder() #endif for (L1Vector<L1HitIndex_t>::iterator phIt = tr.fHits.begin(); /// used strips are marked phIt != tr.fHits.end(); ++phIt) { - L1Hit& h = (*vHits)[*phIt]; - - SetFUsed((*fStripFlag)[h.f]); - SetFUsed((*fStripFlag)[h.b]); - + const L1Hit& hit = fInputData.GetHit(*phIt); + fvHitKeyFlags[hit.f] = 1; + fvHitKeyFlags[hit.b] = 1; fRecoHits_local[num_thread].push_back(*phIt); - const L1Hit& hit = (*vHits)[*phIt]; L1HitPoint tempPoint = CreateHitPoint(hit); //TODO take number of station from hit L1Station stah = fParameters.GetStation(0); // TODO: Why is it a copy? @@ -2554,7 +2557,7 @@ void L1Algo::CATrackFinder() int NHitsOnStationTmp = NHitsOnStation; vGridTime[ista].UpdateIterGrid(Nelements, staHits, RealIHitPBuf, staHitIndices, vHitsUnused_buf, - vHitPointsUnused_buf, staHitPoints, NHitsOnStation, ista, *this, fStripFlag); + vHitPointsUnused_buf, staHitPoints, NHitsOnStation, ista, *this, fvHitKeyFlags); HitsUnusedStartIndex[ista] = NHitsOnStationTmp; HitsUnusedStopIndex[ista] = NHitsOnStation; @@ -2731,7 +2734,12 @@ inline void L1Algo::CAFindTrack(int ista, L1Branch& best_tr, unsigned char& best const L1HitIndex_t& ihitr = curr_trip->GetRHit(); - if (!GetFUsed((*fStripFlag)[(*vHitsUnused)[ihitm].f] | (*fStripFlag)[(*vHitsUnused)[ihitm].b])) { + //if (!GetFUsed((*fStripFlag)[(*vHitsUnused)[ihitm].f] | (*fStripFlag)[(*vHitsUnused)[ihitm].b])) { + //L1_SHOW(fInputData.GetNhitKeys()); + //L1_SHOW(fvHitKeyFlags.size()); + //L1_SHOW((*vHitsUnused)[ihitm].f); + //L1_SHOW((*vHitsUnused)[ihitm].b); + if (!(fvHitKeyFlags[(*vHitsUnused)[ihitm].f] || fvHitKeyFlags[(*vHitsUnused)[ihitm].b])) { // curr_tr.Hits.push_back((*RealIHitP)[ihitm]); @@ -2742,7 +2750,12 @@ inline void L1Algo::CAFindTrack(int ista, L1Branch& best_tr, unsigned char& best curr_L++; } - if (!GetFUsed((*fStripFlag)[(*vHitsUnused)[ihitr].f] | (*fStripFlag)[(*vHitsUnused)[ihitr].b])) { + //if (!GetFUsed((*fStripFlag)[(*vHitsUnused)[ihitr].f] | (*fStripFlag)[(*vHitsUnused)[ihitr].b])) { + //L1_SHOW(fInputData.GetNhitKeys()); + //L1_SHOW(fvHitKeyFlags.size()); + //L1_SHOW((*vHitsUnused)[ihitr].f); + //L1_SHOW((*vHitsUnused)[ihitr].b); + if (!(fvHitKeyFlags[(*vHitsUnused)[ihitr].f] || fvHitKeyFlags[(*vHitsUnused)[ihitr].b])) { //curr_tr.Hits.push_back((*RealIHitP)[ihitr]); curr_tr.fHits.push_back((*RealIHitP)[ihitr]); @@ -2846,8 +2859,14 @@ inline void L1Algo::CAFindTrack(int ista, L1Branch& best_tr, unsigned char& best if (dtx > fPickNeighbour * sqrt(Ctx)) continue; } - if (GetFUsed((*fStripFlag)[(*vHitsUnused)[new_trip.GetLHit()].f] - | (*fStripFlag)[(*vHitsUnused)[new_trip.GetLHit()].b])) { //hits are used + //if (GetFUsed((*fStripFlag)[(*vHitsUnused)[new_trip.GetLHit()].f] + // | (*fStripFlag)[(*vHitsUnused)[new_trip.GetLHit()].b])) { //hits are used + //L1_SHOW(fInputData.GetNhitKeys()); + //L1_SHOW(fvHitKeyFlags.size()); + //L1_SHOW((*vHitsUnused)[new_trip.GetLHit()].f); + //L1_SHOW((*vHitsUnused)[new_trip.GetLHit()].b); + if (fvHitKeyFlags[(*vHitsUnused)[new_trip.GetLHit()].f] + || fvHitKeyFlags[(*vHitsUnused)[new_trip.GetLHit()].b]) { //hits are used // no used hits allowed -> compare and store track if ((curr_L > best_L) || ((curr_L == best_L) && (curr_chi2 < best_chi2))) { best_tr = curr_tr; diff --git a/reco/L1/L1Algo/L1ClonesMerger.cxx b/reco/L1/L1Algo/L1ClonesMerger.cxx index 8329386dc7a1ba63a6ce0d9ccde03e09be2221a2..8192ad776957a4ec669a95898f3661b6986db738 100644 --- a/reco/L1/L1Algo/L1ClonesMerger.cxx +++ b/reco/L1/L1Algo/L1ClonesMerger.cxx @@ -64,10 +64,10 @@ void L1ClonesMerger::Exec(L1Vector<L1Track>& extTracks, L1Vector<L1HitIndex_t>& #endif for (int iTr = 0; iTr < nTracks; iTr++) { firstHit[iTr] = start_hit; - firstStation[iTr] = (*frAlgo.vHits)[extRecoHits[start_hit]].iSt; + firstStation[iTr] = frAlgo.GetInputData()->GetHit(extRecoHits[start_hit]).iSt; start_hit += extTracks[iTr].NHits - 1; lastHit[iTr] = start_hit; - lastStation[iTr] = (*frAlgo.vHits)[extRecoHits[start_hit]].iSt; + lastStation[iTr] = frAlgo.GetInputData()->GetHit(extRecoHits[start_hit]).iSt; start_hit++; isStored[iTr] = false; diff --git a/reco/L1/L1Algo/L1Grid.cxx b/reco/L1/L1Algo/L1Grid.cxx index 862b724a867e17f3a127a56b431f310186d7380b..0ef7ba5e3e2c60551d7126e8673e46f0a3f5a7a5 100644 --- a/reco/L1/L1Algo/L1Grid.cxx +++ b/reco/L1/L1Algo/L1Grid.cxx @@ -40,9 +40,9 @@ inline void memset(T* dest, T i, size_t num) void L1Grid::UpdateIterGrid(unsigned int Nelements, L1Hit* hits, L1Vector<L1HitIndex_t>* indicesBuf, L1HitIndex_t* indices, L1Vector<L1Hit>* hits2, L1Vector<L1HitPoint>* pointsBuf, L1HitPoint* points, int& NHitsOnStation, char iS, L1Algo& Algo, - const L1Vector<unsigned char>* vSFlag) + const L1Vector<unsigned char>& vSFlag) { - + //L1_SHOW(vSFlag.size()); fFirstHitInBin.reset(fN + 2, 0); fscal xs = 0; @@ -55,7 +55,7 @@ void L1Grid::UpdateIterGrid(unsigned int Nelements, L1Hit* hits, L1Vector<L1HitI const L1Hit& hit = hits[x]; - if (!L1Algo::GetFUsed((*vSFlag)[hit.f] | (*vSFlag)[hit.b])) { + if (!(vSFlag[hit.f] || vSFlag[hit.b])) { Algo.GetHitCoor(hit, xs, ys, iS); const L1HitIndex_t& bin = GetBinBounded(xs, ys, hit.t); @@ -97,7 +97,7 @@ void L1Grid::UpdateIterGrid(unsigned int Nelements, L1Hit* hits, L1Vector<L1HitI for (L1HitIndex_t x = 0; x < Nelements; x++) { const L1Hit& hit = hits[x]; - if (!L1Algo::GetFUsed((*vSFlag)[hit.f] | (*vSFlag)[hit.b])) { + if (!(vSFlag[hit.f] || vSFlag[hit.b])) { Algo.GetHitCoor(hit, xs, ys, iS); diff --git a/reco/L1/L1Algo/L1Grid.h b/reco/L1/L1Algo/L1Grid.h index aa3113c975ad049e934914b00cfe4d0f1534a24a..448145d786eeac5a68a6c997629e047028f71395 100644 --- a/reco/L1/L1Algo/L1Grid.h +++ b/reco/L1/L1Algo/L1Grid.h @@ -103,7 +103,7 @@ public: void UpdateIterGrid(unsigned int Nelements, L1Hit* hits, L1Vector<L1HitIndex_t>* indicesBuf, L1HitIndex_t* indices, L1Vector<L1Hit>* hits2, L1Vector<L1HitPoint>* pointsBuf, L1HitPoint* points, int& NHitsOnStation, - char iS, L1Algo& Algo, const L1Vector<unsigned char>* vSFlag); + char iS, L1Algo& Algo, const L1Vector<unsigned char>& vSFlag); private: diff --git a/reco/L1/L1Algo/L1InputData.cxx b/reco/L1/L1Algo/L1InputData.cxx index 35dfe5bdc122071e7caf2c07397ef90384158a37..48bdb49dcedef73aa2bad82236a56a3dfa9c424c 100644 --- a/reco/L1/L1Algo/L1InputData.cxx +++ b/reco/L1/L1Algo/L1InputData.cxx @@ -12,14 +12,7 @@ // --------------------------------------------------------------------------------------------------------------------- // -L1InputData::L1InputData() -{ - // Init first hit indexes - //for (int iStation = 0; iStation < L1Constants::size::kMaxNstations; ++iStation) { - // fvFirstHitIndexes[iStation] = static_cast<L1HitIndex_t>(-1); - //} - // NOTE: the last hit indexes should be initialized with 0. It is done in the variable declaration -} +L1InputData::L1InputData() {} // --------------------------------------------------------------------------------------------------------------------- // diff --git a/reco/L1/L1Algo/L1InputData.h b/reco/L1/L1Algo/L1InputData.h index 06572efbe0f482883db95130a90f71d0f442d474..88a204d045524b9d8e3058432cb5643ef334f996 100644 --- a/reco/L1/L1Algo/L1InputData.h +++ b/reco/L1/L1Algo/L1InputData.h @@ -63,9 +63,12 @@ public: /// \param index Index of hit in the hits sample const L1Hit& GetHit(L1HitIndex_t index) const { return fvHits[index]; } - /// Get reference to hits vector + /// Gets reference to hits vector const L1Vector<L1Hit>& GetHits() const { return fvHits; } + /// Gets number of hits in the hits vector + L1HitIndex_t GetNhits() const { return fvHits.size(); } + /// Gets total number of stored keys int GetNhitKeys() const { return fNhitKeys; } @@ -87,12 +90,13 @@ private: // ** Member variables list ** // *************************** - L1Vector<L1Hit> fvHits = {"L1InputData::fvHits"}; ///< Sorted sample of input hits - ///< \note Hits in the vector are sorted as follows. Among two hits - ///< the largest has the largest station index in the active - ///< stations array. If both indexes were measured withing one - ///< station, the largest hit has the largest y component of - ///< the coordinates + /// Sorted sample of input hits + /// \note Hits in the vector are sorted as follows. Among two hits + /// the largest has the largest station index in the active + /// stations array. If both indexes were measured withing one + /// station, the largest hit has the largest y component of + /// the coordinates + L1Vector<L1Hit> fvHits = {"L1InputData::fvHits"}; /// Index of the first hit in the sorted hits vector for a given station std::array<L1HitIndex_t, L1Constants::size::kMaxNstations> fvStartHitIndexes = {0}; diff --git a/reco/L1/L1Algo/L1TrackExtender.cxx b/reco/L1/L1Algo/L1TrackExtender.cxx index 77be8f855fa59f16a4f40ae6e6d42cf7421bab98..6c8effd6f3302ea979d629ee7ca616e0042c1942 100644 --- a/reco/L1/L1Algo/L1TrackExtender.cxx +++ b/reco/L1/L1Algo/L1TrackExtender.cxx @@ -40,9 +40,9 @@ void L1Algo::BranchFitterFast(const L1Branch& t, L1TrackPar& T, const bool dir, const int iFirstHit = (dir) ? nHits - 1 : 0; const int iLastHit = (dir) ? 0 : nHits - 1; - const L1Hit& hit0 = (*vHits)[hits[iFirstHit]]; - const L1Hit& hit1 = (*vHits)[hits[iFirstHit + step]]; - const L1Hit& hit2 = (*vHits)[hits[iFirstHit + 2 * step]]; + const L1Hit& hit0 = fInputData.GetHit(hits[iFirstHit]); + const L1Hit& hit1 = fInputData.GetHit(hits[iFirstHit + step]); + const L1Hit& hit2 = fInputData.GetHit(hits[iFirstHit + 2 * step]); int ista0 = hit0.iSt; int ista1 = hit1.iSt; @@ -119,7 +119,7 @@ void L1Algo::BranchFitterFast(const L1Branch& t, L1TrackPar& T, const bool dir, int ista = ista2; for (int i = iFirstHit + step; step * i <= step * iLastHit; i += step) { - const L1Hit& hit = (*vHits)[hits[i]]; + const L1Hit& hit = fInputData.GetHit(hits[i]); ista_prev = ista; ista = hit.iSt; @@ -199,11 +199,11 @@ void L1Algo::FindMoreHits(L1Branch& t, L1TrackPar& T, const bool dir, const signed short int step = -2 * static_cast<int>(dir) + 1; // increment for station index const int iFirstHit = (dir) ? 2 : t.NHits - 3; - // int ista = (*vHits)[t.Hits[iFirstHit]].iSt + 2*step; // current station. set to the end of track + // int ista = fInputData.GetHit(t.Hits[iFirstHit]).iSt + 2 * step; // current station. set to the end of track - const L1Hit& hit0 = (*vHits)[t.fHits[iFirstHit]]; // optimize - const L1Hit& hit1 = (*vHits)[t.fHits[iFirstHit + step]]; - const L1Hit& hit2 = (*vHits)[t.fHits[iFirstHit + 2 * step]]; + const L1Hit& hit0 = fInputData.GetHit(t.fHits[iFirstHit]); // optimize + const L1Hit& hit1 = fInputData.GetHit(t.fHits[iFirstHit + step]); + const L1Hit& hit2 = fInputData.GetHit(t.fHits[iFirstHit + 2 * step]); const int ista0 = hit0.iSt; const int ista1 = hit1.iSt; @@ -276,7 +276,11 @@ void L1Algo::FindMoreHits(L1Branch& t, L1TrackPar& T, const bool dir, //TODO: bug, it should be hit.dt*hit.dt if (fabs(hit.t - T.t[0]) > sqrt(T.C55[0] + hit.dt * hit.dt) * 5) continue; - if (GetFUsed((*fStripFlag)[hit.f] | (*fStripFlag)[hit.b])) continue; // if used + //if (GetFUsed((*fStripFlag)[hit.f] | (*fStripFlag)[hit.b])) continue; // if used + //L1_SHOW(fvHitKeyFlags.size()); + //L1_SHOW(hit.f); + //L1_SHOW(hit.b); + if (fvHitKeyFlags[hit.f] || fvHitKeyFlags[hit.b]) { continue; } fscal xh, yh, zh; GetHitCoor(hit, xh, yh, zh, sta); // faster diff --git a/reco/L1/L1Algo/L1TrackFitter.cxx b/reco/L1/L1Algo/L1TrackFitter.cxx index 222d850c01d0ab52b7ea0d4a7e08e3fae44246b8..7a53988da7e9f27a5f43a70490851daf1ce1a0e6 100644 --- a/reco/L1/L1Algo/L1TrackFitter.cxx +++ b/reco/L1/L1Algo/L1TrackFitter.cxx @@ -52,9 +52,9 @@ void L1Algo::KFTrackFitter_simple() // TODO: Add pipe. for (int iter = 0; iter < 3; iter++) { //cout<<" Back 1"<<endl; { // fit backward - const L1Hit& hit0 = (*vHits)[hits[nHits - 1]]; - const L1Hit& hit1 = (*vHits)[hits[nHits - 2]]; - const L1Hit& hit2 = (*vHits)[hits[nHits - 3]]; + const L1Hit& hit0 = fInputData.GetHit(hits[nHits - 1]); + const L1Hit& hit1 = fInputData.GetHit(hits[nHits - 2]); + const L1Hit& hit2 = fInputData.GetHit(hits[nHits - 3]); int ista0 = hit0.iSt; int ista1 = hit1.iSt; @@ -124,7 +124,7 @@ void L1Algo::KFTrackFitter_simple() // TODO: Add pipe. //cout<<"\nfit, iter=:"<<iter<<endl; for (int i = nHits - 2; i >= 0; i--) { // if( fabs(T.qp[0])>2. ) break; // iklm. Don't know it need for - const L1Hit& hit = (*vHits)[hits[i]]; + const L1Hit& hit = fInputData.GetHit(hits[i]); ista = hit.iSt; const L1Station& sta = fParameters.GetStation(ista); @@ -189,10 +189,9 @@ void L1Algo::KFTrackFitter_simple() // TODO: Add pipe. // fit forward { //T.qp = first_trip->GetQpOrig(MaxInvMom); - - const L1Hit& hit0 = (*vHits)[hits[0]]; - const L1Hit& hit1 = (*vHits)[hits[1]]; - const L1Hit& hit2 = (*vHits)[hits[2]]; + const L1Hit& hit0 = fInputData.GetHit(hits[0]); + const L1Hit& hit1 = fInputData.GetHit(hits[1]); + const L1Hit& hit2 = fInputData.GetHit(hits[2]); int ista0 = hit0.iSt; int ista1 = hit1.iSt; @@ -256,7 +255,7 @@ void L1Algo::KFTrackFitter_simple() // TODO: Add pipe. int ista = ista2; for (int i = 1; i < nHits; i++) { - const L1Hit& hit = (*vHits)[hits[i]]; + const L1Hit& hit = fInputData.GetHit(hits[i]); ista = hit.iSt; const L1Station& sta = fParameters.GetStation(ista); fvec u = hit.u; @@ -423,7 +422,7 @@ void L1Algo::L1KFTrackFitter() int nHitsTrack = t[iVec]->NHits; int iSta[L1Constants::size::kMaxNstations]; for (i = 0; i < nHitsTrack; i++) { - const L1Hit& hit = (*vHits)[fRecoHits[start_hit++]]; + const L1Hit& hit = fInputData.GetHit(fRecoHits[start_hit++]); const int ista = hit.iSt; iSta[i] = ista; w[ista][iVec] = 1.; @@ -893,7 +892,7 @@ void L1Algo::L1KFTrackFitterMuch() int nHitsTrack = t[iVec]->NHits; int nHitsTrackField = 0; for (i = 0; i < nHitsTrack; i++) { - const L1Hit& hit = (*vHits)[fRecoHits[start_hit++]]; + const L1Hit& hit = fInputData.GetHit(fRecoHits[start_hit++]); const int ista = hit.iSt; if (ista < fNfieldStations) nHitsTrackField++; iSta[i] = ista; diff --git a/reco/L1/L1Algo/utils/L1AlgoDraw.cxx b/reco/L1/L1Algo/utils/L1AlgoDraw.cxx index a11086b29744c2e335276fb5ced848cdd3a4cff7..477cea144e27adad5eb90d8e0a45806c5245de13 100644 --- a/reco/L1/L1Algo/utils/L1AlgoDraw.cxx +++ b/reco/L1/L1Algo/utils/L1AlgoDraw.cxx @@ -74,11 +74,11 @@ void L1AlgoDraw::InitL1Draw(L1Algo* algo_) // algo = CbmL1::Instance()->algo; algo = algo_; - vHits.reserve(algo->vHits->size()); - for (unsigned int i = 0; i < algo->vHits->size(); i++) { - vHits.push_back((*algo->vHits)[i]); + vHits.reserve(algo->GetInputData()->GetNhits()); + for (unsigned int i = 0; i < algo->GetInputData()->GetNhits(); i++) { + vHits.push_back(algo->GetInputData()->GetHit(i)); } - NStations = algo->GetNstations(); + NStations = algo->GetParameters()->GetNstationsActive(); for (int i = 0; i < NStations; i++) { HitsStartIndex[i] = algo->HitsStartIndex[i]; HitsStopIndex[i] = algo->HitsStopIndex[i]; @@ -466,7 +466,7 @@ void L1AlgoDraw::DrawDoublet(int il, int ir) void L1AlgoDraw::DrawInfo() { - cout << " vHits.size = " << algo->vHits->size() << endl; + cout << " vHits.size = " << algo->GetInputData()->GetNhits() << endl; cout << " vRecoHits.size = " << algo->fRecoHits.size() << endl; cout << " vTracks.size = " << algo->fTracks.size() << endl; } diff --git a/reco/L1/L1Algo/utils/L1AlgoPulls.cxx b/reco/L1/L1Algo/utils/L1AlgoPulls.cxx index 1d7704dd3c4241e2e08da8f7b33c092e2d8592ea..796c8c9bc512f80f87d9f9c504b6b1e1753ec483 100644 --- a/reco/L1/L1Algo/utils/L1AlgoPulls.cxx +++ b/reco/L1/L1Algo/utils/L1AlgoPulls.cxx @@ -140,7 +140,7 @@ void L1AlgoPulls::AddOne(L1TrackPar& T_, int i, L1HitIndex_t ih) #ifdef BUILD_HISTO_FOR_EACH_STANTION int ista = mcP.iStation - 2; // last hit - // int ista = fL1->algo->vSFlag[ fL1->algo->vHits[ih].f ]/4 - 2; // last hit + // int ista = fL1->algo->vSFlag[ fL1->algo->GetInputData()->GetHit(ih).f ]/4 - 2; // last hit fStaPulls[ista].push_back(P); #endif // BUILD_HISTO_FOR_EACH_STANTION };