DAS  3.0
Das Analysis System
DAS::Muon Namespace Reference

Classes

class  IDApplier
 
class  TriggerApplier
 

Enumerations

enum  Selector {
  None = 0u, CutBasedIdLoose = 1u<< 0, CutBasedIdMedium = 1u<< 1, CutBasedIdMediumPrompt = 1u<< 2,
  CutBasedIdTight = 1u<< 3, CutBasedIdGlobalHighPt = 1u<< 4, CutBasedIdTrkHighPt = 1u<< 5, PFIsoVeryLoose = 1u<< 6,
  PFIsoLoose = 1u<< 7, PFIsoMedium = 1u<< 8, PFIsoTight = 1u<< 9, PFIsoVeryTight = 1u<<10,
  TkIsoLoose = 1u<<11, TkIsoTight = 1u<<12, SoftCutBasedId = 1u<<13, SoftMvaId = 1u<<14,
  MvaLoose = 1u<<15, MvaMedium = 1u<<16, MvaTight = 1u<<17, MiniIsoLoose = 1u<<18,
  MiniIsoMedium = 1u<<19, MiniIsoTight = 1u<<20, MiniIsoVeryTight = 1u<<21
}
 

Functions

bool PassTriggerSelection (const Trigger &trg, const vector< RecMuon > &recMuons, int year)
 
void applyDimuonTriggerStrategy (const vector< fs::path > &inputs, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0})
 
void applyMuonSelection (const vector< fs::path > &inputs, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0})
 
void applyRochesterCorr (const vector< fs::path > &inputs, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0})
 
vector< float > GetMassEdges (int nbins=100, double M=3000, double m=30)
 
void getDimuonSpectrum (const vector< fs::path > &inputs, const fs::path &output, const int steering, const DT::Slice slice={1, 0})
 
std::tuple< std::filesystem::path, std::string > getLocation (const std::string &location)
 

Enumeration Type Documentation

◆ Selector

enum Selector

Adapted from CMSSW

Enumerator
None 
CutBasedIdLoose 
CutBasedIdMedium 
CutBasedIdMediumPrompt 
CutBasedIdTight 
CutBasedIdGlobalHighPt 
CutBasedIdTrkHighPt 
PFIsoVeryLoose 
PFIsoLoose 
PFIsoMedium 
PFIsoTight 
PFIsoVeryTight 
TkIsoLoose 
TkIsoTight 
SoftCutBasedId 
SoftMvaId 
MvaLoose 
MvaMedium 
MvaTight 
MiniIsoLoose 
MiniIsoMedium 
MiniIsoTight 
MiniIsoVeryTight 
39  {
40  None = 0u, // added
41  CutBasedIdLoose = 1u<< 0,
42  CutBasedIdMedium = 1u<< 1,
43  CutBasedIdMediumPrompt = 1u<< 2, // medium with IP cuts
44  CutBasedIdTight = 1u<< 3,
45  CutBasedIdGlobalHighPt = 1u<< 4, // high pt muon for Z',W' (better momentum resolution)
46  CutBasedIdTrkHighPt = 1u<< 5, // high pt muon for boosted Z (better efficiency)
47  PFIsoVeryLoose = 1u<< 6, // reliso<0.40
48  PFIsoLoose = 1u<< 7, // reliso<0.25
49  PFIsoMedium = 1u<< 8, // reliso<0.20
50  PFIsoTight = 1u<< 9, // reliso<0.15
51  PFIsoVeryTight = 1u<<10, // reliso<0.10
52  TkIsoLoose = 1u<<11, // reliso<0.10
53  TkIsoTight = 1u<<12, // reliso<0.05
54  SoftCutBasedId = 1u<<13,
55  SoftMvaId = 1u<<14,
56  MvaLoose = 1u<<15,
57  MvaMedium = 1u<<16,
58  MvaTight = 1u<<17,
59  MiniIsoLoose = 1u<<18, // reliso<0.40
60  MiniIsoMedium = 1u<<19, // reliso<0.20
61  MiniIsoTight = 1u<<20, // reliso<0.10
62  MiniIsoVeryTight = 1u<<21 // reliso<0.05
63 };

