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  unique_ptr<TChain> tIn = DT::GetChain(inputs);
49  unique_ptr<TFile> fOut(DT_GetOutput(output));
50  auto tOut = unique_ptr<TTree>(tIn->CloneTree(0));
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  RecEvent * recEvt = nullptr;
61  GenEvent * genEvt = nullptr;
62  tIn->SetBranchAddress("recEvent", &recEvt);
63  if (isMC)
64  tIn->SetBranchAddress("genEvent", &genEvt);
65 
66  vector<RecJet> * recJets = nullptr;
67  tIn->SetBranchAddress("recJets", &recJets);
68 
69  ControlPlots raw("raw");
70  ControlPlots nominal("HotKillers");
71 
72  for (DT::Looper looper(tIn, slice); looper(); ++looper) {
73  [[ maybe_unused ]]
74  static auto& cout = (steering & DT::verbose) == DT::verbose ? ::cout : DT::dev_null;
75 
76  auto ev_w = (isMC ? genEvt->weights.front().v : 1) * recEvt->weights.front().v;
77 
78  raw(*recJets, ev_w);
79 
80  for (auto& recJet: *recJets)
81  jetveto(recJet);
82 
83  nominal(*recJets, ev_w);
84 
85  if ((steering & DT::fill) == DT::fill) tOut->Fill();
86  }
87 
88  fOut->cd();
89  jetveto.Write(fOut.get());
90  raw.Write(fOut.get());
91  nominal.Write(fOut.get());
92 
93  metainfo.Set<bool>("git", "complete", true);
94  fOut->cd();
95  tOut->Write();
96 
97  cout << __func__ << ' ' << slice << " end" << endl;
98 }

◆ 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");
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 }
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
Darwin::Tools::MetaInfo
Generic meta-information for n-tuple (including speficities to Darwin).
Definition: MetaInfo.h:65
deps
static const double deps
Definition: Greta.h:18
Darwin::Tools::fill
@ fill
activate -f to fill the tree
Definition: Options.h:28
Ntupliser_cfg.config
config
Definition: Ntupliser_cfg.py:263
DAS::Uncertainties::nominal
const Variation nominal
Definition: Variation.h:109
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
DT_GetOutput
#define DT_GetOutput(output)
Definition: FileUtils.h:96
Darwin::Exceptions::BadInput
Generic exception for ill-defined input (before the event loop).
Definition: exceptions.h:68