Skip to content

Commit e1a22e6

Browse files
Laura Serksnytewiechula
authored andcommitted
Shared clusters, found clusters and crossed rows TASK for TPC QC
1 parent 3100572 commit e1a22e6

5 files changed

Lines changed: 217 additions & 1 deletion

File tree

Modules/TPC/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ target_sources(O2QcTPC PRIVATE src/PID.cxx
3434
src/IDCScaleReductor.cxx
3535
src/SACs.cxx
3636
src/TPCAggregator.cxx
37-
src/SACZeroScaleReductor.cxx)
37+
src/SACZeroScaleReductor.cxx
38+
src/TrackClusters.cxx)
3839

3940
target_include_directories(
4041
O2QcTPC
@@ -89,6 +90,7 @@ add_root_dictionary(O2QcTPC
8990
include/TPC/SACs.h
9091
include/TPC/TPCAggregator.h
9192
include/TPC/SACZeroScaleReductor.h
93+
include/TPC/TrackClusters.h
9294
LINKDEF include/TPC/LinkDef.h)
9395

9496
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/TPC
@@ -168,4 +170,5 @@ install(FILES run/tpcQCPID_sampled.json
168170
run/tpcQCROCTrending.json
169171
run/tpcQCSACs.json
170172
run/tpcQCSACScaleTrend.json
173+
run/tpcQCTrackClusters.json
171174
DESTINATION etc)

Modules/TPC/include/TPC/LinkDef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#pragma link C++ class o2::quality_control_modules::tpc::SACs + ;
4040
#pragma link C++ class o2::quality_control_modules::tpc::TPCAggregator + ;
4141
#pragma link C++ class o2::quality_control_modules::tpc::SACZeroScaleReductor + ;
42+
#pragma link C++ class o2::quality_control_modules::tpc::TrackClusters + ;
4243

4344
#pragma link C++ function o2::quality_control_modules::tpc::addAndPublish + ;
4445
#pragma link C++ function o2::quality_control_modules::tpc::toVector + ;
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
///
13+
/// \file TrackClusters.h
14+
/// \author Laura Serksnyte
15+
///
16+
17+
#ifndef QC_MODULE_TPC_TRACKCLUSTERS_H
18+
#define QC_MODULE_TPC_TRACKCLUSTERS_H
19+
20+
// O2 includes
21+
#include "TPCQC/TrackClusters.h"
22+
23+
// QC includes
24+
#include "QualityControl/TaskInterface.h"
25+
26+
// ROOT includes
27+
#include <TRandom3.h>
28+
29+
using namespace o2::quality_control::core;
30+
31+
namespace o2::quality_control_modules::tpc
32+
{
33+
34+
/// \brief Quality Control task for the shared clusters and crossed rows distribution
35+
class TrackClusters : public TaskInterface
36+
{
37+
public:
38+
/// \brief Constructor
39+
TrackClusters();
40+
/// \brief Destructor
41+
~TrackClusters() = default;
42+
43+
// Definition of the methods for the template method pattern
44+
void initialize(o2::framework::InitContext& ctx) override;
45+
void startOfActivity(const Activity& activity) override;
46+
void startOfCycle() override;
47+
void monitorData(o2::framework::ProcessingContext& ctx) override;
48+
void endOfCycle() override;
49+
void endOfActivity(const Activity& activity) override;
50+
void reset() override;
51+
52+
private:
53+
o2::tpc::qc::TrackClusters mQCTrackClusters{}; ///< TPC QC class from o2
54+
TRandom3* mRandomGenerator;
55+
float mSamplingFraction;
56+
};
57+
58+
} // namespace o2::quality_control_modules::tpc
59+
60+
#endif // QC_MODULE_TPC_TRACKCLUSTERS_H
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"qc": {
3+
"config": {
4+
"database": {
5+
"implementation": "CCDB",
6+
"host": "ccdb-test.cern.ch:8080",
7+
"username": "not_applicable",
8+
"password": "not_applicable",
9+
"name": "not_applicable"
10+
},
11+
"Activity": {
12+
},
13+
"monitoring": {
14+
"url": "infologger:///debug?qc"
15+
},
16+
"consul": {
17+
"url": ""
18+
},
19+
"conditionDB": {
20+
"url": "ccdb-test.cern.ch:8080"
21+
}
22+
},
23+
"tasks": {
24+
"TrackClusters": {
25+
"active": "true",
26+
"className": "o2::quality_control_modules::tpc::TrackClusters",
27+
"moduleName": "QcTPC",
28+
"detectorName": "TPC",
29+
"cycleDurationSeconds": "200",
30+
"maxNumberCycles": "-1",
31+
"dataSource": {
32+
"type": "direct",
33+
"query": "inputTracks:TPC/TRACKS/0;inputClusters:TPC/CLUSTERNATIVE/0;inputClusRefs:TPC/CLUSREFS/0"
34+
},
35+
"taskParameters": {
36+
"cutAbsEta": "1.", "cutMinNCluster": "60", "cutMindEdxTot": "20.",
37+
"seed": "0", "samplingFraction": "1"
38+
},
39+
"location": "remote"
40+
}
41+
}
42+
},
43+
"dataSamplingPolicies": [
44+
45+
]
46+
}

