15#include <TStopwatch.h>
52 void process(
o2::globaltracking::RecoContainer& recoData);
57 std::unique_ptr<
o2::
utils::TreeStreamRedirector> mDBGOut;
59 std::unique_ptr<TH1F> mDTHisto{};
60 const std::string mOutName{
"its_offset_Study.root"};
65 mDBGOut = std::make_unique<o2::utils::TreeStreamRedirector>(mOutName.c_str(),
"recreate");
66 mDTHisto = std::make_unique<TH1F>(
"dT",
"T_{TOF} - T_{ITS-ROF}, #mus", 1000, 1, -1);
67 mDTHisto->SetDirectory(
nullptr);
74 updateTimeDependentParams(pc);
80 static bool initOnceDone =
false;
88 constexpr float PS2MUS = 1e-6;
93 std::vector<int> itsTr2ROFID;
94 std::unordered_map<GTrackID, char> ambigMap;
97 for (
const auto& rof : itsROFs) {
98 size_t maxE = rof.getFirstEntry() + rof.getNEntries();
99 if (itsTr2ROFID.size() < maxE) {
100 itsTr2ROFID.resize(maxE, cntROF);
105 int nv = vtxRefs.size();
106 for (
int iv = 0; iv < nv; iv++) {
107 const auto& vtref = vtxRefs[iv];
109 if (!mTracksSrc[is] || !(GTrackID::getSourceDetectorsMask(is)[
GTrackID::ITS] && GTrackID::getSourceDetectorsMask(is)[
GTrackID::TOF])) {
112 int idMin = vtxRefs[iv].getFirstEntryOfSource(is), idMax = idMin + vtxRefs[iv].getEntriesOfSource(is);
113 for (
int i = idMin;
i < idMax;
i++) {
114 auto vid = trackIndex[
i];
115 if (vid.isAmbiguous()) {
116 auto& ambEntry = ambigMap[vid];
132 const auto& rof = itsROFs[itsTr2ROFID[itsTrackID]];
134 (*mDBGOut) <<
"itstof"
135 <<
"gid=" << vid <<
"ttof=" << timeTOFMUS <<
"tits=" << tsROF <<
"itsROFID=" << itsTr2ROFID[itsTrackID] <<
"\n";
136 mDTHisto->Fill(timeTOFMUS - tsROF);
137 const auto& trc = recoData.
getTrackParam(tofMatch.getTrackRef());
138 (*mDBGOut) <<
"dttof"
139 <<
"refgid=" << tofMatch.getTrackRef() <<
"dtime=" << tofMatch.getDeltaT() <<
"phi=" << trc.getPhi() <<
"tgl=" << trc.getTgl() <<
"q2t=" << trc.getQ2Pt() <<
"\n";
148 TFile fout(mOutName.c_str(),
"update");
149 fout.WriteTObject(mDTHisto.get());
150 LOGP(info,
"Stored time differences histogram {} and tree {} into {}", mDTHisto->GetName(),
"itstof", mOutName.c_str());
160 std::vector<OutputSpec> outputs;
161 auto dataRequest = std::make_shared<DataRequest>();
163 dataRequest->requestTracks(srcTracks, useMC);
164 dataRequest->requestClusters(srcClusters, useMC);
165 dataRequest->requestPrimaryVertices(useMC);
171 AlgorithmSpec{adaptFromTask<ITSOffsStudy>(dataRequest, srcTracks)},
Global index for barrel track: provides provenance (detectors combination), index in respective array...
Definition of the Names Generator class.
Wrapper container for different reconstructed object types.
Referenc on track indices contributing to the vertex, with possibility chose tracks from specific sou...
Static class with identifiers, bitmasks and names for ALICE detectors.
void init(InitContext &ic) final
void finaliseCCDB(ConcreteDataMatcher &matcher, void *obj) final
void endOfStream(EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
~ITSOffsStudy() final=default
ITSOffsStudy(std::shared_ptr< DataRequest > dr, GTrackID::mask_t src)
void process(o2::globaltracking::RecoContainer &recoData)
void run(ProcessingContext &pc) final
constexpr double LHCBunchSpacingMUS
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
o2::framework::DataProcessorSpec getITSOffsStudy(o2::dataformats::GlobalTrackID::mask_t srcTracks, o2::dataformats::GlobalTrackID::mask_t srcClus)
create a processor spec
o2::dataformats::VtxTrackRef V2TRef
o2::dataformats::VtxTrackIndex VTIndex
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.
Common utility functions.
o2::InteractionRecord startIR
GlobalIDSet getSingleDetectorRefs(GTrackID gidx) const
auto getPrimaryVertexMatchedTracks() const
auto getPrimaryVertexMatchedTrackRefs() const
const o2::track::TrackParCov & getTrackParam(GTrackID gidx) const
auto getTOFClusters() const
void collectData(o2::framework::ProcessingContext &pc, const DataRequest &request)
auto getITSTracksROFRecords() const
const o2::dataformats::MatchInfoTOF & getTOFMatch(GTrackID id) const