102102#include < utility>
103103#include < vector>
104104
105- #include < math.h>
106-
107105using namespace o2 ;
108106using namespace o2 ::framework;
109107using std::array;
@@ -291,9 +289,9 @@ struct OnTheFlyTracker {
291289 nSiliconHits (nSiliconHitsInput),
292290 nTPCHits (nTPCHitsInput),
293291 trackType (trackTypeInput) {}
294- const TimeEst& getTimeMUS () const { return timeEst; }
292+ [[nodiscard]] const TimeEst& getTimeMUS () const { return timeEst; }
295293 int64_t mcLabel = -1 ; // /< MC label of the track
296- TimeEst timeEst{}; // /< time estimate in ns
294+ TimeEst timeEst; // /< time estimate in ns
297295 bool isDecayDau = false ; // /< is a decay daughter
298296 bool isPVContributor = false ; // /< track is PV contributor
299297 bool isWeakDecayDau = false ; // /< is a weak decay daughter
@@ -450,7 +448,7 @@ struct OnTheFlyTracker {
450448 // load LUTs for primaries
451449 for (const auto & entry : globalConfiguration) {
452450 int pdg = 0 ;
453- if (entry.first .find (" lut" ) != 0 ) {
451+ if (! entry.first .starts_with (" lut" )) {
454452 continue ;
455453 }
456454 if (entry.first .find (" lutEl" ) != std::string::npos) {
@@ -487,8 +485,7 @@ struct OnTheFlyTracker {
487485 if (filename.empty ()) {
488486 LOG (warning) << " No LUT file passed for pdg " << pdg << " , skipping." ;
489487 }
490- bool success = mSmearer [icfg]->loadTable (pdg, filename.c_str ());
491- if (!success) {
488+ if (!mSmearer [icfg]->loadTable (pdg, filename.c_str ())) {
492489 LOG (fatal) << " Having issue with loading the LUT " << pdg << " " << filename;
493490 }
494491 }
@@ -500,7 +497,7 @@ struct OnTheFlyTracker {
500497 mSmearer [icfg]->skipUnreconstructed (!processUnreconstructedTracks.value );
501498
502499 insertHist (histPath + " hPtGenerated" , " hPtGenerated;#it{p}_{T} (GeV/c);Counts" , kTH1D , {{axes.axisMomentum }});
503- insertHist (histPath + " hPhiGenerated" , " hPhiGenerated;#phi (rad);Counts" , kTH1D , {{100 , 0 .0f , 2 * M_PI , " #phi (rad)" }});
500+ insertHist (histPath + " hPhiGenerated" , " hPhiGenerated;#phi (rad);Counts" , kTH1D , {{100 , 0 .0f , o2::constants::math::TwoPI , " #phi (rad)" }});
504501
505502 insertHist (histPath + " hPtGeneratedEl" , " hPtGeneratedEl;Gen #it{p}_{T} (GeV/c);Counts" , kTH1D , {{axes.axisMomentum }});
506503 insertHist (histPath + " hPtGeneratedPi" , " hPtGeneratedPi;Gen #it{p}_{T} (GeV/c);Counts" , kTH1D , {{axes.axisMomentum }});
@@ -740,7 +737,7 @@ struct OnTheFlyTracker {
740737 // Cross-check
741738 LOGF (info, " Check field at (0, 0, 0): %.1f kG, nominal: %.1f" , static_cast <float >(fieldInstance->GetBz (0 , 0 , 0 )), static_cast <float >(field));
742739 LOGF (info, " Initializing empty material cylinder LUT - could be better in the future" );
743- o2::base::MatLayerCylSet * lut = new o2::base::MatLayerCylSet ();
740+ auto * lut = new o2::base::MatLayerCylSet ();
744741 lut->addLayer (200 , 200.1 , 2 , 1 .0f , 100 .0f );
745742 LOGF (info, " MatLayerCylSet::optimizePhiSlices()" );
746743 lut->optimizePhiSlices ();
@@ -1070,10 +1067,10 @@ struct OnTheFlyTracker {
10701067 if (TMath::IsNaN (xiDaughterTrackParCovsTracked[i].getZ ())) {
10711068 isReco[i] = false ;
10721069 continue ;
1073- } else {
1074- getHist<TH1 >(histPath + " hXiBuilding" )->Fill (4 .0f );
1075- histos.fill (HIST (" hNaNBookkeeping" ), i + 1 , 1 .0f );
10761070 }
1071+ getHist<TH1 >(histPath + " hXiBuilding" )->Fill (4 .0f );
1072+ histos.fill (HIST (" hNaNBookkeeping" ), i + 1 , 1 .0f );
1073+
10771074 trackTime = (eventCollisionTimeNS + gRandom ->Gaus (0 ., timeResolutionNs)) * nsToMus;
10781075 // TODO: add flag for whether it's a ghost track or not, currently assuming all are reconstructed tracks if they pass the fast tracker requirements
10791076 TrackType trackType = isReco[i] ? TrackType::kRecoCascDaug : TrackType::kGenCascDaug ;
@@ -1298,7 +1295,7 @@ struct OnTheFlyTracker {
12981295 o2::track::TrackParCov trackedCascade;
12991296 const o2::track::TrackParCov& trackedBach = xiDaughterTrackParCovsTracked[0 ];
13001297 const int nCascHits = fastTracker[icfg]->FastTrack (perfectCascadeTrack, trackedCascade, dNdEta, xiDecayRadius2D);
1301- reconstructedCascade = ( fastTrackerSettings.minSiliconHitsForKinkReco < nCascHits) ? true : false ;
1298+ reconstructedCascade = fastTrackerSettings.minSiliconHitsForKinkReco < nCascHits;
13021299 if (reconstructedCascade) {
13031300 std::array<float , 3 > pCasc{};
13041301 std::array<float , 3 > pBach{};
@@ -1358,10 +1355,9 @@ struct OnTheFlyTracker {
13581355 std::array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassLambda});
13591356 newCascadeTrack.setPID (pdgCodeToPID (PDG_t::kXiMinus )); // FIXME: not OK for omegas
13601357 float trackTime = (eventCollisionTimeNS + gRandom ->Gaus (0 ., timeResolutionNs)) * nsToMus;
1361- if (reconstructedCascade) {
1362- tracksCascadeProngs[kCascProngs + 1 ] = TrackAlice3{newCascadeTrack, mcParticle.globalIndex (), trackTime, timeResolutionUs, false , false , false , 1 , thisCascade.foundClusters , TrackType::kRecoCascDaug };
1363- }
1364- tracksCascadeProngs[kCascProngs + 1 ] = TrackAlice3{newCascadeTrack, mcParticle.globalIndex (), trackTime, timeResolutionUs, false , false , false , 1 , thisCascade.foundClusters , 0 , TrackType::kRecoCascDaug };
1358+
1359+ tracksCascadeProngs[kCascProngs + 1 ] = TrackAlice3{newCascadeTrack, mcParticle.globalIndex (), trackTime, timeResolutionUs, false , false , false , 1 , thisCascade.foundClusters , TrackType::kRecoCascDaug };
1360+
13651361 fillCascadeTable = true ;
13661362 } // end fitter OK
13671363 } // end cascade found
@@ -1840,57 +1836,58 @@ struct OnTheFlyTracker {
18401836 // / \param trackParCov track of the particle to compute bremsstrahlung for
18411837 void computeBremsstrahlungLoss (const int icfg, const auto & mcParticle, o2::track::TrackParCov& trackParCov)
18421838 {
1843- if (brSettings.radiateBR ) {
1844- const o2::fastsim::GeometryEntry geoEntry = mGeoContainer .getEntry (icfg);
1845-
1846- for (auto const & layerName : geoEntry.getLayerNames ()) {
1847- if (layerName.find (" global" ) != std::string::npos) { // Layers with global tag are skipped
1848- continue ;
1849- }
1839+ if (!brSettings.radiateBR ) {
1840+ return ;
1841+ }
1842+ const o2::fastsim::GeometryEntry geoEntry = mGeoContainer .getEntry (icfg);
18501843
1851- float mass = o2::constants::physics::MassElectron;
1844+ for (auto const & layerName : geoEntry.getLayerNames ()) {
1845+ if (layerName.find (" global" ) != std::string::npos) { // Layers with global tag are skipped
1846+ continue ;
1847+ }
18521848
1853- switch (std::abs (mcParticle.pdgCode ())) {
1854- case kElectron :
1855- mass = o2::constants::physics::MassElectron;
1856- break ;
1857- case kMuonMinus :
1858- mass = o2::constants::physics::MassMuon;
1859- break ;
1860- case kPiPlus :
1861- mass = o2::constants::physics::MassPionCharged;
1862- break ;
1863- case kKPlus :
1864- mass = o2::constants::physics::MassKaonCharged;
1865- break ;
1866- case kProton :
1867- mass = o2::constants::physics::MassProton;
1868- break ;
1869- default :
1870- break ;
1871- }
1849+ float mass = o2::constants::physics::MassElectron;
1850+
1851+ switch (std::abs (mcParticle.pdgCode ())) {
1852+ case kElectron :
1853+ mass = o2::constants::physics::MassElectron;
1854+ break ;
1855+ case kMuonMinus :
1856+ mass = o2::constants::physics::MassMuon;
1857+ break ;
1858+ case kPiPlus :
1859+ mass = o2::constants::physics::MassPionCharged;
1860+ break ;
1861+ case kKPlus :
1862+ mass = o2::constants::physics::MassKaonCharged;
1863+ break ;
1864+ case kProton :
1865+ mass = o2::constants::physics::MassProton;
1866+ break ;
1867+ default :
1868+ break ;
1869+ }
18721870
1873- float lambda = brSettings.radiationStrength * mcParticle.e () * geoEntry.getFloatValue (layerName, " x0" ) / (mass * mass);
1874- ULong64_t nPhotons = gRandom ->Poisson (lambda);
1871+ float lambda = brSettings.radiationStrength * mcParticle.e () * geoEntry.getFloatValue (layerName, " x0" ) / (mass * mass);
1872+ ULong64_t nPhotons = gRandom ->Poisson (lambda);
18751873
1876- double initialMomentum = trackParCov.getP ();
1874+ double initialMomentum = trackParCov.getP ();
18771875
1878- for (ULong64_t photon = 0 ; photon < nPhotons; ++photon) {
1879- float radiativeLoss = 1 .0f - brSettings.minBREnergyFraction * std::pow (brSettings.maxBREnergyFraction / brSettings.minBREnergyFraction , gRandom ->Rndm ());
1880- trackParCov.setQ2Pt (trackParCov.getQ2Pt () / radiativeLoss);
1881- }
1876+ for (ULong64_t photon = 0 ; photon < nPhotons; ++photon) {
1877+ float radiativeLoss = 1 .0f - brSettings.minBREnergyFraction * std::pow (brSettings.maxBREnergyFraction / brSettings.minBREnergyFraction , gRandom ->Rndm ());
1878+ trackParCov.setQ2Pt (trackParCov.getQ2Pt () / radiativeLoss);
1879+ }
18821880
1883- double afterRadiationMomentum = trackParCov.getP ();
1881+ double afterRadiationMomentum = trackParCov.getP ();
18841882
1885- if (brSettings.doBRQA ) {
1886- const std::string histPath = " Configuration_" + std::to_string (icfg) + " /" ;
1883+ if (brSettings.doBRQA ) {
1884+ const std::string histPath = " Configuration_" + std::to_string (icfg) + " /" ;
18871885
1888- getHist<TH1 >(histPath + " h1dNBRPhotons" )->Fill (static_cast <double >(nPhotons));
1889- getHist<TH1 >(histPath + " h1dBREnergyLoss" )->Fill ((initialMomentum - afterRadiationMomentum) / afterRadiationMomentum);
1886+ getHist<TH1 >(histPath + " h1dNBRPhotons" )->Fill (static_cast <double >(nPhotons));
1887+ getHist<TH1 >(histPath + " h1dBREnergyLoss" )->Fill ((initialMomentum - afterRadiationMomentum) / afterRadiationMomentum);
18901888
1891- getHist<TH2 >(histPath + " h2dBRPtRes" )->Fill (trackParCov.getPt (), (trackParCov.getPt () - mcParticle.pt ()) / trackParCov.getPt ());
1892- getHist<TH2 >(histPath + " h2dBRPtResAbs" )->Fill (trackParCov.getPt (), trackParCov.getPt () - mcParticle.pt ());
1893- }
1889+ getHist<TH2 >(histPath + " h2dBRPtRes" )->Fill (trackParCov.getPt (), (trackParCov.getPt () - mcParticle.pt ()) / trackParCov.getPt ());
1890+ getHist<TH2 >(histPath + " h2dBRPtResAbs" )->Fill (trackParCov.getPt (), trackParCov.getPt () - mcParticle.pt ());
18941891 }
18951892 }
18961893 }
@@ -1980,28 +1977,44 @@ struct OnTheFlyTracker {
19801977 }
19811978 getHist<TH1 >(histPath + " hPtGenerated" )->Fill (mcParticle.pt ());
19821979 getHist<TH1 >(histPath + " hPhiGenerated" )->Fill (mcParticle.phi ());
1983- if (std::abs (mcParticle.pdgCode ()) == kElectron )
1984- getHist<TH1 >(histPath + " hPtGeneratedEl" )->Fill (mcParticle.pt ());
1985- if (std::abs (mcParticle.pdgCode ()) == kPiPlus )
1986- getHist<TH1 >(histPath + " hPtGeneratedPi" )->Fill (mcParticle.pt ());
1987- if (std::abs (mcParticle.pdgCode ()) == kKPlus )
1988- getHist<TH1 >(histPath + " hPtGeneratedKa" )->Fill (mcParticle.pt ());
1989- if (std::abs (mcParticle.pdgCode ()) == kProton )
1990- getHist<TH1 >(histPath + " hPtGeneratedPr" )->Fill (mcParticle.pt ());
1980+ switch (std::abs (mcParticle.pdgCode ())) {
1981+ case kElectron :
1982+ getHist<TH1 >(histPath + " hPtGeneratedEl" )->Fill (mcParticle.pt ());
1983+ break ;
1984+ case kPiPlus :
1985+ getHist<TH1 >(histPath + " hPtGeneratedPi" )->Fill (mcParticle.pt ());
1986+ break ;
1987+ case kKPlus :
1988+ getHist<TH1 >(histPath + " hPtGeneratedKa" )->Fill (mcParticle.pt ());
1989+ break ;
1990+ case kProton :
1991+ getHist<TH1 >(histPath + " hPtGeneratedPr" )->Fill (mcParticle.pt ());
1992+ break ;
1993+ default :
1994+ break ;
1995+ }
19911996
19921997 if (!reconstructed && !processUnreconstructedTracks) {
19931998 continue ;
19941999 }
19952000
19962001 getHist<TH1 >(histPath + " hPtReconstructed" )->Fill (trackParCov.getPt ());
1997- if (std::abs (mcParticle.pdgCode ()) == kElectron )
1998- getHist<TH1 >(histPath + " hPtReconstructedEl" )->Fill (trackParCov.getPt ());
1999- if (std::abs (mcParticle.pdgCode ()) == kPiPlus )
2000- getHist<TH1 >(histPath + " hPtReconstructedPi" )->Fill (trackParCov.getPt ());
2001- if (std::abs (mcParticle.pdgCode ()) == kKPlus )
2002- getHist<TH1 >(histPath + " hPtReconstructedKa" )->Fill (trackParCov.getPt ());
2003- if (std::abs (mcParticle.pdgCode ()) == kProton )
2004- getHist<TH1 >(histPath + " hPtReconstructedPr" )->Fill (trackParCov.getPt ());
2002+ switch (std::abs (mcParticle.pdgCode ())) {
2003+ case kElectron :
2004+ getHist<TH1 >(histPath + " hPtReconstructedEl" )->Fill (mcParticle.pt ());
2005+ break ;
2006+ case kPiPlus :
2007+ getHist<TH1 >(histPath + " hPtReconstructedPi" )->Fill (mcParticle.pt ());
2008+ break ;
2009+ case kKPlus :
2010+ getHist<TH1 >(histPath + " hPtReconstructedKa" )->Fill (mcParticle.pt ());
2011+ break ;
2012+ case kProton :
2013+ getHist<TH1 >(histPath + " hPtReconstructedPr" )->Fill (mcParticle.pt ());
2014+ break ;
2015+ default :
2016+ break ;
2017+ }
20052018 }
20062019 if (doExtraQA) {
20072020 getHist<TH2 >(histPath + " h2dPtRes" )->Fill (trackParCov.getPt (), (trackParCov.getPt () - mcParticle.pt ()) / trackParCov.getPt ());
@@ -2189,11 +2202,7 @@ struct OnTheFlyTracker {
21892202 computeBremsstrahlungLoss (icfg, mcParticle, perfectTrackParCov);
21902203 perfectTrackParCov.setPID (pdgCodeToPID (mcParticle.pdgCode ()));
21912204 nTrkHits = fastTracker[icfg]->FastTrack (perfectTrackParCov, trackParCov, dNdEta);
2192- if (nTrkHits < fastTrackerSettings.minSiliconHits ) {
2193- reconstructed = false ;
2194- } else {
2195- reconstructed = true ;
2196- }
2205+ reconstructed = nTrkHits >= fastTrackerSettings.minSiliconHits ;
21972206 }
21982207
21992208 if (!reconstructed && !processUnreconstructedTracks) {
0 commit comments