DAS  3.0
Das Analysis System
PtYFillerfinal

#include <PtY.h>

+ Inheritance diagram for PtYFiller:
+ Collaboration diagram for PtYFiller:

Public Member Functions

 PtYFiller (const PtY &obs, TTreeReader &reader)
 
bool selection (double pt, double absy)
 
std::list< int > fillRec (DistVariation &) override
 
void match () override
 
void fillMC (DistVariation &) override
 
- Public Member Functions inherited from Filler
virtual ~Filler ()=default
 

Public Attributes

PtY obs
 
std::optional< TTreeReaderArray< GenJet > > genJets
 
TTreeReaderArray< RecJetrecJets
 
std::optional< TTreeReaderValue< GenEvent > > gEv
 
TTreeReaderValue< RecEventrEv
 
std::optional< JMEmatching< TTreeReaderArray< DAS::RecJet >, TTreeReaderArray< DAS::GenJet > > > matching
 

Constructor & Destructor Documentation

◆ PtYFiller()

PtYFiller ( const PtY obs,
TTreeReader &  reader 
)

Constructor.

14  : obs(obs)
15  , genJets(initOptionalBranch<decltype(genJets)>(reader, "genJets"))
16  , recJets(reader, "recJets")
17  , gEv(initOptionalBranch<decltype(gEv)>(reader, "genEvent"))
18  , rEv(reader, "recEvent")
19 {
20  JMEmatching<TTreeReaderArray<RecJet>,TTreeReaderArray<GenJet>>::maxDR = obs.maxDR;
21 }

Member Function Documentation

◆ fillMC()

void fillMC ( DistVariation v)
overridevirtual

See Filler::fillMC

Todo:
use RM underflow?

Reimplemented from Filler.

54 {
55  if (!obs.isMC)
56  BOOST_THROW_EXCEPTION( runtime_error(__func__ + " should only be called for MC"s) );
57 
58  double rEvW = rEv->Weight(v),
59  gEvW = (*gEv)->Weight(v);
60 
61  for (const auto& [rec_it,gen_it]: matching->match_its) {
62 
63  double genpt = gen_it->CorrPt(v),
64  geny = gen_it->AbsRap();
65 
66  bool goodGen = selection(genpt, geny);
67  auto igenbin = obs.genBinning->GetGlobalBinNumber(genpt,geny);
68 
69  double gJetW = gen_it->Weight(v);
70 
71  if (goodGen) v.gen->Fill(igenbin, gEvW * gJetW);
72 
73  double recpt = rec_it->CorrPt(v),
74  recy = rec_it->AbsRap();
75 
76  bool goodRec = selection(recpt, recy);
77  auto irecbin = obs.recBinning->GetGlobalBinNumber(recpt,recy);
78 
79  double rJetW = rec_it->Weight(v);
80 
81  if ( goodRec && goodGen) { v.RM ->Fill(igenbin, irecbin, gEvW * gJetW * rEvW * rJetW );
82  v.missNoMatch->Fill(igenbin, gEvW * gJetW * (1 - rEvW * rJetW)); }
83  else if (!goodRec && goodGen) v.missOut ->Fill(igenbin, gEvW * gJetW );
84  else if ( goodRec && !goodGen) v.fakeOut ->Fill( irecbin, gEvW * gJetW * rEvW * rJetW );
85  }
86 
87  for (const auto& gen_it: matching->miss_its) {
88 
89  double pt = gen_it->CorrPt(v),
90  y = gen_it->AbsRap();
91  if (!selection(pt,y)) continue;
92 
93  double gJetW = gen_it->Weight(v);
94  auto igenbin = obs.genBinning->GetGlobalBinNumber(pt,y);
95 
96  v.missNoMatch->Fill(igenbin, gEvW * gJetW);
97  v.gen ->Fill(igenbin, gEvW * gJetW);
98  }
99 
100  for (const auto& rec_it: matching->fake_its) {
101 
102  double pt = rec_it->CorrPt(v),
103  y = rec_it->AbsRap();
104  if (!selection(pt,y)) continue;
105 
106  double rJetW = rec_it->Weight(v);
107  auto irecbin = obs.recBinning->GetGlobalBinNumber(pt,y);
108 
109  v.fakeNoMatch->Fill(irecbin, gEvW * rEvW * rJetW);
110  }
111 }

