|
DAS
3.0
Das Analysis System
|
Go to the documentation of this file.
21 std::unique_ptr<TFile>
GetOutput (std::filesystem::path output,
22 const std::string&
name);
36 (std::vector<std::filesystem::path>
inputs);
41 (std::vector<std::filesystem::path>
inputs,
42 const Slice slice = {1, 0},
43 const std::string&
name =
"events");
49 [[deprecated(
"Pass a slice as second parameter.")]]
50 inline std::unique_ptr<ChainSlice>
GetChain
51 (std::vector<std::filesystem::path>
inputs,
59 template<
typename THX = TH1>
60 inline std::unique_ptr<THX>
GetHist
61 (std::vector<std::filesystem::path>
inputs,
62 const std::string&
name =
"h")
65 namespace fs = filesystem;
70 auto fIn = make_unique<TFile>(
input.c_str(),
"READ");
72 unique_ptr<THX> h(fIn->Get<THX>(
name.c_str()));
75 BOOST_THROW_EXCEPTION(
DE::BadInput(Form(
"`%s` cannot be found in (one of) the "
76 " file(s).",
name.c_str()), fIn));
82 sum->SetDirectory(
nullptr);
94 (
const std::filesystem::path&
input);
105 std::unique_ptr<TTree>
NewTree (
const std::unique_ptr<ChainSlice>& chain,
106 const bool makeFriend,
107 const std::string& thisFunc);
123 const std::string&
name,
125 const int steering = 0,
126 bool raise_exception =
true)
132 cout <<
"Loading branch `" <<
name <<
"`" << endl;
134 if (tIn->GetBranch(
name.c_str()) ==
nullptr) {
135 if (raise_exception) {
136 string what =
name +
" branch could not be found";
137 BOOST_THROW_EXCEPTION(
DE::BadInput(what.c_str(), *tIn));
144 if (
int err = tIn->SetBranchAddress(
name.c_str(), t); err < 0) {
145 string what =
name +
" branch could not be set "
146 "(`SetBranchAddress()` returned " + to_string(err) +
")";
147 BOOST_THROW_EXCEPTION(
DE::BadInput(what.c_str(), *tIn));
164 const std::string&
name,
166 const int steering = 0)
172 cout <<
"Setting up new branch for `" <<
name <<
"`" << endl;
175 if (tOut->Branch(
name.c_str(), t) ==
nullptr) {
177 string what =
name +
" branch could not be set up";
178 BOOST_THROW_EXCEPTION(
DE::BadInput(what.c_str(), *tOut) );
194 typename TTreePtrOut>
196 const TTreePtrIn& tIn,
198 const std::string&
name,
200 const int steering = 0,
201 bool raise_exception =
true)
205 GetBranchReadOnly<T>(tIn,
name, t, steering, raise_exception);
209 cout <<
"Setting up new branch for `" <<
name <<
"`" << endl;
210 if (tOut->Branch(
name.c_str(), t) ==
nullptr) {
212 string what =
name +
" branch could not be set up";
213 BOOST_THROW_EXCEPTION(
DE::BadInput(what.c_str(), *tOut) );
222 #define DT_GetOutput(output) Darwin::Tools::GetOutput(output, __func__)
223 #define DT_NewTree(input,makeFriend) Darwin::Tools::NewTree(input, makeFriend, __func__)
name
Definition: DYToLL_M-50_13TeV_pythia8_cff_GEN_SIM_RECOBEFMIX_DIGI_L1_DIGI2RAW_L1Reco_RECO.py:48
Handling of exceptions.
Definition: darwin.h:35
input
Definition: DYToLL_M-50_13TeV_pythia8_cff_GEN_SIM_RECOBEFMIX_DIGI_L1_DIGI2RAW_L1Reco_RECO.py:35
def inputs
Definition: jercExample.py:118