Function Documentation

◆ applyDimuonTriggerStrategy()

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

Code to apply the Double Muon trigger SFs documented at the following link: https://indico.cern.ch/event/1106050/contributions/4653418/ Expecting one the following triggers:

  • HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass8_v <– expected from n-tupliser
  • HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass8_v
  • HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass3p8_v <– expected from n-tupliser
  • HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass3p8_v

The code was written assuming the calibration files found in /eos/cms/store/group/phys_muon/jmijusko/DoubleMuonTrigger_SF_UL/ which contains the following TH2Ds with axes corresponding to the respective muon pseudorapidities and bin content to the efficiency.

  • ScaleFactor[WP]_UL[year]
  • ScaleFactor[WP]_UL[year]_stat
  • ScaleFactor[WP]_UL[year]_syst
  • ScaleFactor[WP]_UL[year]_alt (except for 2018)
  • ScaleFactor[WP]_UL[year]_massBin (except for 2018)
  • ScaleFactor[WP]_UL[year]_massRange (except for 2018) where [WP] = Tight or Medium (for both ID and ISO) [year] = 2016_HIPM, 2016, 2017, or 2018
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
128  {1,0}
129  )
130 {
131  cout << __func__ << ' ' << slice << " start" << endl;
132 
133  unique_ptr<TChain> tIn = DT::GetChain(inputs);
134  unique_ptr<TFile> fOut(DT_GetOutput(output));
135  auto tOut = unique_ptr<TTree>(tIn->CloneTree(0));
136 
137  DT::MetaInfo metainfo(tOut);
138  metainfo.Check(config);
139  auto isMC = metainfo.Get<bool>("flags", "isMC");
140  auto year = metainfo.Get<int>("flags", "year");
141 
142  auto efficiency = config.get<string>("corrections.muons.trigger_eff");
143  auto [filename, histname] = getLocation(efficiency);
144  bool applySyst = (steering & DT::syst) == DT::syst;
145 
146  TriggerApplier applier(filename, histname, year,
147  isMC && filename != "/dev/null", applySyst);
148  metainfo.Set<string>("corrections", "muons", "trigger_eff", efficiency);
149  for (const auto& name: applier.weightNames())
150  metainfo.Set<string>("variations", RecEvent::WeightVar, name);
151 
152  Trigger * trg = nullptr;
153  tIn->SetBranchAddress("muonTrigger", &trg);
154 
155  RecEvent * recEvent = nullptr;
156  tIn->SetBranchAddress("recEvent", &recEvent);
157 
158  vector<RecMuon> * recMuons = nullptr;
159  tIn->SetBranchAddress("recMuons", &recMuons);
160 
161  for (DT::Looper looper(tIn, slice); looper(); ++looper) {
162  [[ maybe_unused]]
163  static auto& cout = (steering & DT::verbose) == DT::verbose ? ::cout : DT::dev_null;
164 
165  applier(*recEvent, *trg, *recMuons);
166 
167  if ((steering & DT::fill) == DT::fill) tOut->Fill();
168  }
169 
170  fOut->cd();
171  metainfo.Set<bool>("git", "complete", true);
172  tOut->Write();
173 
174  cout << __func__ << ' ' << slice << " stop" << endl;
175 }

◆ applyMuonSelection()

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

Generic executable for all types of muon efficiency corrections. The command should be called once for each table.

TWiki Tables

==== RECO NUM = TrackerMuons DEN = genTracks

  • binning: abseta_pt
  • uncertainties: – (?)

