DAS  3.0
Das Analysis System
MuellerNavelet.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include <algorithm>
6 #include <list>
7 #include <optional>
8 #include <vector>
9 
16 namespace DAS::MN {
17 
29 struct Obs2Jets {
30 
31  Obs2Jets ( const DAS::RecJet & Fwd, const DAS::RecJet & Bwd );
32  Obs2Jets ( const DAS::GenJet & Fwd, const DAS::GenJet & Bwd );
33 
34  float PtAve () const;
35  float PtFWD () const;
36  float PtBWD () const;
37  float PtRatMN () const;
38  float DEta () const;
39  float DPhi () const;
40  float CosDPhi (int n
41  ) const;
42  size_t size () const;
43 
44  const float weightFWD,
46  const float weight;
47 
48 private:
49  std::vector<DAS::FourVector> LeadingJets;
50 };
53 
66 struct ObsMiniJets {
67 
68  ObsMiniJets ( const std::vector<DAS::RecJet> & recJets );
69  ObsMiniJets ( const std::vector<DAS::GenJet> & genJets );
70 
71  float PtAveMini () const;
72  float DEtaAveMini () const;
73  float REtaAveMini () const;
74  float RPtExpDEta () const;
75  size_t size () const;
76 
77  const float weight;
78 
79 private:
80  std::vector<DAS::FourVector> MiniJets;
81 };// end of class ObsMiniJets
83 
94 template<typename Jet>
95 std::optional<std::pair<Jet,Jet>> GetMNJet (std::vector<Jet> jets, std::function<bool(Jet&)> ptcut=[](Jet& jet) {return jet.p4.Pt() < 35 ;});
96 
97 template<typename Jet>
98 std::optional<std::pair<Jet, Jet>> GetMNJet (std::vector <Jet> jets, std::function<bool(Jet&)> ptcut)
99 {
100  jets.erase(remove_if(jets.begin(), jets.end(), ptcut), jets.end());
101  if (jets.size() < 2) return std::nullopt;
102  auto result = minmax_element( jets.begin(), jets.end() , [](Jet& j1, Jet& j2)
103  {return j1.p4.Eta() > j2.p4.Eta();} );
104 
105  if (result.first->p4.Eta() <= 0 || result.second->p4.Eta() >= 0) return std::nullopt;
106  return std::make_optional<std::pair<Jet,Jet>>(*result.first, *result.second);
107 }
108 
124 template<typename Jet>
125 std::vector<Jet> GetMiniJets (std::vector<Jet> jets, const std::pair<Jet,Jet>& MNJets, std::function<bool(Jet&)> ptcut=[](Jet& jet) {return jet.p4.Pt()<20;});
126 
127 template<typename Jet>
128 std::vector<Jet> GetMiniJets (std::vector<Jet> jets, const std::pair<Jet,Jet>& MNJets, std::function<bool(Jet&)> ptcut)
129 {
130  jets.erase(std::remove_if(jets.begin(), jets.end(), ptcut), jets.end());
131  jets.erase(std::remove_if(jets.begin(), jets.end(),
132  [MNJets](Jet& jet){return jet.p4.Eta() >= MNJets.first.p4.Eta();}), jets.end());
133 
134  jets.erase(std::remove_if(jets.begin(), jets.end(),
135  [MNJets](Jet& jet){return jet.p4.Eta() <= MNJets.second.p4.Eta();}), jets.end());
136 
137  std::sort( jets.begin(), jets.end() , [](Jet& j1, Jet& j2)
138  {return j1.p4.Eta() > j2.p4.Eta();} );
139 
140  return jets;
141 }
142 
143 } // end of namespace DAS::MN
DAS::MN::ObsMiniJets::weight
const float weight
Definition: MuellerNavelet.h:77
DAS::MN::Obs2Jets::PtFWD
float PtFWD() const
Definition: MuellerNavelet.cc:43
DAS::MN::Obs2Jets::PtAve
float PtAve() const
Definition: MuellerNavelet.cc:38
DAS::MN::Obs2Jets::weight
const float weight
product of weightFWD and weightBWD
Definition: MuellerNavelet.h:46
DAS::MN::ObsMiniJets::RPtExpDEta
float RPtExpDEta() const
Definition: MuellerNavelet.cc:126
DAS::MN::ObsMiniJets::DEtaAveMini
float DEtaAveMini() const
Definition: MuellerNavelet.cc:108
DAS::MN::Obs2Jets::CosDPhi
float CosDPhi(int n) const
Definition: MuellerNavelet.cc:71
DAS::RecJet
Definition: Jet.h:37
Jet.h
Ntupliser_cfg.jets
string jets
Definition: Ntupliser_cfg.py:41
DAS::GenJet
class GenJet
Definition: Jet.h:9
DAS::MN::Obs2Jets::weightBWD
const float weightBWD
weight of the most backward jet
Definition: MuellerNavelet.h:45
DAS::MN::Obs2Jets::size
size_t size() const
Definition: MuellerNavelet.cc:76
DAS::MN::Obs2Jets::PtRatMN
float PtRatMN() const
Definition: MuellerNavelet.cc:29
DAS::MN::GetMNJet
std::optional< std::pair< Jet, Jet > > GetMNJet(std::vector< Jet > jets, std::function< bool(Jet &)> ptcut=[](Jet &jet) {return jet.p4.Pt()< 35 ;})
Definition: MuellerNavelet.h:98
DAS::MN
Definition: getMNobservables.cc:35
DAS::MN::Obs2Jets::Obs2Jets
Obs2Jets(const DAS::RecJet &Fwd, const DAS::RecJet &Bwd)
Definition: MuellerNavelet.cc:14
DAS::MN::Obs2Jets::DEta
float DEta() const
Definition: MuellerNavelet.cc:53
DAS::MN::Obs2Jets::LeadingJets
std::vector< DAS::FourVector > LeadingJets
Definition: MuellerNavelet.h:49
DAS::MN::Obs2Jets::PtBWD
float PtBWD() const
Definition: MuellerNavelet.cc:48
DAS::MN::ObsMiniJets::REtaAveMini
float REtaAveMini() const
Definition: MuellerNavelet.cc:117
DAS::MN::ObsMiniJets::ObsMiniJets
ObsMiniJets(const std::vector< DAS::RecJet > &recJets)
Definition: MuellerNavelet.cc:78
DAS::MN::ObsMiniJets
Definition: MuellerNavelet.h:66
DAS::MN::ObsMiniJets::size
size_t size() const
Definition: MuellerNavelet.cc:141
DAS::MN::Obs2Jets::DPhi
float DPhi() const
Definition: MuellerNavelet.cc:60
DAS::MN::ObsMiniJets::PtAveMini
float PtAveMini() const
Definition: MuellerNavelet.cc:100
DAS::MN::Obs2Jets::weightFWD
const float weightFWD
weight of the most forward jet
Definition: MuellerNavelet.h:44
DAS::MN::Obs2Jets
Definition: MuellerNavelet.h:29
DAS::MN::GetMiniJets
std::vector< Jet > GetMiniJets(std::vector< Jet > jets, const std::pair< Jet, Jet > &MNJets, std::function< bool(Jet &)> ptcut=[](Jet &jet) {return jet.p4.Pt()< 20;})
Definition: MuellerNavelet.h:128
DAS::MN::ObsMiniJets::MiniJets
std::vector< DAS::FourVector > MiniJets
The size should be >1.
Definition: MuellerNavelet.h:80