Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 57 additions & 41 deletions ALICE3/TableProducer/OTF/onTheFlyTracker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
#include <TGeoGlobalMagField.h>
#include <TH1.h>
#include <TH2.h>
#include <TLorentzVector.h>

Check failure on line 81 in ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
#include <TMCProcess.h>
#include <TMath.h>
#include <TPDGCode.h>
Expand Down Expand Up @@ -275,16 +275,15 @@
int isUsedInCascadingInput = 0,
int nSiliconHitsInput = 0,
int nTPCHitsInput = 0,
TrackType trackTypeInput = TrackType::kRecoPrimary
) : o2::track::TrackParCov(src),
mcLabel{label},
timeEst{time, timeError},
isDecayDau(decayDauInput),
isWeakDecayDau(weakDecayDauInput),
isUsedInCascading(isUsedInCascadingInput),
nSiliconHits(nSiliconHitsInput),
nTPCHits(nTPCHitsInput),
trackType(trackTypeInput) {}
TrackType trackTypeInput = TrackType::kRecoPrimary) : o2::track::TrackParCov(src),
mcLabel{label},
timeEst{time, timeError},
isDecayDau(decayDauInput),
isWeakDecayDau(weakDecayDauInput),
isUsedInCascading(isUsedInCascadingInput),
nSiliconHits(nSiliconHitsInput),
nTPCHits(nTPCHitsInput),
trackType(trackTypeInput) {}
const TimeEst& getTimeMUS() const { return timeEst; }
int64_t mcLabel;
TimeEst timeEst; ///< time estimate in ns
Expand Down Expand Up @@ -738,7 +737,7 @@
/// \param xiDecayVertex the address of the xi decay vertex
/// \param laDecayVertex the address of the la decay vertex
template <typename McParticleType>
void decayCascade(McParticleType particle, o2::track::TrackParCov track, std::vector<TLorentzVector>& decayDaughters, std::vector<double>& xiDecayVertex, std::vector<double>& laDecayVertex)

