72 {
73
74
75 StatusCode::enableFailure();
76 StatusCode::enableFailure();
77
78
80
81
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;
86
87 for (
int k = 1;
k <
argc - 1; ++
k) {
88 if (std::string(argv[k]).
find(
"-i") == 0) {
90 }
91 if (std::string(argv[k]).
find(
"-n") == 0) {
93 }
94 if (std::string(argv[k]).
find(
"--ilumi") == 0) {
95 ilumiFilename =
argv[
k + 1];
96 }
97 if (std::string(argv[k]).
find(
"--prw") == 0) {
98 prwFilename =
argv[
k + 1];
99 }
100 }
101
103
104
106 std::unique_ptr<TFile>
ifile(TFile::Open(InFile.c_str(),
"READ"));
109 }
110
111 std::string DefaultCalibRelease("");
112 if (argc == 3) {
113 DefaultCalibRelease =
argv[2];
114 std::cout << "Found second argument (" << DefaultCalibRelease << "), assuming it is the CalibrationRelease..." << std::endl;
115 }
116
117
120 Info(
APP_NAME,
"Number of events in the file: %i",
static_cast<int>(
event.getEntries()));
121
122 Long64_t
entries =
event.getEntries();
124
125 TStopwatch tsw;
126 tsw.Start();
127 double t_init = tsw.CpuTime();
128 tsw.Reset();
129
130
131 asg::StandaloneToolHandle < CP::IPileupReweightingTool > m_prw_tool("CP::PileupReweightingTool/myTool");
132
133 std::vector<std::string> m_ConfigFiles {
134 prwFilename
135 };
136 std::vector<std::string> m_LumiCalcFiles {
137 ilumiFilename
138 };
141
145
147
148 const std::vector<std::string>
WPs {
149
150 "Loose", "Medium", "Tight", "HighPt", "LowPt",
151
152 "TTVA",
153
154
155
156 "Loose_VarRadIso", "Tight_VarRadIso", "PflowLoose_VarRadIso", "PflowTight_VarRadIso"
157 };
158
159 std::vector<EffiToolInstance> EffiTools;
160 for (auto& WP : WPs) {
161 EffiTools.push_back(
createSFTool(WP, DefaultCalibRelease,
false));
162 }
163
164 tsw.Start();
165
166
167
168
169 std::vector<float> replicas(50);
171
172
173 event.getEntry(entry);
174
175
178
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));
181
182
186
187 for (const auto *mu : *muons) {
188
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.;
194 float data_Eff = 1.;
195 float mc_Eff = 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);
201
203 for (
size_t t = 0;
t < replicas.size();
t++) {
204 Info(
APP_NAME,
" scaleFactor Replica %d = %.8f",
static_cast<int>(t), replicas[t]);
205 }
206 }
207 }
208 }
209
211 "run #%i %i events processed so far <<<===",
static_cast<int>(ei->
eventNumber()),
static_cast<int>(ei->
runNumber()),
static_cast<int>(entry + 1));
212 }
213 double t_run = tsw.CpuTime() /
entries;
216
218
219
220 return 0;
221}
#define ASG_CHECK_SA(SOURCE, EXP)
Helper macro for checking the status code of a call outside of an ASG tool.
#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)
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
static const Attributes_t empty
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.
ReadStats & stats()
Access the object belonging to the current thread.
static IOStats & instance()
Singleton object accessor.
void printSmartSlimmingBranchList(bool autoIncludeLinks=false) const
Print the accessed variables, formatted for smart slimming.
Tool for accessing xAOD files outside of Athena.
@ kClassAccess
Access auxiliary data using the aux containers.
std::string find(const std::string &s)
return a remapped string
std::vector< CP::SystematicSet > make_systematics_vector(const SystematicSet &systematics)
utility functions for working with systematics
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.
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
EventInfo_v1 EventInfo
Definition of the latest event info version.
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".