|
DAS
3.0
Das Analysis System
|
Go to the documentation of this file.
18 #include "Math/VectorUtil.h"
24 namespace fs = std::filesystem;
73 std::map<int, TriggerLumi>::const_reverse_iterator
it;
91 fs::path trigger_curves,
92 const std::string& strategy,
103 cout <<
"ntriggers = " <<
ntriggers <<
'\n'
105 <<
"minpt = " <<
minpt << endl;
107 if (
method ==
"prescales")
109 else if (
method ==
"lumi")
112 cerr <<
"method ('" <<
method <<
"') is not defined, aborting\n";
116 if (strategy ==
"pt")
118 else if (strategy ==
"eta")
121 cerr <<
"strategy of selection and normalisation ('" << strategy <<
"') is not defined, aborting\n";
135 std::vector<RecJet>& recJets,
136 std::vector<FourVector>& hltJets,
158 if (preL1min != preL1max)
159 cerr <<
"\x1B[31m\e[1m" << preL1min <<
' ' << preL1max <<
"\x1B[30m\e[0m\n";
161 double prescale = preHLT * preL1min;
166 static vector<map<pair<int,int>,
int>> prescales(
ntriggers);
167 pair<int,int> runlum = {evnt.
runNo, evnt.
lumi};
168 if (prescales.at(
ibit).count(runlum))
169 assert(prescales.at(
ibit).at(runlum) == prescale);
171 prescales.at(
ibit)[runlum] = prescale;
175 double efficiency =
eff(leadingJet);
199 double efficiency =
eff(leadingJet);
200 double inv_eff_lumi = (
it->second).
weight;
206 double norm = inv_eff_lumi / efficiency;
220 std::vector<RecJet>& recJets,
221 std::vector<FourVector>& hltJets,
227 auto leadingInTk =
phaseSel(recJets);
230 if (leadingInTk == recJets.end()) {
232 return recJets.front();
235 auto leading_pt = leadingInTk->CorrPt();
237 if (leading_pt <
minpt) {
239 return recJets.front();
248 if (leading_pt >=
it->second.turnon)
break;
259 cerr <<
"\x1B[31m\e[1mProblem with `trigger_lumi` iterator (leading_pt = " << leading_pt <<
")\x1B[30m\e[0m\n";
261 return recJets.front();
264 cerr <<
"\x1B[31m\e[1mProblem with `ibit` (leading_pt = " << leading_pt <<
")\x1B[30m\e[0m\n";
266 return recJets.front();
272 return recJets.front();
291 std::vector<RecJet>& recJets,
292 std::vector<FourVector>& hltJets,
298 auto mnorder = [] (
const RecJet& recJet1,
const RecJet& recJet2) {
299 return (recJet1.
p4.Eta() > recJet2.p4.Eta());
301 sort(recJets.begin(), recJets.end(), mnorder);
304 auto leadingJet = recJets.begin();
305 auto subleadingJet = prev(recJets.end());
311 return recJets.front();
315 float leading_pt = leadingJet->CorrPt();
316 float subleading_pt = subleadingJet->CorrPt();
318 if (leading_pt <
minpt && subleading_pt <
minpt) {
320 return recJets.front();
326 float leadingHlt_pt = leadingHltTk.Pt();
327 float subleadingHlt_pt = subleadingHltTk.Pt();
334 int recturnon =
it->second.turnon;
335 float hltthreshold =
it->first;
336 if ( (leading_pt >= recturnon) && (leadingHlt_pt >= hltthreshold)
337 && (subleading_pt >= recturnon) && (subleadingHlt_pt >= hltthreshold) ) {
338 if ( std::abs(subleadingJet->p4.Eta()) > std::abs(leadingJet->p4.Eta()) ) {
339 swap(leadingJet, subleadingJet);
340 swap(leading_pt, subleading_pt);
341 swap(leadingHlt_pt, subleadingHlt_pt);
345 if (leading_pt >= recturnon && leadingHlt_pt >= hltthreshold)
break;
346 if (subleading_pt >= recturnon && subleadingHlt_pt >= hltthreshold) {
347 swap(leadingJet, subleadingJet);
348 swap(leading_pt, subleading_pt);
349 swap(leadingHlt_pt, subleadingHlt_pt);
360 return recJets.front();
364 cerr <<
"\x1B[31m\e[1mProblem with `ibit` (leading_pt = " << leading_pt <<
")\x1B[30m\e[0m\n";
366 return recJets.front();
372 return recJets.front();
std::vector< DAS::RecJet >::iterator phaseSel(std::vector< DAS::RecJet > &recjets)
Definition: PhaseSelection.h:9
method
Definition: Core-gitclone-lastrun.txt:5
std::vector< Weight > Weights
Definition: Weight.h:41
cerr
Definition: Ntupliser_cfg.py:93
const RecJet & NormalisationStd(RecEvent &evnt, std::vector< RecJet > &recJets, std::vector< FourVector > &hltJets, Trigger &trigger)
Definition: applyDataNormalisation.h:219
FourVector p4
raw four-momentum directly after reconstruction
Definition: PhysicsObject.h:47
const RecJet & operator()(RecEvent &evnt, std::vector< RecJet > &recJets, std::vector< FourVector > &hltJets, Trigger &trigger)
Definition: applyDataNormalisation.h:134
TriggerEff eff
Definition: applyDataNormalisation.h:68
int year
Definition: Ntupliser_cfg.py:63
const RecJet & NormalisationFwd(RecEvent &evnt, std::vector< RecJet > &recJets, std::vector< FourVector > &hltJets, Trigger &trigger)
Definition: applyDataNormalisation.h:290
std::vector< bool > Bit
indicates which trigger has fired
Definition: Event.h:72
const RecJet & NormalisationCommonLumi(RecEvent &evnt, const RecJet &leadingJet, const Trigger &trigger)
Definition: applyDataNormalisation.h:194
void reset(Weights &wgts, const double v=0)
Definition: applyDataNormalisation.h:28
Weights weights
e.g. cross section normalisation
Definition: Event.h:23
int runNo
6-digit run number
Definition: Event.h:55
std::map< int, TriggerLumi >::const_reverse_iterator it
Definition: applyDataNormalisation.h:73
const size_t ntriggers
Definition: applyDataNormalisation.h:69
const RecJet &(Functor::* NormalisationPtr)(RecEvent &, std::vector< RecJet > &, std::vector< FourVector > &, Trigger &)
Definition: applyDataNormalisation.h:83
std::vector< int > PreL1max
L1 max pre-scale.
Definition: Event.h:75
DAS::Weight weight
Definition: classes.h:11
Definition: applyDataNormalisation.h:66
const float minpt
Definition: applyDataNormalisation.h:71
int lumi
lumi section
Definition: Event.h:56
size_t ibit
Definition: applyDataNormalisation.h:72
std::vector< int > PreL1min
L1 min pre-scale.
Definition: Event.h:74
std::map< int, TriggerLumi > GetLumiFromFiles(const std::filesystem::path &lumi_file, const std::filesystem::path &turnon_file)
path to text file with turn-on points
const double inv_total_lumi
Definition: applyDataNormalisation.h:70
Functor(fs::path lumi_file, fs::path turnon_file, fs::path trigger_curves, const std::string &strategy, const std::string &method, const int year)
Definition: applyDataNormalisation.h:89
Definition: getHLTJetResponse.cc:34
Functor to return the efficiency of a given trigger for a given (leading) jet.
Definition: TriggerEff.h:27
const std::map< int, TriggerLumi > triggers_lumi
Definition: applyDataNormalisation.h:67
DAS::FourVector match(const DAS::FourVector &jet, const std::vector< DAS::FourVector > *hltJets)
Definition: match.h:7
const RecJet & NormalisationCommonPresc(RecEvent &evnt, const RecJet &leadingJet, const Trigger &trigger)
Definition: applyDataNormalisation.h:148
std::vector< int > PreHLT
HLT prescale.
Definition: Event.h:73
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< float > > FourVector
Definition: PhysicsObject.h:15
const RecJet &(Functor::* NormalisationCommonPtr)(RecEvent &, const RecJet &, const Trigger &)
Definition: applyDataNormalisation.h:84