DAS  3.0
Das Analysis System
DAS::Normalisation Namespace Reference

Classes

struct  Efficiency
 
struct  Functor
 
struct  LumiUnc
 
struct  TriggerEff
 
struct  TriggerLumi
 

Enumerations

enum  { WEIGHT = 0b001, SIGN = 0b010, CUTOFF = 0b100 }
 

Functions

void getHLTJetResponse (const vector< fs::path > &inputs, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0})
 
unique_ptr< TH3 > makeRespHist (TString name, TString study)
 
void applyDataNormalisation (const vector< fs::path > &inputs, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0})
 
void reset (Weights &wgts, const double v=0)
 
float GetNormFactor (const fs::path &f_sumWgts, const float xsec)
 
void applyMClumi (const vector< fs::path > &inputs, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0})
 
void applyNormFactor (const vector< fs::path > &inputs, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0})
 
void getSumWeights (const vector< fs::path > &inputs, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0})
 
std::vector< DAS::RecJet >::iterator phaseSel (std::vector< DAS::RecJet > &recjets)
 
std::ostream & operator<< (std::ostream &Stream, const TriggerLumi &tr_lu)
 
float getPrescale (Trigger *trigger, size_t indx)
 
void getTriggerCurves (const vector< fs::path > &inputs, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0})
 
void getTriggerTurnons (const fs::path &input, const fs::path &outputRoot, const fs::path &outputTxt, const pt::ptree &config, const int steering)
 
DAS::FourVector match (const DAS::FourVector &jet, const std::vector< DAS::FourVector > *hltJets)
 
float GetX (TF1 *f)
 
template<typename STREAM >
TF1 * FitTriggerEfficiency (int trigger, TH1 *h, STREAM &Stream, int from, const char *options="NQERS")
 
template<typename STREAM >
float GetTriggerEfficiency (int trigger, TH1 *h, STREAM &Stream, float from, float minEff)
 

Variables

vector< double > thresholds
 
int nThresholds
 
const float threshold = 0.995
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
WEIGHT 

use the weights

SIGN 

use the sign

CUTOFF 

apply a selection on the weight

27  {
28  WEIGHT = 0b001,
29  SIGN = 0b010,
30  CUTOFF = 0b100
31 };

Function Documentation

◆ applyDataNormalisation()

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

Apply the the kinematic selection, ensuring that events in the dataset have fired a trigger and correcting the weight of the events with the associated trigger prescales, trigger efficiency, and total luminosity. The weight $\frac{ \text{Prescale} * \mathcal{L}^{-1} }{ \epsilon_\text{trigger} } $ is applied by event. The argument 'strategy' defines the selection criterion of the events and the calculation of the weight (see functor in applyDataNormalisation.h).

Todo:
add lumi unc variations
Todo:
revisit the logic (having inputs modified + a return object may be confusing)
Todo:
reimplement the logic to avoid a selection on the weight
Parameters
inputsinput ROOT files (n-tuple)
outputoutput ROOT file (n-tuple)
configconfig handled with `Darwin::Tools::Options`
steeringparameters obtained from explicit options
slicenumber and index of slice
48  {1,0}
49  )
50 {
51  cout << __func__ << ' ' << slice << " start" << endl;
52 
53  unique_ptr<TChain> tIn = DT::GetChain(inputs);
54  unique_ptr<TFile> fOut(DT_GetOutput(output));
55  auto tOut = unique_ptr<TTree>(tIn->CloneTree(0));
56 
57  DT::MetaInfo metainfo(tOut);
58  metainfo.Check(config);
59  auto isMC = metainfo.Get<bool>("flags", "isMC");
60  if (isMC)
61  BOOST_THROW_EXCEPTION( DE::BadInput("Only real data may be used as input.", metainfo) );
62 
63  RecEvent * event = nullptr;
64  Trigger * trigger = nullptr;
65  tIn->SetBranchAddress("recEvent", &event);
66  tIn->SetBranchAddress("jetTrigger", &trigger);
67  vector<FourVector> * hltJets = nullptr;
68  vector<RecJet> * recJets = nullptr;
69  tIn->SetBranchAddress("hltJets", &hltJets);
70  tIn->SetBranchAddress("recJets", &recJets);
71 
72  int year = metainfo.Get<int>("flags", "year");
73 
74  // defining functor to apply data prescales
75  auto lumi_file = config.get<fs::path>("corrections.normalisation.luminosities" ),
76  unc_file = config.get<fs::path>("corrections.normalisation.uncertainties"),
77  turnon_file = config.get<fs::path>("corrections.normalisation.turnons" ),
78  efficiencies = config.get<fs::path>("corrections.normalisation.efficiencies" );
79  auto strategy = config.get<string>("corrections.normalisation.strategy"),
80  method = config.get<string>("corrections.normalisation.method" );
81  Functor normalisation(lumi_file, turnon_file, efficiencies, strategy, method, year);
82  LumiUnc lumi_unc(unc_file, year);
83  fOut->cd();
84 
85  bool applySyst = steering & DT::syst;
86  if (applySyst)
87  for (string source: lumi_unc.sources)
88  metainfo.Set<string>("variations", RecEvent::WeightVar, source);
89 
90  // a few control plots
91  ControlPlots::isMC = false;
92  ControlPlots corrNoTrigEff("corrNoTrigEff");
93 
94  vector<ControlPlots> corr { ControlPlots("nominal") };
95  TList * ev_wgts = metainfo.List("variations", RecEvent::WeightVar);
96  for (TObject * obj: *ev_wgts) {
97  auto name = dynamic_cast<TObjString*>(obj)->GetString();
98  corr.push_back(ControlPlots(name));
99  }
100  //if (applySyst)
102 
103  for (DT::Looper looper(tIn, slice); looper(); ++looper) {
104  [[ maybe_unused ]]
105  static auto& cout = steering & DT::verbose ? ::cout : DT::dev_null;
106 
107  if (applySyst)
108  lumi_unc(event);
109 
110  if (recJets->size() == 0) continue;
111 
112  RecJet leadingJet = normalisation(*event, *recJets, *hltJets, *trigger);
113  cout << "leadingJet: " << leadingJet << endl;
114  // the normalisation itself is done in `Normalisation::Functor`
116 
118  if (event->weights.front() <= 0) continue;
119  if (steering & DT::fill) tOut->Fill();
120 
121  float evtWgts = event->weights.front();
122  float efficiency = normalisation.eff(leadingJet);
123 
124  cout << "evtWgts = " << evtWgts << '\n'
125  << "efficiency = " << efficiency << endl;
126  if (efficiency <= 0) continue;
127 
128  corrNoTrigEff(*recJets, evtWgts*efficiency); // compensate
129  for (size_t i = 0; i < corr.size(); ++i)
130  corr.at(i)(*recJets, event->weights.at(i));
131 
132  // Exclusive curves are filled (i.e. one event can populate only a trigger curve).
133  // The ibit value is determined by
134  // the leading jet but also the other jets of the event can populate the trigger curve.
135  for (auto& jet: *recJets) {
136  float y = jet.AbsRap();
137  float w = event->weights.front();
138  normalisation.eff.contribs.at(normalisation.ibit)->Fill(jet.CorrPt(), y, w);
139  }
140  }
141 
142  fOut->cd();
143  corrNoTrigEff.Write(fOut.get());
144  for (size_t i = 0; i < corr.size(); ++i)
145  corr.at(i).Write(fOut.get());
146  TDirectory * controlplots = fOut->mkdir("controlplots");
147  controlplots->cd();
148  for (TH2 * h: normalisation.eff.contribs) {
149  h->SetDirectory(controlplots);
150  h->Write();
151  }
152 
153  metainfo.Set<bool>("git", "complete", true);
154  fOut->cd();
155  tOut->Write();
156 
157  cout << __func__ << ' ' << slice << " stop" << endl;
158 }

