Skip to content

Commit

Permalink
Limit TFs extraxted from CTF file with --max-tf-per-file CTF-reader N
Browse files Browse the repository at this point in the history
  • Loading branch information
shahor02 committed Nov 15, 2024
1 parent e260639 commit e755da1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Detectors/CTF/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ comma-separated list of detectors to skip
```
max CTFs to process (<= 0 : infinite)
```
--max-tf-per-file arg (=-1)
```
max TFs to process from every CTF file (<= 0 : infinite)
```
--loop arg (=0)
```
Expand Down
1 change: 1 addition & 0 deletions Detectors/CTF/workflow/include/CTFWorkflow/CTFReaderSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct CTFReaderInp {
int64_t delay_us = 0;
int maxLoops = 0;
int maxTFs = -1;
int maxTFsPerFile = -1;
unsigned int subspec = 0;
unsigned int decSSpecEMC = 0;
int tfRateLimit = -999;
Expand Down
2 changes: 1 addition & 1 deletion Detectors/CTF/workflow/src/CTFReaderSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ bool CTFReaderSpec::processTF(ProcessingContext& pc)
void CTFReaderSpec::checkTreeEntries()
{
// check if the tree has entries left, if needed, close current tree/file
if (++mCurrTreeEntry >= mCTFTree->GetEntries()) { // this file is done, check if there are other files
if (++mCurrTreeEntry >= mCTFTree->GetEntries() || (mInput.maxTFsPerFile > 0 && mCurrTreeEntry >= mInput.maxTFsPerFile)) { // this file is done, check if there are other files
mCTFTree.reset();
mCTFFile->Close();
mCTFFile.reset();
Expand Down
4 changes: 4 additions & 0 deletions Detectors/CTF/workflow/src/ctf-reader-workflow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
options.push_back(ConfigParamSpec{"onlyDet", VariantType::String, std::string{DetID::ALL}, {"comma-separated list of detectors to accept. Overrides skipDet"}});
options.push_back(ConfigParamSpec{"skipDet", VariantType::String, std::string{DetID::NONE}, {"comma-separate list of detectors to skip"}});
options.push_back(ConfigParamSpec{"max-tf", VariantType::Int, -1, {"max CTFs to process (<= 0 : infinite)"}});
options.push_back(ConfigParamSpec{"max-tf-per-file", VariantType::Int, -1, {"max TFs to process per ctf file (<= 0 : infinite)"}});
options.push_back(ConfigParamSpec{"loop", VariantType::Int, 0, {"loop N times (infinite for N<0)"}});
options.push_back(ConfigParamSpec{"delay", VariantType::Float, 0.f, {"delay in seconds between consecutive TFs sending"}});
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
Expand Down Expand Up @@ -119,6 +120,9 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
int n = configcontext.options().get<int>("max-tf");
ctfInput.maxTFs = n > 0 ? n : 0x7fffffff;

n = configcontext.options().get<int>("max-tf-per-file");
ctfInput.maxTFsPerFile = n > 0 ? n : 0x7fffffff;

ctfInput.maxFileCache = std::max(1, configcontext.options().get<int>("max-cached-files"));

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

0 comments on commit e755da1

Please sign in to comment.