ATLAS Offline Software
KLFitterRun.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3  */
4 
6 
7 #include "TopEvent/Event.h"
8 #include "TopEvent/EventTools.h"
10 
11 #include <iostream>
12 #include <vector>
13 #include <cmath>
14 #include <fstream>
15 
16 namespace top {
17  KLFitterRun::KLFitterRun(const std::string& kSelectionName, const std::string& kParameters,
18  std::shared_ptr<top::TopConfig> config) :
19  m_name(""),
20  m_myFitter(nullptr) {
21  std::string kLeptonType = "";
22  std::string kCustomParameters = "";
23  if (kParameters.find(" ") != std::string::npos) {
24  kLeptonType = kParameters.substr(0, kParameters.find(" "));
25  kCustomParameters = kParameters.substr(kParameters.find(" ") + 1);
26  } else kLeptonType = kParameters;
27  m_name = "RECO::KLFitterRun_" + kLeptonType;
28  m_myFitter = std::unique_ptr<top::KLFitterTool> (new top::KLFitterTool(m_name));
29  top::check(m_myFitter->setProperty("config", config), "Failed to setProperty of KLFitterTool");
30  top::check(m_myFitter->setProperty("LeptonType", kLeptonType), "Failed to setProperty of KLFitterTool");
31  top::check(m_myFitter->setProperty("CustomParameters", kCustomParameters), "Failed to setProperty of KLFitterTool");
32  top::check(m_myFitter->setProperty("SelectionName", kSelectionName), "Failed to setProperty of KLFitterTool");
33  top::check(m_myFitter->initialize(), "Failed to initialize KLFitterTool");
34  }
35 
36  bool KLFitterRun::apply(const top::Event& event) const {
37  top::check(m_myFitter->execute(event), "Failed to run KLFitterTool");
38  return true;
39  }
40 
41  std::string KLFitterRun::name() const {
42  return m_name;
43  }
44 }
top::KLFitterRun::name
std::string name() const override
A human readable name.
Definition: KLFitterRun.cxx:41
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::KLFitterRun::KLFitterRun
KLFitterRun(const std::string &kSelectionName, const std::string &kParameters, std::shared_ptr< top::TopConfig > config)
Definition: KLFitterRun.cxx:17
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
EventTools.h
A few functions for doing operations on particles / events. Currently holds code for dR,...
top::KLFitterRun::apply
virtual bool apply(const top::Event &) const override
This does stuff based on the information in an event.
Definition: KLFitterRun.cxx:36
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
top::check
void check(bool thingToCheck, const std::string &usefulFailureMessage)
Print an error message and terminate if thingToCheck is false.
Definition: EventTools.cxx:15
Event.h
top::KLFitterTool
Definition: KLFitterTool.h:68
KLFitterRun.h
TopConfig.h
top::KLFitterRun::m_name
std::string m_name
Definition: KLFitterRun.h:25
top::KLFitterRun::m_myFitter
std::unique_ptr< top::KLFitterTool > m_myFitter
Definition: KLFitterRun.h:27
top::Event
Very simple class to hold event data after reading from a file.
Definition: Event.h:49