Skip to content

Commit

Permalink
aslkdllkjlhjh
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 17, 2024
1 parent 571f33a commit cf08d51
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 12 deletions.
5 changes: 4 additions & 1 deletion Detectors/TRD/workflow/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)

add_subdirectory(io)

o2_add_library(TRDWorkflow
Expand Down Expand Up @@ -49,7 +51,8 @@ o2_add_library(TRDWorkflow
O2::TPCWorkflow
O2::TRDWorkflowIO
O2::TRDPID
O2::DataFormatsFT0)
O2::DataFormatsFT0
PUBLIC_UPGRADE_LINK_LIBRARIES O2::ITS3Reconstruction)

o2_add_executable(trap-sim
COMPONENT_NAME trd
Expand Down
18 changes: 13 additions & 5 deletions Detectors/TRD/workflow/include/TRDWorkflow/TRDGlobalTrackingSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
#include "DataFormatsITSMFT/TrkClusRef.h"
#include "DataFormatsITSMFT/TopologyDictionary.h"

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

namespace o2
{
namespace trd
Expand All @@ -49,7 +53,7 @@ class TRDGlobalTracking : public o2::framework::Task
{
public:
TRDGlobalTracking(bool useMC, bool withPID, PIDPolicy policy, std::shared_ptr<o2::globaltracking::DataRequest> dataRequest, std::shared_ptr<o2::base::GRPGeomRequest> gr, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts,
o2::dataformats::GlobalTrackID::mask_t src, bool trigRecFilterActive, bool strict) : mUseMC(useMC), mWithPID(withPID), mDataRequest(dataRequest), mGGCCDBRequest(gr), mTrkMask(src), mTrigRecFilter(trigRecFilterActive), mStrict(strict), mPolicy(policy)
o2::dataformats::GlobalTrackID::mask_t src, bool trigRecFilterActive, bool strict, bool withIT3 = false) : mUseMC(useMC), mWithPID(withPID), mDataRequest(dataRequest), mGGCCDBRequest(gr), mTrkMask(src), mTrigRecFilter(trigRecFilterActive), mStrict(strict), mPolicy(policy), mWithIT3(withIT3)
{
mTPCCorrMapsLoader.setLumiScaleType(sclOpts.lumiType);
mTPCCorrMapsLoader.setLumiScaleMode(sclOpts.lumiMode);
Expand Down Expand Up @@ -98,16 +102,20 @@ class TRDGlobalTracking : public o2::framework::Task
gsl::span<const int> mITSTrackClusIdx; ///< input ITS track cluster indices span
gsl::span<const int> mITSABTrackClusIdx; ///< input ITSAB track cluster indices span
std::vector<o2::BaseCluster<float>> mITSClustersArray; ///< ITS clusters created in run() method from compact clusters
const o2::itsmft::TopologyDictionary* mITSDict = nullptr; ///< cluster patterns dictionary
std::array<float, 5> mCovDiagInner{}; ///< total cov.matrix extra diagonal error from TrackTuneParams
std::array<float, 5> mCovDiagOuter{}; ///< total cov.matrix extra diagonal error from TrackTuneParams
const o2::itsmft::TopologyDictionary* mITSDict = nullptr; ///< ITS cluster patterns dictionary
#ifdef ENABLE_UPGRADES
const o2::its3::TopologyDictionary* mIT3Dict = nullptr; ///< IT3 cluster patterns dictionary
#endif
bool mWithIT3{false}; ///< running with IT3
std::array<float, 5> mCovDiagInner{}; ///< total cov.matrix extra diagonal error from TrackTuneParams
std::array<float, 5> mCovDiagOuter{}; ///< total cov.matrix extra diagonal error from TrackTuneParams
// PID
PIDPolicy mPolicy{PIDPolicy::DEFAULT}; ///< Model to load an evaluate
std::unique_ptr<PIDBase> mBase; ///< PID engine
};

/// create a processor spec
framework::DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC, o2::dataformats::GlobalTrackID::mask_t src, bool trigRecFilterActive, bool strict /* = false*/, bool withPID /* = false*/, PIDPolicy policy /* = PIDPolicy::DEFAULT*/, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts);
framework::DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC, o2::dataformats::GlobalTrackID::mask_t src, bool trigRecFilterActive, bool strict /* = false*/, bool withPID /* = false*/, PIDPolicy policy /* = PIDPolicy::DEFAULT*/, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts, bool withIT3 = false);

} // namespace trd
} // namespace o2
Expand Down
29 changes: 24 additions & 5 deletions Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
#include "GPUTRDInterfaces.h"
#include "GPUTRDGeometry.h"

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

#include <regex>
#include <algorithm>
#include <numeric>
Expand Down Expand Up @@ -186,6 +190,13 @@ void TRDGlobalTracking::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj)
mITSDict = (const o2::itsmft::TopologyDictionary*)obj;
return;
}
#ifdef ENABLE_UPGRADES
if (matcher == ConcreteDataMatcher("IT3", "CLUSDICT", 0)) {
LOG(info) << "it3 cluster dictionary updated";
mIT3Dict = (const o2::its3::TopologyDictionary*)obj;
return;
}
#endif
}

void TRDGlobalTracking::fillMCTruthInfo(const TrackTRD& trk, o2::MCCompLabel lblSeed, std::vector<o2::MCCompLabel>& lblContainerTrd, std::vector<o2::MCCompLabel>& lblContainerMatch, const o2::dataformats::MCTruthContainer<o2::MCCompLabel>* trkltLabels) const
Expand Down Expand Up @@ -292,7 +303,15 @@ void TRDGlobalTracking::run(ProcessingContext& pc)
auto pattIt = patterns.begin();
mITSClustersArray.clear();
mITSClustersArray.reserve(clusITS.size());
#ifdef ENABLE_UPGRADES
if (mWithIT3) {
o2::its3::ioutils::convertCompactClusters(clusITS, pattIt, mITSClustersArray, mIT3Dict);
} else {
o2::its::ioutils::convertCompactClusters(clusITS, pattIt, mITSClustersArray, mITSDict);
}
#else
o2::its::ioutils::convertCompactClusters(clusITS, pattIt, mITSClustersArray, mITSDict);
#endif
}

