-
Notifications
You must be signed in to change notification settings - Fork 484
TPC track interpolation as DPL workflow, add TOF reader for matching information #3232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b2a3373
TOF DPL reader for matching information
martenole 4d9374f
Fix short range moving average filter and add possibility to dump out…
martenole bc84103
Prepare TPC track interpolation for DPL driven input and suppress tre…
martenole 464bd97
Add possibility to run TPC track interpolation as DPL workflow
martenole File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
58 changes: 58 additions & 0 deletions
58
Detectors/GlobalTrackingWorkflow/tofworkflow/include/TOFWorkflow/TOFMatchedReaderSpec.h
This file contains hidden or 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,58 @@ | ||
| // Copyright CERN and copyright holders of ALICE O2. This software is | ||
| // distributed under the terms of the GNU General Public License v3 (GPL | ||
| // Version 3), copied verbatim in the file "COPYING". | ||
| // | ||
| // See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| // | ||
| // 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. | ||
|
|
||
| /// @file TOFMatchedReaderSpec.h | ||
|
|
||
| #ifndef O2_TOF_MATCHINFOREADER | ||
| #define O2_TOF_MATCHINFOREADER | ||
|
|
||
| #include "TFile.h" | ||
| #include "TTree.h" | ||
|
|
||
| #include "Framework/DataProcessorSpec.h" | ||
| #include "Framework/Task.h" | ||
| #include "ReconstructionDataFormats/MatchInfoTOF.h" | ||
| #include "SimulationDataFormat/MCCompLabel.h" | ||
|
|
||
| namespace o2 | ||
| { | ||
| namespace tof | ||
| { | ||
|
|
||
| class TOFMatchedReader : public o2::framework::Task | ||
| { | ||
| public: | ||
| TOFMatchedReader(bool useMC) : mUseMC(useMC) {} | ||
| ~TOFMatchedReader() override = default; | ||
| void init(o2::framework::InitContext& ic) final; | ||
| void run(o2::framework::ProcessingContext& pc) final; | ||
|
|
||
| private: | ||
| void connectTree(const std::string& filename); | ||
|
|
||
| bool mUseMC = false; | ||
| std::string mInFileName{"o2match_tof.root"}; | ||
| std::string mInTreeName{"matchTOF"}; | ||
| std::unique_ptr<TFile> mFile = nullptr; | ||
| std::unique_ptr<TTree> mTree = nullptr; | ||
| std::vector<o2::dataformats::MatchInfoTOF> mMatches, *mMatchesPtr = &mMatches; | ||
| std::vector<o2::MCCompLabel> mLabelTOF, *mLabelTOFPtr = &mLabelTOF; | ||
| std::vector<o2::MCCompLabel> mLabelTPC, *mLabelTPCPtr = &mLabelTPC; | ||
| std::vector<o2::MCCompLabel> mLabelITS, *mLabelITSPtr = &mLabelITS; | ||
| }; | ||
|
|
||
| /// create a processor spec | ||
| /// read matched TOF clusters from a ROOT file | ||
| framework::DataProcessorSpec getTOFMatchedReaderSpec(bool useMC); | ||
|
|
||
| } // namespace tof | ||
| } // namespace o2 | ||
|
|
||
| #endif /* O2_TOF_MATCHINFOREADER */ |
99 changes: 99 additions & 0 deletions
99
Detectors/GlobalTrackingWorkflow/tofworkflow/src/TOFMatchedReaderSpec.cxx
This file contains hidden or 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,99 @@ | ||
| // Copyright CERN and copyright holders of ALICE O2. This software is | ||
| // distributed under the terms of the GNU General Public License v3 (GPL | ||
| // Version 3), copied verbatim in the file "COPYING". | ||
| // | ||
| // See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| // | ||
| // 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. | ||
|
|
||
| /// @file TOFMatchedReaderSpec.cxx | ||
|
|
||
| #include <vector> | ||
|
|
||
| #include "TTree.h" | ||
| #include "TFile.h" | ||
|
|
||
| #include "TOFWorkflow/TOFMatchedReaderSpec.h" | ||
| #include "Framework/ControlService.h" | ||
| #include "Framework/ConfigParamRegistry.h" | ||
| #include "Headers/DataHeader.h" | ||
| #include "SimulationDataFormat/MCCompLabel.h" | ||
| #include "SimulationDataFormat/MCTruthContainer.h" | ||
| #include "ReconstructionDataFormats/MatchInfoTOF.h" | ||
|
|
||
| using namespace o2::framework; | ||
|
|
||
| namespace o2 | ||
| { | ||
| namespace tof | ||
| { | ||
|
|
||
| void TOFMatchedReader::init(InitContext& ic) | ||
| { | ||
| // get the option from the init context | ||
| LOG(INFO) << "Init TOF matching info reader!"; | ||
| mInFileName = ic.options().get<std::string>("tof-matched-infile"); | ||
| mInTreeName = ic.options().get<std::string>("treename"); | ||
| connectTree(mInFileName); | ||
| } | ||
|
|
||
| void TOFMatchedReader::connectTree(const std::string& filename) | ||
| { | ||
| mTree.reset(nullptr); // in case it was already loaded | ||
| mFile.reset(TFile::Open(filename.c_str())); | ||
| assert(mFile && !mFile->IsZombie()); | ||
| mTree.reset((TTree*)mFile->Get(mInTreeName.c_str())); | ||
| assert(mTree); | ||
| mTree->SetBranchAddress("TOFMatchInfo", &mMatchesPtr); | ||
| if (mUseMC) { | ||
| mTree->SetBranchAddress("MatchTOFMCTruth", &mLabelTOFPtr); | ||
| mTree->SetBranchAddress("MatchTPCMCTruth", &mLabelTPCPtr); | ||
| mTree->SetBranchAddress("MatchITSMCTruth", &mLabelITSPtr); | ||
| } | ||
| LOG(INFO) << "Loaded tree from " << filename << " with " << mTree->GetEntries() << " entries"; | ||
| } | ||
|
|
||
| void TOFMatchedReader::run(ProcessingContext& pc) | ||
| { | ||
| auto currEntry = mTree->GetReadEntry() + 1; | ||
| assert(currEntry < mTree->GetEntries()); // this should not happen | ||
| mTree->GetEntry(currEntry); | ||
| LOG(INFO) << "Pushing " << mMatches.size() << " TOF matchings at entry " << currEntry; | ||
|
|
||
| pc.outputs().snapshot(Output{o2::header::gDataOriginTOF, "MATCHINFOS", 0, Lifetime::Timeframe}, mMatches); | ||
| if (mUseMC) { | ||
| pc.outputs().snapshot(Output{o2::header::gDataOriginTOF, "MATCHTOFINFOSMC", 0, Lifetime::Timeframe}, mLabelTOF); | ||
| pc.outputs().snapshot(Output{o2::header::gDataOriginTOF, "MATCHTPCINFOSMC", 0, Lifetime::Timeframe}, mLabelTPC); | ||
| pc.outputs().snapshot(Output{o2::header::gDataOriginTOF, "MATCHITSINFOSMC", 0, Lifetime::Timeframe}, mLabelITS); | ||
| } | ||
|
|
||
| if (mTree->GetReadEntry() + 1 >= mTree->GetEntries()) { | ||
| pc.services().get<ControlService>().endOfStream(); | ||
| pc.services().get<ControlService>().readyToQuit(QuitRequest::Me); | ||
| } | ||
| } | ||
|
|
||
| DataProcessorSpec getTOFMatchedReaderSpec(bool useMC) | ||
| { | ||
| std::vector<OutputSpec> outputs; | ||
| outputs.emplace_back(o2::header::gDataOriginTOF, "MATCHINFOS", 0, Lifetime::Timeframe); | ||
| if (useMC) { | ||
| outputs.emplace_back(o2::header::gDataOriginTOF, "MATCHTOFINFOSMC", 0, Lifetime::Timeframe); | ||
| outputs.emplace_back(o2::header::gDataOriginTOF, "MATCHTPCINFOSMC", 0, Lifetime::Timeframe); | ||
| outputs.emplace_back(o2::header::gDataOriginTOF, "MATCHITSINFOSMC", 0, Lifetime::Timeframe); | ||
| } | ||
|
|
||
| return DataProcessorSpec{ | ||
| "TOFMatchedReader", | ||
| Inputs{}, | ||
| outputs, | ||
| AlgorithmSpec{adaptFromTask<TOFMatchedReader>(useMC)}, | ||
| Options{ | ||
| {"tof-matched-infile", VariantType::String, "o2match_tof.root", {"Name of the input file"}}, | ||
| {"treename", VariantType::String, "matchTOF", {"Name of top-level TTree"}}, | ||
| }}; | ||
| } | ||
| } // namespace tof | ||
| } // namespace o2 | ||
28 changes: 28 additions & 0 deletions
28
Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/CMakeLists.txt
This file contains hidden or 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,28 @@ | ||
| # Copyright CERN and copyright holders of ALICE O2. This software is distributed | ||
| # under the terms of the GNU General Public License v3 (GPL Version 3), copied | ||
| # verbatim in the file "COPYING". | ||
| # | ||
| # See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| # | ||
| # 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. | ||
|
|
||
| #TODO Does the O2::GlobalTracking library need to be linked? | ||
| o2_add_library(TPCInterpolationWorkflow | ||
| SOURCES src/TPCInterpolationSpec.cxx | ||
| src/TPCResidualWriterSpec.cxx | ||
| src/TrackInterpolationReaderSpec.cxx | ||
| src/TrackInterpolationWorkflow.cxx | ||
| PUBLIC_LINK_LIBRARIES O2::GlobalTracking | ||
| O2::ITSWorkflow | ||
| O2::SpacePoints | ||
| O2::GlobalTrackingWorkflow | ||
| O2::TOFWorkflow | ||
| O2::Framework | ||
| ) | ||
|
|
||
| o2_add_executable(scdcalib-interpolation-workflow | ||
| COMPONENT_NAME tpc | ||
| SOURCES src/tpc-interpolation-workflow.cxx | ||
| PUBLIC_LINK_LIBRARIES O2::TPCInterpolationWorkflow) |
49 changes: 49 additions & 0 deletions
49
...Workflow/tpcinterpolationworkflow/include/TPCInterpolationWorkflow/TPCInterpolationSpec.h
This file contains hidden or 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,49 @@ | ||
| // Copyright CERN and copyright holders of ALICE O2. This software is | ||
| // distributed under the terms of the GNU General Public License v3 (GPL | ||
| // Version 3), copied verbatim in the file "COPYING". | ||
| // | ||
| // See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| // | ||
| // 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_TPC_INTERPOLATION_SPEC_H | ||
| #define O2_TPC_INTERPOLATION_SPEC_H | ||
|
|
||
| /// @file TPCInterpolationSpec.h | ||
|
|
||
| #include "DataFormatsTPC/Constants.h" | ||
| #include "SpacePoints/TrackInterpolation.h" | ||
| #include "Framework/DataProcessorSpec.h" | ||
| #include "Framework/Task.h" | ||
|
|
||
| using namespace o2::framework; | ||
|
|
||
| namespace o2 | ||
| { | ||
| namespace tpc | ||
| { | ||
| class TPCInterpolationDPL : public Task | ||
| { | ||
| public: | ||
| TPCInterpolationDPL(bool useMC, const std::vector<int>& tpcClusLanes) : mUseMC(useMC), mTPCClusLanes(tpcClusLanes) {} | ||
| ~TPCInterpolationDPL() override = default; | ||
| void init(InitContext& ic) final; | ||
| void run(ProcessingContext& pc) final; | ||
|
|
||
| private: | ||
| o2::tpc::TrackInterpolation mInterpolation; // track interpolation engine | ||
| std::vector<int> mTPCClusLanes; | ||
| std::array<std::vector<char>, o2::tpc::Constants::MAXSECTOR> mBufferedTPCClusters; | ||
|
|
||
| bool mUseMC{false}; ///< MC flag | ||
| }; | ||
|
|
||
| /// create a processor spec | ||
| framework::DataProcessorSpec getTPCInterpolationSpec(bool useMC, const std::vector<int>& tpcClusLanes); | ||
|
|
||
| } // namespace tpc | ||
| } // namespace o2 | ||
|
|
||
| #endif |
53 changes: 53 additions & 0 deletions
53
...orkflow/tpcinterpolationworkflow/include/TPCInterpolationWorkflow/TPCResidualWriterSpec.h
This file contains hidden or 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,53 @@ | ||
| // Copyright CERN and copyright holders of ALICE O2. This software is | ||
| // distributed under the terms of the GNU General Public License v3 (GPL | ||
| // Version 3), copied verbatim in the file "COPYING". | ||
| // | ||
| // See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| // | ||
| // 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_TPC_RESIDUAL_WRITER_H | ||
| #define O2_TPC_RESIDUAL_WRITER_H | ||
|
|
||
| /// @file TPCResidualWriterSpec.h | ||
|
|
||
| #include "TFile.h" | ||
| #include "TTree.h" | ||
|
|
||
| #include "Framework/DataProcessorSpec.h" | ||
| #include "Framework/Task.h" | ||
| #include <string> | ||
|
|
||
| namespace o2 | ||
| { | ||
| namespace tpc | ||
| { | ||
|
|
||
| class ResidualWriterTPC : public o2::framework::Task | ||
| { | ||
| public: | ||
| ResidualWriterTPC(bool useMC = false) : mUseMC(useMC) {} | ||
| ~ResidualWriterTPC() override = default; | ||
| void init(o2::framework::InitContext& ic) final; | ||
| void run(o2::framework::ProcessingContext& pc) final; | ||
| void endOfStream(o2::framework::EndOfStreamContext& ec) final; | ||
|
|
||
| private: | ||
| bool mUseMC = false; ///< MC flag | ||
| std::string mOutFileName = "o2residuals_tpc.root"; ///< name of output file | ||
| std::string mTreeName = "residualsTPC"; ///< name of tree containing output | ||
| std::string mOutTracksBranchName = "tracks"; ///< name of branch containing output used tracks | ||
| std::string mOutResidualsBranchName = "residuals"; ///< name of branch containing output used residuals | ||
| std::unique_ptr<TFile> mFile = nullptr; | ||
| std::unique_ptr<TTree> mTree = nullptr; | ||
| }; | ||
|
|
||
| /// create a processor spec | ||
| framework::DataProcessorSpec getTPCResidualWriterSpec(bool useMC); | ||
|
|
||
| } // namespace tpc | ||
| } // namespace o2 | ||
|
|
||
| #endif |
26 changes: 26 additions & 0 deletions
26
.../tpcinterpolationworkflow/include/TPCInterpolationWorkflow/TrackInterpolationReaderSpec.h
This file contains hidden or 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,26 @@ | ||
| // Copyright CERN and copyright holders of ALICE O2. This software is | ||
| // distributed under the terms of the GNU General Public License v3 (GPL | ||
| // Version 3), copied verbatim in the file "COPYING". | ||
| // | ||
| // See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| // | ||
| // 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_TPC_INTERPOLATION_READER_H | ||
| #define O2_TPC_INTERPOLATION_READER_H | ||
|
|
||
| /// @file TrackInterpolationReaderSpec.h | ||
|
|
||
| namespace o2 | ||
| { | ||
| namespace tpc | ||
| { | ||
|
|
||
| // TODO add specification for reading TPC cluster residuals and reference tracks | ||
|
|
||
| } // namespace tpc | ||
| } // namespace o2 | ||
|
|
||
| #endif |
28 changes: 28 additions & 0 deletions
28
...ow/tpcinterpolationworkflow/include/TPCInterpolationWorkflow/TrackInterpolationWorkflow.h
This file contains hidden or 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,28 @@ | ||
| // Copyright CERN and copyright holders of ALICE O2. This software is | ||
| // distributed under the terms of the GNU General Public License v3 (GPL | ||
| // Version 3), copied verbatim in the file "COPYING". | ||
| // | ||
| // See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| // | ||
| // 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_TPC_INTERPOLATION_WORKFLOW_H | ||
| #define O2_TPC_INTERPOLATION_WORKFLOW_H | ||
|
|
||
| /// @file TrackInterpolationWorkflow.h | ||
|
|
||
| #include "Framework/WorkflowSpec.h" | ||
|
|
||
| namespace o2 | ||
| { | ||
| namespace tpc | ||
| { | ||
|
|
||
| framework::WorkflowSpec getTPCInterpolationWorkflow(bool useMC); | ||
|
|
||
| } // namespace tpc | ||
| } // namespace o2 | ||
|
|
||
| #endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.