◆ fillRec()

list< int > fillRec ( DistVariation v)
overridevirtual

See Filler::fillRec

Reimplemented from Filler.

24 {
25  list<int> binIDs;
26 
27  double evW = rEv->Weight(v);
28  if (obs.isMC) evW *= (*gEv)->Weight(v);
29 
30  for (const RecJet& recJet: recJets) {
31  double pt = recJet.CorrPt(v),
32  y = recJet.AbsRap();
33  if (!selection(pt,y)) continue;
34 
35  auto irecbin = obs.recBinning->GetGlobalBinNumber(pt,y);
36 
37  if (find(binIDs.begin(), binIDs.end(), irecbin) == binIDs.end())
38  binIDs.push_back(irecbin);
39 
40  double jetW = recJet.Weight(v);
41  v.tmp->Fill(irecbin, evW * jetW);
42  v.rec->Fill(irecbin, evW * jetW);
43  }
44  return binIDs;
45 }

◆ match()

void match ( )
overridevirtual

Using JME matching.

Todo:
just write sth like std::optional<JMEmatching<TTreeReaderArray>>?

Reimplemented from Filler.

48 {
49  matching.reset();
50  matching.emplace(recJets, *genJets);
51 }

◆ selection()

bool selection ( double  pt,
double  absy 
)
inline

Jet selection.

63  {
64  return pt >= minpt && pt < maxpt && absy < maxy;
65  }

Member Data Documentation

◆ genJets

std::optional<TTreeReaderArray<GenJet> > genJets

◆ gEv

std::optional<TTreeReaderValue<GenEvent> > gEv

◆ matching

std::optional<JMEmatching<TTreeReaderArray<DAS::RecJet>,TTreeReaderArray<DAS::GenJet> > > matching

◆ obs

PtY obs

Backreference to the observable.

◆ recJets

TTreeReaderArray<RecJet> recJets

◆ rEv

TTreeReaderValue<RecEvent> rEv

The documentation for this struct was generated from the following files:
jmarExample.pt
pt
Definition: jmarExample.py:19
DAS::Unfolding::InclusiveJet::PtYFiller::gEv
std::optional< TTreeReaderValue< GenEvent > > gEv
Definition: PtY.h:53
DAS::Unfolding::InclusiveJet::PtYFiller::genJets
std::optional< TTreeReaderArray< GenJet > > genJets
Definition: PtY.h:51
DAS::Unfolding::InclusiveJet::PtYFiller::selection
bool selection(double pt, double absy)
Jet selection.
Definition: PtY.h:62
DAS::Unfolding::InclusiveJet::maxpt
static const double maxpt
Definition: PtY.h:31
DAS::Unfolding::InclusiveJet::maxy
static const double maxy
Definition: PtY.h:31
DAS::Unfolding::Observable::genBinning
TUnfoldBinning * genBinning
particle-level binning
Definition: Observable.h:150
DAS::Unfolding::InclusiveJet::PtYFiller::obs
PtY obs
Backreference to the observable.
Definition: PtY.h:49
DAS::Unfolding::Observable::isMC
static bool isMC
Definition: Observable.h:144
DAS::Unfolding::InclusiveJet::PtYFiller::recJets
TTreeReaderArray< RecJet > recJets
Definition: PtY.h:52
DAS::Unfolding::InclusiveJet::minpt
static const double minpt
Definition: PtY.h:31
DAS::Unfolding::initOptionalBranch
auto initOptionalBranch(TTreeReader &reader, const char *name)
Definition: Observable.h:39
DAS::Unfolding::InclusiveJet::PtYFiller::matching
std::optional< JMEmatching< TTreeReaderArray< DAS::RecJet >, TTreeReaderArray< DAS::GenJet > > > matching
Definition: PtY.h:71
DAS::Unfolding::Observable::recBinning
TUnfoldBinning * recBinning
detector-level binning
Definition: Observable.h:149
DAS::Unfolding::InclusiveJet::PtYFiller::rEv
TTreeReaderValue< RecEvent > rEv
Definition: PtY.h:54
DAS::Unfolding::Observable::maxDR
static double maxDR
max Delta R
Definition: Observable.h:146