Modules/TPC/src/TrackClusters.cxx

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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+
///
13+
/// \file TrackClusters.cxx
14+
/// \author Laura Serksnyte
15+
///
16+
17+
// O2 includes
18+
#include "Framework/ProcessingContext.h"
19+
#include <Framework/InputRecord.h>
20+
#include "DataFormatsTPC/TrackTPC.h"
21+
#include "TPCQC/Helpers.h"
22+
#include "DataFormatsTPC/ClusterNative.h"
23+
#include "DataFormatsTPC/WorkflowHelper.h"
24+
25+
// QC includes
26+
#include "QualityControl/QcInfoLogger.h"
27+
#include "TPC/TrackClusters.h"
28+
#include "Common/Utils.h"
29+
30+
using namespace o2::framework;
31+
using namespace o2::tpc;
32+
33+
namespace o2::quality_control_modules::tpc
34+
{
35+
36+
TrackClusters::TrackClusters() : TaskInterface()
37+
{
38+
}
39+
40+
void TrackClusters::initialize(InitContext& /*ctx*/)
41+
{
42+
ILOG(Debug, Devel) << "initialize TPC TrackClusters QC task" << ENDM;
43+
44+
// do random generator
45+
const int seed = o2::quality_control_modules::common::getFromConfig<int>(mCustomParameters, "seed");
46+
mRandomGenerator = new TRandom3(seed);
47+
mSamplingFraction = o2::quality_control_modules::common::getFromConfig<float>(mCustomParameters, "samplingFraction");
48+
49+
const int cutMinNCluster = o2::quality_control_modules::common::getFromConfig<int>(mCustomParameters, "cutMinNCluster");
50+
const float cutMindEdxTot = o2::quality_control_modules::common::getFromConfig<float>(mCustomParameters, "cutMindEdxTot");
51+
const float cutAbsEta = o2::quality_control_modules::common::getFromConfig<float>(mCustomParameters, "cutAbsEta");
52+
53+
mQCTrackClusters.setTrackClustersCuts(cutMinNCluster, cutMindEdxTot, cutAbsEta);
54+
mQCTrackClusters.initializeHistograms();
55+
56+
o2::tpc::qc::helpers::setStyleHistogramsInMap(mQCTrackClusters.getMapOfHisto());
57+
for (auto const& pair : mQCTrackClusters.getMapOfHisto()) {
58+
for (auto& hist : pair.second) {
59+
getObjectsManager()->startPublishing(hist.get());
60+
}
61+
}
62+
}
63+
64+
void TrackClusters::startOfActivity(const Activity& /*activity*/)
65+
{
66+
ILOG(Debug, Devel) << "startOfActivity" << ENDM;
67+
// serksnyte: anything neeeded for start of activity (in track tasks there is a reset of histograms)?
68+
}
69+
70+
void TrackClusters::startOfCycle()
71+
{
72+
ILOG(Debug, Devel) << "startOfCycle" << ENDM;
73+
}
74+
75+
void TrackClusters::monitorData(ProcessingContext& ctx)
76+
{
77+
if (mRandomGenerator->Uniform(0., 1.) < mSamplingFraction) {
78+
79+
using TrackType = std::vector<o2::tpc::TrackTPC>;
80+
using ClusterRefType = std::vector<o2::tpc::TPCClRefElem>;
81+
82+
auto tracks = ctx.inputs().get<TrackType>("inputTracks");
83+
const auto& inputsTPCclusters = o2::tpc::getWorkflowTPCInput(ctx, 0, false);
84+
auto clusRefs = ctx.inputs().get<ClusterRefType>("inputClusRefs");
85+
86+
mQCTrackClusters.processTrackAndClusters(&tracks, &inputsTPCclusters->clusterIndex, &clusRefs);
87+
}
88+
}
89+
90+
void TrackClusters::endOfCycle()
91+
{
92+
ILOG(Debug, Devel) << "endOfCycle" << ENDM;
93+
}
94+
95+
void TrackClusters::endOfActivity(const Activity& /*activity*/)
96+
{
97+
ILOG(Debug, Devel) << "endOfActivity" << ENDM;
98+
}
99+
100+
void TrackClusters::reset()
101+
{
102+
ILOG(Debug, Devel) << "Resetting the data" << ENDM;
103+
mQCTrackClusters.resetHistograms();
104+
}
105+
106+
} // namespace o2::quality_control_modules::tpc

0 commit comments

Comments
 (0)