DAS  3.0
Das Analysis System
PtYFillerfinal

#include <PtY.h>

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

Public Member Functions

 PtYFiller (const PtY &, Darwin::Tools::Flow &)
 
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::vector< GenJet > * genJets
 
std::vector< RecJet > * recJets
 
GenEventgEv
 
RecEventrEv
 
std::optional< DAS::JMEmatching< std::vector< DAS::RecJet >, std::vector< DAS::GenJet > > > matching
 

Constructor & Destructor Documentation

◆ PtYFiller()

PtYFiller ( const PtY obs,
Darwin::Tools::Flow flow 
)

Constructor.

15  : obs(obs)
16  , genJets(obs.isMC ? flow.GetBranchReadOnly<vector<GenJet>>("genJets") : nullptr)
17  , recJets(flow.GetBranchReadOnly<vector<RecJet>>("recJets"))
18  , gEv(obs.isMC ? flow.GetBranchReadOnly<GenEvent>("genEvent") : nullptr)
19  , rEv(flow.GetBranchReadOnly<RecEvent>("recEvent"))
20 {
21  JMEmatching<vector<RecJet>,vector<GenJet>>::maxDR = obs.maxDR;
22 }

Member Function Documentation

◆ fillMC()

void fillMC ( DistVariation v)
overridevirtual

See Filler::fillMC

Todo:
use RM underflow?

Reimplemented from Filler.

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

◆ fillRec()

list< int > fillRec ( DistVariation v)
overridevirtual

See Filler::fillRec

Reimplemented from Filler.

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

◆ match()

void match ( )
overridevirtual

Using JME matching.

Reimplemented from Filler.

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

◆ selection()

bool selection ( double  pt,
double  absy 
)
inline

Jet selection.

61  {
62  return pt >= minpt && pt < maxpt && absy < maxy;
63  }

Member Data Documentation

◆ genJets

std::vector<GenJet>* genJets

◆ gEv

GenEvent* gEv

◆ matching

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

◆ obs

PtY obs

Backreference to the observable.

◆ recJets

std::vector<RecJet>* recJets

◆ rEv

RecEvent* rEv

The documentation for this struct was generated from the following files:
jmarExample.pt
pt
Definition: jmarExample.py:19
DAS::Unfolding::InclusiveJet::PtYFiller::selection
bool selection(double pt, double absy)
Jet selection.
Definition: PtY.h:60
DAS::Unfolding::InclusiveJet::PtYFiller::recJets
std::vector< RecJet > * recJets
Definition: PtY.h:50
DAS::Unfolding::InclusiveJet::PtYFiller::rEv
RecEvent * rEv
Definition: PtY.h:52
DAS::Unfolding::InclusiveJet::maxpt
static const double maxpt
Definition: PtY.h:29
DAS::Unfolding::InclusiveJet::maxy
static const double maxy
Definition: PtY.h:29
DAS::Unfolding::Observable::genBinning
TUnfoldBinning * genBinning
particle-level binning
Definition: Observable.h:125
DAS::Unfolding::InclusiveJet::PtYFiller::obs
PtY obs
Backreference to the observable.
Definition: PtY.h:47
DAS::Unfolding::Observable::isMC
static bool isMC
Definition: Observable.h:119
DAS::AbstractEvent::Weight
double Weight(const Uncertainties::Variation &v) const
< weight
Definition: Event.h:25
DAS::Unfolding::InclusiveJet::minpt
static const double minpt
Definition: PtY.h:29
DAS::Unfolding::InclusiveJet::PtYFiller::genJets
std::vector< GenJet > * genJets
Definition: PtY.h:49
Darwin::Tools::Flow::GetBranchReadOnly
T * GetBranchReadOnly(const std::string &name, BranchMode mode=mandatory)
Wrapper to initialise read-only branches.
Definition: Flow.h:257
DAS::Unfolding::InclusiveJet::PtYFiller::matching
std::optional< DAS::JMEmatching< std::vector< DAS::RecJet >, std::vector< DAS::GenJet > > > matching
Definition: PtY.h:70
DAS::Unfolding::Observable::recBinning
TUnfoldBinning * recBinning
detector-level binning
Definition: Observable.h:124
DAS::Unfolding::InclusiveJet::PtYFiller::gEv
GenEvent * gEv
Definition: PtY.h:51
DAS::Unfolding::Observable::maxDR
static double maxDR
max Delta R
Definition: Observable.h:121