|
45 | 45 | #include "TROOT.h" |
46 | 46 | #include "ReconstructionDataFormats/MatchInfoTOF.h" |
47 | 47 | #include "DataFormatsTOF/Cluster.h" |
| 48 | +#include "DataFormatsFT0/RecPoints.h" |
48 | 49 |
|
49 | 50 | using namespace o2::globaltracking; |
50 | 51 | using GTrackID = o2::dataformats::GlobalTrackID; |
@@ -206,25 +207,74 @@ class TPCTimeSeries : public Task |
206 | 207 | indicesITSTPC[tracksITSTPC[i].getRefTPC().getIndex()] = {i, idxVtx}; |
207 | 208 | } |
208 | 209 |
|
209 | | - 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 |
| 210 | + std::vector<std::tuple<int, float, float, o2::track::TrackLTIntegral, double, float, int>> idxTPCTrackToTOFCluster; // store for each tpc track index the index to the TOF cluster |
210 | 211 |
|
211 | 212 | // get matches to TOF in case skimmed data is produced |
212 | 213 | if (mUnbinnedWriter) { |
213 | 214 | // getLTIntegralOut(), ///< L,TOF integral calculated during the propagation |
214 | 215 | // getSignal() mSignal = 0.0; ///< TOF time in ps |
215 | 216 | o2::track::TrackLTIntegral defLT; |
216 | | - idxTPCTrackToTOFCluster = std::vector<std::tuple<int, float, float, o2::track::TrackLTIntegral, double, float>>(tracksTPC.size(), {-1, -999, -999, defLT, 0, 0}); |
| 217 | + idxTPCTrackToTOFCluster = std::vector<std::tuple<int, float, float, o2::track::TrackLTIntegral, double, float, int>>(tracksTPC.size(), {-1, -999, -999, defLT, 0, 0, 0}); |
217 | 218 | const std::vector<gsl::span<const o2::dataformats::MatchInfoTOF>> tofMatches{recoData.getTPCTOFMatches(), recoData.getTPCTRDTOFMatches(), recoData.getITSTPCTOFMatches(), recoData.getITSTPCTRDTOFMatches()}; |
218 | 219 |
|
| 220 | + const auto& ft0rec = recoData.getFT0RecPoints(); |
| 221 | + // fill available FT0-AC event times vs BClong |
| 222 | + std::map<ULong64_t, short> t0array; |
| 223 | + for (const auto& t0 : ft0rec) { |
| 224 | + if (!(t0.isValidTime(1) && t0.isValidTime(2))) { // skip if !(A & C) |
| 225 | + continue; |
| 226 | + } |
| 227 | + |
| 228 | + ULong64_t bclong = (t0.mIntRecord.orbit - processing_helpers::getFirstTForbit(pc)) * o2::constants::lhc::LHCMaxBunches + t0.mIntRecord.bc; |
| 229 | + if (t0array.find(bclong) == t0array.end()) { // add if it doesn't exist |
| 230 | + t0array.emplace(std::make_pair(bclong, t0.getCollisionTime(0))); |
| 231 | + } |
| 232 | + } |
| 233 | + |
| 234 | + static const double BC_TIME_INPS_INV = 1E-3 / o2::constants::lhc::LHCBunchSpacingNS; |
| 235 | + |
219 | 236 | // loop over ITS-TPC-TRD-TOF and ITS-TPC-TOF tracks an store for each ITS-TPC track the TOF track index |
220 | 237 | for (const auto& tofMatch : tofMatches) { |
221 | 238 | for (const auto& tpctofmatch : tofMatch) { |
222 | 239 | auto refTPC = recoData.getTPCContributorGID(tpctofmatch.getTrackRef()); |
223 | 240 | if (refTPC.isIndexSet()) { |
224 | 241 | o2::track::TrackLTIntegral ltIntegral = tpctofmatch.getLTIntegralOut(); |
225 | | - double signal = tpctofmatch.getSignal(); |
| 242 | + ULong64_t bclongtof = (tpctofmatch.getSignal() - 10000) * BC_TIME_INPS_INV; |
| 243 | + double t0 = 0; // bclongtof * o2::constants::lhc::LHCBunchSpacingNS * 1E3; // if you want to subtract also the BC uncomment this part (-> tofsignal can be a float) |
| 244 | + if (!(t0array.find(bclongtof) == t0array.end())) { // subtract FT0-AC if it exists in the same BC |
| 245 | + t0 += t0array.find(bclongtof)->second; |
| 246 | + } |
| 247 | + |
| 248 | + double signal = tpctofmatch.getSignal() - t0; |
226 | 249 | float deltaT = tpctofmatch.getDeltaT(); |
227 | | - idxTPCTrackToTOFCluster[refTPC] = {tpctofmatch.getIdxTOFCl(), tpctofmatch.getDXatTOF(), tpctofmatch.getDZatTOF(), ltIntegral, signal, deltaT}; |
| 250 | + |
| 251 | + float dy = tpctofmatch.getDYatTOF(); // residual orthogonal to the strip (it should be close to zero) |
| 252 | + bool isMultiHitZ = tpctofmatch.getHitPatternUpDown(); |
| 253 | + bool isMultiHitX = tpctofmatch.getHitPatternLeftRight(); |
| 254 | + bool isMultiStripMatch = tpctofmatch.getChi2() < 1E-9; |
| 255 | + float chi2 = tpctofmatch.getChi2(); |
| 256 | + |
| 257 | + int mask = 0; |
| 258 | + if (isMultiHitX) { // 1nd bit on if multiple hits along X |
| 259 | + mask += 1; |
| 260 | + } |
| 261 | + if (isMultiHitZ) { // 2nd bit on if multiple hits along Z |
| 262 | + mask += 2; |
| 263 | + } |
| 264 | + if (fabs(dy) > 0.5) { // 3rd bit on if Y-residual too large |
| 265 | + mask += 4; |
| 266 | + } |
| 267 | + if (isMultiStripMatch) { // 4th bit on if two strips fired |
| 268 | + mask += 8; |
| 269 | + } |
| 270 | + if (chi2 > 3) { // 5th bit on if chi2 > 3 |
| 271 | + mask += 16; |
| 272 | + } |
| 273 | + if (chi2 > 5) { |
| 274 | + mask += 32; |
| 275 | + } |
| 276 | + |
| 277 | + idxTPCTrackToTOFCluster[refTPC] = {tpctofmatch.getIdxTOFCl(), tpctofmatch.getDXatTOF(), tpctofmatch.getDZatTOF(), ltIntegral, signal, deltaT, mask}; |
228 | 278 | } |
229 | 279 | } |
230 | 280 | } |
@@ -1055,7 +1105,7 @@ class TPCTimeSeries : public Task |
1055 | 1105 | return isGoodTrack; |
1056 | 1106 | } |
1057 | 1107 |
|
1058 | | - 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) |
| 1108 | + 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, int>>& idxTPCTrackToTOFCluster, const gsl::span<const o2::tof::Cluster> tofClusters) |
1059 | 1109 | { |
1060 | 1110 | const auto& trackFull = tracksTPC[iTrk]; |
1061 | 1111 | const bool isGoodTrack = checkTrack(trackFull); |
@@ -1444,6 +1494,7 @@ class TPCTimeSeries : public Task |
1444 | 1494 | << "mDeltaTTOFTPC=" << std::get<5>(idxTPCTrackToTOFCluster[iTrk]) /// delta T- TPC TOF |
1445 | 1495 | << "vertexTime=" << vertexTime /// time stamp assigned to the vertex |
1446 | 1496 | << "trackTime0=" << trackTime0 /// time stamp assigned to the track |
| 1497 | + << "TOFmask=" << std::get<6>(idxTPCTrackToTOFCluster[iTrk]) /// delta T- TPC TOF |
1447 | 1498 | // TPC delta param |
1448 | 1499 | << "deltaTPCParamInOutTgl=" << deltaTPCParamInOutTgl |
1449 | 1500 | << "deltaTPCParamInOutQPt=" << deltaTPCParamInOutQPt |
@@ -1751,14 +1802,19 @@ class TPCTimeSeries : public Task |
1751 | 1802 | } |
1752 | 1803 | }; |
1753 | 1804 |
|
1754 | | -o2::framework::DataProcessorSpec getTPCTimeSeriesSpec(const bool disableWriter, const o2::base::Propagator::MatCorrType matType, const bool enableUnbinnedWriter, GTrackID::mask_t src) |
| 1805 | +o2::framework::DataProcessorSpec getTPCTimeSeriesSpec(const bool disableWriter, const o2::base::Propagator::MatCorrType matType, const bool enableUnbinnedWriter, GTrackID::mask_t src, bool useft0) |
1755 | 1806 | { |
1756 | 1807 | auto dataRequest = std::make_shared<DataRequest>(); |
1757 | 1808 | bool useMC = false; |
1758 | 1809 | GTrackID::mask_t srcTracks = GTrackID::getSourcesMask("TPC,ITS,ITS-TPC,ITS-TPC-TRD,ITS-TPC-TOF,ITS-TPC-TRD-TOF") & src; |
1759 | 1810 | srcTracks.set(GTrackID::TPC); // TPC must be always there |
1760 | 1811 | dataRequest->requestTracks(srcTracks, useMC); |
1761 | 1812 | dataRequest->requestClusters(GTrackID::getSourcesMask("TPC"), useMC); |
| 1813 | + |
| 1814 | + if (useft0) { |
| 1815 | + dataRequest->requestFT0RecPoints(false); |
| 1816 | + } |
| 1817 | + |
1762 | 1818 | bool tpcOnly = srcTracks == GTrackID::getSourcesMask("TPC"); |
1763 | 1819 | if (!tpcOnly) { |
1764 | 1820 | dataRequest->requestPrimaryVertices(useMC); |
|
0 commit comments