|
DAS
3.0
Das Analysis System
|
Go to the documentation of this file.
21 #include <source_location>
59 std::unique_ptr<ChainSlice>
tIn;
60 std::shared_ptr<TFile>
fOut;
61 std::unique_ptr<TTree>
tOut;
63 std::map<std::string, std::any>
branches;
72 cout <<
"Flow: retrieving an existing branch" << endl;
74 return any_cast<shared_ptr<T*>>(branch);
76 catch (
const std::bad_any_cast& e) {
77 BOOST_THROW_EXCEPTION(e);
86 std::string what =
name +
" branch could not be found";
95 auto keys =
branches | std::views::keys;
96 return std::accumulate(keys.begin(), keys.end(), std::string(),
97 [](
const std::string& str,
const std::string& branch_name) {
98 return str +
' ' + branch_name;
117 (std::vector<std::filesystem::path> = {},
118 const Slice = {1, 0},
119 const std::string& =
"events");
135 const std::source_location = std::source_location::current());
140 const std::source_location = std::source_location::current());
152 std::pair<TFile *, TTree *>
GetOutput (
const std::filesystem::path&,
153 const std::source_location = std::source_location::current());
167 const std::string&
name,
173 BOOST_THROW_EXCEPTION( invalid_argument(
"`GetInputTree()` should "
174 "be called before declaring a read-only branch") );
181 t = GetBranch<T>(
name);
183 t = make_shared<T*>();
185 cout <<
"Flow: loading branch `" <<
name <<
"`" << endl;
187 if (
tIn->GetBranch(
name.c_str()) ==
nullptr)
188 return NoBranch<T>(
name, mode);
190 int err =
tIn->SetBranchAddress(
name.c_str(), t.get());
192 cout <<
"Flow: `TTree::SetBranchAddress()` returned " << to_string(err)
193 <<
" (check `TTree::ESetBranchAddressStatus` for the meaning)."
196 string what =
"`"s +
name +
"` branch could not be set. "s;
199 cout <<
orange <<
"Flow: " << what <<
def << endl;
223 BOOST_THROW_EXCEPTION( invalid_argument(
"`GetOutputTree()` should "
224 "be called before") );
229 t = GetBranch<T>(
name);
231 t = make_shared<T*>();
234 cout <<
"Flow: setting up new branch for `" <<
name <<
"`" << endl;
235 if (
tOut->Branch(
name.c_str(), t.get()) ==
nullptr) {
237 string what =
name +
" branch could not be set up";
261 BOOST_THROW_EXCEPTION( invalid_argument(
"`GetInputTree()` should "
262 "be called before declaring a read-write branch") );
265 BOOST_THROW_EXCEPTION( invalid_argument(
"`GetOutputTree()` should "
266 "be called before declaring a read-write branch") );
271 t = GetBranch<T>(
name);
273 if (GetBranchReadOnly<T>(
name, mode) ==
nullptr)
274 return NoBranch<T>(
name, mode);
276 GetBranchWriteOnly<T>(
name);
name
Definition: DYToLL_M-50_13TeV_pythia8_cff_GEN_SIM_RECOBEFMIX_DIGI_L1_DIGI2RAW_L1Reco_RECO.py:48
static const char * def
Definition: Step.h:36
Handling of exceptions.
Definition: darwin.h:36
static const char * orange
Definition: colours.h:6