==== Muon ID NUM = HighPtID LooseID MediumID MediumPromptID SoftID TightID TrkHighPtID DEN = TrackerMuons

  • binning: abseta_pt
  • uncertainties: stat, syst

==== Muon ISO DEN \ NUM LooseRelIso LooseRelTkIso TightRelIso TightRelTkIso LooseID x MediumID x x MediumPromptID x x TightID & IPCut x x HighPtID & IPCut x x TrkHighPtID & IPCut x x

  • binning: abseta_pt
  • uncertainties: stat, syst

==== trigger DEN \ NUM IsoMu24 IsoMu24_or_Mu50 Mu50_or_OldMu100_or_TkMu100 IdMedium & PFIsoMedium x x IdTight & PFIsoTight x x IdGlobalHighPt & TkIsoLoose x

  • binning: abseta_pt, charge_abseta_pt, charge_eta_pt, eta_pt
  • uncertainties: stat, syst

==== tracking Quoting the TWiki:

Official tracking POG SFs, where the probe is a standalone muon and it is required to be matched to a generalTrack in its vicinity, are independent of momentum. The SFs are found to be above 0.99, and are considered equivalent to unity. You can find the detailed plots per eta and pT bins in this TWiki. The recommendation are to not apply them, unless you target a precison analysis.

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
217  {1,0}
218  )
219 {
220  cout << __func__ << ' ' << slice << " start" << endl;
221 
222  unique_ptr<TChain> tIn = DT::GetChain(inputs);
223  unique_ptr<TFile> fOut(DT_GetOutput(output));
224  auto tOut = unique_ptr<TTree>(tIn->CloneTree(0));
225 
226  DT::MetaInfo metainfo(tOut);
227  metainfo.Check(config);
228 
229  vector<RecMuon> * recMuons = nullptr;
230  tIn->SetBranchAddress("recMuons", &recMuons);
231 
232  auto efficiency = config.get<string>("corrections.muons.efficiency");
233  if (efficiency == "") {
234  auto& efficiencies = config.get_child("corrections.muons.efficiency");
235  if (efficiencies.size() == 0)
236  BOOST_THROW_EXCEPTION( invalid_argument("Missing efficiency") );
237  auto it = efficiencies.begin();
238  while (metainfo.Find("corrections", "muons", "efficiency", it->first))
239  ++it;
240  efficiency = it->first;
241  }
242  auto [filename, histname] = getLocation(efficiency);
243  cout << filename << ' ' << histname << endl;
244 
245  IDApplier applier(filename, histname, filename != "/dev/null", steering & DT::syst);
246  if (metainfo.Find("corrections", "muons", "efficiency")) {
247  // 0 = previous, former
248  auto efficiency0 = metainfo.Get<string>("corrections", "muons", "efficiency");
249  auto [filename0, histname0] = getLocation(efficiency0);
250  if (filename == filename0 && filename != "/dev/null")
251  cerr << orange << "The same file has been used twice in a row, "
252  "which is unexpected: `" << filename << "`. "
253  "Proceed at your own risks.\n" << def;
254  IDApplier applier0(filename0, histname0, false, false);
255  if (applier.DEN != applier0.NUM)
256  cerr << orange << "The former and present muon efficiency corrections are "
257  "unexpected combinations: `" << applier0.name << "` and `"
258  << applier.name <<"`. Proceed at your own risks.\n" << def;
259  }
260  metainfo.Set<string>("corrections", "muons", "efficiency", efficiency);
261 
262  for (const auto& name: applier.weightNames())
263  metainfo.Set<string>("variations", RecMuon::WeightVar, name);
264 
266 
267  for (DT::Looper looper(tIn, slice); looper(); ++looper) {
268  [[ maybe_unused]]
269  static auto& cout = (steering & DT::verbose) == DT::verbose ? ::cout : DT::dev_null;
270 
271  applier(*recMuons);
272 
273  static const bool fillTree = (steering & DT::fill) == DT::fill;
274  if (fillTree) tOut->Fill();
275  }
276 
277  metainfo.Set<bool>("git", "complete", true);
278  fOut->cd();
279  tOut->Write();
280 
281  cout << __func__ << ' ' << slice << " stop" << endl;
282 }

