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.
Merge pull request AliceO2Group#7 from AliceO2Group/dev
sync with master
- Loading branch information
Showing
8 changed files
with
751 additions
and
2 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
60 changes: 60 additions & 0 deletions
60
Detectors/TRD/base/include/TRDBase/TRDDiffandTimeStructEstimator.h
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,60 @@ | ||
// 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_TRDDIFFANDTIMESTRUCTESTIMATOR_H | ||
#define O2_TRDDIFFANDTIMESTRUCTESTIMATOR_H | ||
|
||
#include <array> | ||
|
||
namespace o2 | ||
{ | ||
namespace trd | ||
{ | ||
|
||
// CONTANT TIME STRUCTURE DATA FROM GARFIELD | ||
constexpr int ktimebin = 38; | ||
constexpr int kZbin = 11; | ||
|
||
/// A class to calculate diffusion and time structure values (GARFIELD model) | ||
/// (used in digitization). Class was split off trom TRDCommonParam | ||
/// and is no longer a singleton so that we can use it in a multithreaded context. | ||
class TRDDiffusionAndTimeStructEstimator | ||
{ | ||
public: | ||
TRDDiffusionAndTimeStructEstimator() = default; | ||
|
||
/// determines the diffusion coefficients as a function of drift velocity | ||
bool GetDiffCoeff(float& dl, float& dt, float vdrift); | ||
|
||
/// determines drift time as function of drift velocity and coordinates | ||
float TimeStruct(float vdrift, float xd, float z); | ||
|
||
private: | ||
void SampleTimeStruct(float vdrift); | ||
|
||
std::array<float, ktimebin * kZbin> mTimeStruct1; //! cached Time Structure of Drift Cells (for last vdrift value) | ||
std::array<float, ktimebin * kZbin> mTimeStruct2; //! cached Time Structure of Drift Cells (for last vdrift value) | ||
float mVDlo; //! Lower drift velocity, for interpolation | ||
float mVDhi; //! Higher drift velocity, for interpolation | ||
float mInvBinWidth; //! caching 1/(mVDhi - mVDlo) | ||
float mTimeLastVdrift = -1.f; //! The structures are valid for this mLastVdrift (caching) | ||
|
||
// for the diffusion part | ||
float mDiffLastVdrift = -1.f; | ||
float mDiffusionL = -1.f; | ||
float mDiffusionT = -1.f; | ||
|
||
// ClassDef(TRDDiffusionAndTimeStructEstimator, 1); | ||
}; | ||
|
||
} // namespace trd | ||
} // namespace o2 | ||
|
||
#endif //O2_TRDDIFFANDTIMESTRUCTESTIMATOR_H |
578 changes: 578 additions & 0 deletions
578
Detectors/TRD/base/src/TRDDiffAndTimeStructEstimator.cxx
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -240,6 +240,7 @@ foreach(b | |
DeviceMetricsInfo | ||
InputRecord | ||
TableBuilder | ||
WorkflowHelpers | ||
ASoA | ||
HistogramRegistry | ||
) | ||
|
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,86 @@ | ||
// 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. | ||
#include "Framework/WorkflowSpec.h" | ||
#include "Framework/DataSpecUtils.h" | ||
#include "Framework/OutputSpec.h" | ||
#include "../src/WorkflowHelpers.h" | ||
#include <benchmark/benchmark.h> | ||
#include <algorithm> | ||
|
||
using namespace o2::framework; | ||
|
||
static void BM_CreateGraphOverhead(benchmark::State& state) | ||
{ | ||
|
||
for (auto _ : state) { | ||
std::vector<InputSpec> inputSpecs; | ||
std::vector<OutputSpec> outputSpecs; | ||
|
||
for (size_t i = 0; i < state.range(); ++i) { | ||
auto subSpec = static_cast<o2::header::DataHeader::SubSpecificationType>(i); | ||
inputSpecs.emplace_back(InputSpec{"y", "TST", "A", subSpec}); | ||
outputSpecs.emplace_back(OutputSpec{{"y"}, "TST", "A", subSpec}); | ||
} | ||
|
||
WorkflowSpec workflow{ | ||
{"A", | ||
{}, | ||
outputSpecs}, | ||
{"B", inputSpecs}}; | ||
|
||
std::vector<DeviceConnectionEdge> logicalEdges; | ||
std::vector<OutputSpec> outputs; | ||
std::vector<LogicalForwardInfo> availableForwardsInfo; | ||
|
||
WorkflowHelpers::verifyWorkflow(workflow); | ||
WorkflowHelpers::injectServiceDevices(workflow); | ||
WorkflowHelpers::constructGraph(workflow, | ||
logicalEdges, | ||
outputs, | ||
availableForwardsInfo); | ||
} | ||
} | ||
|
||
BENCHMARK(BM_CreateGraphOverhead)->Range(1, 1 << 10); | ||
|
||
static void BM_CreateGraphReverseOverhead(benchmark::State& state) | ||
{ | ||
|
||
for (auto _ : state) { | ||
std::vector<InputSpec> inputSpecs; | ||
std::vector<OutputSpec> outputSpecs; | ||
|
||
for (size_t i = 0; i < state.range(); ++i) { | ||
auto subSpec = static_cast<o2::header::DataHeader::SubSpecificationType>(i); | ||
auto subSpecReverse = static_cast<o2::header::DataHeader::SubSpecificationType>(state.range() - i - 1); | ||
inputSpecs.emplace_back(InputSpec{"y", "TST", "A", subSpec}); | ||
outputSpecs.emplace_back(OutputSpec{{"y"}, "TST", "A", subSpecReverse}); | ||
} | ||
|
||
WorkflowSpec workflow{ | ||
{"A", | ||
{}, | ||
outputSpecs}, | ||
{"B", inputSpecs}}; | ||
|
||
std::vector<DeviceConnectionEdge> logicalEdges; | ||
std::vector<OutputSpec> outputs; | ||
std::vector<LogicalForwardInfo> availableForwardsInfo; | ||
|
||
WorkflowHelpers::verifyWorkflow(workflow); | ||
WorkflowHelpers::injectServiceDevices(workflow); | ||
WorkflowHelpers::constructGraph(workflow, logicalEdges, | ||
outputs, | ||
availableForwardsInfo); | ||
} | ||
} | ||
|
||
BENCHMARK(BM_CreateGraphReverseOverhead)->Range(1, 1 << 10); | ||
BENCHMARK_MAIN(); |