DAS  3.0
Das Analysis System
DAS::MN Namespace Reference

Classes

struct  Hist
 
struct  Obs2Jets
 
struct  ObsMiniJets
 

Functions

void getMNobservables (const vector< fs::path > inputs, const fs::path output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0})
 
template<typename Jet >
std::optional< std::pair< Jet, Jet > > GetMNJet (std::vector< Jet > jets, std::function< bool(Jet &)> ptcut=[](Jet &jet) {return jet.p4.Pt()< 35 ;})
 
template<typename Jet >
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;})
 

Variables

static const vector< double > binsY = {0., 0.25, .5, 0.75, 1., 1.25, 1.5, 1.75, 2., 2.25, 2.5, 2.75, 3., 3.25, 3.5, 3.75, 4., 4.25, 4.5, 4.75, 5., 5.25, 5.5, 5.75, 6., 6.25, 6.5, 6.75, 7., 7.25, 7.5, 7.75, 8., 8.25, 8.5, 8.75, 9., 9.25, 9.5}
 
static const vector< double > binsPhi = {0.,.1*M_PI, .2*M_PI, .3*M_PI, .4*M_PI, .5*M_PI, .6*M_PI, .7*M_PI, .8*M_PI, .9*M_PI, M_PI}
 
static const double minY = binsY.front()
 
static const double maxY = binsY.back()
 
static const double maxy = 4.7
 
static const double minpt = 32
 
static const double maxpt = 1.e10
 

Detailed Description

The namespace MN_Helper contains the classes that are needed by getMNobservables.cc to build the histograms. Two types of objects are present here: bs2Jets and ObsMiniJets that contains structures to store the observables themselves (they are higher level physics objects) and Hist that contains histograms.

Function Documentation

◆ 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;} 
)

This function takes as an input a vector of jet, a pair of Mueller-Navelet jets in this event and a selection fuction. All the jet for which the selection function is false are dicarded. Remove all the jets that are at higher-or-equal rapidity than the first member of the pair (considered as the 'leading MN jet') or lower-or-equal rapidity than the second member of the pair (considered a the 'subleading MN jet'). The function is build assuming that the two Mueller-Navelet jets that are provided are also present in the vector of jets of the event. The two Mueller-Navelet jets are removed by the lower-or-equal / higher-or-equal logic of the sample.

Note
there is no consistency check. So if the two MNJets that are given are not present in the vector of jets, it will not throw any error.
if the paire provided is trivial, it will not throw any error. The non-triviallity must be check before hand.
As this function is a template function, it is declared and defined in the common.h. Definitions of template functions are not compiled until they are instantiated with a specific type instance.
Todo:
check the consistency of this condition
Todo:
check the consistency of this condition
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 }

◆ GetMNJet()

std::optional< std::pair< Jet, Jet > > GetMNJet ( std::vector< Jet >  jets,
std::function< bool(Jet &)>  ptcut = [](Jet& jet) {return jet.p4.Pt() < 35 ;} 
)

This function takes as an input a vector of jet and a function<bool(Jet&)>. It finds the two jets that are th most bakward and most forward in the event and satisfies the cut implemented in the function<bool(Jet&)> provided as argument. This function is apllied to all the jets. If it return false, the jets are discarded. The out is an optional. So that if there are no jets satifying the cuts in the event, it returns nullopt.

Note
As this function is a template function, it is declared and defined in the common.h. Definitions of template functions are not compiled until they are instantiated with a specific type instance.
Todo:
check the consistency of this condition
Todo:
check the consistency of this condition
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 }

◆ getMNobservables()

void DAS::MN::getMNobservables ( const vector< fs::path >  inputs,
const fs::path  output,
const pt::ptree &  config,
const int  steering,
const DT::Slice  slice = {1,0} 
)

Calculate the observables that can be used to caracterise Mueller-Navelet Jets.

