Skip to content

Commit 04c0378

Browse files
wiechuladavidrohr
authored andcommitted
cleanup, remove artificial TF limit, add occupancy analysis
1 parent f03719c commit 04c0378

File tree

3 files changed

+44
-13
lines changed

3 files changed

+44
-13
lines changed

Detectors/TPC/workflow/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ o2_add_library(TPCWorkflow
3232
PUBLIC_LINK_LIBRARIES O2::Framework O2::DataFormatsTPC
3333
O2::DPLUtils O2::TPCReconstruction
3434
O2::TPCCalibration O2::TPCSimulation
35-
O2::DetectorsCalibration)
35+
O2::TPCQC O2::DetectorsCalibration)
3636

3737

3838
o2_add_executable(chunkeddigit-merger

Detectors/TPC/workflow/src/RawToDigitsSpec.cxx

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "CCDB/CcdbApi.h"
2525
#include "DetectorsCalibration/Utils.h"
2626

27+
#include "TPCQC/Clusters.h"
2728
#include "TPCBase/Mapper.h"
2829
#include "TPCCalibration/DigitDump.h"
2930
#include "TPCReconstruction/RawReaderCRU.h"
@@ -43,6 +44,15 @@ class TPCDigitDumpDevice : public o2::framework::Task
4344

4445
void init(o2::framework::InitContext& ic) final
4546
{
47+
// parse command line arguments
48+
mMaxEvents = static_cast<uint32_t>(ic.options().get<int>("max-events"));
49+
mUseOldSubspec = ic.options().get<bool>("use-old-subspec");
50+
const bool createOccupancyMaps = ic.options().get<bool>("create-occupancy-maps");
51+
mForceQuit = ic.options().get<bool>("force-quit");
52+
if (mUseOldSubspec) {
53+
LOGP(info, "Using old subspecification (CruId << 16) | ((LinkId + 1) << (CruEndPoint == 1 ? 8 : 0))");
54+
}
55+
4656
// set up ADC value filling
4757
mRawReader.createReader("");
4858
mDigitDump.init();
@@ -53,6 +63,11 @@ class TPCDigitDumpDevice : public o2::framework::Task
5363
mDigitDump.setPedestalAndNoiseFile(pedestalFile);
5464
}
5565

66+
// set up cluster qc if requested
67+
if (createOccupancyMaps) {
68+
mClusterQC = std::make_unique<qc::Clusters>();
69+
}
70+
5671
mRawReader.setADCDataCallback([this](const PadROCPos& padROCPos, const CRU& cru, const gsl::span<const uint32_t> data) -> int {
5772
const int timeBins = mDigitDump.update(padROCPos, cru, data);
5873
mDigitDump.setNumberOfProcessedTimeBins(std::max(mDigitDump.getNumberOfProcessedTimeBins(), size_t(timeBins)));
@@ -63,15 +78,11 @@ class TPCDigitDumpDevice : public o2::framework::Task
6378
CRU cruID(cru);
6479
const PadRegionInfo& regionInfo = Mapper::instance().getPadRegionInfo(cruID.region());
6580
mDigitDump.updateCRU(cruID, rowInSector - regionInfo.getGlobalRowOffset(), padInRow, timeBin, adcValue);
81+
if (mClusterQC) {
82+
mClusterQC->fillADCValue(cru, rowInSector, padInRow, timeBin, adcValue);
83+
}
6684
return true;
6785
});
68-
69-
mMaxEvents = static_cast<uint32_t>(ic.options().get<int>("max-events"));
70-
mUseOldSubspec = ic.options().get<bool>("use-old-subspec");
71-
mForceQuit = ic.options().get<bool>("force-quit");
72-
if (mUseOldSubspec) {
73-
LOGP(info, "Using old subspecification (CruId << 16) | ((LinkId + 1) << (CruEndPoint == 1 ? 8 : 0))");
74-
}
7586
}
7687

7788
void run(o2::framework::ProcessingContext& pc) final
@@ -89,7 +100,7 @@ class TPCDigitDumpDevice : public o2::framework::Task
89100

90101
snapshotDigits(pc.outputs());
91102

