|
ATLAS Offline Software
|
Go to the documentation of this file.
18 #include <TStopwatch.h>
46 #define CHECK_CPCorr(Arg) \
47 if (Arg.code() == CP::CorrectionCode::Error){ \
48 Error(#Arg,"Correction Code 'Error' (returned in line %i) ",__LINE__); \
51 #define CHECK_CPSys(Arg) \
52 if (Arg.isFailure()){ \
53 Warning(#Arg,"Unsupported systematic (in line %i) ",__LINE__); \
63 tool.setProperty(
"WorkingPoint",
WP).isSuccess();
64 tool.setProperty(
"UncorrelateSystematics", uncorrelate_Syst).isSuccess();
65 tool.setProperty(
"LowPtThreshold", 15.
e3).isSuccess();
66 tool.retrieve().isSuccess();
68 if (!CustomInput.empty())
tool.setProperty(
"CustomInputFolder", CustomInput).isSuccess();
75 StatusCode::enableFailure();
76 StatusCode::enableFailure();
82 std::string prwFilename =
"dev/PileupReweighting/share/DSID361xxx/pileup_mc20a_dsid361107_FS.root";
83 std::string ilumiFilename =
"GoodRunsLists/data16_13TeV/20180129/PHYS_StandardGRL_All_Good_25ns_297730-311481_OflLumi-13TeV-009.root";
84 std::string InFile =
"";
85 long long int nmax = -1;
87 for (
int k = 1;
k <
argc - 1; ++
k) {
88 if (std::string(
argv[
k]).
find(
"-i") == 0) {
91 if (std::string(
argv[
k]).
find(
"-n") == 0) {
94 if (std::string(
argv[
k]).
find(
"--ilumi") == 0) {
95 ilumiFilename =
argv[
k + 1];
97 if (std::string(
argv[
k]).
find(
"--prw") == 0) {
98 prwFilename =
argv[
k + 1];
105 Info(
APP_NAME,
"Opening file: %s", InFile.c_str());
106 std::unique_ptr<TFile>
ifile(TFile::Open(InFile.c_str(),
"READ"));
111 std::string DefaultCalibRelease(
"");
113 DefaultCalibRelease =
argv[2];
114 std::cout <<
"Found second argument (" << DefaultCalibRelease <<
"), assuming it is the CalibrationRelease..." << std::endl;
122 Long64_t
entries =
event.getEntries();
127 double t_init = tsw.CpuTime();
133 std::vector<std::string> m_ConfigFiles {
136 std::vector<std::string> m_LumiCalcFiles {
148 const std::vector<std::string>
WPs {
150 "Loose",
"Medium",
"Tight",
"HighPt",
"LowPt",
156 "Loose_VarRadIso",
"Tight_VarRadIso",
"PflowLoose_VarRadIso",
"PflowTight_VarRadIso"
159 std::vector<EffiToolInstance> EffiTools;
160 for (
auto&
WP :
WPs) {
161 EffiTools.push_back(
createSFTool(
WP, DefaultCalibRelease,
false));
169 std::vector<float> replicas(50);
173 event.getEntry(
entry);
180 Info(
APP_NAME,
"===>>> start processing event #%i, run #%i %i events processed so far <<<===",
static_cast<int>(ei->
eventNumber()),
static_cast<int>(ei->
runNumber()),
static_cast<int>(
entry));
185 Info(
APP_NAME,
"Number of muons: %i",
static_cast<int>(muons->
size()));
187 for (
const auto *
mu : *muons) {
189 Info(
APP_NAME,
" Selected muon: eta = %g, phi = %g, pt = %g",
mu->eta(),
mu->phi(),
mu->pt());
190 for (
auto&
effi : EffiTools) {
193 float nominalSF = 1.;
199 std::string
sysName = (syst.name().empty()) ?
"Nominal" : syst.name();
200 Info(
APP_NAME,
"Applied %s variation. The scale-factor is %.3f, the data-efficiency is %.3f and the mc-efficiency is %.3f",
sysName.c_str(), nominalSF, data_Eff, mc_Eff);
203 for (
size_t t = 0;
t < replicas.size();
t++) {
204 Info(
APP_NAME,
" scaleFactor Replica %d = %.8f",
static_cast<int>(
t), replicas[
t]);
210 Info(
APP_NAME,
"===>>> done processing event #%i, "
211 "run #%i %i events processed so far <<<===",
static_cast<int>(ei->
eventNumber()),
static_cast<int>(ei->
runNumber()),
static_cast<int>(
entry + 1));
213 double t_run = tsw.CpuTime() /
entries;
214 Info(
APP_NAME,
" MCP init took %gs", t_init);
215 Info(
APP_NAME,
" time per event: %gs", t_run);
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
std::vector< CP::SystematicSet > make_systematics_vector(const SystematicSet &systematics)
utility functions for working with systematics
std::string find(const std::string &s)
return a remapped string
uint64_t eventNumber() const
The current event's event number.
ReadStats & stats()
Access the object belonging to the current thread.
asg::StandaloneToolHandle< CP::IMuonEfficiencyScaleFactors > EffiToolInstance
Example of how to run the MuonEfficiencyCorrections package to obtain information from muons.
@ kClassAccess
Access auxiliary data using the aux containers.
uint32_t runNumber() const
The current event's run number.
StatusCode readFrom(TFile *file)
POOL::TEvent event(POOL::TEvent::kClassAccess)
int main(int argc, char *argv[])
static IOStats & instance()
Singleton object accessor.
void printSmartSlimmingBranchList(bool autoIncludeLinks=false) const
Print the accessed variables, formatted for smart slimming.
Class describing the basic event information.
StatusCode retrieve(const T *&obj)
#define ASG_CHECK_SA(SOURCE, EXP)
Helper macro for checking the status code of a call outside of an ASG tool.
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Error
The different types of error that can be flagged in the L1TopoRDO.
size_type size() const noexcept
Returns the number of elements in the collection.
Tool for accessing xAOD files outside of Athena.
#define CHECK_CPCorr(Arg)
a simple testing macro for the MuonEfficiencyScaleFactors class shamelessly stolen from CPToolTests....
EffiToolInstance createSFTool(const std::string &WP, const std::string &CustomInput, bool uncorrelate_Syst)
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.