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
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ class AODProducerWorkflowDPL : public Task
float tofChi2 = -999.f;
float tpcSignal = -999.f;
float trdSignal = -999.f;
float tofSignal = -999.f;
float length = -999.f;
float tofExpMom = -999.f;
float trackEtaEMCAL = -999.f;
Expand Down
23 changes: 15 additions & 8 deletions Detectors/AOD/src/AODProducerWorkflowSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include "SimulationDataFormat/MCTrack.h"
#include "SimulationDataFormat/MCTruthContainer.h"
#include "GPUTPCGMMergedTrackHit.h"
#include "TOFBase/Utils.h"
#include "O2Version.h"
#include "TMath.h"
#include "MathUtils/Utils.h"
Expand Down Expand Up @@ -301,6 +302,7 @@ void AODProducerWorkflowDPL::fillTrackTablesPerCollision(int collisionID,
// normal tracks table
auto contributorsGID = data.getSingleDetectorRefs(trackIndex);
const auto& trackPar = data.getTrackParam(trackIndex);
extraInfoHolder.flags |= trackPar.getPID() << 28;
if (contributorsGID[GIndex::Source::ITS].isIndexSet()) {
int nClusters = itsTracks[contributorsGID[GIndex::ITS].getIndex()].getNClusters();
float chi2 = itsTracks[contributorsGID[GIndex::ITS].getIndex()].getChi2();
Expand All @@ -326,10 +328,9 @@ void AODProducerWorkflowDPL::fillTrackTablesPerCollision(int collisionID,
extraInfoHolder.tofChi2 = tofMatch.getChi2();
const auto& tofInt = tofMatch.getLTIntegralOut();
const float intLen = tofInt.getL();
double timeOrbit = static_cast<int>(tofMatch.getSignal() / o2::constants::lhc::LHCOrbitNS * 1E-3) * o2::constants::lhc::LHCOrbitNS * 1E3;
const float tofSignal = static_cast<float>(o2::tof::Utils::subtractInteractionBC(tofMatch.getSignal() - timeOrbit));
extraInfoHolder.length = intLen;
if (interactionTime > 0) {
extraInfoHolder.tofSignal = static_cast<float>(tofMatch.getSignal() - interactionTime * 1E3);
}
const float mass = o2::constants::physics::MassPionCharged; // default pid = pion
if (tofInt.getTOF(o2::track::PID::Pion) > 0.f) {
const float expBeta = (intLen / (tofInt.getTOF(o2::track::PID::Pion) * cSpeed));
Expand All @@ -339,8 +340,8 @@ void AODProducerWorkflowDPL::fillTrackTablesPerCollision(int collisionID,
const double massZ = o2::track::PID::getMass2Z(trackPar.getPID());
const double energy = sqrt((massZ * massZ) + (extraInfoHolder.tofExpMom * extraInfoHolder.tofExpMom));
const double exp = extraInfoHolder.length * energy / (cSpeed * extraInfoHolder.tofExpMom);
extraInfoHolder.trackTime = static_cast<float>((tofMatch.getSignal() - exp) * 1e-3 - interactionTime); // tof time in \mus, FIXME: account for time of flight to R TOF
extraInfoHolder.trackTimeRes = 200e-3; // FIXME: calculate actual resolution (if possible?)
extraInfoHolder.trackTime = static_cast<float>((tofSignal - exp) * 1e-3); // tof time in ns, taken from the definition of Ruben scaled by 1000 to convert from mus to ns to match the collisionTime
extraInfoHolder.trackTimeRes = 200e-3; // FIXME: calculate actual resolution (if possible?)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shahor02 I am in favour of merging this. Unrelated: Don't we have an estimate of the track type already somewhere?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgrosseo sorry, just saw the question. If you are asking whether we do reco-time PID: no, for that the TPC would need to provide a dedx -> PID algorithm.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shahor02 I wrote track type but mean track time resolution (sorry for this; and that's why I made the comment here).
So do you already have a track time resolution (even course based on the type of track)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for ITS-TPC-TOF tracks: they are somewhat special since their time is given by the TOF signal stored in the match info (while the kinematic comes from ITS-TPC). In the

const float timeErr = 0.010f; // assume 10 ns error FIXME
if (creator(tracksTPCTRD[gidx.getIndex()], {i, GTrackID::TPCTRDTOF}, timeTOFMUS, timeErr)) {
a 10 ns error is assigned (which is surely an overkill but is much more precise that the ITS-TPC time errors), but AOD producer does not use this method, since it relias on the vertex->tracks attachments tables.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should propagate these values into the AOD (even if you mark them as "overkill" for now). All this info should be available in the AOD converter, so it just requires adjusting the code, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TrackTime contains here the track time estimate based on TOF (absolute wrt BC). We do not talk about the estimated time with a momentum and particle hypothesis. Do we talk about the same thing?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgrosseo for tracks with TRD the error corresponds to the nominal triggered BC duration (i.e. a few 100 ps), for ITS-TPC tracks: uncertainty in matching point Z / vdrift.

Can we add this to the AOD producer already?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. A deltat (t_tof - t_track) is avaliable with the matching info.
For the resolution we depend on the track time precision which is available with the track.
Is this what you need?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgrosseo

We do not talk about the estimated time with a momentum and particle hypothesis. Do we talk about the same thing?

Does this matter if we speak about the uncertainty?

Can we add this to the AOD producer already?

Do you mean to fill extraInfoHolder.trackTime and extraInfoHolder.trackTimeRes for all tracks types?

Copy link
Collaborator

@jgrosseo jgrosseo Dec 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to fill extraInfoHolder.trackTime and extraInfoHolder.trackTimeRes for all tracks types?

Yes!

}
if (src == GIndex::Source::TPCTRD || src == GIndex::Source::ITSTPCTRD) {
const auto& trdOrig = data.getTrack<o2::trd::TrackTRD>(src, contributorsGID[src].getIndex());
Expand Down Expand Up @@ -1106,11 +1107,17 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
auto caloCellsCursor = caloCellsBuilder.cursor<o2::aod::Calos>();
auto caloCellsTRGTableCursor = caloCellsTRGTableBuilder.cursor<o2::aod::CaloTriggers>();

std::unique_ptr<o2::steer::MCKinematicsReader> mcReader;
if (mUseMC) {
mcReader = std::make_unique<o2::steer::MCKinematicsReader>("collisioncontext.root");
std::unique_ptr<o2::steer::MCKinematicsReader> mcReader = std::make_unique<o2::steer::MCKinematicsReader>("collisioncontext.root");
if (!o2::tof::Utils::hasFillScheme()) {
LOG(debug) << "FOUND " << mcReader->getDigitizationContext()->getEventRecords().size()
<< " records" << mcReader->getDigitizationContext()->getEventParts().size() << " parts";
o2::BunchFilling bcf = mcReader->getDigitizationContext()->getBunchFilling();
std::bitset<3564> bs = bcf.getBCPattern();
for (int i = 0; i < bs.size(); i++) {
if (bs.test(i)) {
o2::tof::Utils::addInteractionBC(i);
}
}
}

std::map<uint64_t, int> bcsMap;
Expand Down