Skip to content

Commit

Permalink
IT3: Enable Glo-tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
f3sch committed Apr 23, 2024
1 parent 3994fe2 commit ee50417
Show file tree
Hide file tree
Showing 19 changed files with 288 additions and 111 deletions.
4 changes: 4 additions & 0 deletions DataFormats/Detectors/GlobalTracking/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

#add_compile_options(-O0 -g -fPIC -fno-omit-frame-pointer)

o2_add_library(
DataFormatsGlobalTracking
SOURCES src/RecoContainer.cxx
Expand All @@ -35,6 +37,8 @@ o2_add_library(
O2::DataFormatsPHOS
O2::DataFormatsEMCAL
O2::GPUDataTypeHeaders
PUBLIC_UPGRADE_LINK_LIBRARIES
O2::ITS3Reconstruction
PRIVATE_LINK_LIBRARIES
O2::Framework)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ struct DataRequest {
void requestFV0RecPoints(bool mc);
void requestFDDRecPoints(bool mc);
void requestZDCRecEvents(bool mc);
void requestITSClusters(bool mc);
void requestITSClusters(bool mc, bool withIT3 = false);
void requestMFTClusters(bool mc);
void requestTPCClusters(bool mc);
void requestTPCTriggers();
Expand Down Expand Up @@ -370,7 +370,7 @@ struct RecoContainer {
void addMFTMCHMatches(o2::framework::ProcessingContext& pc, bool mc);
void addMCHMIDMatches(o2::framework::ProcessingContext& pc, bool mc);

void addITSClusters(o2::framework::ProcessingContext& pc, bool mc);
void addITSClusters(o2::framework::ProcessingContext& pc, bool mc, bool withIT3 = false);
void addMFTClusters(o2::framework::ProcessingContext& pc, bool mc);
void addTPCClusters(o2::framework::ProcessingContext& pc, bool mc, bool shmap, bool occmap);
void addTPCTriggers(o2::framework::ProcessingContext& pc);
Expand Down
37 changes: 33 additions & 4 deletions DataFormats/Detectors/GlobalTracking/src/RecoContainer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
#include "Framework/DataRefUtils.h"
#include "Framework/CCDBParamSpec.h"

#ifdef ENABLE_UPGRADES
#include "ITS3Reconstruction/TopologyDictionary.h"
#endif

using namespace o2::globaltracking;
using namespace o2::framework;
namespace o2d = o2::dataformats;
Expand Down Expand Up @@ -222,17 +226,27 @@ void DataRequest::requestTOFMatches(o2::dataformats::GlobalTrackID::mask_t src,
}
}

void DataRequest::requestITSClusters(bool mc)
void DataRequest::requestITSClusters(bool mc, bool withIT3)
{
addInput({"clusITS", "ITS", "COMPCLUSTERS", 0, Lifetime::Timeframe});
addInput({"clusITSPatt", "ITS", "PATTERNS", 0, Lifetime::Timeframe});
addInput({"clusITSROF", "ITS", "CLUSTERSROF", 0, Lifetime::Timeframe});
addInput({"cldictITS", "ITS", "CLUSDICT", 0, Lifetime::Condition, ccdbParamSpec("ITS/Calib/ClusterDictionary")});
addInput({"alpparITS", "ITS", "ALPIDEPARAM", 0, Lifetime::Condition, ccdbParamSpec("ITS/Config/AlpideParam")});
if (mc) {
addInput({"clusITSMC", "ITS", "CLUSTERSMCTR", 0, Lifetime::Timeframe});
}
#ifdef ENABLE_UPGRADES
if (withIT3) {
addInput({"cldictIT3", "IT3", "CLUSDICT", 0, Lifetime::Condition, ccdbParamSpec("IT3/Calib/ClusterDictionary")});
requestMap["clusIT3"] = mc;
} else {
addInput({"cldictITS", "ITS", "CLUSDICT", 0, Lifetime::Condition, ccdbParamSpec("ITS/Calib/ClusterDictionary")});
requestMap["clusITS"] = mc;
}
#else
addInput({"cldictITS", "ITS", "CLUSDICT", 0, Lifetime::Condition, ccdbParamSpec("ITS/Calib/ClusterDictionary")});
requestMap["clusITS"] = mc;
#endif
}

void DataRequest::requestMFTClusters(bool mc)
Expand Down Expand Up @@ -673,6 +687,13 @@ void RecoContainer::collectData(ProcessingContext& pc, const DataRequest& reques
addITSClusters(pc, req->second);
}

#ifdef ENABLE_UPGRADES
req = reqMap.find("clusIT3");
if (req != reqMap.end()) {
addITSClusters(pc, req->second, true);
}
#endif

req = reqMap.find("clusMFT");
if (req != reqMap.end()) {
addMFTClusters(pc, req->second);
Expand Down Expand Up @@ -1033,11 +1054,19 @@ void RecoContainer::addHMPMatches(ProcessingContext& pc, bool mc)
}

//__________________________________________________________
void RecoContainer::addITSClusters(ProcessingContext& pc, bool mc)
void RecoContainer::addITSClusters(ProcessingContext& pc, bool mc, bool withIT3)
{
if (pc.services().get<o2::framework::TimingInfo>().globalRunNumberChanged) { // this params need to be queried only once
pc.inputs().get<o2::itsmft::TopologyDictionary*>("cldictITS"); // just to trigger the finaliseCCDB
pc.inputs().get<o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>*>("alpparITS"); // note: configurable param does not need finaliseCCDB
#ifdef ENABLE_UPGRADES
if (withIT3) {
pc.inputs().get<o2::its3::TopologyDictionary*>("cldictIT3"); // just to trigger the finaliseCCDB
} else {
pc.inputs().get<o2::itsmft::TopologyDictionary*>("cldictITS"); // just to trigger the finaliseCCDB
}
#else
pc.inputs().get<o2::itsmft::TopologyDictionary*>("cldictITS"); // just to trigger the finaliseCCDB
#endif
}
commonPool[GTrackID::ITS].registerContainer(pc.inputs().get<gsl::span<o2::itsmft::ROFRecord>>("clusITSROF"), CLUSREFS);
commonPool[GTrackID::ITS].registerContainer(pc.inputs().get<gsl::span<o2::itsmft::CompClusterExt>>("clusITS"), CLUSTERS);
Expand Down
61 changes: 31 additions & 30 deletions Detectors/GlobalTracking/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# In applying this license CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.
# add_compile_options(-O0 -g -fPIC)
#add_compile_options(-O0 -g -fPIC -fno-omit-frame-pointer)

o2_add_library(GlobalTracking
TARGETVARNAME targetName
Expand All @@ -24,35 +24,36 @@ o2_add_library(GlobalTracking
src/ITSTPCMatchingQCParams.cxx
src/MatchGlobalFwdParam.cxx
src/MatchTOFParams.cxx
PUBLIC_LINK_LIBRARIES O2::Framework
O2::DataFormatsTPC
O2::DataFormatsITSMFT
O2::DataFormatsITS
O2::DataFormatsFT0
O2::DataFormatsTOF
O2::DataFormatsHMP
O2::DataFormatsTRD
O2::ITSReconstruction
O2::FT0Reconstruction
O2::TPCFastTransformation
O2::GPUO2Interface
O2::GPUTracking
O2::TPCBase
O2::TPCReconstruction
O2::TPCCalibration
O2::TOFBase
O2::HMPIDReconstruction
O2::TOFCalibration
O2::TOFWorkflowUtils
O2::SimConfig
O2::DataFormatsFT0
O2::DataFormatsGlobalTracking
O2::ITStracking
O2::MFTTracking
O2::MCHTracking
O2::MathUtils
O2::ReconstructionDataFormats
O2::Steer)
PUBLIC_LINK_LIBRARIES O2::Framework
O2::DataFormatsTPC
O2::DataFormatsITSMFT
O2::DataFormatsITS
O2::DataFormatsFT0
O2::DataFormatsTOF
O2::DataFormatsHMP
O2::DataFormatsTRD
O2::ITSReconstruction
O2::FT0Reconstruction
O2::TPCFastTransformation
O2::GPUO2Interface
O2::GPUTracking
O2::TPCBase
O2::TPCReconstruction
O2::TPCCalibration
O2::TOFBase
O2::HMPIDReconstruction
O2::TOFCalibration
O2::TOFWorkflowUtils
O2::SimConfig
O2::DataFormatsFT0
O2::DataFormatsGlobalTracking
O2::ITStracking
O2::MFTTracking
O2::MCHTracking
O2::MathUtils
O2::ReconstructionDataFormats
O2::Steer
PUBLIC_UPGRADE_LINK_LIBRARIES O2::ITS3Reconstruction)

o2_target_root_dictionary(GlobalTracking
HEADERS include/GlobalTracking/MatchTPCITSParams.h
Expand Down
67 changes: 49 additions & 18 deletions Detectors/GlobalTracking/include/GlobalTracking/MatchTPCITS.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__ROOTCLING__) && !defined(__CLING__)
#include "MemoryResources/MemoryResources.h"
#endif
#ifdef ENABLE_UPGRADES
#include "ITS3Reconstruction/TopologyDictionary.h"
#endif

class TTree;

Expand Down Expand Up @@ -137,7 +140,7 @@ struct TrackLocTPC : public o2::track::TrackParCov {
}
float getSignedDT(float dt) const // account for TPC side in time difference for dt=external_time - tpc.time0
{
return constraint == Constrained ? 0. : (constraint == ASide ? dt : -dt);
return constraint == Constrained ? 0.f : (constraint == ASide ? dt : -dt);
}

ClassDefNV(TrackLocTPC, 2);
Expand Down Expand Up @@ -298,12 +301,24 @@ struct ITSChipClustersRefs {
///< contaner for sorted cluster indices for certain time window (usually ROF) and reference on the start and N clusters
///< for every chip
using ClusRange = o2::dataformats::RangeReference<int, int>;
std::vector<int> clusterID; // indices of sorted clusters
std::vector<int> clusterID; // indices of sorted clusters

#ifndef ENABLE_UPGRADES
std::array<ClusRange, o2::its::RecoGeomHelper::getNChips()> chipRefs; // offset and number of clusters in each chip
ITSChipClustersRefs(int nclIni = 50000)
{
clusterID.reserve(nclIni);
}
#else
std::vector<ClusRange> chipRefs; // offset and number of clusters in each chip
ITSChipClustersRefs(int nchips = o2::its::RecoGeomHelper::getNChips(), int nclIni = 50000)
{
clusterID.reserve(nclIni);
chipRefs.reserve(nchips);
std::generate(chipRefs.begin(), chipRefs.end(), []() { return ClusRange(); });
}
#endif

void clear()
{
clusterID.clear();
Expand Down Expand Up @@ -356,7 +371,10 @@ class MatchTPCITS
pmr::vector<o2::itsmft::TrkClusRef>& ABTrackletRefs, pmr::vector<o2::dataformats::Triplet<float, float, float>>& calib);
bool refitABTrack(int iITSAB, const TPCABSeed& seed, pmr::vector<o2::dataformats::TrackTPCITS>& matchedTracks, pmr::vector<int>& ABTrackletClusterIDs, pmr::vector<o2::itsmft::TrkClusRef>& ABTrackletRefs);
#endif // CLING
void setSkipTPCOnly(bool v) { mSkipTPCOnly = v; }
void setSkipTPCOnly(bool v)
{
mSkipTPCOnly = v;
}
void setCosmics(bool v) { mCosmics = v; }
bool isCosmics() const { return mCosmics; }
void setNThreads(int n);
Expand Down Expand Up @@ -395,13 +413,21 @@ class MatchTPCITS

// ==================== >> DPL-driven input >> =======================
void setITSDictionary(const o2::itsmft::TopologyDictionary* d) { mITSDict = d; }
#ifdef ENABLE_UPGRADES
void setIT3Dictionary(const o2::its3::TopologyDictionary* d)
{
mIT3Dict = d;
}
#endif

///< set flag to use MC truth
void setMCTruthOn(bool v)
{
mMCTruthON = v;
}

void setWithIT3(bool v) { mWithIT3 = v; }

///< request VDrift calibration
void setVDriftCalib(bool v)
{
Expand Down Expand Up @@ -558,13 +584,14 @@ class MatchTPCITS
float correctTPCTrack(o2::track::TrackParCov& trc, const TrackLocTPC& tTPC, const InteractionCandidate& cand) const; // RS FIXME will be needed for refit
//================================================================

bool mInitDone = false; ///< flag init already done
bool mFieldON = true; ///< flag for field ON/OFF
bool mCosmics = false; ///< flag cosmics mode
bool mMCTruthON = false; ///< flag availability of MC truth
float mBz = 0; ///< nominal Bz
int mTFCount = 0; ///< internal TF counter for debugger
int mNThreads = 1; ///< number of OMP threads
bool mInitDone = false; ///< flag init already done
bool mFieldON = true; ///< flag for field ON/OFF
bool mCosmics = false; ///< flag cosmics mode
bool mMCTruthON = false; ///< flag availability of MC truth
bool mWithIT3 = false; ///< flag availability of using IT3
float mBz = 0; ///< nominal Bz
int mTFCount = 0; ///< internal TF counter for debugger
int mNThreads = 1; ///< number of OMP threads
int mNHBPerTF = 0;
int mNTPCOccBinLength = 0; ///< TPC occ. histo bin length in TBs
float mNTPCOccBinLengthInv;
Expand Down Expand Up @@ -644,6 +671,9 @@ class MatchTPCITS
gsl::span<const unsigned int> mTPCRefitterOccMap; ///< externally set TPC clusters occupancy map

const o2::itsmft::TopologyDictionary* mITSDict{nullptr}; // cluster patterns dictionary
#ifdef ENABLE_UPGRADES
const o2::its3::TopologyDictionary* mIT3Dict{nullptr}; // cluster patterns dictionary
#endif

const o2::tpc::ClusterNativeAccess* mTPCClusterIdxStruct = nullptr; ///< struct holding the TPC cluster indices

Expand All @@ -657,23 +687,24 @@ class MatchTPCITS
size_t mNMatchesControl = 0;

size_t mNABRefsClus = 0;
float mAB2MatchGuess = 0.2; // heuristic guess about fraction of AB matches in total matches
std::vector<InteractionCandidate> mInteractions; ///< possible interaction times
std::vector<int> mInteractionMUSLUT; ///< LUT for interactions in 1MUS bins
float mAB2MatchGuess = 0.2; // heuristic guess about fraction of AB matches in total matches
std::vector<InteractionCandidate> mInteractions; ///< possible interaction times
std::vector<int> mInteractionMUSLUT; ///< LUT for interactions in 1MUS bins

///< container for record the match of TPC track to single ITS track
std::vector<MatchRecord> mMatchRecordsTPC; // RSS DEQ
///< container for reference to MatchRecord involving particular ITS track
std::vector<MatchRecord> mMatchRecordsITS; // RSS DEQ

//// std::vector<int> mITSROFofTPCBin; ///< aux structure for mapping of TPC time-bins on ITS ROFs
std::vector<BracketF> mITSROFTimes; ///< min/max times of ITS ROFs in \mus
std::vector<TrackLocTPC> mTPCWork; ///< TPC track params prepared for matching
std::vector<TrackLocITS> mITSWork; ///< ITS track params prepared for matching
std::vector<BracketF> mITSROFTimes; ///< min/max times of ITS ROFs in \mus
std::vector<TrackLocTPC> mTPCWork; ///< TPC track params prepared for matching
std::vector<TrackLocITS> mITSWork; ///< ITS track params prepared for matching
std::vector<o2::MCCompLabel> mTPCLblWork; ///< TPC track labels
std::vector<o2::MCCompLabel> mITSLblWork; ///< ITS track labels
std::vector<float> mWinnerChi2Refit; ///< vector of refitChi2 for winners
std::vector<float> mTBinClOcc; ///< TPC occupancy histo: i-th entry is the integrated occupancy for ~1 orbit starting from the TB = i*mNTPCOccBinLength
std::vector<float> mWinnerChi2Refit; ///< vector of refitChi2 for winners
std::vector<float> mTBinClOcc; ///< TPC occupancy histo: i-th entry is the integrated occupancy for ~1 orbit starting from the TB = i*mNTPCOccBinLength

// ------------------------------
std::vector<TPCABSeed> mTPCABSeeds; ///< pool of primary TPC seeds for AB
///< indices of selected track entries in mTPCWork (for tracks selected by AfterBurner)
Expand Down
Loading

0 comments on commit ee50417

Please sign in to comment.