◆ applyRochesterCorr()

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

TWiki

 set   nmembers  comment

Default 0 1 default, reference based on madgraph sample, with adhoc ewk (sw2eff and Z width) and Z pt (to match data) weights. Stat 1 100 pre-generated stat. replicas; Zpt 2 1 derived without reweighting reference pt to data. Ewk 3 1 derived without applying ad-hoc ewk weights deltaM 4 1 one representative set for alternative profile deltaM mass window

Ewk2 5 1 reweight the reference from constant to s-dependent Z width

For statistical replicas, std. dev. gives uncertainty. For the rest, difference wrt the cental is assigned as syst. error. Total uncertainty is calculated as a quadrature sum of all components.

Todo:
Implement alternative nominal correction
Todo:
Zpt: rather provide as alternative? (issue #76)
Todo:
Ewk2: understand 3rd remark from MUON POG
Todo:
clear scales?
Todo:
should we force up (down) in the first (second) place?
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
57  {1,0}
58  )
59 {
60  cout << __func__ << ' ' << slice << " start" << endl;
61 
62  unique_ptr<TChain> tIn = DT::GetChain(inputs);
63  unique_ptr<TFile> fOut(DT_GetOutput(output));
64  auto tOut = unique_ptr<TTree>(tIn->CloneTree(0));
65 
66  DT::MetaInfo metainfo(tOut);
67  metainfo.Check(config);
68  auto isMC = metainfo.Get<bool>("flags", "isMC");
69 
70  vector<RecMuon> * recMuons = nullptr;
71  tIn->SetBranchAddress("recMuons", &recMuons);
72  vector<GenMuon> * genMuons = nullptr;
73  if (isMC)
74  tIn->SetBranchAddress("genMuons", &genMuons);
75 
76  auto tables = config.get<fs::path>("corrections.muons.rochester.tables");
77  if (!fs::exists(tables))
78  BOOST_THROW_EXCEPTION( fs::filesystem_error("Tables can't be found.",
79  tables, make_error_code(errc::no_such_file_or_directory)));
80  metainfo.Set<fs::path>("corrections", "muons", "rochester", "tables", tables);
81  RoccoR rc(tables.c_str());
82 
83  auto alternative = config.get<bool>("corrections.muons.rochester.alternative");
85  if (alternative)
86  BOOST_THROW_EXCEPTION( logic_error("Alternative nominal correction not yet implemented") );
87  metainfo.Set<bool>("corrections", "muons", "rochester", "alternative", alternative);
88 
89  const bool applySyst = (steering & DT::syst) == DT::syst;
90  if (applySyst) {
93  for (const string& syst: {"stat", "Zpt", "Ewk", "deltaM", "Ewk2"}) {
94  metainfo.Set<string>("variations", RecMuon::WeightVar, syst + SysUp);
95  metainfo.Set<string>("variations", RecMuon::WeightVar, syst + SysDown);
96  }
97  }
98 
99  vector<GenMuon> mcands; // matching candidates
100  for (DT::Looper looper(tIn, slice); looper(); ++looper) {
101  [[ maybe_unused]]
102  static auto& cout = (steering & DT::verbose) == DT::verbose ? ::cout : DT::dev_null;
103 
104  if (isMC) mcands = *genMuons; // copy to avoid modifying the event
105 
106  for (auto& recMuon: *recMuons) {
107 
108  float pt = recMuon.p4.Pt(),
109  eta = recMuon.p4.Eta(),
110  phi = recMuon.p4.Phi();
111  int Q = recMuon.Q;
112  cout << Q << '\t' << pt << '\t' << eta << '\t' << phi << endl;
113 
114  auto& nl = recMuon.nTkHits;
115 
116  // 1) get scale factor (lambda)
117  function<double(int /* unc set */,int /* member */)> SF;
118  if (isMC) {
119  // find the closest gen muon within DR <= 0.1
120  auto DR = [&recMuon](const GenMuon& m) { return DeltaR(m.p4, recMuon.p4) < 0.1; };
121  auto getClosest = [&DR](const GenMuon& m1, const GenMuon& m2) { return DR(m1) < DR(m2); };
122  auto closestGenMuon_it = min_element(genMuons->begin(), genMuons->end(), getClosest);
123 
124  if (closestGenMuon_it != mcands.end() && DR(*closestGenMuon_it))
125  SF = [&](int s, int m) {
126  float genpt = closestGenMuon_it->p4.Pt();
127  return rc.kSpreadMC(Q, pt, eta, phi, genpt, s, m);
128  };
129  else {
130  static TRandom3 r(metainfo.Seed<897532>(slice));
131  const auto u = r.Rndm();
132  SF = [&](int s, int m) { return rc.kSmearMC(Q, pt, eta, phi, nl, u, s, m); };
133  }
134  }
135  else
136  SF = [&](int s, int m) { return rc.kScaleDT(Q, pt, eta, phi, s, m); };
137 
138  // 2) store it in scale
139  recMuon.scales.clear();
140  auto nom = SF(0,0);
141  recMuon.scales.push_back(nom);
142 
143  // 3) variations
144 
145  if (!applySyst) continue;
146 
147  static const int nvars = 5;
148  recMuon.scales.reserve(1+2*nvars);
149  auto push_back = [&recMuon,&nom](float unc) {
150  recMuon.scales.push_back(unc);
151  unc -= nom; unc *= -1; unc += nom;
152  recMuon.scales.push_back(unc);
154  };
155 
156  // 3a) first stat unc (from replicas)
157  float sum1 = 0, sum2 = 0;
158  for (int m = 0; m < 100; ++m) {
159  float sf = SF(1, m);
160  sum1 += sf;
161  sum2 += sf*sf;
162  }
163  double unc = sqrt(sum1*sum1 - sum2) / 100;
164 
165  push_back(unc);
166 
167  // 3b) then the syst unc
168  for (int s = 2; s <= nvars; ++s) {
169  unc = SF(s,0);
170  push_back(unc);
171  }
172  }
173  if ((steering & DT::fill) == DT::fill) tOut->Fill();
174  }
175 
176  metainfo.Set<bool>("git", "complete", true);
177  tOut->Write();
178 
179  cout << __func__ << ' ' << slice << " stop" << endl;
180 }

