Skip to content

Commit adcd323

Browse files
committed
Limit TFs extraxted from CTF file with --max-tf-per-file CTF-reader N
1 parent 13bdce1 commit adcd323

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

Detectors/CTF/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ comma-separated list of detectors to skip
100100
```
101101
max CTFs to process (<= 0 : infinite)
102102
103+
```
104+
--max-tf-per-file arg (=-1)
105+
```
106+
max TFs to process from every CTF file (<= 0 : infinite)
107+
103108
```
104109
--loop arg (=0)
105110
```

Detectors/CTF/workflow/include/CTFWorkflow/CTFReaderSpec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ struct CTFReaderInp {
4040
int64_t delay_us = 0;
4141
int maxLoops = 0;
4242
int maxTFs = -1;
43+
int maxTFsPerFile = -1;
4344
unsigned int subspec = 0;
4445
unsigned int decSSpecEMC = 0;
4546
int tfRateLimit = -999;

Detectors/CTF/workflow/src/CTFReaderSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ bool CTFReaderSpec::processTF(ProcessingContext& pc)
360360
void CTFReaderSpec::checkTreeEntries()
361361
{
362362
// check if the tree has entries left, if needed, close current tree/file
363-
if (++mCurrTreeEntry >= mCTFTree->GetEntries()) { // this file is done, check if there are other files
363+
if (++mCurrTreeEntry >= mCTFTree->GetEntries() || (mInput.maxTFsPerFile > 0 && mCurrTreeEntry >= mInput.maxTFsPerFile)) { // this file is done, check if there are other files
364364
mCTFTree.reset();
365365
mCTFFile->Close();
366366
mCTFFile.reset();

Detectors/CTF/workflow/src/ctf-reader-workflow.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
5555
options.push_back(ConfigParamSpec{"onlyDet", VariantType::String, std::string{DetID::ALL}, {"comma-separated list of detectors to accept. Overrides skipDet"}});
5656
options.push_back(ConfigParamSpec{"skipDet", VariantType::String, std::string{DetID::NONE}, {"comma-separate list of detectors to skip"}});
5757
options.push_back(ConfigParamSpec{"max-tf", VariantType::Int, -1, {"max CTFs to process (<= 0 : infinite)"}});
58+
options.push_back(ConfigParamSpec{"max-tf-per-file", VariantType::Int, -1, {"max TFs to process per ctf file (<= 0 : infinite)"}});
5859
options.push_back(ConfigParamSpec{"loop", VariantType::Int, 0, {"loop N times (infinite for N<0)"}});
5960
options.push_back(ConfigParamSpec{"delay", VariantType::Float, 0.f, {"delay in seconds between consecutive TFs sending"}});
6061
options.push_back(ConfigParamSpec{"copy-cmd", VariantType::String, "alien_cp ?src file://?dst", {"copy command for remote files or no-copy to avoid copying"}}); // Use "XrdSecPROTOCOL=sss,unix xrdcp -N root://eosaliceo2.cern.ch/?src ?dst" for direct EOS access
@@ -119,6 +120,9 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
119120
int n = configcontext.options().get<int>("max-tf");
120121
ctfInput.maxTFs = n > 0 ? n : 0x7fffffff;
121122

123+
n = configcontext.options().get<int>("max-tf-per-file");
124+
ctfInput.maxTFsPerFile = n > 0 ? n : 0x7fffffff;
125+
122126
ctfInput.maxFileCache = std::max(1, configcontext.options().get<int>("max-cached-files"));
123127

124128
ctfInput.copyCmd = configcontext.options().get<std::string>("copy-cmd");

0 commit comments

Comments
 (0)