DAS  3.0
Das Analysis System
Darwin::Physics Namespace Reference

Classes

struct  Event
 
struct  FourVector
 
struct  GenEvent
 
struct  GenJet
 
struct  Jet
 
struct  MET
 
struct  PileUp
 
struct  RecEvent
 
struct  RecJet
 
struct  RecMET
 
struct  Trigger
 
struct  Vertex
 

Functions

template<bool DARWIN_TEST_EXCEPTIONS = false>
void example02 (const vector< fs::path > &inputs, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0})
 
void example03 (const vector< fs::path > &inputs, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0})
 
template<bool DARWIN_TEST_EXCEPTIONS = false>
void example02 (const fs::path &input, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0})
 
void example03 (const fs::path &input, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0})
 

Detailed Description

Everything what concerns physics analysis directly.

Function Documentation

◆ example02() [1/2]

void Darwin::Physics::example02 ( const fs::path &  input,
const fs::path &  output,
const pt::ptree &  config,
const int  steering,
const DT::Slice  slice = {1,0} 
)
42  {1,0} )
43 {
44  example02<DARWIN_TEST_EXCEPTIONS>(vector<fs::path>{input}, output, config, steering, slice);
45 }

◆ example02() [2/2]

void Darwin::Physics::example02 ( const vector< fs::path > &  inputs,
const fs::path &  output,
const pt::ptree &  config,
const int  steering,
const DT::Slice  slice = {1,0} 
)

Toy example to modify a n-tuple.

The template argument is only for the test of exceptions in unit tests.

Parameters
inputsinput ROOT files (n-tuples)
outputoutput ROOT file (n-tuple)
configconfig handled with `Darwin::Tools::options`
steeringparameters obtained from explicit options
slicenumber and index of slice
34  {1,0}
35  )
36 {
37  cout << __func__ << ' ' << slice << " start" << endl;
38 
39  unique_ptr<TChain> tIn = DT::GetChain(inputs);
40  unique_ptr<TFile> fOut(DT_GetOutput(output));
41  unique_ptr<TTree> tOut(DT_NewTree(tIn, (steering & DT::Friend) == DT::Friend));
42 
43  DT::MetaInfo metainfo(tOut);
44  metainfo.Check(config);
45 
46  vector<RecJet> * recs = nullptr;
47  tIn->SetBranchAddress("recs", &recs);
48  if ((steering & DT::Friend) == DT::Friend)
49  tOut->Branch("recs", &recs);
50 
51  const auto& corrections = config.get_child("corrections");
52  metainfo.Set<string>("corrections", "METfilters", corrections.get<string>("METfilters"));
53  metainfo.Set<string>("corrections", "hotzones", corrections.get<string>("hotzones" ));
54 
55  metainfo.Set<const char *>("variations", "JECs", "nominal");
56  if (steering & DT::syst) {
57  metainfo.Set<const char *>("variations", "JECs", "JESdn");
58  metainfo.Set<const char *>("variations", "JECs", "JESup");
59  }
60 
61  for (DT::Looper looper(tIn, slice); looper(); ++looper) {
62  static auto& cout = steering & DT::verbose ? ::cout : DT::dev_null;
63 
64  if constexpr (DARWIN_TEST_EXCEPTIONS)
65  if (*looper == 5)
66  BOOST_THROW_EXCEPTION(DE::AnomalousEvent("Here is an anomally", tIn));
67 
68  for (auto& rec: *recs) {
69  rec.area = M_PI*pow(0.4,2);
70  rec.scales = {1.1}; // nominal
71  if (steering & DT::syst) {
72  rec.scales.push_back(1.05); // JESdn
73  rec.scales.push_back(1.15); // JESup
74  }
75  cout << rec << endl;
76  }
77 
78  if (steering & DT::fill) tOut->Fill();
79  }
80 
81  metainfo.Set<bool>("git", "complete", true);
82  fOut->cd();
83  tOut->Write();
84 
85  cout << __func__ << ' ' << slice << " end" << endl;
86 }