◆ getDimuonSpectrum()

void DAS::Muon::getDimuonSpectrum ( const vector< fs::path > &  inputs,
const fs::path &  output,
const int  steering,
const DT::Slice  slice = {1,0} 
)

Obtain dimuon spectrum.

Parameters
inputsinput ROOT files (n-tuples)
outputoutput ROOT file (n-tuple)
steeringparameters obtained from explicit options
slicenumber and index of slice
51  {1,0}
52  )
53 {
54  cout << __func__ << ' ' << slice << " start" << endl;
55 
56  unique_ptr<TChain> tIn = DT::GetChain(inputs);
57  unique_ptr<TFile> fOut(DT_GetOutput(output));
58  auto tOut = unique_ptr<TTree>(tIn->CloneTree(0));
59 
60  DT::MetaInfo metainfo(tOut);
61  auto isMC = metainfo.Get<bool>("flags", "isMC");
62 
63  RecEvent * recEvt = nullptr;
64  GenEvent * genEvt = nullptr;
65  tIn->SetBranchAddress("recEvent", &recEvt);
66  if (isMC)
67  tIn->SetBranchAddress("genEvent", &genEvt);
68 
69  vector<RecMuon> * recMuons = nullptr;
70  tIn->SetBranchAddress("recMuons", &recMuons);
71  vector<RecPhoton> * recPhotons = nullptr;
72  if (branchExists(tIn, "recPhotons"))
73  tIn->SetBranchAddress("recPhotons", &recPhotons);
74  vector<RecJet> * recJets = nullptr;
75  if (branchExists(tIn, "recJets"))
76  tIn->SetBranchAddress("recJets", &recJets);
77 
78  vector<float> mass_edges = GetMassEdges();
79  unique_ptr<TH1F> h_dimuon = make_unique<TH1F>("dimuon", "", mass_edges.size()-1, mass_edges.data());
80  unique_ptr<TH1F> h_mmg = make_unique<TH1F>("mumugamma", "", mass_edges.size()-1, mass_edges.data());
81 
82  unique_ptr<TH1F> h_dimuon_peak = make_unique<TH1F>("dimuon_peak", "", 60, 71, 121);
83  unique_ptr<TH1F> h_mmg_peak = make_unique<TH1F>("mumugamma_peak", "", 60, 71, 121);
84 
85  vector<double> pt_edges = {25., 30., 35., 40., 50., 60., 70., 80., 90., 100., 110.,
86  130., 150., 170., 190., 220., 250., 400., 1000.};
87  unique_ptr<TH3D> h_Zjet = make_unique<TH3D>("Zjet", "", (int) pt_edges.size()-1, pt_edges.data(),
88  (int) y_edges.size()-1, y_edges.data(),
89  (int) y_edges.size()-1, y_edges.data());
90 
91  for (DT::Looper looper(tIn, slice); looper(); ++looper) {
92  [[ maybe_unused]]
93  static auto& cout = (steering & DT::verbose) == DT::verbose ? ::cout : DT::dev_null;
94 
95  if (recMuons->size() < 2) continue;
96  if (recMuons->at(0).CorrPt() < 20) continue;
97  if (recMuons->at(1).CorrPt() < 15) continue;
98 
99  FourVector m0 = recMuons->at(0).CorrP4(),
100  m1 = recMuons->at(1).CorrP4();
101  FourVector diMuon = m0 + m1;
102  float w_Z = recEvt->weights.front()
103  * recMuons->at(0).weights.front()
104  * recMuons->at(1).weights.front();
105  if (isMC) w_Z *= genEvt->weights.front();
106  h_dimuon->Fill(diMuon.M(), w_Z);
107  h_dimuon_peak->Fill(diMuon.M(), w_Z);
108 
109  if (recJets != nullptr && !recJets->empty() && // at least one jet
110  abs(diMuon.M()-91.2) < 20 && diMuon.Pt() > 25) {
111  const auto& jet = recJets->front().CorrP4();
112  if (jet.Pt() > 20 && abs(jet.Rapidity()) < 2.4 && // jet selection
113  min(m0.Pt(), m1.Pt()) > 29 && max(abs(m0.Eta()), abs(m1.Eta())) < 2.4 && // muon selection
114  DeltaR(jet, m0) > 0.4 && DeltaR(jet, m1) > 0.4) { // opening angle
115  float w_j = recJets->front().weights.front(),
116  y_b = 0.5*(diMuon.Rapidity() + recJets->front().Rapidity()),
117  y_s = 0.5*(diMuon.Rapidity() - recJets->front().Rapidity());
118  h_Zjet->Fill(diMuon.Pt(), y_b, y_s, w_Z * w_j);
119  }
120  }
121 
122  if (diMuon.M() >= 76) continue;
123  if (recPhotons != nullptr && !recPhotons->empty()) {
124  FourVector ph = recPhotons->front().CorrP4();
125  if (ph.Pt() < 20) continue;
126  FourVector mumugamma = diMuon + ph;
127  float w_ph = recPhotons->front().weights.front();
128  h_mmg->Fill(mumugamma.M(), w_Z * w_ph);
129  h_mmg_peak->Fill(mumugamma.M(), w_Z * w_ph);
130  }
131  }
132 
133  metainfo.Set<bool>("git", "complete", true);
134  tOut->Write();
135  h_dimuon->SetDirectory(fOut.get());
136  h_dimuon_peak->SetDirectory(fOut.get());
137  h_mmg->SetDirectory(fOut.get());
138  h_mmg_peak->SetDirectory(fOut.get());
139  h_Zjet->SetDirectory(fOut.get());
140  h_dimuon->Write();
141  h_dimuon_peak->Write();
142  h_mmg->Write();
143  h_mmg_peak->Write();
144  h_Zjet->Write();
145 
146  cout << __func__ << ' ' << slice << " stop" << endl;
147 }

