Skip to content

Commit

Permalink
Possibility to specify the track sources
Browse files Browse the repository at this point in the history
  • Loading branch information
chiarazampolli committed Jun 11, 2024
1 parent 5c9a864 commit 4865dea
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 21 deletions.
5 changes: 3 additions & 2 deletions Detectors/GLOQC/include/GLOQC/MatchITSTPCQC.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class MatchITSTPCQC
}
}

void setSources(GID::mask_t src) { mSrc = src; }
void setTrkSources(GID::mask_t src) { mSrc = src; }
void setUseTrkPID(bool b) { mUseTrkPID = b; }
bool getUseTrkPID() const { return mUseTrkPID; }
void setUseMC(bool b) { mUseMC = b; }
Expand Down Expand Up @@ -273,8 +273,9 @@ class MatchITSTPCQC
private:
std::shared_ptr<o2::globaltracking::DataRequest> mDataRequest;
o2::globaltracking::RecoContainer mRecoCont;
std::string mRequestedSources = "ITS,TPC,ITS-TPC";
GID::mask_t mSrc = GID::getSourcesMask("ITS,TPC,ITS-TPC");
GID::mask_t mAllowedSources = GID::getSourcesMask("ITS,TPC,ITS-TPC,ITS-TPC-TOF,TPC-TOF,TPC-TRD,ITS-TPC-TRD,TPC-TRD-TOF,ITS-TPC-TOF,ITS-TPC-TRD-TOF");
GID::mask_t mAllowedSources = GID::getSourcesMask("all");
// TPC
gsl::span<const o2::tpc::TrackTPC> mTPCTracks;
// ITS
Expand Down
6 changes: 3 additions & 3 deletions Detectors/GLOQC/src/MatchITSTPCQC.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,6 @@ void MatchITSTPCQC::initDataRequest()

// initialize data request, if it was not already done

if (mDoK0QC) {
mSrc = GID::getSourcesMask("ITS,TPC,ITS-TPC,ITS-TPC-TOF,TPC-TOF,TPC-TRD,ITS-TPC-TRD,TPC-TRD-TOF,ITS-TPC-TOF,ITS-TPC-TRD-TOF");
}
mSrc &= mAllowedSources;