◆ applyMClumi()

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

Normalise with sum of weights (to be computed) and cross section (given)

Note
A cut-off for events with hard scale above 5 TeV is applied, since these events are not realistic
Todo:
Events with scale > 5TeV are removed because Pythia used to generate too many of them. Check that this is still needed and that the cut is still appropriate.
Parameters
inputsinput ROOT files (n-tuple)
outputoutput ROOT file (n-tuple)
configconfig handled with `Darwin::Tools::Options`
steeringparameters obtained from explicit options
slicenumber and index of slice
66  {1,0}
67  )
68 {
69  cout << __func__ << ' ' << slice << " start" << endl;
70 
71  unique_ptr<TChain> tIn = DT::GetChain(inputs);
72  unique_ptr<TFile> fOut(DT_GetOutput(output));
73  auto tOut = unique_ptr<TTree>(tIn->CloneTree(0));
74 
75  DT::MetaInfo metainfo(tOut);
76  metainfo.Check(config);
77  auto isMC = metainfo.Get<bool>("flags", "isMC");
78  if (!isMC) BOOST_THROW_EXCEPTION( DE::BadInput("Only MC may be used as input.",
79  make_unique<TFile>(inputs.front().c_str() )) );
80 
81  // normalisation factor
82  auto f_sumWgts = config.get<fs::path>("corrections.MCnormalisation.sumWgts");
83  auto xsection = config.get<float>("corrections.MCnormalisation.xsection");
84  float factor = GetNormFactor(f_sumWgts, xsection);
85  metainfo.Set<fs::path>("corrections", "MCnormalisation", "sumWgts", f_sumWgts);
86  metainfo.Set<float>("corrections", "MCnormalisation", "xsection", xsection);
87 
88  // declaring branches
89  RecEvent * recEvt = nullptr;
90  GenEvent * genEvt = nullptr;
91  PileUp * pileup = nullptr;
92  tIn->SetBranchAddress("recEvent", &recEvt);
93  if (isMC)
94  tIn->SetBranchAddress("genEvent", &genEvt);
95  tIn->SetBranchAddress("pileup", &pileup);
96  vector<GenJet> * genjets = nullptr;
97  vector<RecJet> * recjets = nullptr;
98  if (branchExists(tIn, "recJets"))
99  tIn->SetBranchAddress("recJets", &recjets);
100  if (branchExists(tIn, "genJets"))
101  tIn->SetBranchAddress("genJets", &genjets);
102 
103  // control plot
104  ControlPlots::isMC = true;
105  ControlPlots plots("controlplots");
106 
107  for (DT::Looper looper(tIn, slice); looper(); ++looper) {
108  [[ maybe_unused ]]
109  static auto& cout = steering & DT::verbose ? ::cout : DT::dev_null;
110 
113  if (genEvt->hard_scale > 5000 /* GeV */) continue;
114 
115  // sanity check
116  if (genEvt->weights.size() != 1 || recEvt->weights.size() != 1)
117  BOOST_THROW_EXCEPTION( DE::AnomalousEvent("Unexpected event weights", tIn) );
118  if (recjets != nullptr && recjets->size() > 0 && recjets->front().scales.size() > 1)
119  BOOST_THROW_EXCEPTION( DE::AnomalousEvent("Unexpected jet energy scale variations", tIn) );
120 
121  // renormalisation
122  genEvt->weights.front() *= factor;
123  if (steering & DT::fill) tOut->Fill();
124 
125  // control plot
126  if (genjets != nullptr)
127  plots(*genjets, genEvt->weights.front() );
128  if (recjets != nullptr)
129  plots(*recjets, genEvt->weights.front() * recEvt->weights.front());
130  }
131 
132  metainfo.Set<bool>("git", "complete", true);
133  fOut->cd();
134  tOut->Write();
135 
136  plots.Write(fOut.get());
137 
138  cout << __func__ << ' ' << slice << " stop" << endl;
139 }

◆ applyNormFactor()

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

Multiplies the gen weight of every event by a factor provided on the command line.

Parameters
inputsinput ROOT files (n-tuple)
outputoutput ROOT file (n-tuple)
configconfig handled with `Darwin::Tools::Options`
steeringparameters obtained from explicit options
slicenumber and index of slice
41  {1,0}
42  )
43 {
44  cout << __func__ << ' ' << slice << " start" << endl;
45 
46  unique_ptr<TChain> tIn = DT::GetChain(inputs);
47  unique_ptr<TFile> fOut(DT_GetOutput(output));
48  auto tOut = unique_ptr<TTree>(tIn->CloneTree(0));
49 
50  DT::MetaInfo metainfo(tOut);
51  metainfo.Check(config);
52  auto isMC = metainfo.Get<bool>("flags", "isMC");
53  if (!isMC) BOOST_THROW_EXCEPTION( DE::BadInput("Only MC may be used as input.",
54  make_unique<TFile>(inputs.front().c_str() )) );
55 
56  const float factor = config.get<float>("corrections.normFactor");
57  metainfo.Set<float>("corrections", "normFactor", factor);
58 
59  // declaring branches
60  GenEvent * evnt = nullptr;
61  tIn->SetBranchAddress("genEvent", &evnt);
62 
63  for (DT::Looper looper(tIn, slice); looper(); ++looper) {
64  [[ maybe_unused ]]
65  static auto& cout = (steering & DT::verbose) == DT::verbose ? ::cout : DT::dev_null;
66 
67  // sanity check
68  if (evnt->weights.size() != 1)
69  BOOST_THROW_EXCEPTION( DE::AnomalousEvent("Unexpected event weights", tIn) );
70 
71  // normalise
72  for (auto& weight: evnt->weights) {
73  weight *= factor;
74  }
75 
76  if ((steering & DT::fill) == DT::fill) tOut->Fill();
77  }
78 
79  metainfo.Set<bool>("git", "complete", true);
80  fOut->cd();
81  tOut->Write();
82 
83  cout << __func__ << ' ' << slice << " stop" << endl;
84 }

