Skip to content

Commit

Permalink
add comparison with MC truth for TOF
Browse files Browse the repository at this point in the history
  • Loading branch information
noferini committed Dec 30, 2024
1 parent 7b6a2f2 commit e24faa2
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Modules/TOF/include/TOF/TOFMatchedTracks.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ class TOFMatchedTracks final : public TaskInterface
TH2F* mDTimeTrk[18] = {};
TH2F* mDTimeTrkTPC[18] = {};
TH2F* mDTimeTrkTRD[18] = {};
TH1F* mDeltaTwMC;
TH2F* mExpTimesPiMC[matchType::SIZE] = {};
TH2F* mExpTimesKaMC[matchType::SIZE] = {};
TH2F* mExpTimesPrMC[matchType::SIZE] = {};

TEfficiency* mEffPt[matchType::SIZE] = {};
TEfficiency* mEffEta[matchType::SIZE] = {};
Expand Down
55 changes: 55 additions & 0 deletions Modules/TOF/src/TOFMatchedTracks.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,20 @@ namespace o2::quality_control_modules::tof

TOFMatchedTracks::~TOFMatchedTracks()
{
if (mUseMC) {
delete mDeltaTwMC;
}

for (int i = 0; i < matchType::SIZE; ++i) {
delete mMatchedTracksPt[i];
delete mMatchedTracksEta[i];
delete mMatchedTracks2DPtEta[i];
if (mUseMC) {
delete mFakeMatchedTracksPt[i];
delete mFakeMatchedTracksEta[i];
delete mExpTimesPiMC[i];
delete mExpTimesKaMC[i];
delete mExpTimesPrMC[i];
}
delete mInTracksPt[i];
delete mInTracksEta[i];
Expand Down Expand Up @@ -142,6 +149,11 @@ void TOFMatchedTracks::initialize(o2::framework::InitContext& /*ctx*/)
}

std::array<std::string, 3> title{ "TPC", "ITSTPC-ITSTPCTRD", "TPCTRD" };

if (mUseMC) {
mDeltaTwMC = new TH1F("mDeltaTwMC", "all types;t_{TOF} - t^{0}_{MC} - t_{geant} (ps)", 100, -500, 500);
}

for (int i = 0; i < matchType::SIZE; ++i) {
mInTracksPt[i] = new TH1F(Form("mInTracksPt_%s", title[i].c_str()), Form("mInTracksPt (matchType: %s); #it{p}_{T}; counts", title[i].c_str()), 100, 0.f, 20.f);
mInTracksEta[i] = new TH1F(Form("mInTracksEta_%s", title[i].c_str()), Form("mInTracksEta (matchType: %s); #eta; counts", title[i].c_str()), 100, -1.0f, 1.0f);
Expand All @@ -154,6 +166,9 @@ void TOFMatchedTracks::initialize(o2::framework::InitContext& /*ctx*/)
mFakeMatchedTracksEta[i] = new TH1F(Form("mFakeMatchedTracksEta_%s", title[i].c_str()), Form("mFakeMatchedTracksEta (matchType: %s); #eta; counts", title[i].c_str()), 100, -1.0f, 1.0f);
mFakeFractionTracksPt[i] = new TEfficiency(Form("mFakeFractionPt_%s", title[i].c_str()), Form("Fraction of fake matches vs Pt (matchType: %s); #it{p}_{T}; Eff", title[i].c_str()), 100, 0.f, 20.f);
mFakeFractionTracksEta[i] = new TEfficiency(Form("mFakeFractionEta_%s", title[i].c_str()), Form("Fraction of fake matches vs Eta (matchType: %s); #eta; Eff", title[i].c_str()), 100, -1.0f, 1.0f);
mExpTimesPiMC[i] = new TH2F(Form("mExpTimesPiMC_%s", title[i].c_str()), ";p_{T} (GeV/c);t_{geant} - t_{exp}^{#pi} (ps)", 10, 0, 2, 100, -1000, 1000);
mExpTimesKaMC[i] = new TH2F(Form("mExpTimesKaMC_%s", title[i].c_str()), ";p_{T} (GeV/c);t_{geant} - t_{exp}^{K} (ps)", 10, 0, 2, 100, -1000, 1000);
mExpTimesPrMC[i] = new TH2F(Form("mExpTimesPrMC_%s", title[i].c_str()), ";p_{T} (GeV/c);t_{geant} - t_{exp}^{p} (ps)", 10, 0, 2, 100, -1000, 1000);
}
mEffPt[i] = new TEfficiency(Form("mEffPt_%s", title[i].c_str()), Form("Efficiency vs Pt (matchType: %s); #it{p}_{T}; Eff", title[i].c_str()), 100, 0.f, 20.f);
mEffEta[i] = new TEfficiency(Form("mEffEta_%s", title[i].c_str()), Form("Efficiency vs Eta (matchType: %s); #eta; Eff", title[i].c_str()), 100, -1.f, 1.f);
Expand Down Expand Up @@ -181,6 +196,10 @@ void TOFMatchedTracks::initialize(o2::framework::InitContext& /*ctx*/)
}
}