92-
if ((mDigitDump.getNumberOfProcessedEvents() >= mMaxEvents)) {
103+
if (mMaxEvents && (mDigitDump.getNumberOfProcessedEvents() >= mMaxEvents)) {
93104
LOGP(info, "Maximm number of events reached ({}), no more processing will be done", mMaxEvents);
94105
mReadyToQuit = true;
95106
if (mForceQuit) {
@@ -108,12 +119,17 @@ class TPCDigitDumpDevice : public o2::framework::Task
108119
snapshotDigits(ec.outputs());
109120
}
110121
ec.services().get<ControlService>().readyToQuit(QuitRequest::Me);
122+
123+
if (mClusterQC) {
124+
dumpClusterQC();
125+
}
111126
}
112127

113128
private:
114129
DigitDump mDigitDump;
130+
std::unique_ptr<qc::Clusters> mClusterQC;
115131
rawreader::RawReaderCRUManager mRawReader;
116-
uint32_t mMaxEvents{100};
132+
uint32_t mMaxEvents{0};
117133
bool mReadyToQuit{false};
118134
bool mCalibDumped{false};
119135
bool mUseOldSubspec{false};
@@ -135,6 +151,13 @@ class TPCDigitDumpDevice : public o2::framework::Task
135151
mDigitDump.clearDigits();
136152
mActiveSectors = 0;
137153
}
154+
155+
//____________________________________________________________________________
156+
void dumpClusterQC()
157+
{
158+
mClusterQC->analyse();
159+
mClusterQC->dumpToFile("ClusterQC.root");
160+
}
138161
};
139162

140163
DataProcessorSpec getRawToDigitsSpec(int channel, const std::string inputSpec, std::vector<int> const& tpcSectors)
@@ -152,10 +175,11 @@ DataProcessorSpec getRawToDigitsSpec(int channel, const std::string inputSpec, s
152175
outputs,
153176
AlgorithmSpec{adaptFromTask<device>(tpcSectors)},
154177
Options{
155-
{"max-events", VariantType::Int, 100, {"maximum number of events to process"}},
178+
{"max-events", VariantType::Int, 0, {"maximum number of events to process"}},
156179
{"use-old-subspec", VariantType::Bool, false, {"use old subsecifiation definition"}},
157180
{"force-quit", VariantType::Bool, false, {"force quit after max-events have been reached"}},
158181
{"pedestal-file", VariantType::String, "", {"file with pedestals and noise for zero suppression"}},
182+
{"create-occupancy-maps", VariantType::Bool, false, {"create occupancy maps and store them to local root file for debugging"}},
159183
} // end Options
160184
}; // end DataProcessorSpec
161185
}

Detectors/TPC/workflow/src/tpc-raw-to-digits-workflow.cxx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
#include "Framework/ControlService.h"
1515
#include "Framework/Logger.h"
1616
#include "Framework/ConfigParamSpec.h"
17+
#include "Framework/CompletionPolicy.h"
18+
#include "Framework/CompletionPolicyHelpers.h"
1719
#include "CommonUtils/ConfigurableParam.h"
1820
#include "Algorithm/RangeTokenizer.h"
1921
#include "TPCWorkflow/RawToDigitsSpec.h"
20-
#include "TPCWorkflow/LinkZSToDigitsSpec.h"
2122
#include "TPCWorkflow/RecoWorkflow.h"
2223
#include "TPCBase/Sector.h"
2324
#include <vector>
@@ -27,6 +28,13 @@
2728

2829
using namespace o2::framework;
2930

31+
// customize the completion policy
32+
void customize(std::vector<o2::framework::CompletionPolicy>& policies)
33+
{
34+
using o2::framework::CompletionPolicy;
35+
policies.push_back(CompletionPolicyHelpers::defineByName("TPCDigitizer.*", CompletionPolicy::CompletionOp::Consume));
36+
}
37+
3038
// we need to add workflow options before including Framework/runDataProcessing
3139
void customize(std::vector<ConfigParamSpec>& workflowOptions)
3240
{
@@ -37,7 +45,6 @@ void customize(std::vector<ConfigParamSpec>& workflowOptions)
3745
const std::string sectorshelp("List of TPC sectors, comma separated ranges, e.g. 0-3,7,9-15");
3846
const std::string sectorDefault = "0-" + std::to_string(o2::tpc::Sector::MAXSECTOR - 1);
3947
const std::string tpcrthelp("Run TPC reco workflow to specified output type, currently supported: 'digits,clusters,tracks'");
40-
const std::string decoderHelp("Decoder type to use: 'GBT,LinkZS'");
4148

4249
std::vector<ConfigParamSpec> options{
4350
{"input-spec", VariantType::String, "A:TPC/RAWDATA", {"selection string input specs"}},

0 commit comments

Comments
 (0)