◆ FitTriggerEfficiency()

TF1* DAS::Normalisation::FitTriggerEfficiency ( int  trigger,
TH1 *  h,
STREAM &  Stream,
int  from,
const char *  options = "NQERS" 
)

Fit the trigger efficiency with sigmoid function in [trigger, 3* trigger], where trigger is the HLT pt threshold.

The sigmoid function is defined as follows:

\epsilon (p_T) = a + 0.5 \times (1-a) \times \left( 1 + \erf \left( \frac{p_T - \mu}{\sigma} \right) \right)

where a, $\mu$ and $\sigma$ are the three parameters.

NOTE:

  • the output is very sensitive to the fit range
  • unclear if/how JES uncertainties should be taken into account
Parameters
triggertrigger HLT threshold
hefficiency histogram
Stream`cout` or file
fromlast turnon, to know from where the ref is efficient
optionsfit options for TF1 function
54 {
55  assert(from > 0);
56  int mbin = h->GetXaxis()->FindBin( from),
57  Mbin = h->GetXaxis()->FindBin(3*from);
58  float m = h->GetBinLowEdge(mbin+1), M = h->GetBinLowEdge(Mbin);
59  for (int bin = 0; bin <= mbin; ++bin) {
60  h->SetBinContent(bin, 0);
61  h->SetBinError (bin, 0);
62  }
63  for (int bin = Mbin+1; bin <= h->GetNbinsX()+1; ++bin) {
64  h->SetBinContent(bin, 0);
65  h->SetBinError (bin, 0);
66  }
67 
68  cout << "Fitting trigger " << trigger << " from " << m << " to " << M << endl;
69 
70  // function
71  TF1 * f = new TF1(Form("sigmoid%d", trigger),
72  "[0]+0.5*(1-[0])*(1+erf((x-[1])/[2]))",
73  m, M);
74 
75  f->SetParNames("a", "#mu", "#sigma");
76 
77  //f->FixParameter(0,0);
78  f->SetParameter(0,0.1);
79  f->SetParLimits(0,0,0.9);
80 
81  f->SetParameter(1,1.1*trigger);
82  f->SetParLimits(1,m,M);
83 
84  f->SetParameter(2,10);
85  f->SetParLimits(2,1,150);
86 
87  // fit
88  h->Fit(f, options, "", m, M);
89 
90  float turnon = GetX(f);
91 
92  Stream << trigger << '\t' << turnon << '\n';
93 
94  return f;
95 }

◆ getHLTJetResponse()

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

Get HLT single-jet response in bins of kinematics in real data. The output can be used as input to fitJetResponse to determine and understand the deviations from the Gaussian expectations, which prevent from fitting the trigger efficiency with the error function.

Parameters
inputsinput ROOT files (n-tuples)
outputname of output ROOT file (histograms)
configconfig file from `DTOptions`
steeringsteering parameters from `DTOptions`
sliceslices for running
46  {1,0}
47  )
48 {
49  cout << __func__ << ' ' << slice << " start" << endl;
50 
51  unique_ptr<TChain> tIn = DT::GetChain(inputs);
52  unique_ptr<TFile> fOut(DT_GetOutput(output));
53  auto tOut = unique_ptr<TTree>(tIn->CloneTree(0));
54 
55  DT::MetaInfo metainfo(tOut);
56  metainfo.Check(config);
57  auto isMC = metainfo.Get<bool>("flags", "isMC");
58  if (isMC)
59  BOOST_THROW_EXCEPTION( DE::BadInput("Only DATA may be used as input.", metainfo) );
60 
61  RecEvent * rEv = nullptr;
62  tIn->SetBranchAddress("recEvent", &rEv);
63 
64  vector<RecJet> * recjets = nullptr;
65  vector<FourVector> * hltjets = nullptr;
66  tIn->SetBranchAddress("recJets", &recjets);
67  tIn->SetBranchAddress("hltJets", &hltjets);
68 
69  unique_ptr<TH3> inclResp = makeRespHist("inclusive", "HLT"); // Inclusive response
70 
71  for (DT::Looper looper(tIn, slice); looper(); ++looper) {
72  [[ maybe_unused ]]
73  static auto& cout = steering & DT::verbose ? ::cout : DT::dev_null;
74 
75  auto recWgt = rEv->weights.front();
76  // Matching & Fill response
77  for (const RecJet& recjet: *recjets) {
78  FourVector hltjet = match(recjet.p4, hltjets);
79  auto ptrec = recjet.CorrPt();
80  auto pthlt = hltjet.Pt();
81 
82  int pthltbin = inclResp->GetXaxis()->FindBin(pthlt);
83  double hlt_lowedge = inclResp->GetXaxis()->GetBinLowEdge(pthltbin);
84 
85  // Fill response
86  auto response = ptrec/hlt_lowedge;
87  auto yrec = recjet.AbsRap();
88 
89  inclResp->Fill(pthlt, yrec, response, recWgt);
90 
91  } // End of recjets' loop
92  } // End of event loop
93 
94  // Creating directory hierarchy and saving histograms
95  inclResp->SetDirectory(fOut.get());
96  inclResp->SetTitle("Response");
97  inclResp->Write("Response");
98 
99  fOut->cd();
100  metainfo.Set<bool>("git", "complete", true);
101  tOut->Write();
102 
103  cout << __func__ << ' ' << slice << " end" << endl;
104 }

◆ GetNormFactor()

float DAS::Normalisation::GetNormFactor ( const fs::path &  f_sumWgts,
const float  xsec 
)

Retrieve the sum of the weights obtained with getSumWeights and combines it with the input cross section to calculate the normalisation factor.

