2 #include "boost/program_options.hpp" 3 #include "boost/algorithm/string.hpp" 52 std::string triggerObjectsL1Muons;
53 if (
config_->triggerObjectsL1Muons() !=
"" )
55 triggerObjectsL1Muons =
config_->triggerObjectsL1Muons();
56 if (
config_->triggerEmulateL1Muons() !=
"" &&
config_->triggerEmulateL1MuonsNMin() > 0 )
58 int nmin =
config_->triggerEmulateL1MuonsNMin();
59 float ptmin =
config_->triggerEmulateL1MuonsPtMin();
60 float etamax =
config_->triggerEmulateL1MuonsEtaMax();
61 std::string newL1Muons =
config_->triggerEmulateL1Muons();
63 triggerObjectsL1Muons = newL1Muons;
68 std::string triggerObjectsL3Muons;
69 if (
config_->triggerObjectsL3Muons() !=
"" )
71 triggerObjectsL3Muons =
config_->triggerObjectsL3Muons();
72 if (
config_->triggerEmulateL3Muons() !=
"" &&
config_->triggerEmulateL3MuonsNMin() > 0 )
74 int nmin =
config_->triggerEmulateL3MuonsNMin();
75 float ptmin =
config_->triggerEmulateL3MuonsPtMin();
76 float etamax =
config_->triggerEmulateL3MuonsEtaMax();
77 std::string newL3Muons =
config_->triggerEmulateL3Muons();
79 triggerObjectsL3Muons = newL3Muons;
87 if ( std::string(
h1_[
"cutflow"] -> GetXaxis()-> GetBinLabel(
cutflow_+1)) ==
"" )
89 h1_[
"cutflow"] -> GetXaxis()-> SetBinLabel(
cutflow_+1,Form(
"Using Muon collection: %s",(
config_->muonsCollection()).c_str()));
94 if (
config_->triggerObjectsL1Muons() !=
"" )
100 if (
config_->triggerObjectsL3Muons() !=
"" )
106 for (
int j = 0 ; j < muons->size() ; ++j )
muons_.push_back(std::make_shared<Muon>(muons->at(j)));
137 for (
int j = 0; j < n; ++j )
139 h1_[Form(
"pt_%s%d" , obj.c_str(),j+1)] = std::make_shared<TH1F>(Form(
"pt_%s%d" , obj.c_str(),j+1) ,
"" ,100 , 0 , 1000 );
140 h1_[Form(
"eta_%s%d" , obj.c_str(),j+1)] = std::make_shared<TH1F>(Form(
"eta_%s%d" , obj.c_str(),j+1) ,
"" , 60 , -3, 3 );
141 h1_[Form(
"phi_%s%d" , obj.c_str(),j+1)] = std::make_shared<TH1F>(Form(
"phi_%s%d" , obj.c_str(),j+1) ,
"" , 64 , -3.2, 3.2 );
154 if ( std::string(
h1_[
"cutflow"] -> GetXaxis()-> GetBinLabel(
cutflow_+1)) ==
"" )
157 h1_[
"cutflow"] -> GetXaxis()-> SetBinLabel(
cutflow_+1,Form(
"Muon %d: pt > %5.1f GeV and pt < %5.1f GeV and |eta| < %3.1f",r,
config_->muonsPtMin()[m],
config_->muonsPtMax()[m],
config_->muonsEtaMax()[m] ));
159 h1_[
"cutflow"] -> GetXaxis()-> SetBinLabel(
cutflow_+1,Form(
"Muon %d: pt > %5.1f GeV and |eta| < %3.1f",r,
config_->muonsPtMin()[m],
config_->muonsEtaMax()[m] ));
181 if ( std::string(
h1_[
"cutflow"] -> GetXaxis()-> GetBinLabel(
cutflow_+1)) ==
"" )
183 if (
config_->muonsPtMax().size() > 0 &&
config_->muonsPtMax().back() >
config_->muonsPtMin().back() )
184 h1_[
"cutflow"] -> GetXaxis()-> SetBinLabel(
cutflow_+1,Form(
"Muons selected: pt > %5.1f GeV and pt < %5.1f GeV and |eta| < %3.1f",
config_->muonsPtMin().back(),
config_->muonsPtMax().back(),
config_->muonsEtaMax().back() ));
186 h1_[
"cutflow"] -> GetXaxis()-> SetBinLabel(
cutflow_+1,Form(
"Muons selected: pt > %5.1f GeV and |eta| < %3.1f",
config_->muonsPtMin().back(),
config_->muonsEtaMax().back() ));
193 if (
config_->muonsPtMax().size() > 0 &&
config_->muonsPtMax().back() >
config_->muonsPtMin().back() )
195 if ( (*muon)->pt() <
config_->muonsPtMin().back() || (*muon)->pt() >
config_->muonsPtMax().back() || fabs((*muon)->eta()) >
config_->muonsEtaMax().back() )
202 if ( (*muon)->pt() <
config_->muonsPtMin().back() || fabs((*muon)->eta()) >
config_->muonsEtaMax().back() )
223 if ( std::string(
h1_[
"cutflow"] -> GetXaxis()-> GetBinLabel(
cutflow_+1)) ==
"" )
224 h1_[
"cutflow"] -> GetXaxis()-> SetBinLabel(
cutflow_+1,Form(
"MuonId: %s",
config_->muonsId().c_str()));
231 if ( ! (*muon)->id(
config_->muonsId() ) )
253 if ( std::string(
h1_[
"cutflow"] -> GetXaxis()-> GetBinLabel(
cutflow_+1)) ==
"" )
254 h1_[
"cutflow"] -> GetXaxis()-> SetBinLabel(
cutflow_+1,Form(
"NMuons >= %d",
config_->nMuonsMin()));
263 if ( r1 >
config_->nMuonsMin() || r2 >
config_->nMuonsMin() )
return true;
267 std::string label = Form(
"DR(muon %d, muon %d) < %4.2f",r1,r2,fabs(delta));
269 label = Form(
"DR(muon %d, muon %d) > %4.2f",r1,r2,fabs(delta));
288 if (
config_->muonsDrMax() < 0 )
297 if (
config_->muonsDrMin() < 0 )
313 if (
config_->triggerObjectsL1Muons() ==
"" &&
config_->triggerObjectsL3Muons() ==
"" )
return true;
316 if ( std::string(
h1_[
"cutflow"] -> GetXaxis()-> GetBinLabel(
cutflow_+1)) ==
"" )
317 h1_[
"cutflow"] -> GetXaxis()-> SetBinLabel(
cutflow_+1,Form(
"Muons selected: Online muon matching: L1 (deltaR < %4.3f) and L3 (deltaR < %4.3f)",
config_-> triggerMatchL1MuonsDrMax(),
config_-> triggerMatchL3MuonsDrMax()));
322 if ( !((*muon)->matched(
config_->triggerObjectsL1Muons()) && (*muon)->matched(
config_->triggerObjectsL3Muons()) ))
338 if (
config_->triggerObjectsL1Muons() ==
"" )
return true;
342 std::string triggerObjectsL1Muons =
config_->triggerObjectsL1Muons();
343 if (
config_->triggerEmulateL1Muons() !=
"" &&
config_->triggerEmulateL1MuonsNMin() > 0 )
345 triggerObjectsL1Muons =
config_->triggerEmulateL1Muons();
349 if ( r >
config_->nMuonsMin() )
351 std::cout <<
"*Warning* MuonAnalyser::onlineL1MuonMatching(): asking for matching of unselected muon. Returning false!" << std::endl;
356 std::cout <<
"*Warning* MuonAnalyser::onlineL1MuonMatching(): selectedMuons is empty. Returning false!" << std::endl;
360 if ( !
selectedMuons_[j]->matched(triggerObjectsL1Muons) )
return false;
362 if ( std::string(
h1_[
"cutflow"] -> GetXaxis()-> GetBinLabel(
cutflow_+1)) ==
"" )
363 h1_[
"cutflow"] -> GetXaxis()-> SetBinLabel(
cutflow_+1,Form(
"Muon %d: L1 muon match (deltaR < %4.3f)",r,
config_-> triggerMatchL1MuonsDrMax()));
373 if (
config_->triggerObjectsL3Muons() ==
"" )
return true;
377 std::string triggerObjectsL3Muons =
config_->triggerObjectsL3Muons();
378 if (
config_->triggerEmulateL3Muons() !=
"" &&
config_->triggerEmulateL3MuonsNMin() > 0 )
380 triggerObjectsL3Muons =
config_->triggerEmulateL3Muons();
383 if ( r >
config_->nMuonsMin() )
385 std::cout <<
"*Warning* MuonAnalyser::onlineL3MuonMatching(): asking for matching of unselected muon. Returning false!" << std::endl;
390 std::cout <<
"*Warning* MuonAnalyser::onlineL3MuonMatching(): selectedMuons is empty. Returning false!" << std::endl;
394 if ( !
selectedMuons_[j]->matched(triggerObjectsL3Muons) )
return false;
396 if ( std::string(
h1_[
"cutflow"] -> GetXaxis()-> GetBinLabel(
cutflow_+1)) ==
"" )
397 h1_[
"cutflow"] -> GetXaxis()-> SetBinLabel(
cutflow_+1,Form(
"Muon %d: L3 muon match (deltaR < %4.3f)",r,
config_-> triggerMatchL3MuonsDrMax()));
410 for (
int j = 0; j < n; ++j )