Skip to content

Commit

Permalink
asldjlkjlk
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
  • Loading branch information
f3sch committed Apr 16, 2024
1 parent a5d23e6 commit e46961b
Show file tree
Hide file tree
Showing 13 changed files with 202 additions and 87 deletions.
60 changes: 31 additions & 29 deletions Detectors/GlobalTracking/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
# 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,34 +25,35 @@ 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::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::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
34 changes: 26 additions & 8 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 @@ -356,7 +359,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 @@ -393,13 +399,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 @@ -560,6 +574,7 @@ class MatchTPCITS
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
Expand Down Expand Up @@ -639,6 +654,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 @@ -652,22 +670,22 @@ 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> mWinnerChi2Refit; ///< vector of refitChi2 for winners

// ------------------------------
std::vector<TPCABSeed> mTPCABSeeds; ///< pool of primary TPC seeds for AB
Expand Down
6 changes: 4 additions & 2 deletions Detectors/GlobalTracking/src/MatchTPCITS.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ void MatchTPCITS::init()
}
#endif

mRGHelper.init(); // prepare helper for TPC track / ITS clusters matching
if (mParams->runAfterBurner) {
mRGHelper.init(); // prepare helper for TPC track / ITS clusters matching
}

clear();

Expand Down Expand Up @@ -1506,7 +1508,7 @@ bool MatchTPCITS::refitTrackTPCITS(int slot, int iTPC, int& iITS, pmr::vector<o2
auto& trfit = matchedTracks[slot];
((o2::track::TrackParCov&)trfit) = (const o2::track::TrackParCov&)tTPC;
trfit.getParamOut() = (const o2::track::TrackParCov&)tITS; // create a copy of TPC track at xRef
trfit.getParamOut().setUserField(0); // reset eventual clones flag
trfit.getParamOut().setUserField(0); // reset eventual clones flag
trfit.setPID(tTPC.getPID(), true);
trfit.getParamOut().setPID(tTPC.getPID(), true);
// in continuos mode the Z of TPC track is meaningless, unless it is CE crossing
Expand Down
6 changes: 4 additions & 2 deletions Detectors/GlobalTrackingWorkflow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# FIXME: do we actually need a library here, or is the executable enough ?

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

o2_add_library(GlobalTrackingWorkflow
SOURCES src/TrackWriterTPCITSSpec.cxx
Expand Down Expand Up @@ -48,7 +48,9 @@ o2_add_library(GlobalTrackingWorkflow
O2::ITSMFTWorkflow
O2::SimulationDataFormat
O2::DetectorsVertexing
O2::StrangenessTracking)
O2::StrangenessTracking
PUBLIC_UPGRADE_LINK_LIBRARIES O2::ITS3Reconstruction)

o2_add_executable(driver-workflow
COMPONENT_NAME reader
SOURCES src/reader-driver-workflow.cxx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct CorrectionMapsLoaderGloOpts;
namespace globaltracking
{
/// create a processor spec
framework::DataProcessorSpec getTPCITSMatchingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useFT0, bool calib, bool skipTPCOnly, bool useGeom, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts);
framework::DataProcessorSpec getTPCITSMatchingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useFT0, bool calib, bool skipTPCOnly, bool useGeom, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts, bool withIT3);

} // namespace globaltracking
} // namespace o2
Expand Down
28 changes: 23 additions & 5 deletions Detectors/GlobalTrackingWorkflow/src/TPCITSMatchingSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
#include "TPCCalibration/VDriftHelper.h"
#include "TPCCalibration/CorrectionMapsLoader.h"

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

using namespace o2::framework;
using MCLabelsCl = o2::dataformats::MCTruthContainer<o2::MCCompLabel>;
using MCLabelsTr = gsl::span<const o2::MCCompLabel>;
Expand All @@ -64,8 +68,8 @@ class TPCITSMatchingDPL : public Task
{
public:
TPCITSMatchingDPL(std::shared_ptr<DataRequest> dr, std::shared_ptr<o2::base::GRPGeomRequest> gr, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts,
bool useFT0, bool calib, bool skipTPCOnly, bool useMC)
: mDataRequest(dr), mGGCCDBRequest(gr), mUseFT0(useFT0), mCalibMode(calib), mSkipTPCOnly(skipTPCOnly), mUseMC(useMC)
bool useFT0, bool calib, bool skipTPCOnly, bool useMC, bool withIT3)
: mDataRequest(dr), mGGCCDBRequest(gr), mUseFT0(useFT0), mCalibMode(calib), mSkipTPCOnly(skipTPCOnly), mUseMC(useMC), mWithIT3(withIT3)
{
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
Expand All @@ -87,6 +91,7 @@ class TPCITSMatchingDPL : public Task
bool mCalibMode = false;
bool mSkipTPCOnly = false; // to use only externally constrained tracks (for test only)
bool mUseMC = true;
bool mWithIT3 = false;
TStopwatch mTimer;
};