Parameters
inputsinput ROOT files (n-tuples)
outputname of output root file containing the histograms
configconfig file from `DTOptions`
steeringsteering parameters from `DTOptions`
sliceslices for running
183  {1,0}
184  )
185 {
186  cout << __func__ << ' ' << slice << " start" << endl;
187 
188  unique_ptr<TChain> tIn = DT::GetChain(inputs);
189  unique_ptr<TFile> fOut(DT_GetOutput(output));
190  auto tOut = unique_ptr<TTree>(tIn->CloneTree(0));
191 
192  DT::MetaInfo metainfo(tOut);
193  metainfo.Check(config);
194  auto isMC = metainfo.Get<bool>("flags", "isMC");
195 
196  GenEvent * gEv = nullptr;
197  RecEvent * rEv = nullptr;
198  if (isMC)
199  tIn->SetBranchAddress("genEvent", &gEv);
200  tIn->SetBranchAddress("recEvent", &rEv);
201 
202  vector<RecJet> * recJets = nullptr;
203  vector<GenJet> * genJets = nullptr;
204  tIn->SetBranchAddress("recJets", &recJets);
205  if (isMC)
206  tIn->SetBranchAddress("genJets", &genJets);
207 
208  Hist genHist("gen"), // NOTE: one should only declare the object if (isMC)
209  recHist("rec");
210 
211  for (DT::Looper looper(tIn, slice); looper(); ++looper) {
212  [[ maybe_unused ]]
213  static auto& cout = (steering & DT::verbose) == DT::verbose ? ::cout : DT::dev_null;
214 
215  auto MNJets = GetMNJet<RecJet>(*recJets, [](RecJet jet){return jet.CorrPt() < 35;});
216  if (MNJets) {
217  double recy = std::abs( MNJets->first.p4.Eta() - MNJets->second.p4.Eta() );
218  bool LowRecY = recy < minY,
219  HighRecY = recy >= maxY;
220  bool goodRec = (!LowRecY) && (!HighRecY)
221  && MNJets->first.p4.Eta() < maxy && MNJets->second.p4.Eta() < maxy
222  && minpt < MNJets->first.CorrPt() && MNJets->first.CorrPt() < maxpt
223  && minpt < MNJets->second.CorrPt() && MNJets->second.CorrPt() < maxpt;
224 
225  if (goodRec) {
226  double evweight = rEv->weights.front();
227  if (isMC) evweight *= gEv->weights.front();
228  recHist.Fill(*recJets, evweight);
229  Obs2Jets obs2jets(MNJets->first, MNJets->second);
230  auto minijets = GetMiniJets(*recJets, *MNJets, function<bool(RecJet&)>([](RecJet& jet){return jet.CorrPt() < 20;}));
231  ObsMiniJets obsminijets(minijets);
232  recHist.Fill(obs2jets, obsminijets, evweight);
233  }
234  }
235 
236  if (!isMC) continue;
237 
238  auto genMNJets = GetMNJet<GenJet>(*genJets, [](GenJet jet){return jet.p4.Pt() < 35;});
239  if (genMNJets) {
240  double genY = std::abs( genMNJets->first.p4.Eta() - genMNJets->second.p4.Eta() );
241  bool LowGenY = genY < minY,
242  HighGenY = genY >= maxY,
243  goodGen = (!LowGenY) && (!HighGenY)
244  && genMNJets->first.p4.Eta() < maxy && genMNJets->second.p4.Eta() < maxy
245  && minpt < genMNJets->first.p4.Pt() && genMNJets->first.p4.Pt() < maxpt
246  && minpt < genMNJets->second.p4.Pt() && genMNJets->second.p4.Pt() < maxpt;
247 
248  if (goodGen) {
249  double evweight = gEv->weights.front();
250  genHist.Fill(*genJets, evweight);
251  Obs2Jets obs2jets(genMNJets->first, genMNJets->second);
252  auto minijets = GetMiniJets(*genJets, *genMNJets, function<bool(GenJet&)>([](GenJet& jet){return jet.p4.Pt() < 20;}));
253  ObsMiniJets obsminijets(minijets);
254  genHist.Fill(obs2jets, obsminijets, evweight);
255  }
256  }
257  }
258 
259  recHist.Write(fOut.get());
260  if (isMC)
261  genHist.Write(fOut.get());
262 
263  metainfo.Set<bool>("git", "complete", true);
264  tOut->Write();
265 
266  cout << __func__ << ' ' << slice << " end" << endl;
267 }

Variable Documentation

◆ binsPhi

const vector<double> binsPhi = {0.,.1*M_PI, .2*M_PI, .3*M_PI, .4*M_PI, .5*M_PI, .6*M_PI, .7*M_PI, .8*M_PI, .9*M_PI, M_PI}
static

◆ binsY

const vector<double> binsY = {0., 0.25, .5, 0.75, 1., 1.25, 1.5, 1.75, 2., 2.25, 2.5, 2.75, 3., 3.25, 3.5, 3.75, 4., 4.25, 4.5, 4.75, 5., 5.25, 5.5, 5.75, 6., 6.25, 6.5, 6.75, 7., 7.25, 7.5, 7.75, 8., 8.25, 8.5, 8.75, 9., 9.25, 9.5}
static

◆ maxpt

const double maxpt = 1.e10
static

◆ maxy

const double maxy = 4.7
static

◆ maxY

const double maxY = binsY.back()
static

◆ minpt

const double minpt = 32
static

◆ minY

const double minY = binsY.front()
static
Step::verbose
static bool verbose
Definition: Step.h:40
Darwin::Tools::GetChain
std::unique_ptr< ChainSlice > GetChain(std::vector< std::filesystem::path > inputs, const Slice slice={1, 0}, const std::string &name="events")
Load chain from a list of files.
Definition: FileUtils.cc:67
Darwin::Tools::Looper
Facility to loop over a n-tuple, including parallelisation and printing.
Definition: Looper.h:32
DAS::MN::maxy
static const double maxy
Definition: getMNobservables.cc:41
DAS::MN::maxY
static const double maxY
Definition: getMNobservables.cc:41
Darwin::Tools::MetaInfo
Generic meta-information for n-tuple (including speficities to Darwin).
Definition: MetaInfo.h:65
DAS::MN::minpt
static const double minpt
Definition: getMNobservables.cc:42
Ntupliser_cfg.jets
string jets
Definition: Ntupliser_cfg.py:41
DAS::MN::minY
static const double minY
Definition: getMNobservables.cc:41
Ntupliser_cfg.config
config
Definition: Ntupliser_cfg.py:260
DAS::MN::maxpt
static const double maxpt
Definition: getMNobservables.cc:42
Ntupliser_cfg.isMC
string isMC
Definition: Ntupliser_cfg.py:59
jercExample.inputs
def inputs
Definition: jercExample.py:118
Darwin::Tools::dev_null
static std::ostream dev_null(nullptr)
to redirect output stream to nowhere
DT_GetOutput
#define DT_GetOutput(output)
Definition: FileUtils.h:222
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