Parameters
f_sumWgtsfile containing the hist
xseccross section value
39 {
40  if (!fs::exists(f_sumWgts))
41  BOOST_THROW_EXCEPTION( fs::filesystem_error(f_sumWgts.string() + " not found"s,
42  make_error_code(errc::no_such_file_or_directory)) );
43  unique_ptr<TFile> f(TFile::Open(f_sumWgts.c_str()));
44  auto h = unique_ptr<TH2>(f->Get<TH2>("hSumWgt"));
45  auto sumw = h->Integral(0, -1, // duplicates in overflow cancel overweighted entries
46  1, 2); // both positive and negative weights
47  if (sumw <= 0)
48  BOOST_THROW_EXCEPTION( DE::BadInput("Negative sum of weights.", h) );
49  if (xsec <= 0)
50  BOOST_THROW_EXCEPTION( invalid_argument("Negative cross section.") );
51  auto factor = xsec/sumw;
52  cout << xsec << '/' << sumw << '=' << factor << endl;
53  return factor;
54 }

◆ getPrescale()

float DAS::Normalisation::getPrescale ( Trigger trigger,
size_t  indx 
)
98 {
99  float preHLT = trigger->PreHLT[indx];
100  float preL1min = trigger->PreL1min[indx];
101  float preL1max = trigger->PreL1max[indx];
102  assert(preL1min == preL1max);
103  float prescale = preHLT * preL1min;
104  return prescale;
105 }

◆ getSumWeights()

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

Sum the weights from ROOT n-tuple. Mostly useful for MC to estimate the effective number of events, which is necessary to normalise.

The histogram is filled in a way so that it can be used for two purposes:

  • provide a distribution of the weights and choose a max weight,
  • extract the normalisation factor by takaing its integral.
Note
The values beyond maxAbsValue are filled a 2nd time in the overflow with the opposite weight. The truncated sum of the weights is then obtained from the integral by including the overflow.
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
45  {1,0}
46  )
47 {
48  cout << __func__ << ' ' << slice << " start" << endl;
49 
50  unique_ptr<TChain> tIn = DT::GetChain(inputs);
51  unique_ptr<TFile> fOut(DT_GetOutput(output));
52  auto tOut = unique_ptr<TTree>(tIn->CloneTree(0)); // ghost tree: only to keep meta info
53 
54  DT::MetaInfo metainfo(tOut);
55  metainfo.Check(config);
56  auto isMC = metainfo.Get<bool>("flags", "isMC");
57  if (!isMC) BOOST_THROW_EXCEPTION( DE::BadInput("Only MC may be used as input.",
58  make_unique<TFile>(inputs.front().c_str() )) );
59 
60  const auto maxAbsValue = config.get<float>("corrections.weights.maxAbsValue");
61  const auto mode = config.get<string>("corrections.weights.mode");
62 
63  cout << "maxAbsValue = " << maxAbsValue << endl;
64 
65  GenEvent * evnt = nullptr;
66  tIn->SetBranchAddress("genEvent", &evnt);
67 
68  TString title = ";log_{10}(w);sign;#sum_{i=1}^{events} w_{i}";
69  if (maxAbsValue > 0) title = Form("w < %d", maxAbsValue);
70  auto h = make_unique<TH2D>("hSumWgt", title, 100, 3, 40,
71  2, -1, 1);
72  const double overflow = h->GetXaxis()->GetXmax()+1.;
73 
74  uint32_t wm = 0;
75  if (mode == "weight" ) wm = WEIGHT | SIGN;
76  else if (mode == "signOnly") wm = SIGN;
77  else if (mode != "count" )
78  BOOST_THROW_EXCEPTION( invalid_argument(mode + " is unknown") );
79 
80  if (maxAbsValue > 0) wm |= CUTOFF;
81 
82  cout << "wm = " << bitset<8>(wm) << endl;
83 
84  if (steering & DT::verbose)
85  cout << setw(20) << "w"
86  << setw(20) << "absw"
87  << setw(20) << "x [log10(abs(w))]"
88  << setw(20) << "y [sign]"
89  << setw(20) << "z [eff. weight]" << endl;
90 
91  for (DT::Looper looper(tIn, slice); looper(); ++looper) {
92  [[ maybe_unused ]]
93  static auto& cout = steering & DT::verbose ? ::cout : DT::dev_null;
94 
95  const double w = evnt->weights.front();
96  if (w == 0.) continue;
97 
98  if (!isfinite(w))
99  BOOST_THROW_EXCEPTION( runtime_error("Infinite or NaN weight:"s + w) );
100 
101  // the weight is used twice:
102  // - once for the bin to fill, which should always be [log(abs(w)),+/-1]
103  // - once for the actual weight in the histogram, which depends on the options
104 
105  const double absw = std::abs(w),
106  x = log10(absw),
107  y = copysign(0.5,w); // bin center
108  double z = wm & WEIGHT ? absw : 1;
109  if (wm & SIGN) z = copysign(z,w);
110 
111  cout << setw(20) << w
112  << setw(20) << absw
113  << setw(20) << x
114  << setw(20) << (2*y) // we want the sign only (bin center is irrelevant)
115  << setw(20) << z << endl;
116 
117  h->Fill(x, y, z);
118 
119  if (x >= overflow)
120  cerr << orange << "Warning: a good weight is being filled in the overflow.\n" << def;
121 
125  if ((wm & CUTOFF) && absw >= maxAbsValue)
126  h->Fill(overflow, y, -z);
127  }
128 
129  metainfo.Set<bool>("git", "complete", true);
130 
131  h->Write();
132  tOut->Write();
133 
134  cout << __func__ << ' ' << slice << " end" << endl;
135 }

◆ getTriggerCurves()

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

Get trigger curves from the data n-tuples.

