20#include "boost/program_options.hpp"
48namespace po = boost::program_options;
55 const bool result = ARG; \
57 ::Error(APP_NAME, "Failed to execute: \"%s\"", \
80template<
class ContainerType>
84 if(obj->pt() > 10000. && fabs(obj->eta()) < 2.5)
93 for(
auto jet : *jets){
94 bool pass = (
jet->pt() > 20000. && fabs(
jet->eta()) < 2.5);
109 for(
auto tau : *
taus){
112 tau->pt() > 20000. && fabs(tau->eta()) < 2.5);
126 Error(
APP_NAME,
"Overlap decoration missing for object");
132 Info(
APP_NAME,
" %s pt %6.2f eta %5.2f phi %5.2f selected %i %s %i",
133 type, obj->pt()*0.001, obj->eta(), obj->phi(),
138 std::stringstream
ss;
ss << overlapObj->
type();
139 Info(
APP_NAME,
" Overlap: type %s pt %6.2f",
140 ss.str().c_str(), overlapObj->
pt()*0.001);
148int main(
int argc,
char* argv[])
154 po::options_description optDesc(
"Allowed options");
155 optDesc.add_options()
156 (
"help,h",
"produce help message")
157 (
"input-file,i", po::value<std::string>()->required(),
158 "input xAOD file name")
159 (
"num-events,n", po::value<Long64_t>()->default_value(-1ll),
160 "number of events to process")
161 (
"working-point,w", po::value<std::string>()->default_value(
"standard"),
164 po::variables_map vm;
165 po::store(po::parse_command_line(argc, argv, optDesc), vm);
166 if(vm.count(
"help")) {
167 std::cout << optDesc << std::endl;
173 catch(
const std::exception& e) {
174 std::cout << e.what() << std::endl;
180 StatusCode::enableFailure();
183 const auto fileName = vm[
"input-file"].as<std::string>();
184 Info(
APP_NAME,
"Opening file: %s", fileName.c_str());
185 TFile inputFile( fileName.c_str() );
190 CHECK( event.readFrom(&inputFile) );
193 Long64_t
entries =
event.getEntries();
194 Long64_t optEntries = vm[
"num-events"].as<Long64_t>();
203 const auto wp = vm[
"working-point"].as<std::string>();
204 if(wp ==
"standard") {
206 }
else if(wp ==
"HF") {
208 }
else if(wp ==
"boosted") {
210 }
else if(wp ==
"boostedHF") {
213 }
else if(wp ==
"photonFavored") {
216 Error(
APP_NAME,
"Unsupported working-point: %s", wp.c_str());
226 if(wp ==
"photonFavored") {
242 unsigned int nTotalElectrons = 0;
243 unsigned int nTotalMuons = 0;
244 unsigned int nTotalJets = 0;
245 unsigned int nTotalTaus = 0;
246 unsigned int nTotalPhotons = 0;
247 unsigned int nSelectedElectrons = 0;
248 unsigned int nSelectedMuons = 0;
249 unsigned int nSelectedJets = 0;
250 unsigned int nSelectedTaus = 0;
251 unsigned int nSelectedPhotons = 0;
252 unsigned int nOverlapElectrons = 0;
253 unsigned int nOverlapMuons = 0;
254 unsigned int nOverlapJets = 0;
255 unsigned int nOverlapTaus = 0;
256 unsigned int nOverlapPhotons = 0;
259 std::cout <<
"Starting loop" << std::endl;
260 for(Long64_t entry = 0; entry <
entries; ++entry){
262 event.getEntry(entry);
266 CHECK( event.retrieve(evtInfo,
"EventInfo") );
267 Info(
APP_NAME,
"===>>> Processing entry %lli, run %u, event %lu <<<===",
272 CHECK( event.retrieve(electrons,
"Electrons") );
275 CHECK( event.retrieve(muons,
"Muons") );
278 CHECK( event.retrieve(jets,
"AntiKt4EMTopoJets") );
281 CHECK( event.retrieve(
taus,
"TauJets") );
284 CHECK( event.retrieve(photons,
"Photons") );
293 Info(
APP_NAME,
"nEle %lu, nMuo %lu, nJet %lu, nTau %lu, nPho %lu",
294 electrons->size(), muons->
size(),
295 jets->size(),
taus->size(),
299 CHECK( orTool->removeOverlaps(electrons, muons, jets,
taus, photons) );
307 Info(
APP_NAME,
"Now dumping the electrons");
308 for(
auto electron : *electrons){
312 nSelectedElectrons++;
318 Info(
APP_NAME,
"Now dumping the muons");
319 for(
auto muon : *muons){
329 Info(
APP_NAME,
"Now dumping the jets");
330 for(
auto jet : *jets){
340 Info(
APP_NAME,
"Now dumping the taus");
341 for(
auto tau : *
taus){
351 Info(
APP_NAME,
"Now dumping the photons");
352 for(
auto photon : *photons){
362 Info(
APP_NAME,
"=====================================");
363 Info(
APP_NAME,
"End of event processing");
364 Info(
APP_NAME,
"Object count summaries: nOverlap / nSelected / nTotal");
365 Info(
APP_NAME,
"Number overlap elecs: %5i / %5i / %5i",
366 nOverlapElectrons, nSelectedElectrons, nTotalElectrons);
367 Info(
APP_NAME,
"Number overlap muons: %5i / %5i / %5i",
368 nOverlapMuons, nSelectedMuons, nTotalMuons);
369 Info(
APP_NAME,
"Number overlap jets: %5i / %5i / %5i",
370 nOverlapJets, nSelectedJets, nTotalJets);
371 Info(
APP_NAME,
"Number overlap taus: %5i / %5i / %5i",
372 nOverlapTaus, nSelectedTaus, nTotalTaus);
373 Info(
APP_NAME,
"Number overlap photons: %5i / %5i / %5i",
374 nOverlapPhotons, nSelectedPhotons, nTotalPhotons);
376 Info(
APP_NAME,
"Application finished successfully");
Defines helper functions for initializing the OR tools in C++.
void selectObjects< xAOD::TauJetContainer >(const xAOD::TauJetContainer *taus)
const ort::inputDecorator_t bJetDec(bJetLabel)
const ort::outputAccessor_t overlapAcc(outputLabel)
const std::string outputLabel
const bool outputPassValue
void printObj(const char *APP_NAME, const char *type, const xAOD::IParticle *obj)
const ort::inputDecorator_t selectDec(inputLabel)
const std::string inputLabel
void selectObjects< xAOD::JetContainer >(const xAOD::JetContainer *jets)
const ort::inputAccessor_t selectAcc(inputLabel)
const std::string bJetLabel
const ort::objLinkAccessor_t objLinkAcc("overlapObject")
void selectObjects(const ContainerType *container)
size_type size() const noexcept
Returns the number of elements in the collection.
uint32_t runNumber() const
The current event's run number.
uint64_t eventNumber() const
The current event's event number.
Class providing the definition of the 4-vector interface.
virtual double pt() const =0
The transverse momentum ( ) of the particle.
virtual Type::ObjectType type() const =0
The type of the object as a simple enumeration.
Tool for accessing xAOD files outside of Athena.
@ kAthenaAccess
Access containers/objects like Athena does.
A relatively simple transient store for objects created in analysis.
StatusCode recommendedTools(const ORFlags &flags, ToolBox &toolBox)
Pre-configured standard recommended OR tools.
SG::AuxElement::ConstAccessor< inputFlag_t > inputAccessor_t
Input object accessor.
SG::AuxElement::Decorator< inputFlag_t > inputDecorator_t
Input object decorator (for convenience if users want it)
SG::AuxElement::ConstAccessor< outputFlag_t > outputAccessor_t
Output object accessor (for convenience)
SG::AuxElement::ConstAccessor< objLink_t > objLinkAccessor_t
Overlap object link accessor (for convenience)
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
EventInfo_v1 EventInfo
Definition of the latest event info version.
JetContainer_v1 JetContainer
Definition of the current "jet container version".
TauJetContainer_v3 TauJetContainer
Definition of the current "taujet container version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
A struct of global config options used to simplify the config helper interface.
bool outputPassValue
Output value to assign passing objects.
std::string bJetLabel
B-jet decoration.
bool boostedLeptons
Activate boosted-lepton recommendations (sliding dR cones)