forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add StatusMap IO and a converter to RejectList
- Loading branch information
Showing
10 changed files
with
488 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
// All rights not expressly granted are reserved. | ||
// | ||
// This software is distributed under the terms of the GNU General Public | ||
// License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
#include "StatusMapReaderSpec.h" | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
#include "Framework/ConfigParamRegistry.h" | ||
#include "Framework/ConfigParamSpec.h" | ||
#include "Framework/ControlService.h" | ||
#include "Framework/InitContext.h" | ||
#include "Framework/Lifetime.h" | ||
#include "Framework/OutputSpec.h" | ||
#include "Framework/ProcessingContext.h" | ||
#include "Framework/Task.h" | ||
|
||
#include "DPLUtils/RootTreeReader.h" | ||
#include "CommonUtils/StringUtils.h" | ||
#include "MCHStatus/StatusMap.h" | ||
|
||
using namespace o2::framework; | ||
|
||
namespace o2::mch | ||
{ | ||
|
||
struct StatusMapReader { | ||
std::unique_ptr<RootTreeReader> mTreeReader; | ||
|
||
void init(InitContext& ic) | ||
{ | ||
auto fileName = o2::utils::Str::concat_string(o2::utils::Str::rectifyDirectory(ic.options().get<std::string>("input-dir")), ic.options().get<std::string>("infile")); | ||
mTreeReader = std::make_unique<RootTreeReader>( | ||
"o2sim", | ||
fileName.c_str(), | ||
-1, | ||
RootTreeReader::PublishingMode::Single, | ||
RootTreeReader::BranchDefinition<StatusMap>{Output{"MCH", "STATUSMAP", 0}, "statusmaps"}); | ||
} | ||
|
||
void run(ProcessingContext& pc) | ||
{ | ||
if (mTreeReader->next()) { | ||
(*mTreeReader)(pc); | ||
} else { | ||
pc.services().get<ControlService>().endOfStream(); | ||
} | ||
} | ||
}; | ||
|
||
DataProcessorSpec getStatusMapReaderSpec(const char* specName) | ||
{ | ||
return DataProcessorSpec{ | ||
specName, | ||
Inputs{}, | ||
Outputs{OutputSpec{{"statusmaps"}, "MCH", "STATUSMAP", 0, Lifetime::Timeframe}}, | ||
adaptFromTask<StatusMapReader>(), | ||
Options{{"infile", VariantType::String, "mchstatusmaps.root", {"name of the input status map file"}}, | ||
{"input-dir", VariantType::String, "none", {"Input directory"}}}}; | ||
} | ||
|
||
} // namespace o2::mch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
// All rights not expressly granted are reserved. | ||
// | ||
// This software is distributed under the terms of the GNU General Public | ||
// License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
#ifndef O2_MCH_WORKFLOW_STATUSMAP_READER_SPEC_H | ||
#define O2_MCH_WORKFLOW_STATUSMAP_READER_SPEC_H | ||
|
||
#include "Framework/DataProcessorSpec.h" | ||
|
||
namespace o2::mch | ||
{ | ||
framework::DataProcessorSpec getStatusMapReaderSpec(const char* specName = "mch-statusmap-reader"); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
// All rights not expressly granted are reserved. | ||
// | ||
// This software is distributed under the terms of the GNU General Public | ||
// License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
#include "StatusMapWriterSpec.h" | ||
|
||
#include "DPLUtils/MakeRootTreeWriterSpec.h" | ||
#include "MCHStatus/StatusMap.h" | ||
|
||
using namespace o2::framework; | ||
|
||
namespace o2::mch | ||
{ | ||
|
||
template <typename T> | ||
using BranchDefinition = MakeRootTreeWriterSpec::BranchDefinition<T>; | ||
|
||
DataProcessorSpec getStatusMapWriterSpec(const char* specName) | ||
{ | ||
return MakeRootTreeWriterSpec(specName, | ||
"mchstatusmaps.root", | ||
MakeRootTreeWriterSpec::TreeAttributes{"o2sim", "Tree MCH StatusMaps"}, | ||
BranchDefinition<StatusMap>{InputSpec{"statusmaps", "MCH", "STATUSMAP"}, "statusmaps"})(); | ||
} | ||
|
||
} // namespace o2::mch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
// All rights not expressly granted are reserved. | ||
// | ||
// This software is distributed under the terms of the GNU General Public | ||
// License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
#ifndef O2_MCH_WORKFLOW_STATUSMAP_WRITER_SPEC_H | ||
#define O2_MCH_WORKFLOW_STATUSMAP_WRITER_SPEC_H | ||
|
||
#include "Framework/DataProcessorSpec.h" | ||
|
||
namespace o2::mch | ||
{ | ||
framework::DataProcessorSpec getStatusMapWriterSpec(const char* specName = "mch-statusmap-writer"); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
// All rights not expressly granted are reserved. | ||
// | ||
// This software is distributed under the terms of the GNU General Public | ||
// License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
#include <vector> | ||
#include "DetectorsRaw/HBFUtilsInitializer.h" | ||
#include "Framework/CallbacksPolicy.h" | ||
#include "Framework/ConfigParamSpec.h" | ||
#include "StatusMapReaderSpec.h" | ||
|
||
using namespace o2::framework; | ||
|
||
void customize(std::vector<CallbacksPolicy>& policies) | ||
{ | ||
o2::raw::HBFUtilsInitializer::addNewTimeSliceCallback(policies); | ||
} | ||
|
||
// we need to add workflow options before including Framework/runDataProcessing | ||
void customize(std::vector<ConfigParamSpec>& workflowOptions) | ||
{ | ||
o2::raw::HBFUtilsInitializer::addConfigOption(workflowOptions); | ||
} | ||
|
||
#include "Framework/runDataProcessing.h" | ||
|
||
WorkflowSpec defineDataProcessing(const ConfigContext& config) | ||
{ | ||
WorkflowSpec wf{o2::mch::getStatusMapReaderSpec("mch-statusmap-reader")}; | ||
o2::raw::HBFUtilsInitializer hbfIni(config, wf); | ||
return wf; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
// All rights not expressly granted are reserved. | ||
// | ||
// This software is distributed under the terms of the GNU General Public | ||
// License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
#include <vector> | ||
#include "Framework/CompletionPolicyHelpers.h" | ||
#include "StatusMapWriterSpec.h" | ||
|
||
using namespace o2::framework; | ||
|
||
void customize(std::vector<o2::framework::CompletionPolicy>& policies) | ||
{ | ||
// ordered policies for the writers | ||
policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*(?:MCH|mch).*[W,w]riter.*")); | ||
} | ||
|
||
#include "Framework/runDataProcessing.h" | ||
|
||
WorkflowSpec defineDataProcessing(const ConfigContext&) | ||
{ | ||
return WorkflowSpec{o2::mch::getStatusMapWriterSpec("mch-statusmap-writer")}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.