diff --git a/analysis/common/analysis_tree_converter/CbmStsTracksConverter.cxx b/analysis/common/analysis_tree_converter/CbmStsTracksConverter.cxx index fe6886defffcb6aaebd8c51db57c739d7d3caa33..aafb6c3a088bbddf3bfce53f36457ee6b16cf19c 100644 --- a/analysis/common/analysis_tree_converter/CbmStsTracksConverter.cxx +++ b/analysis/common/analysis_tree_converter/CbmStsTracksConverter.cxx @@ -94,10 +94,10 @@ void CbmStsTracksConverter::Init() // TODO misleading name, move field filling somewhere else? float CbmStsTracksConverter::ExtrapolateToVertex(CbmStsTrack* sts_track, AnalysisTree::Track& track, int pdg) { - vector<CbmStsTrack> tracks = {*sts_track}; + std::vector<CbmStsTrack> tracks = {*sts_track}; CbmL1PFFitter fitter; - vector<float> chi2_to_vtx; - vector<L1FieldRegion> field; + std::vector<float> chi2_to_vtx; + std::vector<L1FieldRegion> field; CbmKFVertex kfVertex = CbmKFVertex(*cbm_prim_vertex_); if (is_reproduce_cbmkfpf_) { std::vector<int> pdgVector = {pdg}; @@ -210,15 +210,15 @@ bool CbmStsTracksConverter::IsGoodCovMatrix(const CbmStsTrack* sts_track) const } // Cuts, coded in MZ's CbmKFParticleFinder.cxx bool ok = true; - ok = ok && isfinite(sts_track->GetParamFirst()->GetX()); - ok = ok && isfinite(sts_track->GetParamFirst()->GetY()); - ok = ok && isfinite(sts_track->GetParamFirst()->GetZ()); - ok = ok && isfinite(sts_track->GetParamFirst()->GetTx()); - ok = ok && isfinite(sts_track->GetParamFirst()->GetTy()); - ok = ok && isfinite(sts_track->GetParamFirst()->GetQp()); + ok = ok && std::isfinite(sts_track->GetParamFirst()->GetX()); + ok = ok && std::isfinite(sts_track->GetParamFirst()->GetY()); + ok = ok && std::isfinite(sts_track->GetParamFirst()->GetZ()); + ok = ok && std::isfinite(sts_track->GetParamFirst()->GetTx()); + ok = ok && std::isfinite(sts_track->GetParamFirst()->GetTy()); + ok = ok && std::isfinite(sts_track->GetParamFirst()->GetQp()); for (auto element : cov_matrix) { - ok = ok && isfinite(element); + ok = ok && std::isfinite(element); } ok = ok && (cov_matrix[0] < 1. && cov_matrix[0] > 0.) && (cov_matrix[2] < 1. && cov_matrix[2] > 0.) && (cov_matrix[5] < 1. && cov_matrix[5] > 0.) && (cov_matrix[9] < 1. && cov_matrix[9] > 0.) diff --git a/reco/KF/KFQA/CbmKFPartEfficiencies.h b/reco/KF/KFQA/CbmKFPartEfficiencies.h index a4c5bfd4ff10ad33d6c17d8db5f4f580f491779e..7d56e0bf57ced944b7d6c75e061b47a50c5ac2e5 100644 --- a/reco/KF/KFQA/CbmKFPartEfficiencies.h +++ b/reco/KF/KFQA/CbmKFPartEfficiencies.h @@ -523,7 +523,7 @@ public: << " | " << " N MC " << std::endl; - int NCounters = mc.NCounters; + int NCounters = mc.GetNcounters(); for (int iC = 0; iC < NCounters; iC++) { std::cout << names[iC] << " : " << std::setw(6) << ratio_reco.counters[iC] << " / " << std::setw(6) << ratio_ghost.counters[iC] // particles w\o MCParticle diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index b97fe990f168f884c6cda47f74294cf1adb388c3..7552866588a863bb4fd9c5dc6e645d2dee2f4399 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -1579,7 +1579,7 @@ void CbmL1::WriteSTAPGeoData(const L1Vector<float>& geo_) { // write geo in file TString fgeo_name = fSTAPDataDir + "geo_algo.txt"; - ofstream fgeo(fgeo_name); + std::ofstream fgeo(fgeo_name); fgeo.setf(ios::scientific, ios::floatfield); fgeo.precision(20); int size = geo_.size(); @@ -1595,15 +1595,15 @@ void CbmL1::WriteSTAPAlgoData() // must be called after ReadEvent { // write algo data in file static int vNEvent = 1; - fstream fadata; + std::fstream fadata; TString fadata_name = fSTAPDataDir + "data_algo.txt"; // if ( vNEvent <= maxNEvent ) { if (1) { - if (vNEvent == 1) fadata.open(fadata_name, fstream::out); // begin new file + if (vNEvent == 1) fadata.open(fadata_name, std::fstream::out); // begin new file else - fadata.open(fadata_name, fstream::out | fstream::app); + fadata.open(fadata_name, std::fstream::out | std::fstream::app); fadata << "Event:" << " "; @@ -1675,8 +1675,8 @@ void CbmL1::WriteSTAPAlgoData() // must be called after ReadEvent void CbmL1::WriteSTAPPerfData() // must be called after ReadEvent { - fstream fpdata; - fpdata << setprecision(8); + std::fstream fpdata; + fpdata << std::setprecision(8); static int vNEvent = 1; @@ -1685,9 +1685,9 @@ void CbmL1::WriteSTAPPerfData() // must be called after ReadEvent // if ( vNEvent <= maxNEvent ) { if (1) { - if (vNEvent == 1) fpdata.open(fpdata_name, fstream::out); // begin new file + if (vNEvent == 1) fpdata.open(fpdata_name, std::fstream::out); // begin new file else - fpdata.open(fpdata_name, fstream::out | fstream::app); + fpdata.open(fpdata_name, std::fstream::out | std::fstream::app); fpdata << "Event: "; fpdata << vNEvent << endl; @@ -1822,7 +1822,7 @@ void CbmL1::WriteSTAPPerfData() // must be called after ReadEvent vNEvent++; } // void CbmL1::WriteSTAPPerfData() -istream& CbmL1::eatwhite(istream& is) // skip spaces +std::istream& CbmL1::eatwhite(std::istream& is) // skip spaces { char c; while (is.get(c)) { @@ -1839,7 +1839,7 @@ istream& CbmL1::eatwhite(istream& is) // skip spaces void CbmL1::ReadSTAPGeoData(L1Vector<fscal>& geo_, int& size) { TString fgeo_name = fSTAPDataDir + "geo_algo.txt"; - ifstream fgeo(fgeo_name); + std::ifstream fgeo(fgeo_name); cout << "-I- CbmL1: Read geometry from file " << fgeo_name << endl; int i; @@ -1856,11 +1856,11 @@ void CbmL1::ReadSTAPGeoData(L1Vector<fscal>& geo_, int& size) void CbmL1::ReadSTAPAlgoData() { static int nEvent = 1; - static fstream fadata; + static std::fstream fadata; TString fadata_name = fSTAPDataDir + "data_algo.txt"; // if (nEvent <= maxNEvent){ if (1) { - if (nEvent == 1) fadata.open(fadata_name, fstream::in); + if (nEvent == 1) fadata.open(fadata_name, std::fstream::in); if (algo->vStsHits) algo->vStsHits->clear(); algo->NStsStrips = 0; @@ -1931,11 +1931,11 @@ void CbmL1::ReadSTAPAlgoData() void CbmL1::ReadSTAPPerfData() { static int nEvent = 1; - static fstream fpdata; + static std::fstream fpdata; TString fpdata_name = fSTAPDataDir + "data_perfo.txt"; // if (nEvent <= maxNEvent){ if (1) { - if (nEvent == 1) { fpdata.open(fpdata_name, fstream::in); }; + if (nEvent == 1) { fpdata.open(fpdata_name, std::fstream::in); }; vMCPoints.clear(); vMCTracks.clear(); @@ -2113,10 +2113,10 @@ void CbmL1::WriteSIMDKFData() if (first) { FairField* dMF = CbmKF::Instance()->GetMagneticField(); - fstream FileGeo; + std::fstream FileGeo; FileGeo.open("geo.dat", ios::out); - fstream FieldCheck; + std::fstream FieldCheck; FieldCheck.open("field.dat", ios::out); Double_t bfg[3], rfg[3]; @@ -2277,19 +2277,19 @@ void CbmL1::WriteSIMDKFData() ///Write Tracks and MC Tracks static int TrNumber = 0; - fstream Tracks, McTracksCentr, McTracksIn, McTracksOut; + std::fstream Tracks, McTracksCentr, McTracksIn, McTracksOut; if (first) { - Tracks.open("tracks.dat", fstream::out); - McTracksCentr.open("mctrackscentr.dat", fstream::out); - McTracksIn.open("mctracksin.dat", fstream::out); - McTracksOut.open("mctracksout.dat", fstream::out); + Tracks.open("tracks.dat", std::fstream::out); + McTracksCentr.open("mctrackscentr.dat", std::fstream::out); + McTracksIn.open("mctracksin.dat", std::fstream::out); + McTracksOut.open("mctracksout.dat", std::fstream::out); first = 0; } else { - Tracks.open("tracks.dat", fstream::out | fstream::app); - McTracksCentr.open("mctrackscentr.dat", fstream::out | fstream::app); - McTracksIn.open("mctracksin.dat", fstream::out | fstream::app); - McTracksOut.open("mctracksout.dat", fstream::out | fstream::app); + Tracks.open("tracks.dat", std::fstream::out | std::fstream::app); + McTracksCentr.open("mctrackscentr.dat", std::fstream::out | std::fstream::app); + McTracksIn.open("mctracksin.dat", std::fstream::out | std::fstream::app); + McTracksOut.open("mctracksout.dat", std::fstream::out | std::fstream::app); } for (L1Vector<CbmL1Track>::iterator RecTrack = vRTracks.begin(); RecTrack != vRTracks.end(); ++RecTrack) { diff --git a/reco/L1/CbmL1Counters.h b/reco/L1/CbmL1Counters.h index 4975bcadcc2b1ce5ba9bfc9dc006bef0312a40b9..c50f82730848d7691e079aa0c28d9371f993eb6c 100644 --- a/reco/L1/CbmL1Counters.h +++ b/reco/L1/CbmL1Counters.h @@ -11,39 +11,32 @@ #include <iomanip> #include <iostream> #include <map> -#include <vector> -using std::ios; -using std::map; -using std::setw; -using std::vector; + +#include "L1Vector.h" /// counters used for efficiency calculation template<typename T> struct TL1TracksCatCounters // counters for different tracks categories { - TL1TracksCatCounters() : NCounters(0), counters() { counters.clear(); }; - TL1TracksCatCounters(int nCounters) : NCounters(nCounters), counters() { counters.resize(NCounters, T(0)); }; + TL1TracksCatCounters() { counters.reserve(20); } - void AddCounter() - { - NCounters++; - counters.push_back(T(0)); - }; - void AddCounters(int nCounters) - { - NCounters += nCounters; - counters.resize(NCounters, T(0)); - }; + TL1TracksCatCounters(int nCounters) { counters.reset(nCounters, T(0)); }; + + int GetNcounters() const { return counters.size(); } + + void AddCounter() { counters.push_back_no_warning(T(0)); }; + + void AddCounters(int nCounters) { counters.enlarge(GetNcounters() + nCounters, T(0)); }; TL1TracksCatCounters& operator+=(TL1TracksCatCounters& a) { - if (NCounters != a.NCounters) { + if (GetNcounters() != a.GetNcounters()) { std::cout << " TL1TracksCatCounters: Error. Addition of counters of " "different sizes: " - << NCounters << " " << a.NCounters << std::endl; + << GetNcounters() << " " << a.GetNcounters() << std::endl; } else { - for (int iC = 0; iC < NCounters; iC++) { + for (int iC = 0; iC < GetNcounters(); iC++) { counters[iC] += a.counters[iC]; } } @@ -60,14 +53,14 @@ struct TL1TracksCatCounters // counters for different tracks categories template<typename T2> TL1TracksCatCounters<double> operator/(TL1TracksCatCounters<T2>& a) { - TL1TracksCatCounters<double> b(NCounters); - if (NCounters != a.NCounters) { + TL1TracksCatCounters<double> b(GetNcounters()); + if (GetNcounters() != a.GetNcounters()) { std::cout << " TL1TracksCatCounters: Error. Addition of counters of " "different sizes: " - << NCounters << " " << a.NCounters << std::endl; + << GetNcounters() << " " << a.GetNcounters() << std::endl; } else { - for (int iC = 0; iC < NCounters; iC++) { + for (int iC = 0; iC < GetNcounters(); iC++) { b.counters[iC] = Div(counters[iC], a.counters[iC]); } } @@ -77,8 +70,8 @@ struct TL1TracksCatCounters // counters for different tracks categories template<typename T2> TL1TracksCatCounters<T2> operator/(double a) { - TL1TracksCatCounters<T2> b(NCounters); - for (int iC = 0; iC < NCounters; iC++) { + TL1TracksCatCounters<T2> b(GetNcounters()); + for (int iC = 0; iC < GetNcounters(); iC++) { b.counters[iC] = static_cast<T2>(Div(counters[iC], a)); } return b; @@ -86,7 +79,7 @@ struct TL1TracksCatCounters // counters for different tracks categories friend std::fstream& operator<<(std::fstream& strm, const TL1TracksCatCounters<T>& a) { - strm << a.NCounters << " " << a.counters.size() << " "; + strm << a.GetNcounters() << " " << a.counters.size() << " "; for (unsigned int iV = 0; iV < a.counters.size(); iV++) strm << a.counters[iV] << " "; strm << std::endl; @@ -95,7 +88,7 @@ struct TL1TracksCatCounters // counters for different tracks categories friend std::ostream& operator<<(std::ostream& strm, const TL1TracksCatCounters<T>& a) { - strm << a.NCounters << " " << a.counters.size() << " "; + strm << a.counters.size() << " "; for (unsigned int iV = 0; iV < a.counters.size(); iV++) strm << a.counters[iV] << " "; strm << std::endl; @@ -106,9 +99,8 @@ struct TL1TracksCatCounters // counters for different tracks categories { int tmp; strm >> tmp; - a.NCounters = tmp; - strm >> tmp; - a.counters.resize(tmp, T(0)); + a.counters.clear(); + a.counters.reset(tmp, T(0)); for (int iV = 0; iV < tmp; iV++) { T tmp1; strm >> tmp1; @@ -121,8 +113,7 @@ private: double Div(double a, double b) { return (b > 0) ? a / b : -1.; }; public: - int NCounters; - vector<T> counters; + L1Vector<T> counters {"TL1TracksCatCounters::counters"}; }; struct TL1Efficiencies { @@ -153,8 +144,8 @@ struct TL1Efficiencies { void PrintEff(); - vector<TString> names; // names counters indexed by index of counter - map<TString, int> indices; // indices of counters indexed by a counter shortname + std::vector<TString> names; // names counters indexed by index of counter + std::map<TString, int> indices; // indices of counters indexed by a counter shortname TL1TracksCatCounters<double> ratio_reco; double ratio_ghosts; @@ -212,16 +203,16 @@ inline void TL1Efficiencies::Inc(bool isReco, TString name) inline void TL1Efficiencies::PrintEff() { - std::cout.setf(ios::fixed); - std::cout.setf(ios::showpoint); + std::cout.setf(std::ios::fixed); + std::cout.setf(std::ios::showpoint); std::cout.precision(3); - std::cout.setf(ios::right); + std::cout.setf(std::ios::right); std::cout << "Track category : " << " Eff " << " | " << "All MC" << std::endl; - int NCounters = mc.NCounters; + int NCounters = mc.GetNcounters(); for (int iC = 0; iC < NCounters; iC++) { std::cout << names[iC] << " : " << ratio_reco.counters[iC] << " | " << mc.counters[iC] << std::endl; } diff --git a/reco/L1/CbmL1Hit.h b/reco/L1/CbmL1Hit.h index 5b1615936d6efc0b4b33d74f73c4392aebe5d454..c6add884a951ab396e921babb7d8a0e7a308f26f 100644 --- a/reco/L1/CbmL1Hit.h +++ b/reco/L1/CbmL1Hit.h @@ -5,22 +5,20 @@ #ifndef _CbmL1Hit_h_ #define _CbmL1Hit_h_ -#include <vector> -using std::vector; +#include "L1Vector.h" /// /// hits with hit-mcpoint match information /// -class CbmL1Hit { -public: - CbmL1Hit() {}; +struct CbmL1Hit { + + CbmL1Hit() = default; CbmL1Hit(int hitId_, int extIndex_, int Det_) : hitId(hitId_), extIndex(extIndex_), Det(Det_) {}; int hitId = 0; // index of L1Hit in algo->vStsHits array. Should be equal to index of this in L1->vStsHits int extIndex = 0; // index of hit in the TClonesArray array int Det = 0; // station index - vector<int> mcPointIds {}; // indices of CbmL1MCPoint in L1->vMCPoints array float x = 0.f; // measured X coordinate float y = 0.f; // measured Y coordinate float t = 0.f; // measured time @@ -29,6 +27,7 @@ public: int ID = 0; // TODO: check if this ID is redundant int file = 0; // TODO: ?? int event = 0; // TODO: ?? + L1Vector<int> mcPointIds {"CbmL1Hit::mcPointIds"}; // indices of CbmL1MCPoint in L1->vMCPoints array }; #endif diff --git a/reco/L1/CbmL1MCPoint.h b/reco/L1/CbmL1MCPoint.h index 59f8580523eb5aa01587fbe1c39aac81fc5bec06..bb2bf315b89b8475e7495065d3407f54006ebb5e 100644 --- a/reco/L1/CbmL1MCPoint.h +++ b/reco/L1/CbmL1MCPoint.h @@ -21,53 +21,12 @@ #ifndef CbmL1MCPoint_H #define CbmL1MCPoint_H -#include <vector> -using std::vector; +#include "L1Vector.h" struct CbmL1MCPoint { - CbmL1MCPoint() - : x(0) - , y(0) - , z(0) - , px(0) - , py(0) - , pz(0) - , xIn(0) - , yIn(0) - , zIn(0) - , pxIn(0) - , pyIn(0) - , pzIn(0) - , xOut(0) - , yOut(0) - , zOut(0) - , pxOut(0) - , pyOut(0) - , pzOut(0) - , p(0) - , q(0) - , mass(0) - , time(0) - , pdg(0) - , ID(0) - , mother_ID(0) - , iStation(0) - , pointId(-1) - , file(-1) - , event(-1) - , hitIds() - { - } - double x, y, z, px, py, pz; - double xIn, yIn, zIn, pxIn, pyIn, pzIn; - double xOut, yOut, zOut, pxOut, pyOut, pzOut; - double p, q, mass, time; - int pdg, ID, mother_ID; - int iStation; - int pointId; - int file; - int event; + CbmL1MCPoint() = default; + static bool compareIDz(const CbmL1MCPoint& a, const CbmL1MCPoint& b) { return (a.ID < b.ID) || ((a.ID == b.ID) && (a.z < b.z)); @@ -78,7 +37,36 @@ struct CbmL1MCPoint { return (a->ID < b->ID) || ((a->ID == b->ID) && (a->z < b->z)); } - vector<int> hitIds; // indices of CbmL1Hits in L1->vStsHits array + double x = 0.; + double y = 0.; + double z = 0.; + double px = 0.; + double py = 0.; + double pz = 0.; + double xIn = 0.; + double yIn = 0.; + double zIn = 0.; + double pxIn = 0.; + double pyIn = 0.; + double pzIn = 0.; + double xOut = 0.; + double yOut = 0.; + double zOut = 0.; + double pxOut = 0.; + double pyOut = 0.; + double pzOut = 0.; + double p = 0.; + double q = 0.; + double mass = 0.; + double time = 0.; + int pdg = 0; + int ID = 0; + int mother_ID = 0; + int iStation = 0; + int pointId = -1; + int file = -1; + int event = -1; + L1Vector<int> hitIds {"CbmL1MCPoint::hitIds"}; // indices of CbmL1Hits in L1->vStsHits array }; #endif diff --git a/reco/L1/CbmL1MCTrack.cxx b/reco/L1/CbmL1MCTrack.cxx index 4bdf70d64f7bf7d21c11e084d9dda078cc980ce8..996cef6bb2fddbe8f618f50790c28dd440ce6929 100644 --- a/reco/L1/CbmL1MCTrack.cxx +++ b/reco/L1/CbmL1MCTrack.cxx @@ -29,41 +29,18 @@ CbmL1MCTrack::CbmL1MCTrack(double mass_, double q_, TVector3 vr, TLorentzVector vp, int _ID, int _mother_ID, int _pdg) : mass(mass_) , q(q_) - , p(0) - , x(0) - , y(0) - , z(0) - , px(0) - , py(0) - , pz(0) - , time(0) + , p(vp.P()) + , x(vr.X()) + , y(vr.Y()) + , z(vr.Z()) + , px(vp.Px()) + , py(vp.Py()) + , pz(vp.Pz()) , ID(_ID) - , iFile(0) - , iEvent(0) , mother_ID(_mother_ID) , pdg(_pdg) - , Points() - , StsHits() - , nMCContStations(0) - , nHitContStations(0) - , maxNStaMC(0) - , maxNSensorMC(0) - , maxNStaHits(0) - , nStations(0) - , nMCStations(0) - , isReconstructable(0) - , isAdditional() - , rTracks() - , tTracks() { - x = vr.X(); - y = vr.Y(); - z = vr.Z(); - px = vp.Px(); - py = vp.Py(); - pz = vp.Pz(); - p = sqrt(fabs(px * px + py * py + pz * pz)); -}; +} // CbmL1MCTrack::CbmL1MCTrack(TmpMCPoints &mcPoint, TVector3 vr, TLorentzVector vp, int ID, int mother_ID): // ID(_ID), mother_ID(_mother_ID) @@ -90,7 +67,7 @@ void CbmL1MCTrack::Init() CbmL1MCPoint* point = &(L1->vMCPoints[Points[iP]]); for (unsigned int iH = 0; iH < point->hitIds.size(); iH++) { const int iih = point->hitIds[iH]; - if (std::find(StsHits.begin(), StsHits.end(), iih) == StsHits.end()) StsHits.push_back(iih); + if (std::find(StsHits.begin(), StsHits.end(), iih) == StsHits.end()) StsHits.push_back_no_warning(iih); } } @@ -146,9 +123,9 @@ void CbmL1MCTrack::CalculateHitCont() int istaold = -1, ncont = 0; { for (int ih = 0; ih < nhits; ih++) { - int jh = StsHits[ih]; - const L1Hit& h = (*algo->vStsHits)[jh]; - int ista = (*algo->fStripFlag)[h.f] / 4; + int jh = StsHits[ih]; + const L1Hit& h = (*algo->vStsHits)[jh]; + int ista = (*algo->fStripFlag)[h.f] / 4; if (ista - istaold == 1) ncont++; else if (ista - istaold > 1) { diff --git a/reco/L1/CbmL1MCTrack.h b/reco/L1/CbmL1MCTrack.h index 57e8523b2faf6047c45773eee43c0b076a722ad5..3e5867878672a619296ac7f29a9ef323e47d0d68 100644 --- a/reco/L1/CbmL1MCTrack.h +++ b/reco/L1/CbmL1MCTrack.h @@ -27,77 +27,17 @@ #include "TVector3.h" #include <iostream> -#include <vector> -using std::vector; + +#include "L1Vector.h" class CbmL1Track; class CbmL1MCTrack { public: - double mass, q, p, x, y, z, px, py, pz, time; - int ID, iFile, iEvent, mother_ID, pdg; - vector<int> Points; // indices of pints in L1::vMCPoints - vector<int> StsHits; // indices of hits in algo->vStsHits or L1::vStsHits - - CbmL1MCTrack() - : mass(0.) - , q(0.) - , p(0.) - , x(0.) - , y(0.) - , z(0.) - , px(0.) - , py(0.) - , pz(0.) - , time(0.) - , ID(-1) - , iFile(-1) - , iEvent(-1) - , mother_ID(-1) - , pdg(-1) - , Points() - , StsHits() - , nMCContStations(0) - , nHitContStations(0) - , maxNStaMC(0) - , maxNSensorMC(0) - , maxNStaHits(0) - , nStations(0) - , nMCStations(0) - , isReconstructable(0) - , isAdditional(0) - , rTracks() - , tTracks() {}; - - CbmL1MCTrack(int _ID) - : mass(0.) - , q(0.) - , p(0.) - , x(0.) - , y(0.) - , z(0.) - , px(0.) - , py(0.) - , pz(0.) - , time(0.) - , ID(_ID) - , iFile(-1) - , iEvent(-1) - , mother_ID(-1) - , pdg(-1) - , Points() - , StsHits() - , nMCContStations(0) - , nHitContStations(0) - , maxNStaMC(0) - , maxNSensorMC(0) - , maxNStaHits(0) - , nStations(0) - , nMCStations() - , isReconstructable(0) - , isAdditional(0) - , rTracks() - , tTracks() {}; + CbmL1MCTrack() = default; + + CbmL1MCTrack(int _ID) : ID(_ID) {}; + CbmL1MCTrack(double mass, double q, TVector3 vr, TLorentzVector vp, int ID, int mother_ID, int pdg); // CbmL1MCTrack(TmpMCPoints &mcPoint, TVector3 vr, TLorentzVector vp, int ID, int mother_ID); @@ -111,39 +51,60 @@ public: void Init(); - void AddRecoTrack(CbmL1Track* rTr) { rTracks.push_back(rTr); } - vector<CbmL1Track*>& GetRecoTracks() { return rTracks; } + void AddRecoTrack(CbmL1Track* rTr) { rTracks.push_back_no_warning(rTr); } + L1Vector<CbmL1Track*>& GetRecoTracks() { return rTracks; } int GetNClones() const { return rTracks.size() - 1; } bool IsReconstructed() const { return rTracks.size(); } - void AddTouchTrack(CbmL1Track* tTr) { tTracks.push_back(tTr); } + void AddTouchTrack(CbmL1Track* tTr) { tTracks.push_back_no_warning(tTr); } bool IsDisturbed() const { return tTracks.size(); } friend class CbmL1; private: - int nMCContStations; // number of consecutive stations with mcPoints - int nHitContStations; // number of consecutive stations with hits - int maxNStaMC; // max number of mcPoints on station - int maxNSensorMC; // max number of mcPoints with same z - int maxNStaHits; // max number of hits on station - - int nStations; // number of stations with hits - int nMCStations; // number of stations with MCPoints - - bool isReconstructable; - bool isAdditional; // is not reconstructable, but stil interesting - void CalculateMCCont(); void CalculateHitCont(); void CalculateMaxNStaHits(); void CalculateMaxNStaMC(); void CalculateIsReconstructable(); +public: + double mass = 0.; + double q = 0.; + double p = 0.; + double x = 0.; + double y = 0.; + double z = 0.; + double px = 0.; + double py = 0.; + double pz = 0.; + double time = 0.; + int ID = -1; + int iFile = -1; + int iEvent = -1; + int mother_ID = -1; + int pdg = -1; + L1Vector<int> Points {"CbmL1MCTrack::Points"}; // indices of pints in L1::vMCPoints + L1Vector<int> StsHits {"CbmL1MCTrack::StsHits"}; // indices of hits in algo->vStsHits or L1::vStsHits + +private: + int nMCContStations = 0; // number of consecutive stations with mcPoints + int nHitContStations = 0; // number of consecutive stations with hits + int maxNStaMC = 0; // max number of mcPoints on station + int maxNSensorMC = 0; // max number of mcPoints with same z + int maxNStaHits = 0; // max number of hits on station + + int nStations = 0; // number of stations with hits + int nMCStations = 0; // number of stations with MCPoints + + bool isReconstructable = false; + bool isAdditional = false; // is not reconstructable, but stil interesting + // next members filled and used in Performance - vector<CbmL1Track*> rTracks; // array of assosiated recoTracks - vector<CbmL1Track*> - tTracks; // array of recoTracks wich aren't assosiated with this mcTrack, but use some hits from it. + L1Vector<CbmL1Track*> rTracks {"CbmL1MCTrack::rTracks"}; // array of assosiated recoTracks + L1Vector<CbmL1Track*> tTracks {"CbmL1MCTrack::tTracks"}; // array of recoTracks + // wich aren't assosiated with this mcTrack, + // but use some hits from it. }; diff --git a/reco/L1/CbmL1Performance.cxx b/reco/L1/CbmL1Performance.cxx index 06212c90cb3824451031a7b1a5f74fa9b24e331c..1dfe8ca5c90b7fe81cdfe2c537013cf0479582da 100644 --- a/reco/L1/CbmL1Performance.cxx +++ b/reco/L1/CbmL1Performance.cxx @@ -106,17 +106,14 @@ void CbmL1::TrackMatch() if (double(posIt->second) > max_percent * double(hitsum)) max_percent = double(posIt->second) / double(hitsum); // set relation to the mcTrack - if (double(posIt->second) >= CbmL1Constants::MinPurity * double(hitsum)) { // found correspondent MCTrack - if (pMCTrackMap.find(posIt->first) == pMCTrackMap.end()) continue; - CbmL1MCTrack* pmtra = pMCTrackMap[posIt->first]; + if (pMCTrackMap.find(posIt->first) == pMCTrackMap.end()) continue; + CbmL1MCTrack* pmtra = pMCTrackMap[posIt->first]; + if (double(posIt->second) >= CbmL1Constants::MinPurity * double(hitsum)) { // found correspondent MCTrack pmtra->AddRecoTrack(prtra); prtra->AddMCTrack(pmtra); } else { - if (pMCTrackMap.find(posIt->first) == pMCTrackMap.end()) continue; - CbmL1MCTrack* pmtra = pMCTrackMap[posIt->first]; - pmtra->AddTouchTrack(prtra); } } // for hitmap @@ -244,7 +241,7 @@ struct TL1PerfEfficiencies : public TL1Efficiencies { << " / " << "MCl(MCps)" << endl; - int NCounters = mc.NCounters; + int NCounters = mc.GetNcounters(); for (int iC = 0; iC < NCounters; iC++) { if ((names[iC] != "D0 efficiency") || (mc.counters[iC] != 0)) cout << names[iC] << " : " << ratio_reco.counters[iC] << " / " @@ -314,10 +311,10 @@ void CbmL1::EfficienciesPerformance() // is track killed. At least one hit of it belong to some recoTrack const bool killed = !reco && mtra.IsDisturbed(); // ration length for current mcTrack - vector<CbmL1Track*>& rTracks = mtra.GetRecoTracks(); // for length calculations - double ratio_length = 0; - double ratio_fakes = 0; - double mc_length_hits = mtra.NStations(); + L1Vector<CbmL1Track*>& rTracks = mtra.GetRecoTracks(); // for length calculations + double ratio_length = 0; + double ratio_fakes = 0; + double mc_length_hits = mtra.NStations(); int mc_length = mtra.NMCStations(); diff --git a/reco/L1/CbmL1ReadEvent.cxx b/reco/L1/CbmL1ReadEvent.cxx index cdc456c5805a6f325510322d720730730cee86f2..decfe7d2b37385afcc0582258b8199a35bdf6f33 100644 --- a/reco/L1/CbmL1ReadEvent.cxx +++ b/reco/L1/CbmL1ReadEvent.cxx @@ -175,7 +175,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, DFEI2I::iterator trk_it = dFEI2vMCTracks.find(dtrck); if (trk_it == dFEI2vMCTracks.end()) continue; Int_t IND_Track = trk_it->second; - vMCTracks[IND_Track].Points.push_back(vMCPoints.size()); + vMCTracks[IND_Track].Points.push_back_no_warning(vMCPoints.size()); MC.ID = trk_it->second; @@ -207,7 +207,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, DFEI2I::iterator trk_it = dFEI2vMCTracks.find(dtrck); if (trk_it == dFEI2vMCTracks.end()) continue; Int_t IND_Track = trk_it->second; - vMCTracks[IND_Track].Points.push_back(vMCPoints.size()); + vMCTracks[IND_Track].Points.push_back_no_warning(vMCPoints.size()); MC.ID = trk_it->second; vMCPoints.push_back(MC); @@ -236,7 +236,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, if (trk_it == dFEI2vMCTracks.end()) continue; Int_t IND_Track = trk_it->second; - vMCTracks[IND_Track].Points.push_back(vMCPoints.size()); + vMCTracks[IND_Track].Points.push_back_no_warning(vMCPoints.size()); MC.ID = trk_it->second; vMCPoints.push_back(MC); @@ -271,7 +271,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, if (trk_it == dFEI2vMCTracks.end()) continue; Int_t IND_Track = trk_it->second; - vMCTracks[IND_Track].Points.push_back(vMCPoints.size()); + vMCTracks[IND_Track].Points.push_back_no_warning(vMCPoints.size()); MC.ID = trk_it->second; vMCPoints.push_back(MC); @@ -357,7 +357,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, Int_t IND_Track = trk_it->second; - vMCTracks[IND_Track].Points.push_back(vMCPoints.size()); + vMCTracks[IND_Track].Points.push_back_no_warning(vMCPoints.size()); MC.ID = trk_it->second; @@ -918,7 +918,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, int maxHitIndex = nMvdHits + nStsHits + nMuchHits + nTrdHits; if (fTofHits) maxHitIndex += fTofHits->GetEntriesFast(); - SortedIndex.reset(max(nEntSts, maxHitIndex)); + SortedIndex.reset(std::max(nEntSts, maxHitIndex)); vStsHits.reserve(nHits); fData_->vStsHits.reserve(nHits); @@ -1329,63 +1329,28 @@ void CbmL1::HitMatch() } } //mach cluster - if (iP >= 0) { hit.event = vMCPoints[iP].event; - hit.mcPointIds.push_back(iP); - vMCPoints[iP].hitIds.push_back(iH); + hit.mcPointIds.push_back_no_warning(iP); + vMCPoints[iP].hitIds.push_back_no_warning(iH); } else { hit.event = -1; int idPoint = vHitMCRef[iH]; if (idPoint >= 0) { - hit.mcPointIds.push_back(idPoint); - vMCPoints[idPoint].hitIds.push_back(iH); + hit.mcPointIds.push_back_no_warning(idPoint); + vMCPoints[idPoint].hitIds.push_back_no_warning(iH); } } // if no clusters } - - if (hit.Det == 0) { // if no use Links or this is mvd hit - - int iP = vHitMCRef[iH]; - if (iP >= 0) { - hit.mcPointIds.push_back(iP); - vMCPoints[iP].hitIds.push_back(iH); - } - } - - if (hit.Det == 2) { // if no use Links or this is mvd hit - - int iP = vHitMCRef[iH]; - - if (iP >= 0) { - hit.mcPointIds.push_back(iP); - vMCPoints[iP].hitIds.push_back(iH); - } - } - - if (hit.Det == 3) { // if no use Links or this is mvd hit - - + if (hit.Det != 1) { // the hit is not from STS int iP = vHitMCRef[iH]; if (iP >= 0) { - hit.mcPointIds.push_back(iP); - vMCPoints[iP].hitIds.push_back(iH); + hit.mcPointIds.push_back_no_warning(iP); + vMCPoints[iP].hitIds.push_back_no_warning(iH); } } - if (hit.Det == 4) { // if no use Links or this is mvd hit - - - int iP = vHitMCRef[iH]; - - if (iP >= 0) { - hit.mcPointIds.push_back(iP); - vMCPoints[iP].hitIds.push_back(iH); - } - } - - } // for hits } diff --git a/reco/L1/L1Algo/L1AlgoTBB.h b/reco/L1/L1Algo/L1AlgoTBB.h index 112f535a31b4b6c30b3f712e737257737449b526..a0005ff6d46ab93c8e8446cc850c01036d4de2b7 100644 --- a/reco/L1/L1Algo/L1AlgoTBB.h +++ b/reco/L1/L1Algo/L1AlgoTBB.h @@ -13,249 +13,253 @@ #include "tbb/blocked_range.h" #include "tbb/parallel_for.h" #include "tbb/task_scheduler_init.h" -using namespace tbb; - -class ParalleledDup { - // input - int isec; - L1Station* vStations; - int NStations; - Tindex* StsHitsStartIndex; - Tindex* StsHitsStopIndex; - vector<unsigned char>& vSFlag; - vector<unsigned char>& vSFlagB; - std::vector<L1HitPoint>& vStsHits; - double Pick_r; - double Pick_m; - double MaxInvMom; - fvec targX; - fvec targY; - fvec targZ; - L1FieldValue& targB; - L1XYMeasurementInfo& TargetXYInfo; - - Tindex* n_g1; - unsigned* portionStopIndex; - L1TrackPar* T_g1; - L1FieldRegion* fld_g1; - THitI* hitsl_g1; - // fvec *x_minusV_g1; fvec *x_plusV_g1; fvec *y_minusV_g1; fvec *y_plusV_g1; - // output - THitI* Duplets_start; - THitI* Duplets_hits; - - Tindex* n_g2; - THitI* i1_g2; - // L1TrackPar *T_g2; - // L1FieldRegion *fld_g2; - // fvec *u_front_g2; fvec *u_back_g2; - // THitI *hitsl_g2; - THitI* hitsm_g2; - // fvec *x_minusV_g2; fvec *x_plusV_g2; fvec *y_minusV_g2; fvec *y_plusV_g2; - -public: - void operator()(const blocked_range<size_t>& r) const; - - ParalleledDup( - // input - int isec_, L1Station* vStations_, int NStations_, Tindex* StsHitsStartIndex_, Tindex* StsHitsStopIndex_, - vector<unsigned char>& vSFlag_, vector<unsigned char>& vSFlagB_, std::vector<L1HitPoint>& vStsHits_, double Pick_r_, - double Pick_m_, double MaxInvMom_, fvec targX_, fvec targY_, fvec targZ_, L1FieldValue& targB_, - L1XYMeasurementInfo& TargetXYInfo_, - Tindex* n_g1_, unsigned* portionStopIndex_, L1TrackPar* T_g1_, L1FieldRegion* fld_g1_, THitI* hitsl_g1_, - // fvec *x_minusV_g1_, fvec *x_plusV_g1_, fvec *y_minusV_g1_, fvec *y_plusV_g1_, - // output - THitI* Duplets_start_, THitI* Duplets_hits_, - - Tindex* n_g2_, THitI* i1_g2_, - // L1TrackPar *T_g2_, - // L1FieldRegion *fld_g2_, - // fvec *u_front_g2_, fvec *u_back_g2_, - // THitI *hitsl_g2_, - THitI* hitsm_g2_ - // fvec *x_minusV_g2_, fvec *x_plusV_g2_, fvec *y_minusV_g2_, fvec *y_plusV_g2_ - ) - : isec(isec_) - , vStations(vStations_) - , NStations(NStations_) - , StsHitsStartIndex(StsHitsStartIndex_) - , StsHitsStopIndex(StsHitsStopIndex_) - , vSFlag(vSFlag_) - , vSFlagB(vSFlagB_) - , vStsHits(vStsHits_) - , Pick_r(Pick_r_) - , Pick_m(Pick_m_) - , MaxInvMom(MaxInvMom_) - , targX(targX_) - , targY(targY_) - , targZ(targZ_) - , targB(targB_) - , TargetXYInfo(TargetXYInfo_) - , - - n_g1(n_g1_) - , portionStopIndex(portionStopIndex_) - , T_g1(T_g1_) - , fld_g1(fld_g1_) - , hitsl_g1(hitsl_g1_) - , - // x_minusV_g1(x_minusV_g1_), x_plusV_g1(x_plusV_g1_), y_minusV_g1(y_minusV_g1_), y_plusV_g1(y_plusV_g1_), - // output - Duplets_start(Duplets_start_) - , Duplets_hits(Duplets_hits_) - , - - n_g2(n_g2_) - , i1_g2(i1_g2_) - , - // T_g2(T_g2_), - // fld_g2(fld_g2_), - // u_front_g2(u_front_g2_), u_back_g2(u_back_g2_), - // hitsl_g2(hitsl_g2_), - hitsm_g2(hitsm_g2_) - // x_minusV_g2(x_minusV_g2_), x_plusV_g2(x_plusV_g2_), y_minusV_g2(y_minusV_g2_), y_plusV_g2(y_plusV_g2_) - {}; - - ~ParalleledDup() {}; -}; - -void ParalleledDup::operator()(const blocked_range<size_t>& r) const +namespace tbb { - for (Tindex istal = r.begin(); istal < (Tindex) r.end(); ++istal) { - // cout<< " ParalleledDup::operator(). Station: " << istal << endl; - DupletsStaPort( // input - isec, istal, vStsHits, targX, targY, targZ, targB, TargetXYInfo, - - n_g1, portionStopIndex, T_g1, fld_g1, hitsl_g1, - // x_minusV_g1, x_plusV_g1, y_minusV_g1, y_plusV_g1, + class ParalleledDup { + // input + int isec; + L1Station* vStations; + int NStations; + Tindex* StsHitsStartIndex; + Tindex* StsHitsStopIndex; + vector<unsigned char>& vSFlag; + vector<unsigned char>& vSFlagB; + std::vector<L1HitPoint>& vStsHits; + double Pick_r; + double Pick_m; + double MaxInvMom; + fvec targX; + fvec targY; + fvec targZ; + L1FieldValue& targB; + L1XYMeasurementInfo& TargetXYInfo; + + Tindex* n_g1; + unsigned* portionStopIndex; + L1TrackPar* T_g1; + L1FieldRegion* fld_g1; + THitI* hitsl_g1; + // fvec *x_minusV_g1; fvec *x_plusV_g1; fvec *y_minusV_g1; fvec *y_plusV_g1; + // output + THitI* Duplets_start; + THitI* Duplets_hits; + + Tindex* n_g2; + THitI* i1_g2; + // L1TrackPar *T_g2; + // L1FieldRegion *fld_g2; + // fvec *u_front_g2; fvec *u_back_g2; + // THitI *hitsl_g2; + THitI* hitsm_g2; + // fvec *x_minusV_g2; fvec *x_plusV_g2; fvec *y_minusV_g2; fvec *y_plusV_g2; + + public: + void operator()(const blocked_range<size_t>& r) const; + + ParalleledDup( + // input + int isec_, L1Station* vStations_, int NStations_, Tindex* StsHitsStartIndex_, Tindex* StsHitsStopIndex_, + vector<unsigned char>& vSFlag_, vector<unsigned char>& vSFlagB_, std::vector<L1HitPoint>& vStsHits_, + double Pick_r_, double Pick_m_, double MaxInvMom_, fvec targX_, fvec targY_, fvec targZ_, L1FieldValue& targB_, + L1XYMeasurementInfo& TargetXYInfo_, + + Tindex* n_g1_, unsigned* portionStopIndex_, L1TrackPar* T_g1_, L1FieldRegion* fld_g1_, THitI* hitsl_g1_, + // fvec *x_minusV_g1_, fvec *x_plusV_g1_, fvec *y_minusV_g1_, fvec *y_plusV_g1_, // output - Duplets_start, Duplets_hits, - - n_g2, i1_g2, - // T_g2, - // fld_g2, - // u_front_g2, u_back_g2, - // hitsl_g2, - hitsm_g2 - // x_minusV_g2, x_plusV_g2, y_minusV_g2, y_plusV_g2 - ); + THitI* Duplets_start_, THitI* Duplets_hits_, + + Tindex* n_g2_, THitI* i1_g2_, + // L1TrackPar *T_g2_, + // L1FieldRegion *fld_g2_, + // fvec *u_front_g2_, fvec *u_back_g2_, + // THitI *hitsl_g2_, + THitI* hitsm_g2_ + // fvec *x_minusV_g2_, fvec *x_plusV_g2_, fvec *y_minusV_g2_, fvec *y_plusV_g2_ + ) + : isec(isec_) + , vStations(vStations_) + , NStations(NStations_) + , StsHitsStartIndex(StsHitsStartIndex_) + , StsHitsStopIndex(StsHitsStopIndex_) + , vSFlag(vSFlag_) + , vSFlagB(vSFlagB_) + , vStsHits(vStsHits_) + , Pick_r(Pick_r_) + , Pick_m(Pick_m_) + , MaxInvMom(MaxInvMom_) + , targX(targX_) + , targY(targY_) + , targZ(targZ_) + , targB(targB_) + , TargetXYInfo(TargetXYInfo_) + , + + n_g1(n_g1_) + , portionStopIndex(portionStopIndex_) + , T_g1(T_g1_) + , fld_g1(fld_g1_) + , hitsl_g1(hitsl_g1_) + , + // x_minusV_g1(x_minusV_g1_), x_plusV_g1(x_plusV_g1_), y_minusV_g1(y_minusV_g1_), y_plusV_g1(y_plusV_g1_), + // output + Duplets_start(Duplets_start_) + , Duplets_hits(Duplets_hits_) + , + + n_g2(n_g2_) + , i1_g2(i1_g2_) + , + // T_g2(T_g2_), + // fld_g2(fld_g2_), + // u_front_g2(u_front_g2_), u_back_g2(u_back_g2_), + // hitsl_g2(hitsl_g2_), + hitsm_g2(hitsm_g2_) + // x_minusV_g2(x_minusV_g2_), x_plusV_g2(x_plusV_g2_), y_minusV_g2(y_minusV_g2_), y_plusV_g2(y_plusV_g2_) + {}; + + ~ParalleledDup() {}; + }; + + void ParalleledDup::operator()(const blocked_range<size_t>& r) const + { + + for (Tindex istal = r.begin(); istal < (Tindex) r.end(); ++istal) { + // cout<< " ParalleledDup::operator(). Station: " << istal << endl; + DupletsStaPort( // input + isec, istal, vStsHits, targX, targY, targZ, targB, TargetXYInfo, + + n_g1, portionStopIndex, T_g1, fld_g1, hitsl_g1, + // x_minusV_g1, x_plusV_g1, y_minusV_g1, y_plusV_g1, + // output + Duplets_start, Duplets_hits, + + n_g2, i1_g2, + // T_g2, + // fld_g2, + // u_front_g2, u_back_g2, + // hitsl_g2, + hitsm_g2 + // x_minusV_g2, x_plusV_g2, y_minusV_g2, y_plusV_g2 + ); + } } -} - - -class ParalleledTrip { - // input - int isec; - L1Station* vStations; - int NStations; - Tindex* StsHitsStartIndex; - Tindex* StsHitsStopIndex; - std::vector<L1HitPoint>& svStsHits; - double Pick_r; - double TRACK_CHI2_CUT; - double MaxInvMom; - - Tindex* n_g1; - L1TrackPar* T_g1; - L1FieldRegion* fld_g1; - THitI* hitsl_g1; - - Tindex* n_g2; - unsigned* portionStopIndex; - THitI* i1_g2; - /* L1FieldRegion *fld_g2; + + + class ParalleledTrip { + // input + int isec; + L1Station* vStations; + int NStations; + Tindex* StsHitsStartIndex; + Tindex* StsHitsStopIndex; + std::vector<L1HitPoint>& svStsHits; + double Pick_r; + double TRACK_CHI2_CUT; + double MaxInvMom; + + Tindex* n_g1; + L1TrackPar* T_g1; + L1FieldRegion* fld_g1; + THitI* hitsl_g1; + + Tindex* n_g2; + unsigned* portionStopIndex; + THitI* i1_g2; + /* L1FieldRegion *fld_g2; fvec *u_front_g2; fvec *u_back_g2; L1TrackPar *T_g2;*/ - // THitI *hitsl_g2; - THitI* hitsm_g2; - // fvec *x_minusV_g2; fvec *x_plusV_g2; fvec *y_minusV_g2; fvec *y_plusV_g2; - // output - THitI* Duplets_start; - THitI* Duplets_hits; - std::vector<L1Triplet>* vTriplets_part; - unsigned* TripStartIndexH; - unsigned* TripStopIndexH; - -public: - void operator()(const blocked_range<size_t>& r) const; - - ParalleledTrip( - // input - int isec_, L1Station* vStations_, int NStations_, Tindex* StsHitsStartIndex_, Tindex* StsHitsStopIndex_, - std::vector<L1HitPoint>& vStsHits_, double Pick_r_, double TRACK_CHI2_CUT_, double MaxInvMom_, + // THitI *hitsl_g2; + THitI* hitsm_g2; + // fvec *x_minusV_g2; fvec *x_plusV_g2; fvec *y_minusV_g2; fvec *y_plusV_g2; + // output + THitI* Duplets_start; + THitI* Duplets_hits; + std::vector<L1Triplet>* vTriplets_part; + unsigned* TripStartIndexH; + unsigned* TripStopIndexH; + + public: + void operator()(const blocked_range<size_t>& r) const; + + ParalleledTrip( + // input + int isec_, L1Station* vStations_, int NStations_, Tindex* StsHitsStartIndex_, Tindex* StsHitsStopIndex_, + std::vector<L1HitPoint>& vStsHits_, double Pick_r_, double TRACK_CHI2_CUT_, double MaxInvMom_, - Tindex* n_g1_, L1TrackPar* T_g1_, L1FieldRegion* fld_g1_, THitI* hitsl_g1_, + Tindex* n_g1_, L1TrackPar* T_g1_, L1FieldRegion* fld_g1_, THitI* hitsl_g1_, - Tindex* n_g2_, unsigned* portionStopIndex_, THitI* i1_g2_, - /*L1FieldRegion *fld_g2_, + Tindex* n_g2_, unsigned* portionStopIndex_, THitI* i1_g2_, + /*L1FieldRegion *fld_g2_, fvec *u_front_g2_, fvec *u_back_g2_, L1TrackPar *T_g2_,*/ - // THitI *hitsl_g2_, - THitI* hitsm_g2_, - // fvec *x_minusV_g2_, fvec *x_plusV_g2_, fvec *y_minusV_g2_, fvec *y_plusV_g2_, - // output - THitI* Duplets_start_, THitI* Duplets_hits_, std::vector<L1Triplet>* vTriplets_part_, unsigned* TripStartIndexH_, - unsigned* TripStopIndexH_) - : // input - isec(isec_) - , vStations(vStations_) - , NStations(NStations_) - , StsHitsStartIndex(StsHitsStartIndex_) - , StsHitsStopIndex(StsHitsStopIndex_) - , svStsHits(vStsHits_) - , Pick_r(Pick_r_) - , TRACK_CHI2_CUT(TRACK_CHI2_CUT_) - , MaxInvMom(MaxInvMom_) - , - - n_g1(n_g1_) - , T_g1(T_g1_) - , fld_g1(fld_g1_) - , hitsl_g1(hitsl_g1_) - , - - n_g2(n_g2_) - , portionStopIndex(portionStopIndex_) - , i1_g2(i1_g2_) - , - /* fld_g2(fld_g2_), + // THitI *hitsl_g2_, + THitI* hitsm_g2_, + // fvec *x_minusV_g2_, fvec *x_plusV_g2_, fvec *y_minusV_g2_, fvec *y_plusV_g2_, + // output + THitI* Duplets_start_, THitI* Duplets_hits_, std::vector<L1Triplet>* vTriplets_part_, unsigned* TripStartIndexH_, + unsigned* TripStopIndexH_) + : // input + isec(isec_) + , vStations(vStations_) + , NStations(NStations_) + , StsHitsStartIndex(StsHitsStartIndex_) + , StsHitsStopIndex(StsHitsStopIndex_) + , svStsHits(vStsHits_) + , Pick_r(Pick_r_) + , TRACK_CHI2_CUT(TRACK_CHI2_CUT_) + , MaxInvMom(MaxInvMom_) + , + + n_g1(n_g1_) + , T_g1(T_g1_) + , fld_g1(fld_g1_) + , hitsl_g1(hitsl_g1_) + , + + n_g2(n_g2_) + , portionStopIndex(portionStopIndex_) + , i1_g2(i1_g2_) + , + /* fld_g2(fld_g2_), u_front_g2(u_front_g2_), u_back_g2(u_back_g2_), T_g2(T_g2_),*/ - // hitsl_g2(hitsl_g2_), - hitsm_g2(hitsm_g2_) - , - // x_minusV_g2(x_minusV_g2_), x_plusV_g2(x_plusV_g2_), y_minusV_g2(y_minusV_g2_), y_plusV_g2(y_plusV_g2_), - // output - Duplets_start(Duplets_start_) - , Duplets_hits(Duplets_hits_) - , vTriplets_part(vTriplets_part_) - , TripStartIndexH(TripStartIndexH_) - , TripStopIndexH(TripStopIndexH_) {}; + // hitsl_g2(hitsl_g2_), + hitsm_g2(hitsm_g2_) + , + // x_minusV_g2(x_minusV_g2_), x_plusV_g2(x_plusV_g2_), y_minusV_g2(y_minusV_g2_), y_plusV_g2(y_plusV_g2_), + // output + Duplets_start(Duplets_start_) + , Duplets_hits(Duplets_hits_) + , vTriplets_part(vTriplets_part_) + , TripStartIndexH(TripStartIndexH_) + , TripStopIndexH(TripStopIndexH_) {}; - ~ParalleledTrip() {}; -}; + ~ParalleledTrip() {}; + }; -void ParalleledTrip::operator()(const blocked_range<size_t>& r) const -{ + void ParalleledTrip::operator()(const blocked_range<size_t>& r) const + { - for (Tindex istal = r.begin(); istal < (Tindex) r.end(); ++istal) { - // cout<< " ParalleledTrip::operator(). Station: " << istal << endl; - TripletsStaPort( // input - isec, istal, svStsHits, n_g1, T_g1, fld_g1, hitsl_g1, + for (Tindex istal = r.begin(); istal < (Tindex) r.end(); ++istal) { + // cout<< " ParalleledTrip::operator(). Station: " << istal << endl; + TripletsStaPort( // input + isec, istal, svStsHits, n_g1, T_g1, fld_g1, hitsl_g1, - n_g2, portionStopIndex, i1_g2, - /* fld_g2, + n_g2, portionStopIndex, i1_g2, + /* fld_g2, u_front_g2, u_back_g2, T_g2,*/ - // hitsl_g2, - hitsm_g2, - // x_minusV_g2, x_plusV_g2, y_minusV_g2, y_plusV_g2, - // output - Duplets_start, Duplets_hits, vTriplets_part, TripStartIndexH, TripStopIndexH); + // hitsl_g2, + hitsm_g2, + // x_minusV_g2, x_plusV_g2, y_minusV_g2, y_plusV_g2, + // output + Duplets_start, Duplets_hits, vTriplets_part, TripStartIndexH, TripStopIndexH); + } } -} +} //namespace tbb + #endif // TBB #endif diff --git a/reco/L1/L1Algo/L1CATrackFinder.cxx b/reco/L1/L1Algo/L1CATrackFinder.cxx index 81d85355488dd7ad518c63474659ea9138454470..ad64f00a245c38fcfaf4a423742f6d68aceec468 100644 --- a/reco/L1/L1Algo/L1CATrackFinder.cxx +++ b/reco/L1/L1Algo/L1CATrackFinder.cxx @@ -1653,7 +1653,7 @@ void L1Algo::CATrackFinder() for (THitI ih = StsHitsStartIndex[ist]; ih < StsHitsStopIndex[ist]; ++ih) { const float& time = (*vStsHits)[ih].t; - if ((lasttime < time) && (!isinf(time))) lasttime = time; + if ((lasttime < time) && (!std::isinf(time))) lasttime = time; if ((starttime > time) && (time > 0)) starttime = time; if (ist < NMvdStations) { diff --git a/reco/L1/L1Algo/L1Def.h b/reco/L1/L1Algo/L1Def.h index 24c24288db39295b330370488160b9166bc17e3c..f60d2607d534b6c44dbca71b877671c08ce4ba11 100644 --- a/reco/L1/L1Algo/L1Def.h +++ b/reco/L1/L1Algo/L1Def.h @@ -61,8 +61,6 @@ T finite(T x) #endif -using namespace std; - typedef int index_type; #endif diff --git a/reco/L1/L1Algo/L1EventEfficiencies.h b/reco/L1/L1Algo/L1EventEfficiencies.h index 6fb17225bb78d23e8644180b0fe1e46a5224e57d..900c3da018493ac9b5bd60b0e271143c0c5707fd 100644 --- a/reco/L1/L1Algo/L1EventEfficiencies.h +++ b/reco/L1/L1Algo/L1EventEfficiencies.h @@ -7,8 +7,6 @@ #include <cstring> #include <iostream> -using std::string; - class L1EventEfficiencies { public: L1EventEfficiencies() @@ -29,7 +27,7 @@ public: ~L1EventEfficiencies() {}; - void AddCounter(string shortname, string name) + void AddCounter(std::string shortname, std::string name) { indices[shortname] = names.size(); names.push_back(name); @@ -63,7 +61,7 @@ public: } - void Inc(bool isReco, int _nclones, string name) + void Inc(bool isReco, int _nclones, std::string name) { const int index = indices[name]; mc.counters[index]++; @@ -78,8 +76,8 @@ public: void PrintEff() { - std::cout.setf(ios::fixed); - std::cout.setf(ios::showpoint); + std::cout.setf(std::ios::fixed); + std::cout.setf(std::ios::showpoint); std::cout.precision(3); std::cout << "Event category normalised to: " << " Eff " @@ -90,19 +88,19 @@ public: << " | " << "All MC" << std::endl; - int NCounters = mc.NCounters; + int NCounters = mc.GetNcounters(); for (int iC = 0; iC < NCounters; iC++) { std::cout << names[iC] << " : " << ratio_reco.counters[iC] << " / " << ratio_clone.counters[iC] // nCloneTracks/nMCTracks - << " / " << setw(8) << reco.counters[iC] / double(nEvents) << " | " << setw(8) + << " / " << std::setw(8) << reco.counters[iC] / double(nEvents) << " | " << std::setw(8) << mc.counters[iC] / double(nEvents) << std::endl; } std::cout << "Ghost probability : " << ratio_ghosts << " | " << ghosts << std::endl; } private: - vector<string> names; // names counters indexed by index of counter - map<string, int> indices; // indices of counters indexed by a counter shortname + std::vector<std::string> names; // names counters indexed by index of counter + std::map<std::string, int> indices; // indices of counters indexed by a counter shortname TL1TracksCatCounters<double> ratio_reco; double ratio_ghosts; diff --git a/reco/L1/L1Algo/L1Grid.h b/reco/L1/L1Algo/L1Grid.h index fd72235659e9e21e5f759808d1d9ae3c29713f54..77b80e67bb5373f6a97e4e1aa128afe92ff129e4 100644 --- a/reco/L1/L1Algo/L1Grid.h +++ b/reco/L1/L1Algo/L1Grid.h @@ -24,8 +24,6 @@ #include "L1HitPoint.h" #include "L1Vector.h" -using namespace std; - class L1Algo; //class L1HitPoint; @@ -242,8 +240,8 @@ inline void L1Grid::GetBinBounded(const float& Y, const float& Z, unsigned short const short& yBin = (Y * fStepYInv - fYMinOverStep); const short& zBin = (Z * fStepZInv - fZMinOverStep); - bY = max(short(0), min(short(fNy - 1), yBin)); - bZ = max(short(0), min(short(fNz - 1), zBin)); + bY = std::max(short(0), std::min(short(fNy - 1), yBin)); + bZ = std::max(short(0), std::min(short(fNz - 1), zBin)); } inline void L1Grid::GetBinBounded(const float& Y, const float& Z, const float& T, unsigned short& bY, @@ -256,9 +254,9 @@ inline void L1Grid::GetBinBounded(const float& Y, const float& Z, const float& T // cout<<fStepTInv<<" fStepTInv "<<fTMinOverStep<<" fTMinOverStep "<<T<<" T "<<endl; - bY = max(short(0), min(short(fNy - 1), yBin)); - bZ = max(short(0), min(short(fNz - 1), zBin)); - bT = max(short(0), min(short(fNt - 1), tBin)); + bY = std::max(short(0), std::min(short(fNy - 1), yBin)); + bZ = std::max(short(0), std::min(short(fNz - 1), zBin)); + bT = std::max(short(0), std::min(short(fNt - 1), tBin)); // cout<<(fNt - 1)<<" (fNt - 1) "<<tBin<<" tBin "<<bT<<" bT "<<endl; } diff --git a/reco/L1/L1Algo/L1Vector.h b/reco/L1/L1Algo/L1Vector.h index 80f2cf1609078c2da0b00b4c18335ae9f191261f..e286b1a6d4033a6005fd5f125c15d7278ea92d6f 100644 --- a/reco/L1/L1Algo/L1Vector.h +++ b/reco/L1/L1Algo/L1Vector.h @@ -16,8 +16,6 @@ #endif #include <sstream> -using namespace std; - /// L1Vector class is a wrapper around std::vector. /// It does the following: /// 1. gives names to vectors for better debugging @@ -116,6 +114,12 @@ public: Tbase::push_back(value); } + template<typename Tinput> + void push_back_no_warning(Tinput value) + { + Tbase::push_back(value); + } + template<typename... Tinput> void emplace_back(Tinput&&... value) { @@ -180,6 +184,7 @@ public: using Tbase::end; using Tbase::insert; //TODO:: make it private using Tbase::pop_back; + using Tbase::rbegin; using Tbase::reserve; using Tbase::size; using typename Tbase::iterator; diff --git a/reco/L1/L1AlgoInputData.h b/reco/L1/L1AlgoInputData.h index 6b21c9c59987fdc0e36e474a2e41ea8dcdb1bcb4..9e78094dab44cab2f6c8eb8e5002d92fb5fb61ff 100644 --- a/reco/L1/L1AlgoInputData.h +++ b/reco/L1/L1AlgoInputData.h @@ -12,8 +12,6 @@ #include "L1Hit.h" #include "L1Vector.h" -using std::istream; - class L1AlgoInputData { public: @@ -60,8 +58,8 @@ public: // private: // functionality - static istream& eatwhite(istream& is); // skip spaces - /// read data from data_algo.txt + static std::istream& eatwhite(std::istream& is); // skip spaces + /// read data from data_algo.txt // data enum { @@ -71,7 +69,7 @@ public: int NStsStrips {0}; // Number of strips in sts L1Vector<unsigned char> fStripFlag { - "L1AlgoInputData::fStripFlag"}; // information of hits station & using hits in tracks; + "L1AlgoInputData::fStripFlag"}; // information of hits station & used hits in tracks; THitI StsHitsStartIndex[MaxNStations + 1] {0}; // station-bounders in vStsHits array THitI StsHitsStopIndex[MaxNStations + 1] {0}; // station-bounders in vStsHits array diff --git a/reco/eventbuilder/tracks/CbmEbEventEfficiencies.h b/reco/eventbuilder/tracks/CbmEbEventEfficiencies.h index c813d04b3901576304e1d3fabdb80ef59986e6c6..fb3c90ef68faba404b16a80e66bfd7c06a112f9e 100644 --- a/reco/eventbuilder/tracks/CbmEbEventEfficiencies.h +++ b/reco/eventbuilder/tracks/CbmEbEventEfficiencies.h @@ -11,8 +11,7 @@ #include <cstring> #include <iostream> - -using std::string; +#include <vector> class CbmEbEventEfficiencies { public: @@ -34,7 +33,7 @@ public: ~CbmEbEventEfficiencies() {}; - void AddCounter(string shortname, string name) + void AddCounter(std::string shortname, std::string name) { indices[shortname] = names.size(); names.push_back(name); @@ -67,7 +66,7 @@ public: } - void Inc(bool isReco, int _nclones, string name) + void Inc(bool isReco, int _nclones, std::string name) { const int index = indices[name]; mc.counters[index]++; @@ -82,8 +81,8 @@ public: void PrintEff() { - std::cout.setf(ios::fixed); - std::cout.setf(ios::showpoint); + std::cout.setf(std::ios::fixed); + std::cout.setf(std::ios::showpoint); std::cout.precision(3); std::cout << "Event category normalised to: " << " Eff " @@ -94,19 +93,19 @@ public: << " | " << "All MC" << std::endl; - int NCounters = mc.NCounters; + int NCounters = mc.GetNcounters(); for (int iC = 0; iC < NCounters; iC++) { std::cout << names[iC] << " : " << ratio_reco.counters[iC] << " / " << ratio_clone.counters[iC] // nCloneTracks/nMCTracks - << " / " << setw(8) << reco.counters[iC] / double(nEvents) << " | " << setw(8) + << " / " << std::setw(8) << reco.counters[iC] / double(nEvents) << " | " << std::setw(8) << mc.counters[iC] / double(nEvents) << std::endl; } std::cout << "Ghost probability : " << ratio_ghosts << " | " << ghosts << std::endl; } private: - vector<string> names; // names counters indexed by index of counter - map<string, int> indices; // indices of counters indexed by a counter shortname + std::vector<std::string> names; // names counters indexed by index of counter + std::map<std::string, int> indices; // indices of counters indexed by a counter shortname TL1TracksCatCounters<double> ratio_reco; double ratio_ghosts;