if (mUseMC) {
getObjectsManager()->startPublishing(mDeltaTwMC);
}

if (mSrc[GID::Source::TPCTOF] == 1) {
getObjectsManager()->startPublishing(mInTracksPt[matchType::TPC]);
getObjectsManager()->startPublishing(mInTracksEta[matchType::TPC]);
Expand All @@ -193,6 +212,9 @@ void TOFMatchedTracks::initialize(o2::framework::InitContext& /*ctx*/)
getObjectsManager()->startPublishing(mFakeMatchedTracksEta[matchType::TPC]);
getObjectsManager()->startPublishing(mFakeFractionTracksPt[matchType::TPC]);
getObjectsManager()->startPublishing(mFakeFractionTracksEta[matchType::TPC]);
getObjectsManager()->startPublishing(mExpTimesPiMC[matchType::TPC]);
getObjectsManager()->startPublishing(mExpTimesKaMC[matchType::TPC]);
getObjectsManager()->startPublishing(mExpTimesPrMC[matchType::TPC]);
}
getObjectsManager()->startPublishing(mEffPt[matchType::TPC]);
getObjectsManager()->startPublishing(mEffEta[matchType::TPC]);
Expand All @@ -219,6 +241,9 @@ void TOFMatchedTracks::initialize(o2::framework::InitContext& /*ctx*/)
getObjectsManager()->startPublishing(mFakeMatchedTracksEta[matchType::TPCTRD]);
getObjectsManager()->startPublishing(mFakeFractionTracksPt[matchType::TPCTRD]);
getObjectsManager()->startPublishing(mFakeFractionTracksEta[matchType::TPCTRD]);
getObjectsManager()->startPublishing(mExpTimesPiMC[matchType::TPCTRD]);
getObjectsManager()->startPublishing(mExpTimesKaMC[matchType::TPCTRD]);
getObjectsManager()->startPublishing(mExpTimesPrMC[matchType::TPCTRD]);
}
getObjectsManager()->startPublishing(mEffPt[matchType::TPCTRD]);
getObjectsManager()->startPublishing(mEffEta[matchType::TPCTRD]);
Expand All @@ -245,6 +270,9 @@ void TOFMatchedTracks::initialize(o2::framework::InitContext& /*ctx*/)
getObjectsManager()->startPublishing(mFakeMatchedTracksEta[matchType::ITSTPC_ITSTPCTRD]);
getObjectsManager()->startPublishing(mFakeFractionTracksPt[matchType::ITSTPC_ITSTPCTRD]);
getObjectsManager()->startPublishing(mFakeFractionTracksEta[matchType::ITSTPC_ITSTPCTRD]);
getObjectsManager()->startPublishing(mExpTimesPiMC[matchType::ITSTPC_ITSTPCTRD]);
getObjectsManager()->startPublishing(mExpTimesKaMC[matchType::ITSTPC_ITSTPCTRD]);
getObjectsManager()->startPublishing(mExpTimesPrMC[matchType::ITSTPC_ITSTPCTRD]);
}
getObjectsManager()->startPublishing(mEffPt[matchType::ITSTPC_ITSTPCTRD]);
getObjectsManager()->startPublishing(mEffEta[matchType::ITSTPC_ITSTPCTRD]);
Expand Down Expand Up @@ -356,6 +384,11 @@ void TOFMatchedTracks::monitorData(o2::framework::ProcessingContext& ctx)
if (lbl.isFake()) {
mFakeMatchedTracksPt[matchType::TPC]->Fill(trk.getPt());
mFakeMatchedTracksEta[matchType::TPC]->Fill(trk.getEta());
} else {
mDeltaTwMC->Fill(matchTOF.getSignal() - matchTOF.getT0true() - matchTOF.getTgeant() * 1E3);
mExpTimesPiMC[matchType::TPC]->Fill(trk.getPt(), matchTOF.getTgeant() * 1E3 - matchTOF.getLTIntegralOut().getTOF(2));
mExpTimesKaMC[matchType::TPC]->Fill(trk.getPt(), matchTOF.getTgeant() * 1E3 - matchTOF.getLTIntegralOut().getTOF(3));
mExpTimesPrMC[matchType::TPC]->Fill(trk.getPt(), matchTOF.getTgeant() * 1E3 - matchTOF.getLTIntegralOut().getTOF(4));
}
}
}
Expand Down Expand Up @@ -418,6 +451,11 @@ void TOFMatchedTracks::monitorData(o2::framework::ProcessingContext& ctx)
if (lbl.isFake()) {
mFakeMatchedTracksPt[matchType::ITSTPC_ITSTPCTRD]->Fill(trkTPC.getPt());
mFakeMatchedTracksEta[matchType::ITSTPC_ITSTPCTRD]->Fill(trkTPC.getEta());
} else {
mDeltaTwMC->Fill(matchTOF.getSignal() - matchTOF.getT0true() - matchTOF.getTgeant() * 1E3);
mExpTimesPiMC[matchType::ITSTPC_ITSTPCTRD]->Fill(trkTPC.getPt(), matchTOF.getTgeant() * 1E3 - matchTOF.getLTIntegralOut().getTOF(2));
mExpTimesKaMC[matchType::ITSTPC_ITSTPCTRD]->Fill(trkTPC.getPt(), matchTOF.getTgeant() * 1E3 - matchTOF.getLTIntegralOut().getTOF(3));
mExpTimesPrMC[matchType::ITSTPC_ITSTPCTRD]->Fill(trkTPC.getPt(), matchTOF.getTgeant() * 1E3 - matchTOF.getLTIntegralOut().getTOF(4));
}
}
}
Expand Down Expand Up @@ -458,6 +496,11 @@ void TOFMatchedTracks::monitorData(o2::framework::ProcessingContext& ctx)
if (lbl.isFake()) {
mFakeMatchedTracksPt[matchType::TPCTRD]->Fill(trk.getPt());
mFakeMatchedTracksEta[matchType::TPCTRD]->Fill(trk.getEta());
} else {
mDeltaTwMC->Fill(matchTOF.getSignal() - matchTOF.getT0true() - matchTOF.getTgeant() * 1E3);
mExpTimesPiMC[matchType::TPCTRD]->Fill(trk.getPt(), matchTOF.getTgeant() * 1E3 - matchTOF.getLTIntegralOut().getTOF(2));
mExpTimesKaMC[matchType::TPCTRD]->Fill(trk.getPt(), matchTOF.getTgeant() * 1E3 - matchTOF.getLTIntegralOut().getTOF(3));
mExpTimesPrMC[matchType::TPCTRD]->Fill(trk.getPt(), matchTOF.getTgeant() * 1E3 - matchTOF.getLTIntegralOut().getTOF(4));
}
}
}
Expand Down Expand Up @@ -522,6 +565,11 @@ void TOFMatchedTracks::monitorData(o2::framework::ProcessingContext& ctx)
if (lbl.isFake()) {
mFakeMatchedTracksPt[matchType::ITSTPC_ITSTPCTRD]->Fill(trkTPC.getPt());
mFakeMatchedTracksEta[matchType::ITSTPC_ITSTPCTRD]->Fill(trkTPC.getEta());
} else {
mDeltaTwMC->Fill(matchTOF.getSignal() - matchTOF.getT0true() - matchTOF.getTgeant() * 1E3);
mExpTimesPiMC[matchType::ITSTPC_ITSTPCTRD]->Fill(trkTPC.getPt(), matchTOF.getTgeant() * 1E3 - matchTOF.getLTIntegralOut().getTOF(2));
mExpTimesKaMC[matchType::ITSTPC_ITSTPCTRD]->Fill(trkTPC.getPt(), matchTOF.getTgeant() * 1E3 - matchTOF.getLTIntegralOut().getTOF(3));
mExpTimesPrMC[matchType::ITSTPC_ITSTPCTRD]->Fill(trkTPC.getPt(), matchTOF.getTgeant() * 1E3 - matchTOF.getLTIntegralOut().getTOF(4));
}
}
}
Expand Down Expand Up @@ -839,6 +887,10 @@ void TOFMatchedTracks::reset()
{
// clean all the monitor objects here

if (mUseMC) {
mDeltaTwMC->Reset();
}

ILOG(Debug, Devel) << "Resetting the histograms" << ENDM;
for (int i = 0; i < matchType::SIZE; ++i) {
mMatchedTracksPt[i]->Reset();
Expand All @@ -847,6 +899,9 @@ void TOFMatchedTracks::reset()
if (mUseMC) {
mFakeMatchedTracksPt[i]->Reset();
mFakeMatchedTracksEta[i]->Reset();
mExpTimesPiMC[i]->Reset();
mExpTimesKaMC[i]->Reset();
mExpTimesPrMC[i]->Reset();
}
mInTracksPt[i]->Reset();
mInTracksEta[i]->Reset();
Expand Down

0 comments on commit e24faa2

Please sign in to comment.