R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandCalToHitParTask.cxx
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2019-2023 Members of R3B Collaboration *
4 * *
5 * This software is distributed under the terms of the *
6 * GNU General Public Licence (GPL) version 3, *
7 * copied verbatim in the file "LICENSE". *
8 * *
9 * In applying this license GSI does not waive the privileges and immunities *
10 * granted to it by virtue of its status as an Intergovernmental Organization *
11 * or submit itself to any jurisdiction. *
12 ******************************************************************************/
13
15#include "R3BDataMonitor.h"
16#include "R3BException.h"
17#include "R3BNeulandBasePar.h"
20#include "R3BNeulandCommon.h"
21#include <FairRootManager.h>
22#include <FairRuntimeDb.h>
23#include <R3BLogger.h>
25#include <R3BNeulandMillepede.h>
27#include <memory>
28#include <string_view>
29
30namespace R3B::Neuland
31{
32 // NOLINTBEGIN
34 std::string_view cal_data_name,
35 std::string_view base_par_name,
36 std::string_view hit_par_name,
37 std::string_view name,
38 int iVerbose)
39 : CalibrationTask(name, iVerbose)
40 , cal_data_{ cal_data_name }
41 , base_par_{ AddInputPar<CalibrationBasePar>(base_par_name) }
42 // NOLINTEND
43 {
44 switch (method)
45 {
47 engine_ = std::make_unique<Calibration::MuonReconstruction>();
48 hit_par_ = AddOutputPar<Cal2HitPar>(hit_par_name);
49 break;
51 engine_ = std::make_unique<Calibration::MillepedeEngine>();
52 hit_par_ = AddInputPar<Cal2HitPar>(hit_par_name);
53 break;
55 engine_ = std::make_unique<Calibration::HistAnalysis>();
56 hit_par_ = AddOutputPar<Cal2HitPar>(hit_par_name);
57 break;
58 }
59 }
60
61 void Cal2HitParTask::HistogramInit(DataMonitor& histograms) { engine_->HistInit(histograms); }
62
63 void Cal2HitParTask::ExtraInit(FairRootManager* /*rootMan*/)
64 {
65 cal_data_.init();
66
67 const auto plane_num = base_par_->get_num_of_planes();
68 if (plane_num == 0)
69 {
70 throw R3B::runtime_error("Plane number extracted from Map2CalPar is 0!");
71 }
72 engine_->SetTask(this);
73 engine_->SetModuleSize(plane_num * BarsPerPlane);
74 engine_->Init();
75 }
76
77 void Cal2HitParTask::SetExtraPar(FairRuntimeDb* rtdb) {}
78
80 {
81 engine_->EventReset();
82 engine_->AddSignals(cal_data_.get());
83 // for (const auto& bar_signal : cal_data_)
84 // {
85 // engine_->AddSignal(bar_signal);
86 // }
87 auto* eventHeader = GetEventHeader();
88 if (eventHeader != nullptr)
89 {
90 engine_->EndOfEvent(eventHeader->GetEventno());
91 }
92 else
93 {
94 throw R3B::runtime_error("Event header is nullptr!");
95 }
96 }
97
99 {
100 if (hit_par_ == nullptr)
101 {
102 throw R3B::runtime_error("Hit parameter is nullptr during the calibration!");
103 }
104
105 R3BLOG(info, "Starting to do cosmic calibration calibration!");
106 engine_->Calibrate(*hit_par_);
107 engine_->EndOfTask();
108 }
109
111 {
112 auto res = engine_->SignalFilter(cal_data_.get());
113 return res;
114 }
115} // namespace R3B::Neuland
#define R3BLOG(severity, x)
Definition R3BLogger.h:32
InputVectorConnector< BarCalData > cal_data_
void ExtraInit(FairRootManager *rootMan) override
std::unique_ptr< Calibration::CosmicEngineInterface > engine_
void SetExtraPar(FairRuntimeDb *rtdb) override
Cal2HitParTask(Cal2HitParMethod method=Cal2HitParMethod::recons, std::string_view cal_data_name="NeulandCalData", std::string_view base_par_name="NeulandCalibrationBasePar", std::string_view hit_par_name="NeulandHitPar", std::string_view name="NeulandCal2HitParTask", int iVerbose=1)
void HistogramInit(DataMonitor &histograms) override
auto CheckConditions() const -> bool override
auto AddOutputPar(std::string_view par_name, FairRuntimeDb *rtdb=FairRuntimeDb::instance()) -> ParType *
auto AddInputPar(std::string_view par_name, FairRuntimeDb *rtdb=FairRuntimeDb::instance()) -> ParType *
Simulation of NeuLAND Bar/Paddle.
constexpr auto BarsPerPlane