Todo:
fix error
Todo:
fix error
Parameters
inputsinput ROOT file (n-tuple)
outputoutput ROOT file (n-tuple)
configconfig handled with `Darwin::Tools::options`
steeringparameters obtained from explicit options
slicenumber and index of slice
114  {1,0}
115  )
116 {
117  //cout << __func__ << ' ' << slice << " start" << endl;
119 
120  unique_ptr<TChain> tIn = DT::GetChain(inputs);
121  unique_ptr<TFile> fOut(DT_GetOutput(output));
122  auto tOut = unique_ptr<TTree>(tIn->CloneTree(0));
123 
124  DT::MetaInfo metainfo(tOut);
125  metainfo.Check(config);
126 
127  const auto usePrescales = config.get<bool>("corrections.normalisation.use_prescales");
128  metainfo.Set<bool>("corrections", "normalisation", "use_prescales", usePrescales);
129 
130  auto lumi_file = config.get<fs::path>("corrections.normalisation.luminosities");
131  pt::ptree triggers_lumi;
132  pt::read_info(lumi_file.string(), triggers_lumi);
133  for (auto const& trigger_lumi: triggers_lumi)
134  thresholds.push_back(stoi(trigger_lumi.first));
135  nThresholds = thresholds.size()-1;
136  metainfo.Set<fs::path>("corrections", "normalisation", "luminosities", lumi_file);
137 
138  Trigger * trigger = nullptr;
139  tIn->SetBranchAddress("jetTrigger", &trigger);
140 
141  vector<RecJet> * recjets = nullptr;
142  vector<FourVector> * hltjets = nullptr;
143  tIn->SetBranchAddress("recJets", &recjets);
144  tIn->SetBranchAddress("hltJets", &hltjets);
145 
146  map<TString, size_t> methods { // methods[name] = shift (first trigger for which the method is used)
147  {"emulation", 1}, // default method
148  {"emulationShift", 2}, // emulation but with a lower-threshold reference trigger (e.g. trig 40 as reference for trig 80 as test)
149  {"TnP", 0} // tag-and-probe method (used in any case of the lowest reference trigger(s)
150  };
151 
152  TH2 * pt_correlation = new TH2F("ptCorr","; p_{T}^{PF,corr}; p_{T}^{hlt}",nPtBins,pt_edges.data(),nPtBins,pt_edges.data());
153  TH1 * Deta = new TH1F("deta","; #Delta #eta; nevt", 200, -5, 5);
154  TH1 * Dphi = new TH1F("dphi","; #Delta #phi; nevt", 200, -M_PI, M_PI);
155  TH1 * dR = new TH1F("dR" ,"; #Delta R; nevt" , 200, 0, 10);
156 
157  map<TString, map<int, Efficiency>> curves;
158  for (auto method: methods)
159  for (size_t i = method.second; i < thresholds.size(); ++i) {
160  int t = thresholds.at(i);
161  cout << method.first << '\t' << t << '\n';
162  curves[method.first].insert( {t, Efficiency(method.first, t)} );
163  }
164  cout << flush;
165 
166  for (DT::Looper looper(tIn, slice); looper(); ++looper) {
167  [[ maybe_unused ]]
168  static auto& cout = (steering & DT::verbose) == DT::verbose ? ::cout : DT::dev_null;
169 
170  // sanity check
171  size_t nbits = trigger->Bit.size();
172  if (nbits < thresholds.size())
173  BOOST_THROW_EXCEPTION( DE::AnomalousEvent( Form("nbits = %ld < thresholds.size() = %ld",
174  nbits, thresholds.size()), tIn) );
175 
176  // avoid empty events
177  if (recjets->size() == 0) continue;
178 
179  for (const RecJet& pfjet: *recjets){
180  FourVector hltjet = match(pfjet.p4, hltjets);
181  if ( hltjet == FourVector()) continue;
182 
183  Deta->Fill(pfjet.p4.Eta() - hltjet.Eta(), pfjet.weights.front());
184  Dphi->Fill(DeltaPhi(pfjet.p4,hltjet), pfjet.weights.front());
185  dR->Fill(DeltaR(pfjet.p4, hltjet), pfjet.weights.front());
186  pt_correlation->Fill(pfjet.CorrPt(), hltjet.Pt(), pfjet.weights.front());
187  }
188 
189  // NOTE: from now on, only the leading jet is considered
190 
191  auto leadingInTk = phaseSel(*recjets); // iterator
192 
193  if (leadingInTk == recjets->end()) continue;
194 
195  FourVector pfjet0 = leadingInTk->p4;
196  pfjet0 *= leadingInTk->scales.front();
197 
198  FourVector hltjet0 = match(pfjet0, hltjets);
199  if ( hltjet0 == FourVector()) continue;
200 
201  /*** using emulation method(s) ***/
202  for (auto method: methods) {
203 
204  if (method.first.Contains("TnP")) continue;
205  size_t shift = method.second;
206 
207  for (size_t i = shift; i < thresholds.size(); ++i) {
208 
209  int t = thresholds[i];
210  auto& eff = curves.at(method.first).at(t);
211 
212  eff.hAll->Fill(pfjet0.Pt(), hltjet0.Pt());
213 
214  // test if previous trigger has fired
215  if (!trigger->Bit[i-shift]) continue;
216  eff.hFired->Fill(pfjet0.Pt(), hltjet0.Pt());
217 
218  if (hltjet0.Pt() < thresholds.at(i-shift)) continue;
219  eff.hFiredThreshold->Fill(pfjet0.Pt(), hltjet0.Pt());
220 
221  float wgt = usePrescales ? getPrescale(trigger, i-shift) : 1;
222  bool fired = hltjet0.Pt() > t;
223  eff.Fill(pfjet0, fired, wgt*recjets->front().weights.front());
224 
225  eff.hHLTmap->Fill( pfjet0.Phi(),pfjet0.Eta(),wgt*recjets->front().weights.front() );
226  }
227  } // end of loop on methods
228 
229  /*** using tag & probe method ***/
230  for (size_t i = 0; i < thresholds.size(); ++i) {
231 
232  int t = thresholds[i];
233  auto& eff = curves.at("TnP").at(t);
234 
235  eff.hAll->Fill(pfjet0.Pt(), hltjet0.Pt());
236 
237  // first, it needs to have fired
238  if (!trigger->Bit[i])
239  continue;
240  eff.hFired->Fill(pfjet0.Pt(), hltjet0.Pt());
241 
242  // then we need dijet configurations at PF level:
243  // -> 1) at least 2 jets
244  if (recjets->size() == 1)
245  continue;
246  // -> 2) back-to-back jets
247  if (DeltaPhi(recjets->at(0).p4, recjets->at(1).p4) < 2.4) continue;
248  // -> 3) a possible 3rd jet should not be significant
249  if (recjets->size() > 2) {
250  const double pt0 = recjets->at(0).CorrPt(),
251  pt1 = recjets->at(1).CorrPt(),
252  pt2 = recjets->at(2).CorrPt();
253  if (pt2 > 0.15*(pt0 + pt1))
254  continue;
255  }
256 
257  // we take the probe and the tag randomly
258  static TRandom3 Rand(/* seed = */ metainfo.Seed<10989678>(slice));
259  double r = Rand.Uniform();
260  int itag = (r<0.5),
261  iprobe = (r>=0.5);
262 
263  FourVector pftag = recjets->at(itag ).p4,
264  pfprobe = recjets->at(iprobe).p4;
265 
266  float pfprobe_wgt = recjets->at(iprobe).weights.front();
267  float pftag_wgt = recjets->at(itag).weights.front();
268 
269  pftag *= recjets->at(itag ).scales.front();
270  pfprobe *= recjets->at(iprobe).scales.front();
271 
272  // -> 4) selection on the rapidity of the system
273  if (std::abs(recjets->at(itag).p4.Eta()) > 1.3) continue;
274 
275  // match PF at HLT
276  // 1) test if tag can be matched
277  // - if not, continue
278  // 2) then test if the probe can be match
279 
280  const FourVector& hlttag = match(pftag, hltjets);
281  const FourVector& hltprobe = match(pfprobe, hltjets);
282  if ( hlttag == FourVector() || hltprobe == FourVector()) continue;
283 
284  if (hlttag.Pt() > t) {
285  eff.hFiredThreshold->Fill(pfjet0.Pt(), hltjet0.Pt());
286 
287  const FourVector& hltprobe = match(pfprobe, hltjets);
288  bool fired = hltprobe.Pt() > t;
289 
290  float wgt = usePrescales ? getPrescale(trigger, i) : 1;
291  eff.Fill(pfprobe, fired, wgt * pftag_wgt * pfprobe_wgt);
292  eff.hHLTmap->Fill( pfjet0.Phi(),pfjet0.Eta(),wgt*recjets->front().weights.front() );
293  }
294  }
295  }
296 
297  cout << "Writing to file" << endl;
298  for (auto& method: curves) {
299  fOut->cd();
300  auto d = fOut->mkdir(method.first);
301  for (auto& curve: method.second)
302  curve.second.Write(d);
303  }
304  fOut->cd();
305  dR->Write();
306  Deta->Write();
307  Dphi->Write();
308  pt_correlation->Write();
309 
310  metainfo.Set<bool>("git", "complete", true);
311  fOut->cd();
312  tOut->Write();
313 
314  //cout << __func__ << ' ' << slice << " end" << endl;
316 }