Check failure on line 740 in ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
{
const double uXi = rand.Uniform(0, 1);
const double ctauXi = 4.91; // cm
Expand All @@ -761,12 +760,12 @@
xiDecayVertex.push_back(particle.vz() + rxyzXi * (particle.pz() / particle.p()));

std::vector<double> xiDaughters = {o2::constants::physics::MassLambda, o2::constants::physics::MassPionCharged};
TLorentzVector xi(newPx, newPy, particle.pz(), newE);

Check failure on line 763 in ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
TGenPhaseSpace xiDecay;
xiDecay.SetDecay(xi, 2, xiDaughters.data());
xiDecay.Generate();
decayDaughters.push_back(*xiDecay.GetDecay(1));
TLorentzVector la = *xiDecay.GetDecay(0);

Check failure on line 768 in ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.

const double uLa = rand.Uniform(0, 1);
const double ctauLa = 7.845; // cm
Expand All @@ -789,7 +788,7 @@
/// \param decayDaughters the address of resulting daughters
/// \param v0DecayVertex the address of the la decay vertex
template <typename McParticleType>
void decayV0Particle(McParticleType particle, std::vector<TLorentzVector>& decayDaughters, std::vector<double>& v0DecayVertex, int pdgCode)

Check failure on line 791 in ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
{
double u = rand.Uniform(0, 1);
double v0Mass = -1.;
Expand Down Expand Up @@ -823,7 +822,7 @@

const double v0BetaGamma = particle.p() / v0Mass;
const double v0rxyz = (-v0BetaGamma * ctau * std::log(1 - u));
TLorentzVector v0(particle.px(), particle.py(), particle.pz(), particle.e());

Check failure on line 825 in ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.

v0DecayVertex.push_back(particle.vx() + v0rxyz * (particle.px() / particle.p()));
v0DecayVertex.push_back(particle.vy() + v0rxyz * (particle.py() / particle.p()));
Expand All @@ -842,7 +841,8 @@
/// \param mcParticles the set of MC particles to compute dN/deta from
/// \param histPath the path to the histogram where the computed dN/deta value will be stored for QA purposes
template <typename McParticleType>
void computeDNDEta(float& dNdEta, McParticleType const& mcParticles, const std::string histPath) {
void computeDNDEta(float& dNdEta, McParticleType const& mcParticles, const std::string histPath)
{
for (const auto& mcParticle : mcParticles) {
if (std::abs(mcParticle.eta()) > multEtaRange) {
continue;
Expand Down Expand Up @@ -874,7 +874,6 @@

dNdEta /= (multEtaRange * 2.0f);
getHist(TH1, histPath + "hLUTMultiplicity")->Fill(dNdEta);

}

/// Function to study the cascade decay and fill the relevant histograms and output track vector
Expand All @@ -901,7 +900,7 @@
o2::upgrade::convertMCParticleToO2Track(mcParticle, trackParCov, pdgDB);
const std::string histPath = "Configuration_" + std::to_string(icfg) + "/";

std::vector<TLorentzVector> cascadeDecayProducts;

Check failure on line 903 in ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
std::vector<double> xiDecayVertex, laDecayVertex;
static constexpr int kCascProngs = 3;
std::array<o2::track::TrackParCov, kCascProngs> xiDaughterTrackParCovsPerfect;
Expand Down Expand Up @@ -932,11 +931,11 @@
getHist(TH1, histPath + "hXiBuilding")->Fill(0.0f);
}

o2::upgrade::convertTLorentzVectorToO2Track(PDG_t::kPiMinus, cascadeDecayProducts[0], xiDecayVertex, xiDaughterTrackParCovsPerfect[0], pdgDB);

Check failure on line 934 in ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
xiDaughterTrackParCovsPerfect[0].setPID(pdgCodeToPID(PDG_t::kPiMinus));
o2::upgrade::convertTLorentzVectorToO2Track(PDG_t::kPiMinus, cascadeDecayProducts[1], laDecayVertex, xiDaughterTrackParCovsPerfect[1], pdgDB);

Check failure on line 936 in ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
xiDaughterTrackParCovsPerfect[1].setPID(pdgCodeToPID(PDG_t::kPiMinus));
o2::upgrade::convertTLorentzVectorToO2Track(PDG_t::kProton, cascadeDecayProducts[2], laDecayVertex, xiDaughterTrackParCovsPerfect[2], pdgDB);

Check failure on line 938 in ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/lorentz-vector]

Do not use the TLorentzVector legacy class. Use std::array with RecoDecay methods or the ROOT::Math::LorentzVector template instead.
xiDaughterTrackParCovsPerfect[2].setPID(pdgCodeToPID(PDG_t::kProton));
o2::track::TrackParCov perfectCascadeTrack;
o2::upgrade::convertMCParticleToO2Track(mcParticle, perfectCascadeTrack, pdgDB);
Expand Down Expand Up @@ -981,8 +980,7 @@
isReco[i] = true;

for (uint32_t ih = 0; ih < fastTracker[icfg]->GetNHits() && cascadeDecaySettings.doXiQA; ih++) {
getHist(TH2, histPath + "hFastTrackerHits")->Fill(fastTracker[icfg]->GetHitZ(ih),
std::hypot(fastTracker[icfg]->GetHitX(ih), fastTracker[icfg]->GetHitY(ih)));
getHist(TH2, histPath + "hFastTrackerHits")->Fill(fastTracker[icfg]->GetHitZ(ih), std::hypot(fastTracker[icfg]->GetHitX(ih), fastTracker[icfg]->GetHitY(ih)));
}
} else {
isReco[i] = true;
Expand Down Expand Up @@ -1024,8 +1022,8 @@
// n-2: pion from lambda
// n-3: pion from xi
thisCascade.bachelorId = trackTableOffset + 1;
thisCascade.positiveId = trackTableOffset + 2; // Lambda daughters
thisCascade.negativeId = trackTableOffset + 3; // Lambda daughters
thisCascade.positiveId = trackTableOffset + 2; // Lambda daughters
thisCascade.negativeId = trackTableOffset + 3; // Lambda daughters
thisCascade.cascadeTrackId = trackTableOffset + 4;

// use DCA fitters
Expand Down Expand Up @@ -1237,8 +1235,12 @@
}

// Reset indices
if (!isReco[1]) { thisCascade.negativeId = -1; }
if (!isReco[2]) { thisCascade.positiveId = -1; }
if (!isReco[1]) {
thisCascade.negativeId = -1;
}
if (!isReco[2]) {
thisCascade.positiveId = -1;
}

int nCand = 0;
bool kinkFitterOK = true;
Expand Down Expand Up @@ -1267,8 +1269,8 @@
o2::track::TrackParCov newCascadeTrack = fitter.getTrack(0); // (cascade)
std::array<float, 3> kinkVtx = {-999, -999, -999};
kinkVtx = fitter.getPCACandidatePos();
thisCascade.dcaV0dau = -1.f; // unknown
thisCascade.v0radius = -1.f; // unknown
thisCascade.dcaV0dau = -1.f; // unknown
thisCascade.v0radius = -1.f; // unknown
thisCascade.dcacascdau = std::sqrt(fitter.getChi2AtPCACandidate());
thisCascade.cascradius = std::hypot(kinkVtx[0], kinkVtx[1]);
thisCascade.cascradiusMC = xiDecayRadius2D;
Expand Down Expand Up @@ -1319,7 +1321,7 @@
if (isReco[1]) {
getHist(TH2, histPath + "hRecoPiFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[1].Pt());
o2::track::TrackParCov trackParametrizationCascProng1(tracksCascadeProngs[1]);
if (populateTracksDCA && tracksCascadeProngs[1].propagateToDCA(primaryVertex, mMagneticField, &dcaInfo)) { // FIXME: this is not the right trackParametrization, need to propagate the negative pion track
if (populateTracksDCA && tracksCascadeProngs[1].propagateToDCA(primaryVertex, mMagneticField, &dcaInfo)) { // FIXME: this is not the right trackParametrization, need to propagate the negative pion track
dcaXY = dcaInfo.getY();
dcaZ = dcaInfo.getZ();
getHist(TH2, histPath + "h2dDCAxyCascadeNegative")->Fill(trackParametrizationCascProng1.getPt(), dcaXY * 1e+4); // in microns, please
Expand All @@ -1329,7 +1331,7 @@
if (isReco[2]) {
getHist(TH2, histPath + "hRecoPrFromLa")->Fill(laDecayRadius2D, cascadeDecayProducts[2].Pt());
o2::track::TrackParCov trackParametrizationCascProng2(tracksCascadeProngs[2]);
if (populateTracksDCA && tracksCascadeProngs[2].propagateToDCA(primaryVertex, mMagneticField, &dcaInfo)) { // FIXME: this is not the right trackParametrization, need to propagate the positive proton track
if (populateTracksDCA && tracksCascadeProngs[2].propagateToDCA(primaryVertex, mMagneticField, &dcaInfo)) { // FIXME: this is not the right trackParametrization, need to propagate the positive proton track
dcaXY = dcaInfo.getY();
dcaZ = dcaInfo.getZ();
getHist(TH2, histPath + "h2dDCAxyCascadePositive")->Fill(trackParametrizationCascProng2.getPt(), dcaXY * 1e+4); // in microns, please
Expand Down Expand Up @@ -1365,10 +1367,11 @@
template <typename McParticleType>
void studyV0(const int trackTableOffset,
const McParticleType& mcParticle,
std::vector<TrackAlice3>& tracksV0Daugs,
std::vector<TrackAlice3>& tracksV0Daugs,
int icfg,
int dNdEta,
float eventCollisionTimeNS) {
float eventCollisionTimeNS)
{

o2::track::TrackParCov trackParCov;
o2::upgrade::convertMCParticleToO2Track(mcParticle, trackParCov, pdgDB);
Expand Down Expand Up @@ -1439,9 +1442,12 @@
nV0SiliconHits[i] = fastTracker[icfg]->GetNSiliconPoints();
nV0TPCHits[i] = fastTracker[icfg]->GetNGasPoints();

if (nV0SiliconHits[i] < fastTrackerSettings.minSiliconHits) continue;
if (nV0SiliconHits[i] < fastTrackerSettings.minSiliconHitsIfTPCUsed) continue;
if (nV0TPCHits[i] < fastTrackerSettings.minTPCClusters) continue;
if (nV0SiliconHits[i] < fastTrackerSettings.minSiliconHits)
continue;
if (nV0SiliconHits[i] < fastTrackerSettings.minSiliconHitsIfTPCUsed)
continue;
if (nV0TPCHits[i] < fastTrackerSettings.minTPCClusters)
continue;
isV0Reco[i] = true;

if (v0DecaySettings.doV0QA) { // QA
Expand Down Expand Up @@ -1607,7 +1613,8 @@
/// \param primaryVertex the output variable where the computed primary vertex will be stored
/// \param icfg index of the current configuration, used for histogram filling
template <typename McCollisionType, typename TrackType>
void computeVertex(McCollisionType& mcCollision, const std::vector<TrackType>& prmTrks, o2::vertexing::PVertex& primaryVertex, const int icfg) {
void computeVertex(McCollisionType& mcCollision, const std::vector<TrackType>& prmTrks, o2::vertexing::PVertex& primaryVertex, const int icfg)
{

if (!enablePrimaryVertexing) {
primaryVertex.setXYZ(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ());
Expand Down Expand Up @@ -1673,7 +1680,8 @@
/// \param tracks the vector of tracks to be processed
/// \param primaryVertex the primary vertex position, used for DCA calculation
/// \param icfg index of the current configuration, used for histogram filling
void fillTracksInfo(std::vector<TrackAlice3> const& tracks, o2::vertexing::PVertex const& primaryVertex, const int icfg) {
void fillTracksInfo(std::vector<TrackAlice3> const& tracks, o2::vertexing::PVertex const& primaryVertex, const int icfg)
{
const std::string histPath = "Configuration_" + std::to_string(icfg) + "/";

for (const auto& trackParCov : tracks) {
Expand Down Expand Up @@ -1765,8 +1773,8 @@

const bool longLivedToBeHandled = std::find(longLivedHandledPDGs.begin(), longLivedHandledPDGs.end(), std::abs(mcParticle.pdgCode())) != longLivedHandledPDGs.end();
const bool nucleiToBeHandled = std::find(nucleiPDGs.begin(), nucleiPDGs.end(), std::abs(mcParticle.pdgCode())) != nucleiPDGs.end();
const bool pdgsToBeHandled = longLivedToBeHandled ||
(enableNucleiSmearing && nucleiToBeHandled) ||
const bool pdgsToBeHandled = longLivedToBeHandled ||
(enableNucleiSmearing && nucleiToBeHandled) ||
(cascadeDecaySettings.decayXi && isCascade) ||
(v0DecaySettings.decayV0 && isV0);
if (!pdgsToBeHandled) {
Expand Down Expand Up @@ -1799,21 +1807,29 @@
}
getHist(TH1, histPath + "hPtGenerated")->Fill(mcParticle.pt());
getHist(TH1, histPath + "hPhiGenerated")->Fill(mcParticle.phi());
if (std::abs(mcParticle.pdgCode()) == kElectron) getHist(TH1, histPath + "hPtGeneratedEl")->Fill(mcParticle.pt());
if (std::abs(mcParticle.pdgCode()) == kPiPlus) getHist(TH1, histPath + "hPtGeneratedPi")->Fill(mcParticle.pt());
if (std::abs(mcParticle.pdgCode()) == kKPlus) getHist(TH1, histPath + "hPtGeneratedKa")->Fill(mcParticle.pt());
if (std::abs(mcParticle.pdgCode()) == kProton) getHist(TH1, histPath + "hPtGeneratedPr")->Fill(mcParticle.pt());
if (std::abs(mcParticle.pdgCode()) == kElectron)
getHist(TH1, histPath + "hPtGeneratedEl")->Fill(mcParticle.pt());
if (std::abs(mcParticle.pdgCode()) == kPiPlus)
getHist(TH1, histPath + "hPtGeneratedPi")->Fill(mcParticle.pt());
if (std::abs(mcParticle.pdgCode()) == kKPlus)
getHist(TH1, histPath + "hPtGeneratedKa")->Fill(mcParticle.pt());
if (std::abs(mcParticle.pdgCode()) == kProton)
getHist(TH1, histPath + "hPtGeneratedPr")->Fill(mcParticle.pt());

if (!reconstructed && !processUnreconstructedTracks) {
continue;
}

// LOG(info) << "Particle with PDG " << mcParticle.pdgCode() << (reconstructed ? " was reconstructed." : " was not reconstructed.");
getHist(TH1, histPath + "hPtReconstructed")->Fill(trackParCov.getPt());
if (std::abs(mcParticle.pdgCode()) == kElectron) getHist(TH1, histPath + "hPtReconstructedEl")->Fill(trackParCov.getPt());
if (std::abs(mcParticle.pdgCode()) == kPiPlus) getHist(TH1, histPath + "hPtReconstructedPi")->Fill(trackParCov.getPt());
if (std::abs(mcParticle.pdgCode()) == kKPlus) getHist(TH1, histPath + "hPtReconstructedKa")->Fill(trackParCov.getPt());
if (std::abs(mcParticle.pdgCode()) == kProton) getHist(TH1, histPath + "hPtReconstructedPr")->Fill(trackParCov.getPt());
if (std::abs(mcParticle.pdgCode()) == kElectron)
getHist(TH1, histPath + "hPtReconstructedEl")->Fill(trackParCov.getPt());
if (std::abs(mcParticle.pdgCode()) == kPiPlus)
getHist(TH1, histPath + "hPtReconstructedPi")->Fill(trackParCov.getPt());
if (std::abs(mcParticle.pdgCode()) == kKPlus)
getHist(TH1, histPath + "hPtReconstructedKa")->Fill(trackParCov.getPt());
if (std::abs(mcParticle.pdgCode()) == kProton)
getHist(TH1, histPath + "hPtReconstructedPr")->Fill(trackParCov.getPt());
}
if (doExtraQA) {
getHist(TH2, histPath + "h2dPtRes")->Fill(trackParCov.getPt(), (trackParCov.getPt() - mcParticle.pt()) / trackParCov.getPt());
Expand Down Expand Up @@ -1881,7 +1897,7 @@

// *+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*+~+*
// populate tracks
fillTracksInfo(recoPrimaries, primaryVertex, icfg);
fillTracksInfo(recoPrimaries, primaryVertex, icfg);
fillTracksInfo(ghostPrimaries, primaryVertex, icfg);

// do bookkeeping of fastTracker tracking
Expand Down Expand Up @@ -2066,4 +2082,4 @@
return WorkflowSpec{
adaptAnalysisTask<OnTheFlyTracker>(cfgc),
adaptAnalysisTask<onTheFlyTrackerInitializer>(cfgc)};
}
}
6 changes: 3 additions & 3 deletions Common/TableProducer/qVectorsTable.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -588,15 +588,15 @@ struct qVectorsTable {
float sumAmplFT0C = 0.;
float sumAmplFT0M = 0.;
float sumAmplFV0A = 0.;

if (coll.has_foundFT0() && (useDetector["QvectorFT0As"] || useDetector["QvectorFT0Cs"] || useDetector["QvectorFT0Ms"])) {
auto ft0 = coll.foundFT0();

if (useDetector["QvectorFT0As"]) {
for (std::size_t iChA = 0; iChA < ft0.channelA().size(); iChA++) {
float ampl = ft0.amplitudeA()[iChA];
int FT0AchId = ft0.channelA()[iChA];

histosQA.fill(HIST("FT0Amp"), ampl, FT0AchId);
histosQA.fill(HIST("FT0AmpCor"), ampl / FT0RelGainConst[FT0AchId], FT0AchId);

Expand Down
Loading