DAS  3.0
Das Analysis System
DAS::Photon Namespace Reference

Classes

class  ConversionVetoApplier
 
class  IDApplier
 

Functions

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

Function Documentation

◆ applyPhotonConversionVeto()

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

Applies one of the photon conversion veto and (optionally) scale factors.

This function fetches the scale factor for the ID cut previously applied using applyPhotonID (automatically retrieved from the metainfo).

Todo:
ControlPlots
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
120  {1,0}
121  )
122 {
123  cout << __func__ << ' ' << slice << " start" << endl;
124 
125  unique_ptr<TChain> tIn = DT::GetChain(inputs);
126  unique_ptr<TFile> fOut(DT_GetOutput(output));
127  auto tOut = unique_ptr<TTree>(tIn->CloneTree(0));
128 
129  DT::MetaInfo metainfo(tOut);
130  metainfo.Check(config);
131 
132  vector<RecPhoton> * recPhotons = nullptr;
133  tIn->SetBranchAddress("recPhotons", &recPhotons);
134 
135  auto ID = metainfo.Get<string>("corrections", "photons", "ID", "WP");
136  auto table = config.get<fs::path>("corrections.photons.conversion_veto.table");
137  auto type = config.get<string>("corrections.photons.conversion_veto.type");
138  metainfo.Set<string>("corrections", "photons", "conversion_veto", "type", type);
139  metainfo.Set<fs::path>("corrections", "photons", "conversion_veto", "table", table);
140 
141  ConversionVetoApplier applier(table, ID, table != "/dev/null",
142  steering & DT::syst, type);
143  for (const auto& name: applier.weightNames())
144  metainfo.Set<string>("variations", RecPhoton::WeightVar, name);
145 
147 
148  for (DT::Looper looper(tIn, slice); looper(); ++looper) {
149  [[ maybe_unused]]
150  static auto& cout = steering & DT::verbose ? ::cout : DT::dev_null;
151 
152  applier(*recPhotons);
153 
154  static const bool fillTree = steering & DT::fill;
155  if (fillTree) tOut->Fill();
156  }
157 
158  metainfo.Set<bool>("git", "complete", true);
159  fOut->cd();
160  tOut->Write();
161 
162  cout << __func__ << ' ' << slice << " stop" << endl;
163 }

◆ applyPhotonID()

void DAS::Photon::applyPhotonID ( const vector< fs::path > &  inputs,
const fs::path &  output,
const pt::ptree &  config,
const int  steering,
const DT::Slice  slice = {1,0} 
)
Todo:
ControlPlots
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
100  {1,0}
101  )
102 {
103  cout << __func__ << ' ' << slice << " start" << endl;
104 
105  unique_ptr<TChain> tIn = DT::GetChain(inputs);
106  unique_ptr<TFile> fOut(DT_GetOutput(output));
107  auto tOut = unique_ptr<TTree>(tIn->CloneTree(0));
108 
109  DT::MetaInfo metainfo(tOut);
110  metainfo.Check(config);
111 
112  vector<RecPhoton> * recPhotons = nullptr;
113  tIn->SetBranchAddress("recPhotons", &recPhotons);
114 
115  auto ID = config.get<string>("corrections.photons.ID.WP");
116  auto path = config.get<fs::path>("corrections.photons.ID.table");
117  metainfo.Set<string>("corrections", "photons", "ID", "WP", ID);
118  metainfo.Set<fs::path>("corrections", "photons", "ID", "table", path);
119  IDApplier applier(path, ID, path != "/dev/null", steering & DT::syst);
120  for (const auto& name: applier.weightNames())
121  metainfo.Set<string>("variations", RecPhoton::WeightVar, name);
122 
124 
125  for (DT::Looper looper(tIn, slice); looper(); ++looper) {
126  [[ maybe_unused]]
127  static auto& cout = steering & DT::verbose ? ::cout : DT::dev_null;
128 
129  applier(*recPhotons);
130 
131  static const bool fillTree = steering & DT::fill;
132  if (fillTree) tOut->Fill();
133  }
134 
135  metainfo.Set<bool>("git", "complete", true);
136  fOut->cd();
137  tOut->Write();
138 
139  cout << __func__ << ' ' << slice << " stop" << endl;
140 }
DYToLL_M-50_13TeV_pythia8_cff_GEN_SIM_RECOBEFMIX_DIGI_L1_DIGI2RAW_L1Reco_RECO.name
name
Definition: DYToLL_M-50_13TeV_pythia8_cff_GEN_SIM_RECOBEFMIX_DIGI_L1_DIGI2RAW_L1Reco_RECO.py:48
Darwin::Tools::syst
@ syst
activate -s to systematic uncertainties
Definition: Options.h:30
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
Darwin::Tools::fill
@ fill
activate -f to fill the tree
Definition: Options.h:28
Ntupliser_cfg.config
config
Definition: Ntupliser_cfg.py:263
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