Skip to content

Commit 75db58b

Browse files
author
Maximilian Korwieser
committed
[TPC-QC] Add functionality to query the PV position from CCDB.
1 parent 697cda5 commit 75db58b

File tree

3 files changed

+34
-12
lines changed

3 files changed

+34
-12
lines changed

Modules/TPC/include/TPC/Tracks.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class Tracks final : public TaskInterface
5050

5151
private:
5252
o2::tpc::qc::Tracks mQCTracks{}; ///< TPC QC class from o2
53+
bool usePVfromCCDB = false;
5354
};
5455

5556
} // namespace o2::quality_control_modules::tpc

Modules/TPC/run/tpcQCTracks_sampled.json

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,28 @@
2929
"detectorName": "TPC",
3030
"cycleDurationSeconds": "10",
3131
"dataSource_comment": "The other type of dataSource is \"direct\", see basic-no-sampling.json.",
32-
"dataSource": {
33-
"type": "dataSamplingPolicy",
34-
"name": "tpc-tracks"
35-
},
32+
"dataSources": [
33+
{ "type": "dataSamplingPolicy", "name": "tpc-tracks" },
34+
{
35+
"type": "direct",
36+
"query": "meanvertex:CTP/MEANVERTEX/0?lifetime=condition&ccdb-path=CTP/Calib/MeanVertex"
37+
}
38+
],
3639
"taskParameters": {
37-
"cutAbsEta": "1.", "cutMinNCluster": "60", "cutMindEdxTot": "20."
40+
"cutAbsEta": "1.",
41+
"cutMinNCluster": "60",
42+
"cutMindEdxTot": "20.",
43+
"usePVfromCCDB": "true"
3844
},
39-
"grpGeomRequest" : {
45+
"grpGeomRequest": {
4046
"geomRequest": "None",
4147
"askGRPECS": "false",
4248
"askGRPLHCIF": "false",
4349
"askGRPMagField": "true",
4450
"askMatLUT": "true",
4551
"askTime": "false",
4652
"askOnceAllButField": "true",
47-
"needPropagatorD": "false"
53+
"needPropagatorD": "false"
4854
},
4955
"location": "remote"
5056
}
@@ -56,11 +62,13 @@
5662
"moduleName": "QcSkeleton",
5763
"policy": "OnAny",
5864
"detectorName": "TPC",
59-
"dataSource": [{
60-
"type": "Task",
61-
"name": "Tracks",
62-
"MOs": ["example"]
63-
}]
65+
"dataSource": [
66+
{
67+
"type": "Task",
68+
"name": "Tracks",
69+
"MOs": ["example"]
70+
}
71+
]
6472
}
6573
}
6674
},

Modules/TPC/src/Tracks.cxx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
// O2 includes
2323
#include "Framework/ProcessingContext.h"
2424
#include "DataFormatsTPC/TrackTPC.h"
25+
#include "DataFormatsCalibration/MeanVertexObject.h"
2526
#include "TPCQC/Helpers.h"
2627
#include <Framework/InputRecord.h>
2728

@@ -46,6 +47,8 @@ void Tracks::initialize(o2::framework::InitContext& /*ctx*/)
4647
const float cutMaxAbsDCAr = o2::quality_control_modules::common::getFromConfig<float>(mCustomParameters, "cutMaxAbsDCAr", 0.1);
4748
const bool useCutMaxAbsDCArOnHistos = o2::quality_control_modules::common::getFromConfig<bool>(mCustomParameters, "useCutMaxAbsDCArOnHistos");
4849

50+
usePVfromCCDB = o2::quality_control_modules::common::getFromConfig<bool>(mCustomParameters, "usePVfromCCDB");
51+
4952
// set track cuts defaults are (AbsEta = 1.0, nCluster = 60, MindEdxTot = 20)
5053
mQCTracks.setTrackCuts(cutAbsEta, cutMinNCluster, cutMindEdxTot, cutPtForDCAr, samplingFractionDCAr, runAsyncAndTurnOffSomeHistos, cutMaxAbsDCAr, useCutMaxAbsDCArOnHistos);
5154

@@ -70,6 +73,16 @@ void Tracks::startOfCycle()
7073

7174
void Tracks::monitorData(o2::framework::ProcessingContext& ctx)
7275
{
76+
// set the coordinates of the PV (extracted from CCDB)
77+
if (usePVfromCCDB) {
78+
auto coordinatesOfPV = ctx.inputs().get<o2::dataformats::MeanVertexObject*>("CTP/Calib/MeanVertex");
79+
if (!coordinatesOfPV) {
80+
LOGP(error, "Failed to retrieve MeanVertexObject, using default (0,0,0) instead!");
81+
} else {
82+
mQCTracks.setPVposition(coordinatesOfPV->getPos());
83+
}
84+
}
85+
7386
using TrackType = std::vector<o2::tpc::TrackTPC>;
7487
auto tracks = ctx.inputs().get<TrackType>("inputTracks");
7588

0 commit comments

Comments
 (0)