LOGF(info, "There are %i tracklets in total from %i trigger records", mChainTracking->mIOPtrs.nTRDTracklets, mChainTracking->mIOPtrs.nTRDTriggerRecords);
Expand Down Expand Up @@ -667,8 +686,8 @@ bool TRDGlobalTracking::refitTPCTRDTrack(TrackTRD& trk, float timeTRD, o2::globa
auto detRefs = recoCont->getSingleDetectorRefs(trk.getRefGlobalTrackId());
outerParam = trk;
float chi2Out = 0, timeZErr = 0.;
bool pileUpOn = trk.hasPileUpInfo(); // distance to farthest collision within the pileup integration time is set
int retVal = mTPCRefitter->RefitTrackAsTrackParCov(outerParam, mTPCTracksArray[detRefs[GTrackID::TPC]].getClusterRef(), timeTRD * mTPCTBinMUSInv, &chi2Out, true, false); // outward refit
bool pileUpOn = trk.hasPileUpInfo(); // distance to farthest collision within the pileup integration time is set
int retVal = mTPCRefitter->RefitTrackAsTrackParCov(outerParam, mTPCTracksArray[detRefs[GTrackID::TPC]].getClusterRef(), timeTRD * mTPCTBinMUSInv, &chi2Out, true, false); // outward refit
if (retVal < 0) {
LOG(debug) << "TPC refit outwards failed";
return false;
Expand Down Expand Up @@ -818,7 +837,7 @@ void TRDGlobalTracking::endOfStream(EndOfStreamContext& ec)
mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
}

DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC, GTrackID::mask_t src, bool trigRecFilterActive, bool strict, bool withPID, PIDPolicy policy, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts)
DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC, GTrackID::mask_t src, bool trigRecFilterActive, bool strict, bool withPID, PIDPolicy policy, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts, bool withIT3)
{
std::vector<OutputSpec> outputs;
uint32_t ss = o2::globaltracking::getSubSpec(strict ? o2::globaltracking::MatchingType::Strict : o2::globaltracking::MatchingType::Standard);
Expand All @@ -832,7 +851,7 @@ DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC, GTrackID::mask_t src, boo
dataRequest->requestTPCClusters(false); // only needed for refit, don't care about labels
if (GTrackID::includesSource(GTrackID::Source::ITSTPC, src)) {
// ITS clusters are only needed if we match to ITS-TPC tracks
dataRequest->requestITSClusters(false); // only needed for refit, don't care about labels
dataRequest->requestITSClusters(false, withIT3); // only needed for refit, don't care about labels
trkSrc |= GTrackID::getSourcesMask("ITS");
}
dataRequest->requestTracks(trkSrc, useMC);
Expand Down Expand Up @@ -910,7 +929,7 @@ DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC, GTrackID::mask_t src, boo
processorName,
inputs,
outputs,
AlgorithmSpec{adaptFromTask<TRDGlobalTracking>(useMC, withPID, policy, dataRequest, ggRequest, sclOpts, src, trigRecFilterActive, strict)},
AlgorithmSpec{adaptFromTask<TRDGlobalTracking>(useMC, withPID, policy, dataRequest, ggRequest, sclOpts, src, trigRecFilterActive, strict, withIT3)},
opts};
}

Expand Down
4 changes: 3 additions & 1 deletion Detectors/TRD/workflow/src/trd-tracking-workflow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
{"enable-qc", VariantType::Bool, false, {"enable tracking QC"}},
{"enable-pid", VariantType::Bool, false, {"Enable PID"}},
{"enable-ph", VariantType::Bool, false, {"Enable creation of PH plots"}},
{"with-it3", VariantType::Bool, false, {"run with IT3 detector instead of ITS"}},
{"trd-digits-spec", VariantType::Int, 0, {"Input digits subspec, ignored if disable-root-input is false"}},
{"track-sources", VariantType::String, std::string{GTrackID::ALL}, {"comma-separated list of sources to use for tracking"}},
{"filter-trigrec", VariantType::Bool, false, {"ignore interaction records without ITS data"}},
Expand Down Expand Up @@ -86,6 +87,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
auto gain = configcontext.options().get<bool>("enable-gain-calib");
auto pulseHeight = configcontext.options().get<bool>("enable-ph");
auto digitsSpec = configcontext.options().get<int>("trd-digits-spec");
auto withIT3 = configcontext.options().get<bool>("with-it3");
auto sclOpt = o2::tpc::CorrectionMapsLoader::parseGlobalOptions(configcontext.options());
bool rootInput = !configcontext.options().get<bool>("disable-root-input");
GTrackID::mask_t srcTRD = allowedSources & GTrackID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
Expand Down Expand Up @@ -116,7 +118,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
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::trd::getTRDGlobalTrackingSpec(useMC, srcTRD, trigRecFilterActive, strict, pid, policy, sclOpt));
specs.emplace_back(o2::trd::getTRDGlobalTrackingSpec(useMC, srcTRD, trigRecFilterActive, strict, pid, policy, sclOpt, withIT3));
if (vdexb || gain) {
specs.emplace_back(o2::trd::getTRDTrackBasedCalibSpec(srcTRD, vdexb, gain));
}
Expand Down

0 comments on commit cf08d51

Please sign in to comment.