DAS  3.0
Das Analysis System
DAS::JetVeto Namespace Reference

Classes

struct  Conservative
 

Functions

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

Function Documentation

◆ applyConservativeVetoMap()

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

Remove regions that are not properly simulated both in data and simulation (fixed via unfolding at the end).

Maps are derived by Hannu (Helsinki), and should be downloaded and adapted.

Parameters
inputsinput ROOT files (n-tuples)
outputname of output root file containing the histograms
configconfig file from `DTOptions`
steeringsteering parameters from `DTOptions`
sliceslices for running
43  {1,0}
44  )
45 {
46  cout << __func__ << ' ' << slice << " start" << endl;
47 
48  DT::Flow flow(steering);
49  auto tIn = flow.GetInputTree(inputs, slice);
50  auto [fOut, tOut] = flow.GetOutput(output);
51 
52  DT::MetaInfo metainfo(tOut);
53  metainfo.Check(config);
54  auto isMC = metainfo.Get<bool>("flags", "isMC");
55 
56  const auto& jetveto_file = config.get<fs::path>("corrections.jetvetomap.filename");
57  JetVeto::Conservative jetveto(jetveto_file);
58  metainfo.Set<fs::path>("corrections", "jetvetomap", "filename", jetveto_file);
59 
60  auto genEvt = isMC ? flow.GetBranchReadOnly<GenEvent>("genEvent") : nullptr;
61  auto recEvt = flow.GetBranchReadOnly<RecEvent>("recEvent");
62 
63  auto recJets = flow.GetBranchReadWrite<vector<RecJet>>("recJets");
64 
65  ControlPlots raw("raw");
66  ControlPlots nominal("HotKillers");
67 
68  for (DT::Looper looper(tIn); looper(); ++looper) {
69  [[ maybe_unused ]]
70  static auto& cout = steering & DT::verbose ? ::cout : DT::dev_null;
71 
72  auto ev_w = (isMC ? genEvt->weights.front().v : 1) * recEvt->weights.front().v;
73 
74  raw(*recJets, ev_w);
75 
76  for (auto& recJet: *recJets)
77  jetveto(recJet);
78 
79  nominal(*recJets, ev_w);
80 
81  if (steering & DT::fill) tOut->Fill();
82  }
83 
84  fOut->cd();
85  jetveto.Write(fOut);
86  raw.Write(fOut);
87  nominal.Write(fOut);
88 
89  metainfo.Set<bool>("git", "complete", true);
90 
91  cout << __func__ << ' ' << slice << " end" << endl;
92 }

◆ getConservativeMap()

void DAS::JetVeto::getConservativeMap ( const fs::path &  input,
const fs::path &  output,
const pt::ptree &  config,
const int  steering 
)

Maps the JetMET veto maps onto maps containing weights.

Todo:
make smart pointer? (last attempts led to seg)
Parameters
inputname of input root file
outputname of output root file
configconfig handled with `Darwin::Tools::Options`
steeringparameters obtained from explicit options
34 {
35  cout << __func__ << " start" << endl;
36 
37  if (!fs::exists(input))
38  BOOST_THROW_EXCEPTION( fs::filesystem_error("Jet veta map file does not exists.",
39  input, make_error_code(errc::no_such_file_or_directory)) );
40  auto fIn = make_unique<TFile>(input.c_str(), "READ");
41  auto histname = config.get<string>("corrections.jetvetomap.histname");
42  auto h = fIn->Get<TH2>(histname.c_str());
43  if (h == nullptr)
44  BOOST_THROW_EXCEPTION( DE::BadInput("Can't find the efficiency map", fIn) );
45  h->SetDirectory(0);
46  fIn->Close();
47 
48  auto fOut = make_unique<TFile>(output.c_str(), "RECREATE"); // TODO
49 
50  for (int x = 1; x <= h->GetNbinsX(); ++x)
51  for (int y = 1; y <= h->GetNbinsY(); ++y) {
52  auto content = h->GetBinContent(x,y);
53  static const auto deps = numeric_limits<float>::epsilon();
54  content = (content < deps); // 0 or 1, can then be used as an efficiency
55  h->SetBinContent(x,y,content);
56  }
57  h->GetXaxis()->SetTitle("#eta");
58  h->GetYaxis()->SetTitle("#phi");
59  h->GetZaxis()->SetRangeUser(0,1);
60 
61  h->SetDirectory(fOut.get());
62  h->Write("h2hot2");
63 
64  cout << __func__ << " end" << endl;
65 }
Darwin::Tools::fill
@ fill
activate -f to fill the tree
Definition: Options.h:27
Darwin::Tools::Flow
User-friendly handling of input and output n-tuples.
Definition: Flow.h:69
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:32
Darwin::Tools::MetaInfo
Generic meta-information for n-tuple (including speficities to Darwin).
Definition: MetaInfo.h:68
deps
static const double deps
Definition: Greta.h:18
Ntupliser_cfg.config
config
Definition: Ntupliser_cfg.py:264
DAS::Uncertainties::nominal
const Variation nominal
Definition: Variation.h:55
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
Ntupliser_cfg.isMC
string isMC
Definition: Ntupliser_cfg.py:59
jercExample.inputs
def inputs
Definition: jercExample.py:118
Darwin::Tools::dev_null
static std::ostream dev_null(nullptr)
to redirect output stream to nowhere
Darwin::Exceptions::BadInput
Generic exception for ill-defined input (before the event loop).
Definition: exceptions.h:83