Skip to content

Commit a392757

Browse files
committed
TRD: PID calibration workflow
1 parent 7a0fb74 commit a392757

File tree

3 files changed

+116
-1
lines changed

3 files changed

+116
-1
lines changed

Detectors/TRD/workflow/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ o2_add_library(TRDWorkflow
2828
include/TRDWorkflow/TRDGlobalTrackingQCSpec.h
2929
include/TRDWorkflow/NoiseCalibSpec.h
3030
include/TRDWorkflow/T0FitSpec.h
31+
include/TRDWorkflow/PIDCalibSpec.h
3132
PUBLIC_LINK_LIBRARIES O2::Framework O2::DPLUtils
3233
O2::Steer
3334
O2::Algorithm
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#ifndef O2_TRD_PIDCALIBSPEC_H
13+
#define O2_TRD_PIDCALIBSPEC_H
14+
15+
#include "Framework/Task.h"
16+
#include "Framework/DataProcessorSpec.h"
17+
#include "DetectorsBase/GRPGeomHelper.h"
18+
#include "ReconstructionDataFormats/GlobalTrackID.h"
19+
#include "DataFormatsGlobalTracking/RecoContainer.h"
20+
21+
namespace o2
22+
{
23+
namespace calibration::trd
24+
{
25+
26+
class PIDCalibDevice final : public o2::framework::Task
27+
{
28+
public:
29+
PIDCalibDevice(std::shared_ptr<o2::globaltracking::DataRequest> dr, std::shared_ptr<o2::base::GRPGeomRequest> gr, o2::dataformats::GlobalTrackID::mask_t src, bool withSV)
30+
: mDataRequest(dr), mGGCCDBRequest(gr), mTracksSrc(src), mWithSV(withSV) {}
31+
32+
void init(o2::framework::InitContext& ic) final
33+
{
34+
o2::base::GRPGeomHelper::instance().setRequest(mGGCCDBRequest);
35+
}
36+
37+
void run(o2::framework::ProcessingContext& pc) final
38+
{
39+
o2::globaltracking::RecoContainer recoData;
40+
recoData.collectData(pc, *mDataRequest.get()); // select tracks of needed type, with minimal cuts, the real selected will be done in the vertexer
41+
updateTimeDependentParams(pc); // Make sure this is called after recoData.collectData, which may load some conditions
42+
}
43+
44+
void finaliseCCDB(o2::framework::ConcreteDataMatcher& matcher, void* obj) final
45+
{
46+
o2::base::GRPGeomHelper::instance().finaliseCCDB(matcher, obj);
47+
}
48+
49+
private:
50+
std::shared_ptr<o2::globaltracking::DataRequest> mDataRequest;
51+
std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
52+
o2::dataformats::GlobalTrackID::mask_t mTracksSrc{};
53+
bool mWithSV{false};
54+
55+
void updateTimeDependentParams(o2::framework::ProcessingContext& pc)
56+
{
57+
o2::base::GRPGeomHelper::instance().checkUpdates(pc);
58+
}
59+
};
60+
61+
} // namespace calibration::trd
62+
63+
namespace framework
64+
{
65+
66+
DataProcessorSpec getTRDPIDCalibSpec(o2::dataformats::GlobalTrackID::mask_t srcTracks, bool withSV)
67+
{
68+
std::vector<OutputSpec> outputs;
69+
auto dataRequest = std::make_shared<o2::globaltracking::DataRequest>();
70+
dataRequest->requestTracks(srcTracks, false);
71+
if (withSV) {
72+
dataRequest->requestSecondaryVertices(false);
73+
}
74+
75+
auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, // orbitResetTime
76+
false, // GRPECS=true
77+
false, // GRPLHCIF
78+
true, // GRPMagField
79+
true, // askMatLUT
80+
o2::base::GRPGeomRequest::None, // geometry
81+
dataRequest->inputs,
82+
true);
83+
return DataProcessorSpec{
84+
"pid-calibration",
85+
dataRequest->inputs, outputs,
86+
AlgorithmSpec{adaptFromTask<o2::calibration::trd::PIDCalibDevice>(dataRequest, ggRequest, srcTracks, withSV)},
87+
Options{}};
88+
}
89+
} // namespace framework
90+
} // namespace o2
91+
92+
#endif

Detectors/TRD/workflow/src/trd-calib-workflow.cxx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@
1717
#include "TRDWorkflow/GainCalibSpec.h"
1818
#include "TRDWorkflow/NoiseCalibSpec.h"
1919
#include "TRDWorkflow/T0FitSpec.h"
20+
#include "TRDWorkflow/PIDCalibSpec.h"
2021
#include "CommonUtils/ConfigurableParam.h"
22+
#include "ReconstructionDataFormats/GlobalTrackID.h"
23+
#include "DetectorsCommonDataFormats/DetID.h"
24+
#include "GlobalTrackingWorkflowHelpers/InputHelper.h"
25+
#include "DetectorsRaw/HBFUtilsInitializer.h"
2126

2227
using namespace o2::framework;
28+
using GID = o2::dataformats::GlobalTrackID;
29+
using DetID = o2::detectors::DetID;
2330

2431
// we need to add workflow options before including Framework/runDataProcessing
2532
void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
@@ -31,9 +38,12 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
3138
{"noise", o2::framework::VariantType::Bool, false, {"enable noise and pad status calibration"}},
3239
{"gain", o2::framework::VariantType::Bool, false, {"enable gain calibration"}},
3340
{"t0", o2::framework::VariantType::Bool, false, {"enable t0 fit"}},
41+
{"pid", o2::framework::VariantType::Bool, false, {"enable pid calibration"}},
42+
{"track-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of track sources to use"}},
43+
{"with-sv", o2::framework::VariantType::Bool, false, {"request secondary-vertices"}},
3444
{"calib-dds-collection-index", VariantType::Int, -1, {"allow only single collection to produce calibration objects (use -1 for no limit)"}},
3545
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}}};
36-
46+
o2::raw::HBFUtilsInitializer::addConfigOption(options);
3747
std::swap(workflowOptions, options);
3848
}
3949

@@ -87,5 +97,17 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
8797
specs.emplace_back(getTRDT0FitSpec());
8898
}
8999

100+
if (configcontext.options().get<bool>("pid")) {
101+
const auto allowedTrkSources = GID::getSourcesMask("ITS,TPC,TRD,TOF,ITS-TPC-TRD,TPC-TRD,TPC-TRD-TOF,ITS-TPC-TRD-TOF");
102+
auto srcTrc = allowedTrkSources & GID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
103+
o2::globaltracking::InputHelper::addInputSpecs(configcontext, specs, {}, srcTrc, srcTrc, false);
104+
auto withSV = configcontext.options().get<bool>("with-sv");
105+
if (withSV) {
106+
o2::globaltracking::InputHelper::addInputSpecsSVertex(configcontext, specs);
107+
}
108+
specs.emplace_back(getTRDPIDCalibSpec(srcTrc, withSV));
109+
o2::raw::HBFUtilsInitializer hbfIni(configcontext, specs);
110+
}
111+
90112
return specs;
91113
}

0 commit comments

Comments
 (0)