◆ example03() [1/2]

void Darwin::Physics::example03 ( const fs::path &  input,
const fs::path &  output,
const pt::ptree &  config,
const int  steering,
const DT::Slice  slice = {1,0} 
)
49  {1,0})
50 {
51  example03(vector<fs::path>{input}, output, config, steering, slice);
52 }

◆ example03() [2/2]

void Darwin::Physics::example03 ( const vector< fs::path > &  inputs,
const fs::path &  output,
const pt::ptree &  config,
const int  steering,
const DT::Slice  slice = {1,0} 
)

Toy example to project a n-tuple.

Parameters
inputsinput ROOT files (n-tuple)
outputoutput ROOT file (histograms)
configconfig handled with `Darwin::Tools::Options`
steeringparameters obtained from explicit options
slicenumber and index of slice
36  {1,0}
37  )
38 {
39  cout << __func__ << ' ' << slice << " start" << endl;
40 
41  unique_ptr<TChain> tIn = DT::GetChain(inputs);
42 
43  vector<RecJet> * recs = nullptr;
44  tIn->SetBranchAddress("recs", &recs);
45 
46  unique_ptr<TFile> fOut(DT_GetOutput(output));
47  auto tOut = unique_ptr<TTree>(tIn->CloneTree(0)); // ghost tree: only there to keep meta info
48 
49  DT::MetaInfo metainfo(tOut);
50  metainfo.Check(config);
51 
52  auto h = new TH1D("h", ";p_{T};N", 990, 10, 1000);
53 
54  // event loop
55  for (DT::Looper looper(tIn, slice); looper(); ++looper) {
56  static auto& cout = steering & DT::verbose ? ::cout : DT::dev_null;
57  for (const auto& rec: *recs) {
58  h->Fill(rec.Pt());
59  cout << rec << endl;
60  }
61  // here we do *NOT* fill the tree
62  }
63 
64  metainfo.Set<bool>("git", "complete", true);
65 
66  tOut->Write();
67  h->Write();
68 
69  cout << __func__ << ' ' << slice << " end" << endl;
70 }
Darwin::Tools::syst
@ syst
activate -s to systematic uncertainties
Definition: Options.h:30
Darwin::Physics::example03
void example03(const fs::path &input, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0})
Definition: main.cc:47
Step::verbose
static bool verbose
Definition: Step.h:40
Darwin::Tools::Looper
Facility to loop over a n-tuple, including parallelisation and printing.
Definition: Looper.h:33
Darwin::Tools::GetChain
std::unique_ptr< TChain > GetChain(std::vector< std::filesystem::path > inputs, const char *name="events")
Load chain from a list of files.
Definition: FileUtils.cc:67
DT_NewTree
#define DT_NewTree(input, makeFriend)
Definition: FileUtils.h:97
Darwin::Tools::MetaInfo
Generic meta-information for n-tuple (including speficities to Darwin).
Definition: MetaInfo.h:65
Darwin::Tools::fill
@ fill
activate -f to fill the tree
Definition: Options.h:28
Ntupliser_cfg.config
config
Definition: Ntupliser_cfg.py:263
DYToLL_M-50_13TeV_pythia8_cff_GEN_SIM_RECOBEFMIX_DIGI_L1_DIGI2RAW_L1Reco_RECO.input
input
Definition: DYToLL_M-50_13TeV_pythia8_cff_GEN_SIM_RECOBEFMIX_DIGI_L1_DIGI2RAW_L1Reco_RECO.py:35
jercExample.inputs
def inputs
Definition: jercExample.py:118
Darwin::Exceptions::AnomalousEvent
Generic exception for problematic event (during event loop).
Definition: exceptions.h:48
Darwin::Tools::dev_null
static std::ostream dev_null(nullptr)
to redirect output stream to nowhere
Darwin::Tools::Friend
@ Friend
activate -F to only fill the new branches
Definition: Options.h:29
DT_GetOutput
#define DT_GetOutput(output)
Definition: FileUtils.h:96