Skip to content

Commit

Permalink
O2-4592 - adding TOF LTIntegral to time series&skimmed data (#13809)
Browse files Browse the repository at this point in the history
* O2-4592 - adding tof LTIntegral to time series

* O2-4592 - adding deltaT and vertex and TPC times

* O2-4592 - adding deltaT and vertex and TPC times in double precision

* O2-4592 - aply clang-format

---------

Co-authored-by: miranov25 <marian.ivanov@cern.cg>
  • Loading branch information
miranov25 and miranov25 authored Dec 17, 2024
1 parent 051b0b3 commit eae7e1d
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions Detectors/TPC/workflow/src/TPCTimeSeriesSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class TPCTimeSeries : public Task
{
public:
/// \constructor
TPCTimeSeries(std::shared_ptr<o2::base::GRPGeomRequest> req, const bool disableWriter, const o2::base::Propagator::MatCorrType matType, const bool enableUnbinnedWriter, const bool tpcOnly, std::shared_ptr<o2::globaltracking::DataRequest> dr) : mCCDBRequest(req), mDisableWriter(disableWriter), mMatType(matType), mUnbinnedWriter(enableUnbinnedWriter), mTPCOnly(tpcOnly), mDataRequest(dr){};
TPCTimeSeries(std::shared_ptr<o2::base::GRPGeomRequest> req, const bool disableWriter, const o2::base::Propagator::MatCorrType matType, const bool enableUnbinnedWriter, const bool tpcOnly, std::shared_ptr<o2::globaltracking::DataRequest> dr) : mCCDBRequest(req), mDisableWriter(disableWriter), mMatType(matType), mUnbinnedWriter(enableUnbinnedWriter), mTPCOnly(tpcOnly), mDataRequest(dr) {};

void init(framework::InitContext& ic) final
{
Expand Down Expand Up @@ -206,19 +206,25 @@ class TPCTimeSeries : public Task
indicesITSTPC[tracksITSTPC[i].getRefTPC().getIndex()] = {i, idxVtx};
}

std::vector<std::tuple<int, float, float>> idxTPCTrackToTOFCluster; // store for each tpc track index the index to the TOF cluster
std::vector<std::tuple<int, float, float, o2::track::TrackLTIntegral, double, float>> idxTPCTrackToTOFCluster; // store for each tpc track index the index to the TOF cluster

// get matches to TOF in case skimmed data is produced
if (mUnbinnedWriter) {
idxTPCTrackToTOFCluster = std::vector<std::tuple<int, float, float>>(tracksTPC.size(), {-1, -999, -999});
// getLTIntegralOut(), ///< L,TOF integral calculated during the propagation
// getSignal() mSignal = 0.0; ///< TOF time in ps
o2::track::TrackLTIntegral defLT;
idxTPCTrackToTOFCluster = std::vector<std::tuple<int, float, float, o2::track::TrackLTIntegral, double, float>>(tracksTPC.size(), {-1, -999, -999, defLT, 0, 0});
const std::vector<gsl::span<const o2::dataformats::MatchInfoTOF>> tofMatches{recoData.getTPCTOFMatches(), recoData.getTPCTRDTOFMatches(), recoData.getITSTPCTOFMatches(), recoData.getITSTPCTRDTOFMatches()};

// loop over ITS-TPC-TRD-TOF and ITS-TPC-TOF tracks an store for each ITS-TPC track the TOF track index
for (const auto& tofMatch : tofMatches) {
for (const auto& tpctofmatch : tofMatch) {
auto refTPC = recoData.getTPCContributorGID(tpctofmatch.getTrackRef());
if (refTPC.isIndexSet()) {
idxTPCTrackToTOFCluster[refTPC] = {tpctofmatch.getIdxTOFCl(), tpctofmatch.getDXatTOF(), tpctofmatch.getDZatTOF()};
o2::track::TrackLTIntegral ltIntegral = tpctofmatch.getLTIntegralOut();
double signal = tpctofmatch.getSignal();
float deltaT = tpctofmatch.getDeltaT();
idxTPCTrackToTOFCluster[refTPC] = {tpctofmatch.getIdxTOFCl(), tpctofmatch.getDXatTOF(), tpctofmatch.getDZatTOF(), ltIntegral, signal, deltaT};
}
}
}
Expand Down Expand Up @@ -1049,7 +1055,7 @@ class TPCTimeSeries : public Task
return isGoodTrack;
}

void fillDCA(const gsl::span<const TrackTPC> tracksTPC, const gsl::span<const o2::dataformats::TrackTPCITS> tracksITSTPC, const gsl::span<const o2::dataformats::PrimaryVertex> vertices, const int iTrk, const int iThread, const std::unordered_map<unsigned int, std::array<int, 2>>& indicesITSTPC, const gsl::span<const o2::its::TrackITS> tracksITS, const std::vector<std::tuple<int, float, float>>& idxTPCTrackToTOFCluster, const gsl::span<const o2::tof::Cluster> tofClusters)
void fillDCA(const gsl::span<const TrackTPC> tracksTPC, const gsl::span<const o2::dataformats::TrackTPCITS> tracksITSTPC, const gsl::span<const o2::dataformats::PrimaryVertex> vertices, const int iTrk, const int iThread, const std::unordered_map<unsigned int, std::array<int, 2>>& indicesITSTPC, const gsl::span<const o2::its::TrackITS> tracksITS, const std::vector<std::tuple<int, float, float, o2::track::TrackLTIntegral, double, float>>& idxTPCTrackToTOFCluster, const gsl::span<const o2::tof::Cluster> tofClusters)
{
const auto& trackFull = tracksTPC[iTrk];
const bool isGoodTrack = checkTrack(trackFull);
Expand Down Expand Up @@ -1354,7 +1360,8 @@ class TPCTimeSeries : public Task
}
}
}

double vertexTime = vertex.getTimeStamp().getTimeStamp();
double trackTime0 = trackFull.getTime0();
*mStreamer[iThread] << "treeTimeSeries"
// DCAs
<< "triggerMask=" << triggerMask
Expand Down Expand Up @@ -1432,6 +1439,11 @@ class TPCTimeSeries : public Task
<< "tpcZDeltaAtTOF=" << tpcZDeltaAtTOF
<< "mDXatTOF=" << std::get<1>(idxTPCTrackToTOFCluster[iTrk])
<< "mDZatTOF=" << std::get<2>(idxTPCTrackToTOFCluster[iTrk])
<< "mTOFLength=" << std::get<3>(idxTPCTrackToTOFCluster[iTrk])
<< "mTOFSignal=" << std::get<4>(idxTPCTrackToTOFCluster[iTrk])
<< "mDeltaTTOFTPC=" << std::get<5>(idxTPCTrackToTOFCluster[iTrk]) /// delta T- TPC TOF
<< "vertexTime=" << vertexTime /// time stamp assigned to the vertex
<< "trackTime0=" << trackTime0 /// time stamp assigned to the track
// TPC delta param
<< "deltaTPCParamInOutTgl=" << deltaTPCParamInOutTgl
<< "deltaTPCParamInOutQPt=" << deltaTPCParamInOutQPt
Expand Down

0 comments on commit eae7e1d

Please sign in to comment.