Expand Down Expand Up @@ -147,10 +152,17 @@ void TPCITSMatchingDPL::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj)
return;
}
if (matcher == ConcreteDataMatcher("ITS", "CLUSDICT", 0)) {
LOG(info) << "cluster dictionary updated";
LOG(info) << "its cluster dictionary updated";
mMatching.setITSDictionary((const o2::itsmft::TopologyDictionary*)obj);
return;
}
#ifdef ENABLE_UPGRADES
if (matcher == ConcreteDataMatcher("IT3", "CLUSDICT", 0)) {
LOG(info) << "it3 cluster dictionary updated";
mMatching.setIT3Dictionary((const o2::its3::TopologyDictionary*)obj);
return;
}
#endif
if (matcher == ConcreteDataMatcher("ITS", "ALPIDEPARAM", 0)) {
LOG(info) << "ITS Alpide param updated";
const auto& par = o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>::Instance();
Expand Down Expand Up @@ -185,6 +197,7 @@ void TPCITSMatchingDPL::updateTimeDependentParams(ProcessingContext& pc)
mMatching.setSkipTPCOnly(mSkipTPCOnly);
mMatching.setITSTriggered(!o2::base::GRPGeomHelper::instance().getGRPECS()->isDetContinuousReadOut(o2::detectors::DetID::ITS));
mMatching.setMCTruthOn(mUseMC);
mMatching.setWithIT3(mWithIT3);
mMatching.setUseFT0(mUseFT0);
mMatching.setVDriftCalib(mCalibMode);
if (o2::base::GRPGeomHelper::instance().getGRPECS()->getRunType() != o2::parameters::GRPECSObject::RunType::COSMICS) {
Expand Down Expand Up @@ -223,7 +236,7 @@ void TPCITSMatchingDPL::updateTimeDependentParams(ProcessingContext& pc)
}
}

DataProcessorSpec getTPCITSMatchingSpec(GTrackID::mask_t src, bool useFT0, bool calib, bool skipTPCOnly, bool useGeom, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts)
DataProcessorSpec getTPCITSMatchingSpec(GTrackID::mask_t src, bool useFT0, bool calib, bool skipTPCOnly, bool useGeom, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts, bool withIT3)
{
std::vector<OutputSpec> outputs;
auto dataRequest = std::make_shared<DataRequest>();
Expand Down Expand Up @@ -251,6 +264,11 @@ DataProcessorSpec getTPCITSMatchingSpec(GTrackID::mask_t src, bool useFT0, bool
outputs.emplace_back("GLO", "TPCITSAB_MC", 0, Lifetime::Timeframe); // AfterBurner ITS tracklet MC
}
// Note: ITS/CLUSDICT and ITS/ALPIDEPARAM are requested/loaded by the recocontainer
#ifdef ENABLE_UPGRADES
if (withIT3) {
dataRequest->inputs.emplace_back("cldict", "IT3", "CLUSDICT", 0, Lifetime::Condition, ccdbParamSpec("IT3/Calib/ClusterDictionary"));
}
#endif

auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(true, // orbitResetTime
true, // GRPECS=true
Expand All @@ -276,7 +294,7 @@ DataProcessorSpec getTPCITSMatchingSpec(GTrackID::mask_t src, bool useFT0, bool
"itstpc-track-matcher",
dataRequest->inputs,
outputs,
AlgorithmSpec{adaptFromTask<TPCITSMatchingDPL>(dataRequest, ggRequest, sclOpts, useFT0, calib, skipTPCOnly, useMC)},
AlgorithmSpec{adaptFromTask<TPCITSMatchingDPL>(dataRequest, ggRequest, sclOpts, useFT0, calib, skipTPCOnly, useMC, withIT3)},
opts};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
{"disable-root-input", o2::framework::VariantType::Bool, false, {"disable root-files input reader"}},
{"disable-root-output", o2::framework::VariantType::Bool, false, {"disable root-files output writer"}},
{"track-sources", VariantType::String, "TPC", {"comma-separated list of sources to use: TPC,TPC-TOF,TPC-TRD,TPC-TRD-TOF"}},
{"with-it3", VariantType::Bool, false, {"run with IT3 detector instead of ITS"}},
{"produce-calibration-data", o2::framework::VariantType::Bool, false, {"produce output for TPC vdrift calibration"}},
{"use-full-geometry", o2::framework::VariantType::Bool, false, {"use full geometry instead of the light-weight ITS part"}},
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
Expand Down Expand Up @@ -84,7 +85,8 @@ WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& configcont
}
auto useMC = !configcontext.options().get<bool>("disable-mc");
auto calib = configcontext.options().get<bool>("produce-calibration-data");
auto srcL = src | GID::getSourcesMask("ITS,TPC"); // ITS is neadded always, TPC must be loaded even if bare TPC tracks are not used in matching
auto withIT3 = configcontext.options().get<bool>("with-it3");
auto srcL = src | GID::getSourcesMask("ITS,TPC"); // ITS is needed always, TPC must be loaded even if bare TPC tracks are not used in matching
if (sclOpt.requestCTPLumi) {
srcL = srcL | GID::getSourcesMask("CTP");
}
Expand All @@ -93,7 +95,7 @@ WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& configcont
if (sclOpt.needTPCScalersWorkflow() && !configcontext.options().get<bool>("disable-root-input")) {
specs.emplace_back(o2::tpc::getTPCScalerSpec(sclOpt.lumiType == 2, sclOpt.enableMShapeCorrection));
}
specs.emplace_back(o2::globaltracking::getTPCITSMatchingSpec(srcL, useFT0, calib, !GID::includesSource(GID::TPC, src), useGeom, useMC, sclOpt));
specs.emplace_back(o2::globaltracking::getTPCITSMatchingSpec(srcL, useFT0, calib, !GID::includesSource(GID::TPC, src), useGeom, useMC, sclOpt, withIT3));

if (!configcontext.options().get<bool>("disable-root-output")) {
specs.emplace_back(o2::globaltracking::getTrackWriterTPCITSSpec(useMC));
Expand Down
3 changes: 3 additions & 0 deletions Detectors/Upgrades/ITS3/reconstruction/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
# 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 -fno-omit-frame-pointer)

o2_add_library(ITS3Reconstruction
TARGETVARNAME targetName
Expand Down
Loading

0 comments on commit e46961b

Please sign in to comment.