◆ GetTriggerEfficiency()

float DAS::Normalisation::GetTriggerEfficiency ( int  trigger,
TH1 *  h,
STREAM &  Stream,
float  from,
float  minEff 
)

DON'T fit the trigger efficiency but just find the first bin above threshold

Todo:
Where does the factor 6 come from?
Parameters
triggertrigger HLT threshold
hefficiency histogram
Stream`cout` or file
fromlast turnon, to know from where the ref is efficient
minEffmin efficiency (e.g. different for barrel and forward region)
106 {
107  int mbin = h->GetXaxis()->FindBin( from),
108  Mbin = h->GetXaxis()->FindBin(6*from);
109  for (int bin = 0; bin < mbin; ++bin) {
110  h->SetBinContent(bin, 0);
111  h->SetBinError (bin, 0);
112  }
113  for (int bin = Mbin+1; bin <= h->GetNbinsX()+1; ++bin) {
114  h->SetBinContent(bin, 0);
115  h->SetBinError (bin, 0);
116  }
117  for (int bin = mbin; bin <= Mbin; ++bin) {
118  float content = h->GetBinContent(bin);
119  if (content < minEff) continue;
120  float turnon = h->GetBinLowEdge(bin);
121  Stream << trigger << '\t' << turnon << '\n';
122  return turnon;
123  }
124  return -1;
125 }

◆ getTriggerTurnons()

void DAS::Normalisation::getTriggerTurnons ( const fs::path &  input,
const fs::path &  outputRoot,
const fs::path &  outputTxt,
const pt::ptree &  config,
const int  steering 
)

Get the trigger turn-on points from the trigger curves.

Todo:
Use metainfo
Todo:
Get year from metainfo?
Todo:
Get lumis from metainfo?
Todo:
implement a more general logic to use only rapidity <3 turnons to determine the overall turnon
Parameters
inputinput ROOT file (n-tuple)
outputRootoutput ROOT file with efficiency
outputTxtoutput text file with turn-ons
configconfig handled with `Darwin::Tools::options`
steeringparameters obtained from explicit options
45 {
46  cout << __func__ << " start" << endl;
47 
48  unique_ptr<TFile> fOut(DT_GetOutput(outputRoot));
49 
51  //DT::MetaInfo metainfo(tOut);
52  //metainfo.Check(config);
53  int year = config.get<int>("flags.year");
54 
55  cout << setw(10) << "trigger";
56  for (auto yBin: yBins) cout << setw(18) << yBin;
57  cout << endl;
58 
59  pt::ptree triggers_lumi;
60  auto lumi_file = config.get<fs::path>("corrections.normalisation.luminosities");
61  pt::read_info(lumi_file.c_str(), triggers_lumi);
62  vector<int> triggerThresholds;
63  for (auto trigger_lumi: triggers_lumi)
64  triggerThresholds.push_back(stoi(trigger_lumi.first));
65 
66  auto fIn = make_unique<TFile>(input.c_str(), "READ");
67  map<int, int> turnonsFinal;
68  TIter Next(fIn->GetListOfKeys()) ;
69  TKey* key = nullptr;
70  TString defMethod = "TnP"; // only for the first trigger(s)
71  while ( (key = dynamic_cast<TKey*>(Next())) ) { // looping over methods
72  if (TString(key->ReadObj()->ClassName()) != TString("TDirectoryFile"))
73  continue;
74 
75  fIn->cd();
76  auto dIn = dynamic_cast<TDirectory*>(key->ReadObj());
77 
78  int lastturnon = triggerThresholds.front();
79  cout << dIn << endl;
80 
81  TString method = dIn->GetName();
82  cout << method << endl;
83 
84  fOut->cd();
85  auto dOut = fOut->mkdir(method);
86 
87  TIter Next2(dIn->GetListOfKeys()) ;
88  while ( (key = dynamic_cast<TKey*>(Next2())) ) { // looping of triggers
89  if (TString(key->ReadObj()->ClassName()) != TString("TDirectoryFile"))
90  continue;
91 
92  dIn->cd();
93  auto ddIn = dynamic_cast<TDirectory*>(key->ReadObj());
94 
95  TString trigName = ddIn->GetName();
96  assert(trigName.Contains("HLT"));
97 
98  dOut->cd();
99  auto ddOut = dOut->mkdir(trigName);
100 
101  trigName.ReplaceAll("HLT","");
102  int trigger = trigName.Atoi();
103  if (method == "TnP" && trigger < triggerThresholds.at(0)) continue;
104  if (method == "emulation" && trigger < triggerThresholds.at(1)) continue;
105  if (method == "emulationShift" && trigger < triggerThresholds.at(2)) continue;
106  cout << setw(10) << trigger;
107 
108  auto h2 = unique_ptr<TH2>(ddIn->Get<TH2>("test"));
109  {
110  auto den = unique_ptr<TH2>(ddIn->Get<TH2>("ref"));
111  h2->Divide(h2.get(), den.get(), 1, 1, "B");
112  }
113 
114  ddOut->cd();
115 
116  h2->SetDirectory(ddOut);
117  h2->SetName("efficiency");
118 
119  vector<int> turnonsNow;
120  for (int y = 1; y <= h2->GetNbinsY(); ++y) {
121 
122  // efficiency curve
123  auto h1 = unique_ptr<TH1>(h2->ProjectionX(Form("efficiency_ybin%d", y), y, y));
124  //cout << y << '\t';
125  static ostream bitBucket(0); // printing to nowhere
126  double threshold = 0.995;
127  switch (year) {
128  case 2017:
129  if (y > 5) threshold = 0.99;
130  break;
131  case 2018:
132  if (y > 3) threshold = 0.99;
133  break;
134  case 2016:
135  default:
136  if (y > 5) threshold = 0.99; //2016 Pre
137  //if (y > 5) threshold = 0.99; 2016 Post
138  }
139  float from = h1->GetBinLowEdge(h1->FindBin(lastturnon)+1);
140  int turnon = Normalisation::GetTriggerEfficiency(trigger, h1.get(), bitBucket, from, threshold);
141  h1->SetTitle(Form("%d (%.3f)", turnon, threshold));
142  h1->SetDirectory(dOut);
143  h1->Write();
144  turnonsNow.push_back(turnon);
145  }
146 
149  auto maxturnon = max_element(turnonsNow.begin(), turnonsNow.begin()+6);
150  h2->SetTitle(Form("%d", *maxturnon));
151  h2->Write();
152  for (auto turnon: turnonsNow) {
153  if (turnon == *maxturnon) cout << "\x1B[32m\e[1m";
154  if (turnon < 0) cout << "\x1B[31m\e[1m";
155  cout << setw(18) << turnon;
156  cout << "\x1B[30m\e[0m";
157  }
158  cout << endl;
159 
160  // final choice
161  if (method == defMethod)
162  turnonsFinal[trigger] = *maxturnon;
163 
164  defMethod = "emulation";
165  lastturnon = *maxturnon;
166 
167  if (lastturnon == -1) {
168  cerr << "Didn't find any turnon for trigger " << trigger << '\n';
169  lastturnon = trigger;
170  }
171  } // end of loop over triggers
172  } // end of loop over method
173 
174  pt::ptree turnon_file;
175  for (auto& turnon: turnonsFinal)
176  turnon_file.put<int>(to_string(turnon.first), turnon.second);
177  pt::write_info(outputTxt.string(), turnon_file);
178 
179  cout << __func__ << " end" << endl;
180 }