◆ getLocation()

std::tuple<std::filesystem::path, std::string> DAS::Muon::getLocation ( const std::string &  location)
13 {
14  using namespace std;
15  namespace al = boost::algorithm;
16  namespace fs = filesystem;
17 
18  vector<string> words;
19  al::split(words, location, al::is_any_of(":"), al::token_compress_on);
20  if (words.size() != 2)
21  BOOST_THROW_EXCEPTION( invalid_argument("Expecting `/path/to/file.ext:histname`") );
22  fs::path filename = words.front();
23  string histname = words.back();
24  return {filename, histname};
25 }

◆ GetMassEdges()

vector<float> DAS::Muon::GetMassEdges ( int  nbins = 100,
double  M = 3000,
double  m = 30 
)
36 {
37  float R = pow(M/m,1./nbins);
38  vector<float> edges;
39  edges.reserve(nbins+1);
40  for (float edge = m; edge <= M; edge *= R)
41  edges.push_back(edge);
42  return edges;
43 }

◆ PassTriggerSelection()

bool DAS::Muon::PassTriggerSelection ( const Trigger trg,
const vector< RecMuon > &  recMuons,
int  year 
)
37 {
38  if (recMuons.size() < 2) return false;
39 
40  if (recMuons.at(0).CorrPt() < 19) return false;
41  if (recMuons.at(1).CorrPt() < 9) return false;
42 
43  auto dimuon = recMuons.at(0).p4 + recMuons.at(1).p4;
44  float m = dimuon.M();
45  bool pass = false;
46  switch (year) {
47  case 2017:
48  pass |= (m > 3.8 && trg.Bit.at(1));
49  [[fallthrough]];
50  case 2018:
51  pass |= (m > 8 && trg.Bit.at(0));
52  break;
53  default:
54  BOOST_THROW_EXCEPTION( std::runtime_error(to_string(year) + " has not been implemented yet"s) );
55  }
56 
57  return pass;
58 }
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
Ntupliser_cfg.cerr
cerr
Definition: Ntupliser_cfg.py:93
DAS::y_edges
static const std::vector< double > y_edges
Definition: binnings.h:36
DAS::Muon::MiniIsoLoose
@ MiniIsoLoose
Definition: applyMuonSelection.cc:59
jmarExample.pt
pt
Definition: jmarExample.py:19
DAS::Muon::TkIsoLoose
@ TkIsoLoose
Definition: applyMuonSelection.cc:52
DAS::Muon::PFIsoVeryTight
@ PFIsoVeryTight
Definition: applyMuonSelection.cc:51
Darwin::Tools::syst
@ syst
activate -s to systematic uncertainties
Definition: Options.h:30
Step::verbose
static bool verbose
Definition: Step.h:40
Step::def
static const char * def
Definition: Step.h:36
DAS::Muon::PFIsoTight
@ PFIsoTight
Definition: applyMuonSelection.cc:50
DAS::SysUp
const std::string SysUp
Suffix used for "up" uncertainties. Follows the Combine convention.
Definition: Format.h:8
Ntupliser_cfg.year
int year
Definition: Ntupliser_cfg.py:63
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
DAS::Muon::CutBasedIdMedium
@ CutBasedIdMedium
Definition: applyMuonSelection.cc:42
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
DAS::Muon::MvaLoose
@ MvaLoose
Definition: applyMuonSelection.cc:56
DAS::Muon::getLocation
std::tuple< std::filesystem::path, std::string > getLocation(const std::string &location)
Definition: toolbox.h:12
DAS::Muon::MiniIsoVeryTight
@ MiniIsoVeryTight
Definition: applyMuonSelection.cc:62
jercExample.unc
string unc
Definition: jercExample.py:70
DAS::Muon::MvaTight
@ MvaTight
Definition: applyMuonSelection.cc:58
DAS::Muon::PFIsoLoose
@ PFIsoLoose
Definition: applyMuonSelection.cc:48
Darwin::Tools::split
@ split
activate -k and -j to define slice
Definition: Options.h:27
Ntupliser_cfg.config
config
Definition: Ntupliser_cfg.py:263
DAS::Muon::CutBasedIdTrkHighPt
@ CutBasedIdTrkHighPt
Definition: applyMuonSelection.cc:46
DAS::Muon::MiniIsoTight
@ MiniIsoTight
Definition: applyMuonSelection.cc:61
RoccoR
Definition: RoccoR.h:122
orange
static const char * orange
Definition: colours.h:6
DAS::Muon::CutBasedIdTight
@ CutBasedIdTight
Definition: applyMuonSelection.cc:44
DAS::Muon::CutBasedIdMediumPrompt
@ CutBasedIdMediumPrompt
Definition: applyMuonSelection.cc:43
DAS::Muon::PFIsoVeryLoose
@ PFIsoVeryLoose
Definition: applyMuonSelection.cc:47
DAS::Muon::CutBasedIdLoose
@ CutBasedIdLoose
Definition: applyMuonSelection.cc:41
DAS::SysDown
const std::string SysDown
Suffix used for "down" uncertainties. Follows the Combine convention.
Definition: Format.h:10
DAS::Muon::GetMassEdges
vector< float > GetMassEdges(int nbins=100, double M=3000, double m=30)
Definition: getDimuonSpectrum.cc:35
DAS::Muon::SoftCutBasedId
@ SoftCutBasedId
Definition: applyMuonSelection.cc:54
DAS::branchExists
bool branchExists(const TTreePtr &tree, TString brName)
Definition: toolbox.h:27
Ntupliser_cfg.isMC
string isMC
Definition: Ntupliser_cfg.py:59
DAS::Muon::CutBasedIdGlobalHighPt
@ CutBasedIdGlobalHighPt
Definition: applyMuonSelection.cc:45
DAS::Muon::TkIsoTight
@ TkIsoTight
Definition: applyMuonSelection.cc:53
jercExample.sf
sf
Definition: jercExample.py:112
jercExample.inputs
def inputs
Definition: jercExample.py:118
DAS::Muon::None
@ None
Definition: applyMuonSelection.cc:40
DAS::FourVector
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< float > > FourVector
Definition: PhysicsObject.h:15
DAS::Muon::MiniIsoMedium
@ MiniIsoMedium
Definition: applyMuonSelection.cc:60
Darwin::Tools::dev_null
static std::ostream dev_null(nullptr)
to redirect output stream to nowhere
DAS::Muon::MvaMedium
@ MvaMedium
Definition: applyMuonSelection.cc:57
DAS::Muon::PFIsoMedium
@ PFIsoMedium
Definition: applyMuonSelection.cc:49
DT_GetOutput
#define DT_GetOutput(output)
Definition: FileUtils.h:96
jmarExample.eta
eta
DeepAK8/ParticleNet tagging.
Definition: jmarExample.py:19
DAS::Muon::SoftMvaId
@ SoftMvaId
Definition: applyMuonSelection.cc:55