DAS  3.0
Das Analysis System
Plots.h
Go to the documentation of this file.
1 #include <cassert>
2 
3 #include <TH2.h>
4 #include <TDirectory.h>
5 #include <TString.h>
6 
9 
10 namespace DAS::PUprofile {
11 
18 struct Plots {
19 
20  const TString name;
21  TH1F intprofile,
23  rho,
24  nVtx;
25 
26  Plots (TString Name) :
27  name(Name),
28  intprofile(Name + "intPU", ";in-time PU;N^{ev}_{eff}", nPUbins, 0, nPUbins),
29  trprofile (Name + "trPU" , ";true PU;N^{ev}_{eff}", nPUbins, 0, nPUbins),
30  rho (Name + "rho" , ";#rho;N^{ev}_{eff}", nPUbins, 0, nPUbins),
31  nVtx (Name + "nVtx" , ";N_{vtx};N^{ev}_{eff}", nPUbins, 0, nPUbins)
32  {
33  std::cout << __FILE__ << ':' << __func__ << ':' << __LINE__ << '\t' << name << std::endl;
34  }
35 
36  void operator()
37  (const PileUp& pu,
38  float w,
39  const char v = '0',
40  bool OnTheFly = false)
41  {
42  trprofile.Fill(pu.GetTrPU(v), w);
43  rho .Fill(pu.rho , w);
44  nVtx.Fill(pu.nVtx, w);
45 
46  // Filling with 100 values of InTime PU to have smoother profile,
47  if (OnTheFly==true)
48  intprofile.Fill(pu.GetInTimePU(v, OnTheFly), w);
49 
50  if (OnTheFly==false) {
51  const int N = 100;
52  w /= N;
53  for (int i = 0; i < N; ++i)
54  intprofile.Fill(pu.GetInTimePU(v, OnTheFly), w);
55  }
56  }
57 
58  void Write (TDirectory * d)
59  {
60  assert(d);
61  d->cd();
62  std::vector<TH1*> hs{&intprofile, &trprofile, &rho, &nVtx};
63  for (TH1* h: hs) {
64  TString n = h->GetName();
65  std::cout << n << std::endl;
66  n.ReplaceAll(name,"");
67  h->SetDirectory(d);
68  h->Write(n);
69  }
70  }
71 };
72 
73 } // end of namespaces
DAS::PUprofile::Plots
Definition: Plots.h:18
DAS::PUprofile::Plots::trprofile
TH1F trprofile
true pile-up, corresponding to --calcMode true (average pileup conditions under which the event is ge...
Definition: Plots.h:22
Event.h
DAS::PUprofile
Definition: applyBinnedPUprofCorrection.cc:35
DAS::JetEnergy::w
static const float w
Definition: common.h:51
DAS::nPUbins
static const int nPUbins
Definition: binnings.h:51
DAS::PileUp
Definition: Event.h:98
binnings.h
DAS::PUprofile::Plots::name
const TString name
Definition: Plots.h:20
DAS::PUprofile::Plots::Plots
Plots(TString Name)
Definition: Plots.h:26
DAS::PUprofile::Plots::intprofile
TH1F intprofile
in-time pile-up, corresponding to --calcMode observed (the number of pileup events for the in-time bu...
Definition: Plots.h:21
DAS::PUprofile::Plots::nVtx
TH1F nVtx
number of vertices
Definition: Plots.h:24
DAS::PUprofile::Plots::Write
void Write(TDirectory *d)
Definition: Plots.h:58
DAS::PUprofile::Plots::rho
TH1F rho
soft activity
Definition: Plots.h:23