28from ROOT.Experimental import RCanvas, RText, RAttrText, RAttrFont, RPadPos, TObjectDrawable
36 help=
"Run only on a fraction of the total available 10 fb^-1 (only usable together with --full-dataset)",
42 help=
"Use the full dataset (use --lumi-scale to run only on a fraction of it)",
49 help=
"Use implicit multi threading (for the full dataset only possible with --lumi-scale 1.0)",
68print(
"Run on data corresponding to {:.2f} fb^-1 ...".
format(lumi * lumi_scale / 1000.0))
71 dataset_path =
"root://eospublic.cern.ch//eos/opendata/atlas/OutreachDatasets/2020-01-22"
73 dataset_path =
"root://eospublic.cern.ch//eos/root-eos/reduced_atlas_opendata/w"
96 df[sample] = df[sample].
Range(
int(num_events * lumi_scale))
102bool GoodElectronOrMuon(int type, float pt, float eta, float phi, float e, float trackd0pv, float tracksigd0pv, float z0)
104 ROOT::Math::PtEtaPhiEVector p(pt / 1000.0, eta, phi, e / 1000.0);
105 if (abs(z0 * sin(p.theta())) > 0.5) return false;
106 if (type == 11 && abs(eta) < 2.46 && (abs(eta) < 1.37 || abs(eta) > 1.52)) {
107 if (abs(trackd0pv / tracksigd0pv) > 5) return false;
110 if (type == 13 && abs(eta) < 2.5) {
111 if (abs(trackd0pv / tracksigd0pv) > 3) return false;
120 df[s] = df[s].Filter(
"trigE || trigM").Filter(
"met_et > 30000")
126 "good_lep",
"lep_isTightID && lep_pt > 35000 && lep_ptcone30 / lep_pt < 0.1 && lep_etcone20 / lep_pt < 0.1"
128 .Filter(
"ROOT::VecOps::Sum(good_lep) == 1")
134 .Define(
"idx",
"ROOT::VecOps::ArgMax(good_lep)")
136 "GoodElectronOrMuon(lep_type[idx], lep_pt[idx], lep_eta[idx], lep_phi[idx], lep_E[idx], lep_trackd0pvunbiased[idx], lep_tracksigd0pvunbiased[idx], lep_z0[idx])"
143 df[s] = df[s].Define(
"weight",
"1.0")
145 df[s] = df[s].Define(
147 "scaleFactor_ELE * scaleFactor_MUON * scaleFactor_LepTRIGGER * scaleFactor_PILEUP * mcWeight * {} / {} * {}".
format(
148 xsecs[s], sumws[s], lumi
154float ComputeTransverseMass(float met_et, float met_phi, float lep_pt, float lep_eta, float lep_phi, float lep_e)
156 ROOT::Math::PtEtaPhiEVector met(met_et, 0, met_phi, met_et);
157 ROOT::Math::PtEtaPhiEVector lep(lep_pt, lep_eta, lep_phi, lep_e);
158 return (met + lep).Mt() / 1000.0;
164 df[s] = df[s].Define(
165 "mt_w",
"ComputeTransverseMass(met_et, met_phi, lep_pt[idx], lep_eta[idx], lep_phi[idx], lep_E[idx])"
167 histos[s] = df[s].Histo1D(
ROOT.RDF.TH1DModel(s,
"mt_w", 24, 60, 180),
"mt_w",
"weight")
181 t = histos[d[1]].GetValue()
232 [singletop, diboson, ttbar, zjets, wjets],
233 [(0.82, 0.94, 0.76), (0.76, 0.54, 0.57), (0.61, 0.6, 0.8), (0.97, 0.81, 0.41), (0.87, 0.35, 0.42)],
241c.Add[TObjectDrawable]().Set(stack,
"HIST SAME")
248c.Add[TObjectDrawable]().Set(data,
"E SAME")
263c.Add[TObjectDrawable]().Set(legend)
266lbl1 =
c.Add[RText](RPadPos(0.05, 0.88),
"ATLAS")
271lbl2 =
c.Add[RText](RPadPos(0.05 + 0.20, 0.88),
"Open Data")
290 print(
"Saved figure to df105.png")
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
A struct which stores some basic parameters of a TH1D.