◆ GetX()

float DAS::Normalisation::GetX ( TF1 *  f)

Replaces TF1::GetX() which does not return the same value when run after compilation or in interactive mode...

Principle: just scan the pt axis with step = 1 until eff > 0.995

21 {
22  double m = 0, M = 7000;
23  f->GetRange(m,M);
24 
25  for (float pt = m; pt < M; ++pt)
26  if (f->Eval(pt) > threshold)
27  return pt;
28 
29  cerr << "No threshold was found from " << m << " to " << M << ".\nAborting.\n";
30  exit(EXIT_FAILURE);
31 }

◆ makeRespHist()

unique_ptr<TH3> DAS::Normalisation::makeRespHist ( TString  name,
TString  study 
)

Create TH3 histograms for the Jet response and HLT response.

Parameters
nameabitrary name
studyexpecting JER or HLT
22 {
23  using namespace DAS::JetEnergy;
24 
25  static int nResBins = 200;
26  static auto resBins = getBinning(nResBins, 0, 2);
27  unique_ptr<TH3D> h;
28  if (study == "HLT"){
29  // Filling in bins of ptHLT and eta
30  static const char * axistitles = ";p_{T}^{HLT};|#eta^{rec}|;#frac{p_{T}^{rec}}{p_{T}^{HLT bin low edge}}";
31  static const vector<double> HLT_binning = {40., 60., 80., 140., 200., 260., 320., 400., 450., 500.};
32  static int nHLTbins = HLT_binning.size()-1;
33  h = make_unique<TH3D>(name, axistitles,
34  nHLTbins, HLT_binning.data(),
35  nYbins, y_edges.data(),
36  nResBins, resBins.data());
37  }
38  else if (study == "JER"){
39  // Filling in bins of ptgen results in better conditioned response distributions
40  // Pure rec level weight is used
41  static const char * axistitles = ";p_{T}^{gen};|#eta^{rec}|;#frac{p_{T}^{rec}}{p_{T}^{gen}}";
42  h = make_unique<TH3D>(name, axistitles,
43  nPtJERCbins, pt_JERC_edges.data(),
44  nAbsEtaBins, abseta_edges.data(),
45  nResBins, resBins.data());
46  }
47 
48  h->SetDirectory(nullptr);
49  return h;
50 }

◆ match()

DAS::FourVector DAS::Normalisation::match ( const DAS::FourVector jet,
const std::vector< DAS::FourVector > *  hltJets 
)
7  {
8  for (const auto& hltjet: *hltJets){
9  using ROOT::Math::VectorUtil::DeltaR;
10  if (DeltaR(hltjet, jet) < 0.3)
11  return hltjet;
12  }
13  return DAS::FourVector();
14 }

◆ operator<<()

std::ostream& DAS::Normalisation::operator<< ( std::ostream &  Stream,
const TriggerLumi tr_lu 
)
24 {
25  Stream << tr_lu.pt << '\t' << tr_lu.turnon << '\t' << tr_lu.weight << '\t' << 1./tr_lu.weight;
26  return Stream;
27 }

◆ phaseSel()

std::vector<DAS::RecJet>::iterator DAS::Normalisation::phaseSel ( std::vector< DAS::RecJet > &  recjets)
9  {
10  auto leadingInTk = recjets.begin();
11  while (leadingInTk != recjets.end()
12  && std::abs(leadingInTk->Rapidity()) >= 3.0)
13  ++leadingInTk;
14 
15  return leadingInTk;
16 }

◆ reset()

void DAS::Normalisation::reset ( Weights wgts,
const double  v = 0 
)
inline
28 { std::fill(wgts.begin(), wgts.end(), Weight{v,0}); }