if (mSrc[GID::Source::ITSTPC] == 0 || mSrc[GID::Source::TPC] == 0 || mSrc[GID::Source::ITS] == 0) {
Expand Down Expand Up @@ -958,6 +955,9 @@ bool MatchITSTPCQC::processV0(int iv, o2::globaltracking::RecoContainer& recoDat
//__________________________________________________________
bool MatchITSTPCQC::refitV0(const o2::dataformats::V0Index& id, o2::dataformats::V0& v0, o2::globaltracking::RecoContainer& recoData)
{
if (!recoData.isTrackSourceLoaded(id.getProngID(0).getSource()) || !recoData.isTrackSourceLoaded(id.getProngID(1).getSource())) {
return false;
}
auto seedP = recoData.getTrackParam(id.getProngID(0));
auto seedN = recoData.getTrackParam(id.getProngID(1));
bool isTPConly = (id.getProngID(0).getSource() == o2::dataformats::GlobalTrackID::TPC) || (id.getProngID(1).getSource() == o2::dataformats::GlobalTrackID::TPC);
Expand Down
2 changes: 1 addition & 1 deletion Detectors/GlobalTrackingWorkflow/qc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ o2_add_library(GlobalTrackingWorkflowQC
O2::GLOQC
)

o2_add_executable(match-qc
o2_add_executable(matching-qc
COMPONENT_NAME itstpc
SOURCES src/itstpc-matching-qc-workflow.cxx
PUBLIC_LINK_LIBRARIES O2::GlobalTrackingWorkflowQC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace globaltracking
class ITSTPCMatchingQCDevice : public Task
{
public:
ITSTPCMatchingQCDevice(std::shared_ptr<DataRequest> dr, std::shared_ptr<o2::base::GRPGeomRequest> req, bool useMC, bool doK0QC) : mDataRequest(dr), mCCDBRequest(req), mUseMC(useMC), mDoK0QC(doK0QC){};
ITSTPCMatchingQCDevice(std::shared_ptr<DataRequest> dr, std::shared_ptr<o2::base::GRPGeomRequest> req, bool useMC, bool doK0QC, std::string trkSources) : mDataRequest(dr), mCCDBRequest(req), mUseMC(useMC), mDoK0QC(doK0QC), mTrkSources(trkSources){};
void init(o2::framework::InitContext& ic) final;
void run(o2::framework::ProcessingContext& pc) final;
void endOfStream(o2::framework::EndOfStreamContext& ec) final;
Expand All @@ -42,13 +42,14 @@ class ITSTPCMatchingQCDevice : public Task
std::shared_ptr<o2::base::GRPGeomRequest> mCCDBRequest;
bool mUseMC = true;
bool mDoK0QC = true;
std::string mTrkSources = "ITS,TPC,ITS-TPC";
};

} // namespace globaltracking

namespace framework
{
DataProcessorSpec getITSTPCMatchingQCDevice(bool useMC, bool doK0QC);
DataProcessorSpec getITSTPCMatchingQCDevice(bool useMC, bool doK0QC, std::string trkSources);

} // namespace framework
} // namespace o2
Expand Down
37 changes: 27 additions & 10 deletions Detectors/GlobalTrackingWorkflow/qc/src/ITSTPCMatchingQCSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
#include "GLOQC/ITSTPCMatchingQCParams.h"
#include "DataFormatsGlobalTracking/RecoContainer.h"
#include "DetectorsBase/Propagator.h"

#include "DetectorsVertexing/SVertexerParams.h"
#include "Framework/CCDBParamSpec.h"
#include "CommonUtils/NameConf.h"
#include <TFile.h>

Expand All @@ -34,8 +35,8 @@ void ITSTPCMatchingQCDevice::init(InitContext& /*ic*/)
const o2::gloqc::ITSTPCMatchingQCParams& params = o2::gloqc::ITSTPCMatchingQCParams::Instance();

mMatchITSTPCQC = std::make_unique<o2::gloqc::MatchITSTPCQC>();
mMatchITSTPCQC->init();
mMatchITSTPCQC->setDataRequest(mDataRequest);
mMatchITSTPCQC->setTrkSources(o2::dataformats::GlobalTrackID::getSourcesMask(mTrkSources));
mMatchITSTPCQC->setPtCut(params.minPtCut);
mMatchITSTPCQC->setEtaCut(params.etaCut);
mMatchITSTPCQC->setMinNTPCClustersCut(params.minNTPCClustersCut);
Expand All @@ -50,13 +51,19 @@ void ITSTPCMatchingQCDevice::init(InitContext& /*ic*/)
if (mDoK0QC) {
mMatchITSTPCQC->setDoK0QC(mDoK0QC);
}
mMatchITSTPCQC->init();
}

//_____________________________________________________________

void ITSTPCMatchingQCDevice::run(o2::framework::ProcessingContext& pc)
{
o2::base::GRPGeomHelper::instance().checkUpdates(pc);
static bool wasSVParamInitialized = false;
if (!wasSVParamInitialized) {
pc.inputs().get<o2::vertexing::SVertexerParams*>("SVParam");
wasSVParamInitialized = true;
}
mMatchITSTPCQC->run(pc);
}

Expand Down Expand Up @@ -92,34 +99,44 @@ void ITSTPCMatchingQCDevice::finaliseCCDB(ConcreteDataMatcher& matcher, void* ob
if (o2::base::GRPGeomHelper::instance().finaliseCCDB(matcher, obj)) {
return;
}
if (matcher == ConcreteDataMatcher("GLO", "SVPARAM", 0)) {
LOG(info) << "SVertexer Params updated from ccdb - but it should not happen... PLEASE CHECK";
return;
}
}
} // namespace globaltracking

namespace framework
{
using GID = o2::dataformats::GlobalTrackID;

DataProcessorSpec getITSTPCMatchingQCDevice(bool useMC, bool doK0QC)
DataProcessorSpec getITSTPCMatchingQCDevice(bool useMC, bool doK0QC, std::string trkSources)
{
std::vector<OutputSpec> outputs;
outputs.emplace_back("GLO", "ITSTPCMATCHQC", 0, Lifetime::Sporadic);

auto dataRequest = std::make_shared<o2::globaltracking::DataRequest>();
GID::mask_t mSrc = GID::getSourcesMask("TPC,ITS-TPC");
dataRequest->requestTracks(mSrc, useMC);
GID::mask_t srcMask = GID::getSourcesMask(trkSources);
dataRequest->requestTracks(srcMask, useMC);
if (doK0QC) {
dataRequest->requestPrimaryVertices(useMC);
dataRequest->requestSecondaryVertices(useMC);
}
auto ccdbRequest = std::make_shared<o2::base::GRPGeomRequest>(false, // orbitResetTime
false, // GRPECS=true
false, // GRPLHCIF
true, // GRPMagField
false, // askMatLUT
o2::base::GRPGeomRequest::None, // geometry
dataRequest->inputs);

dataRequest->inputs.emplace_back("SVParam", "GLO", "SVPARAM", 0, Lifetime::Condition, ccdbParamSpec("GLO/Config/SVertexerParam"));
return DataProcessorSpec{
"itstpc-matching-qc",
dataRequest->inputs,
outputs,
AlgorithmSpec{adaptFromTask<o2::globaltracking::ITSTPCMatchingQCDevice>(dataRequest, ccdbRequest, useMC, doK0QC)},
Options{{}}};
.name = "itstpc-matching-qc",
.inputs = dataRequest->inputs,
.outputs = outputs,
.algorithm = AlgorithmSpec{adaptFromTask<o2::globaltracking::ITSTPCMatchingQCDevice>(dataRequest, ccdbRequest, useMC, doK0QC, trkSources)},
};
}

} // namespace framework
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
std::vector<o2::framework::ConfigParamSpec> options{
{"disable-mc", o2::framework::VariantType::Bool, false, {"disable use of MC information even if available"}},
{"disable-k0-qc", o2::framework::VariantType::Bool, false, {"disable K0 QC"}},
{"track-sources", o2::framework::VariantType::String, "ITS,TPC,ITS-TPC", {"comma-separated list of track sources to use"}},
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
std::swap(workflowOptions, options);
}
Expand All @@ -34,14 +35,14 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
{
// Update the (declared) parameters if changed from the command line
o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));
// write the configuration used for the workflow
o2::conf::ConfigurableParam::writeINI("o2-itstpc-matching-qc.ini");
LOG(info) << "ITSTPC matching QC: disable-mc = " << configcontext.options().get<std::string>("disable-mc");
auto useMC = !configcontext.options().get<bool>("disable-mc");
LOG(info) << "ITSTPC matching QC: disable-k0-qc = " << configcontext.options().get<std::string>("disable-k0-qc");
auto doK0QC = !configcontext.options().get<bool>("disable-k0-qc");
LOG(info) << "ITSTPC matching QC: track-sources = " << configcontext.options().get<std::string>("track-sources");
std::string trkSources = configcontext.options().get<std::string>("track-sources");

WorkflowSpec specs;
specs.emplace_back(getITSTPCMatchingQCDevice(useMC, doK0QC));
specs.emplace_back(getITSTPCMatchingQCDevice(useMC, doK0QC, trkSources));
return specs;
}

0 comments on commit 4865dea

Please sign in to comment.