Skip to content

Commit 3d89c1c

Browse files
committed
improve TOF infos in TPCtimeseries
1 parent b77f031 commit 3d89c1c

File tree

3 files changed

+61
-4
lines changed

3 files changed

+61
-4
lines changed

Detectors/TPC/workflow/include/TPCWorkflow/TPCTimeSeriesSpec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace tpc
2323
static constexpr header::DataDescription getDataDescriptionTimeSeries() { return header::DataDescription{"TIMESERIES"}; }
2424
static constexpr header::DataDescription getDataDescriptionTPCTimeSeriesTFId() { return header::DataDescription{"ITPCTSTFID"}; }
2525

26-
o2::framework::DataProcessorSpec getTPCTimeSeriesSpec(const bool disableWriter, const o2::base::Propagator::MatCorrType matType, const bool enableUnbinnedWriter, o2::dataformats::GlobalTrackID::mask_t src);
26+
o2::framework::DataProcessorSpec getTPCTimeSeriesSpec(const bool disableWriter, const o2::base::Propagator::MatCorrType matType, const bool enableUnbinnedWriter, o2::dataformats::GlobalTrackID::mask_t src, bool useft0=false);
2727

2828
} // end namespace tpc
2929
} // end namespace o2

Detectors/TPC/workflow/src/TPCTimeSeriesSpec.cxx

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "TROOT.h"
4646
#include "ReconstructionDataFormats/MatchInfoTOF.h"
4747
#include "DataFormatsTOF/Cluster.h"
48+
#include "DataFormatsFT0/RecPoints.h"
4849

4950
using namespace o2::globaltracking;
5051
using GTrackID = o2::dataformats::GlobalTrackID;
@@ -216,14 +217,63 @@ class TPCTimeSeries : public Task
216217
idxTPCTrackToTOFCluster = std::vector<std::tuple<int, float, float, o2::track::TrackLTIntegral, double, float>>(tracksTPC.size(), {-1, -999, -999, defLT, 0, 0});
217218
const std::vector<gsl::span<const o2::dataformats::MatchInfoTOF>> tofMatches{recoData.getTPCTOFMatches(), recoData.getTPCTRDTOFMatches(), recoData.getITSTPCTOFMatches(), recoData.getITSTPCTRDTOFMatches()};
218219

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+
219236
// loop over ITS-TPC-TRD-TOF and ITS-TPC-TOF tracks an store for each ITS-TPC track the TOF track index
220237
for (const auto& tofMatch : tofMatches) {
221238
for (const auto& tpctofmatch : tofMatch) {
222239
auto refTPC = recoData.getTPCContributorGID(tpctofmatch.getTrackRef());
223240
if (refTPC.isIndexSet()) {
224241
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;
226249
float deltaT = tpctofmatch.getDeltaT();
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() < 1E9;
255+
float chi2 = tpctofmatch.getChi2();
256+
257+
int mask = 0; // to be added in idxTPCTrackToTOFCluster?
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+
227277
idxTPCTrackToTOFCluster[refTPC] = {tpctofmatch.getIdxTOFCl(), tpctofmatch.getDXatTOF(), tpctofmatch.getDZatTOF(), ltIntegral, signal, deltaT};
228278
}
229279
}
@@ -1751,14 +1801,19 @@ class TPCTimeSeries : public Task
17511801
}
17521802
};
17531803

1754-
o2::framework::DataProcessorSpec getTPCTimeSeriesSpec(const bool disableWriter, const o2::base::Propagator::MatCorrType matType, const bool enableUnbinnedWriter, GTrackID::mask_t src)
1804+
o2::framework::DataProcessorSpec getTPCTimeSeriesSpec(const bool disableWriter, const o2::base::Propagator::MatCorrType matType, const bool enableUnbinnedWriter, GTrackID::mask_t src, bool useft0)
17551805
{
17561806
auto dataRequest = std::make_shared<DataRequest>();
17571807
bool useMC = false;
17581808
GTrackID::mask_t srcTracks = GTrackID::getSourcesMask("TPC,ITS,ITS-TPC,ITS-TPC-TRD,ITS-TPC-TOF,ITS-TPC-TRD-TOF") & src;
17591809
srcTracks.set(GTrackID::TPC); // TPC must be always there
17601810
dataRequest->requestTracks(srcTracks, useMC);
17611811
dataRequest->requestClusters(GTrackID::getSourcesMask("TPC"), useMC);
1812+
1813+
if(useft0) {
1814+
dataRequest->requestFT0RecPoints(false);
1815+
}
1816+
17621817
bool tpcOnly = srcTracks == GTrackID::getSourcesMask("TPC");
17631818
if (!tpcOnly) {
17641819
dataRequest->requestPrimaryVertices(useMC);

Detectors/TPC/workflow/src/tpc-time-series.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
2929
{"disable-root-output", VariantType::Bool, false, {"disable root-files output writers"}},
3030
{"enable-unbinned-root-output", VariantType::Bool, false, {"writing out unbinned track data"}},
3131
{"track-sources", VariantType::String, std::string{o2::dataformats::GlobalTrackID::ALL}, {"comma-separated list of sources to use"}},
32+
{"use-ft0", VariantType::Bool, false, {"enable FT0 rec-points"}},
3233
{"material-type", VariantType::Int, 2, {"Type for the material budget during track propagation: 0=None, 1=Geo, 2=LUT"}}};
3334
std::swap(workflowOptions, options);
3435
}
@@ -43,7 +44,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& config)
4344
const bool enableUnbinnedWriter = config.options().get<bool>("enable-unbinned-root-output");
4445
auto src = o2::dataformats::GlobalTrackID::getSourcesMask(config.options().get<std::string>("track-sources"));
4546
auto materialType = static_cast<o2::base::Propagator::MatCorrType>(config.options().get<int>("material-type"));
46-
workflow.emplace_back(o2::tpc::getTPCTimeSeriesSpec(disableWriter, materialType, enableUnbinnedWriter, src));
47+
const bool useft0 = config.options().get<bool>("use-ft0");
48+
workflow.emplace_back(o2::tpc::getTPCTimeSeriesSpec(disableWriter, materialType, enableUnbinnedWriter, src, useft0));
4749
if (!disableWriter) {
4850
workflow.emplace_back(o2::tpc::getTPCTimeSeriesWriterSpec());
4951
}

0 commit comments

Comments
 (0)