Variable Documentation

◆ nThresholds

int nThresholds

◆ threshold

const float threshold = 0.995

◆ thresholds

vector<double> thresholds
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
DAS::Normalisation::phaseSel
std::vector< DAS::RecJet >::iterator phaseSel(std::vector< DAS::RecJet > &recjets)
Definition: PhaseSelection.h:9
method
method
Definition: Core-gitclone-lastrun.txt:5
Ntupliser_cfg.cerr
cerr
Definition: Ntupliser_cfg.py:93
DAS::y_edges
static const std::vector< double > y_edges
Definition: binnings.h:36
DYToLL_M-50_13TeV_pythia8_cff_GEN_SIM_RECOBEFMIX_DIGI_L1_DIGI2RAW_L1Reco_RECO.options
options
Definition: DYToLL_M-50_13TeV_pythia8_cff_GEN_SIM_RECOBEFMIX_DIGI_L1_DIGI2RAW_L1Reco_RECO.py:41
jmarExample.pt
pt
Definition: jmarExample.py:19
Darwin::Tools::syst
@ syst
activate -s to systematic uncertainties
Definition: Options.h:30
Step::verbose
static bool verbose
Definition: Step.h:40
DAS::Normalisation::thresholds
vector< double > thresholds
Definition: getTriggerCurves.cc:44
Step::def
static const char * def
Definition: Step.h:36
DAS::PhysicsObject::p4
FourVector p4
raw four-momentum directly after reconstruction
Definition: PhysicsObject.h:47
DAS::Normalisation::nThresholds
int nThresholds
Definition: getTriggerCurves.cc:45
Ntupliser_cfg.year
int year
Definition: Ntupliser_cfg.py:63
DYToLL_M-50_13TeV_pythia8_cff_GEN_SIM_RECOBEFMIX_DIGI_L1_DIGI2RAW_L1Reco_RECO.source
source
Definition: DYToLL_M-50_13TeV_pythia8_cff_GEN_SIM_RECOBEFMIX_DIGI_L1_DIGI2RAW_L1Reco_RECO.py:39
DAS::JetEnergy::pt_JERC_edges
static const std::vector< double > pt_JERC_edges
Definition: common.h:13
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
DAS::pt_edges
static const std::vector< double > pt_edges
Definition: binnings.h:33
Ntupliser_cfg.f
f
Definition: Ntupliser_cfg.py:255
jercExample.key
string key
Definition: jercExample.py:109
DAS::JetEnergy::getBinning
std::vector< double > getBinning(int nBins, float first, float last)
Definition: common.h:49
DAS::JetEnergy::w
static const float w
Definition: common.h:47
Darwin::Tools::MetaInfo
Generic meta-information for n-tuple (including speficities to Darwin).
Definition: MetaInfo.h:65
DAS::Normalisation::SIGN
@ SIGN
use the sign
Definition: getSumWeights.cc:29
DAS::Normalisation::makeRespHist
unique_ptr< TH3 > makeRespHist(TString name, TString study)
Create TH3 histograms for the Jet response and HLT response.
Definition: MakeResponseHistos.h:20
DAS::PhysicsObject::AbsRap
float AbsRap(const Uncertainties::Variation &=Uncertainties::nominal) const
absolute rapidity
Definition: PhysicsObject.h:54
Ntupliser_cfg.genjets
genjets
Definition: Ntupliser_cfg.py:271
Darwin::Tools::fill
@ fill
activate -f to fill the tree
Definition: Options.h:28
recjet
DAS::RecJet recjet
Definition: classes.h:15
weight
DAS::Weight weight
Definition: classes.h:11
DAS::Normalisation::WEIGHT
@ WEIGHT
use the weights
Definition: getSumWeights.cc:28
Ntupliser_cfg.config
config
Definition: Ntupliser_cfg.py:263
gitlab_post_comment.response
response
Definition: gitlab_post_comment.py:23
orange
static const char * orange
Definition: colours.h:6
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.recjets
recjets
Definition: Ntupliser_cfg.py:272
DAS::JetEnergy::abseta_edges
static const std::vector< double > abseta_edges
JERC binning (taken from JERCProtoLab repo, /macros/common_info/common_binning.hpp)
Definition: common.h:18
DAS::PhysicsObject::CorrPt
float CorrPt(size_t i=0) const
corrected transverse momentum
Definition: PhysicsObject.h:52
DAS::nPtBins
static const int nPtBins
Definition: binnings.h:39
pileup
DAS::PileUp pileup
Definition: classes.h:27
DAS::branchExists
bool branchExists(const TTreePtr &tree, TString brName)
Definition: toolbox.h:27
Ntupliser_cfg.isMC
string isMC
Definition: Ntupliser_cfg.py:59
DAS::Normalisation::threshold
const float threshold
Definition: sigmoid.h:14
jercExample.inputs
def inputs
Definition: jercExample.py:118
DAS::Normalisation::match
DAS::FourVector match(const DAS::FourVector &jet, const std::vector< DAS::FourVector > *hltJets)
Definition: match.h:7
Darwin::Exceptions::AnomalousEvent
Generic exception for problematic event (during event loop).
Definition: exceptions.h:48
DAS::Normalisation::GetNormFactor
float GetNormFactor(const fs::path &f_sumWgts, const float xsec)
Definition: applyMClumi.cc:37
DAS::FourVector
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< float > > FourVector
Definition: PhysicsObject.h:15
DAS::JetEnergy::nPtJERCbins
static const int nPtJERCbins
Definition: common.h:14
Darwin::Tools::dev_null
static std::ostream dev_null(nullptr)
to redirect output stream to nowhere
DAS::Normalisation::GetTriggerEfficiency
float GetTriggerEfficiency(int trigger, TH1 *h, STREAM &Stream, float from, float minEff)
Definition: sigmoid.h:101
DAS::Normalisation::CUTOFF
@ CUTOFF
apply a selection on the weight
Definition: getSumWeights.cc:30
DAS::Normalisation::getPrescale
float getPrescale(Trigger *trigger, size_t indx)
Definition: getTriggerCurves.cc:97
DAS::JetEnergy
Definition: applyJERsmearing.cc:41
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
DAS::nYbins
static const int nYbins
Definition: binnings.h:38
DAS::Normalisation::GetX
float GetX(TF1 *f)
Definition: sigmoid.h:20
DAS::yBins
static const std::vector< TString > yBins
Definition: binnings.h:44
DAS::JetEnergy::nAbsEtaBins
static const int nAbsEtaBins
Definition: common.h:19