Go to the source code of this file.
◆ MSGSOURCE
#define MSGSOURCE "Example 4" |
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 48 of file TrigGlobEffCorrExample4.cxx.
52 const std::string flagQuiet(
"--quiet");
58 #ifdef XAOD_STANDALONE
60 StatusCode::enableFailure();
68 #ifndef XAOD_STANDALONE
◆ testElectrons()
StatusCode testElectrons |
( |
const char * |
APP_NAME, |
|
|
bool |
quiet |
|
) |
| |
Retrieve the list of electron map keys for the chosen trigger combination
Then create all the needed electron tools and initialize the TrigGlob tool using the information returned by suggestElectronMapKeys()
Trigger efficiency/scale factor CP tools for electrons and muons
one tool instance for efficiencies, another for scale factors
Safer to retrieve the name from the final ToolHandle, it might be prefixed (by the parent tool name) when the handle is copied
Definition at line 75 of file TrigGlobEffCorrExample4.cxx.
78 std::map<std::string,std::string> triggerCombination;
79 triggerCombination[
"2015"] =
"2e12_lhloose_L12EM10VH || e17_lhloose_mu14 || mu18_mu8noL1"
80 "|| e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose || mu20_iloose_L1MU15";
81 triggerCombination[
"2016"] =
"2e17_lhvloose_nod0 || e17_lhloose_nod0_mu14 || mu22_mu8noL1 "
82 "|| e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium";
83 triggerCombination[
"2017"] =
"2e17_lhvloose_nod0_L12EM15VHI || 2e24_lhvloose_nod0 || e17_lhloose_nod0_mu14 || mu22_mu8noL1 "
84 "|| e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0 || mu26_ivarmedium";
85 triggerCombination[
"2018"] = triggerCombination[
"2017"];
86 std::map<std::string,std::string> legsPerKey, legsAlone;
92 std::string
msg =
"List of trigger legs for this combination of triggers:\n";
93 for(
auto& kv : legsAlone)
95 msg +=
" - " + kv.second +
'\n';
103 return StatusCode::FAILURE;
111 std::string
msg =
"List of map keys necessary for this combination of triggers:\n";
112 for(
auto& kv : legsPerKey)
114 msg +=
" - tool with key \"" + kv.first +
"\" chosen for legs " + kv.second +
'\n';
122 return StatusCode::FAILURE;
129 ToolHandleArray<IAsgElectronEfficiencyCorrectionTool> electronEffTools, electronSFTools;
130 std::vector<asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool> > electronToolsFactory;
131 std::map<std::string,std::string> legsPerTool;
133 for(
auto& kv : legsPerKey)
135 const std::string& trigKey = kv.first;
138 auto t = electronToolsFactory.emplace(electronToolsFactory.end(),
"AsgElectronEfficiencyCorrectionTool/ElTrigEff_"+
std::to_string(nTools++));
139 t->setProperty(
"MapFilePath",
"ElectronEfficiencyCorrection/2015_2018/rel21.2/Precision_Summer2020_v1/map4.txt").ignore();
140 t->setProperty(
"TriggerKey", (j? trigKey :
"Eff_"+trigKey)).ignore();
141 t->setProperty(
"IdKey",
"Tight").ignore();
142 t->setProperty(
"IsoKey",
"FCTight").ignore();
143 t->setProperty(
"CorrelationModel",
"TOTAL").ignore();
145 t->setProperty(
"OutputLevel", MSG::ERROR).ignore();
147 auto& handles = j? electronSFTools : electronEffTools;
148 handles.push_back(
t->getHandle());
150 std::string
name = handles[handles.size()-1].name();
151 legsPerTool[
name] = legsPerKey[trigKey];
155 ToolHandleArray<CP::IMuonTriggerScaleFactors> muonTools;
157 muonTool.setProperty(
"MuonQuality",
"Medium").ignore();
158 muonTool.setProperty(
"OutputLevel", MSG::ERROR).ignore();
159 if(muonTool.initialize() != StatusCode::SUCCESS)
162 return StatusCode::FAILURE;
164 muonTools.push_back(muonTool.getHandle());
167 myTool.setProperty(
"ElectronEfficiencyTools", electronEffTools).ignore();
168 myTool.setProperty(
"ElectronScaleFactorTools", electronSFTools).ignore();
169 myTool.setProperty(
"MuonTools", muonTools).ignore();
170 myTool.setProperty(
"TriggerCombination", triggerCombination).ignore();
171 myTool.setProperty(
"ListOfLegsPerTool", legsPerTool).ignore();
172 myTool.setProperty(
"OutputLevel",
quiet? MSG::WARNING : MSG::INFO).ignore();
174 return StatusCode::SUCCESS;
◆ testPhotons()
StatusCode testPhotons |
( |
const char * |
APP_NAME, |
|
|
bool |
quiet |
|
) |
| |
Retrieve the list of electron map keys for the chosen trigger combination
Then create all the needed photon tools and initialize the TrigGlob tool using the information returned by suggestPhotonMapKeys()
Trigger efficiency/scale factor CP tools for photons
one tool instance for efficiencies, another for scale factors
Definition at line 178 of file TrigGlobEffCorrExample4.cxx.
181 std::map<std::string,std::string> triggerCombination;
182 triggerCombination[
"2015"] =
"g35_loose_g25_loose || 2g20_tight";
183 triggerCombination[
"2016"] =
" g35_loose_g25_loose || 2g22_tight";
184 triggerCombination[
"2017"] =
"g35_medium_g25_medium_L12EM20VH || 2g22_tight_L12EM15VHI";
185 triggerCombination[
"2018"] = triggerCombination[
"2017"];
186 std::map<std::string,std::string> legsPerKey;
192 std::string
msg =
"List of map keys necessary for this combination of triggers:\n";
193 for(
auto& kv : legsPerKey)
195 msg +=
" - tool with key \"" + kv.first +
"\" chosen for legs " + kv.second +
'\n';
203 return StatusCode::FAILURE;
210 ToolHandleArray<IAsgPhotonEfficiencyCorrectionTool> photonEffTools, photonSFTools;
211 std::vector<asg::AnaToolHandle<IAsgPhotonEfficiencyCorrectionTool> > photonToolsFactory;
212 std::map<std::string,std::string> legsPerTool;
214 for(
auto& kv : legsPerKey)
216 const std::string& trigKey = kv.first;
219 auto t = photonToolsFactory.emplace(photonToolsFactory.end(),
"AsgPhotonEfficiencyCorrectionTool/PhTrigEff_"+
std::to_string(nTools++));
220 t->setProperty(
"MapFilePath",
"PhotonEfficiencyCorrection/2015_2018/rel21.2/Summer2020_Rec_v1/map3.txt").ignore();
221 t->setProperty(
"TriggerKey", (j? trigKey :
"Eff_"+trigKey)).ignore();
222 t->setProperty(
"IsoKey",
"TightCaloOnly").ignore();
224 t->setProperty(
"OutputLevel", MSG::ERROR).ignore();
226 auto& handles = j? photonSFTools : photonEffTools;
227 handles.push_back(
t->getHandle());
228 std::string
name = handles[handles.size()-1].name();
229 legsPerTool[
name] = legsPerKey[trigKey];
233 myTool.setProperty(
"PhotonEfficiencyTools", photonEffTools).ignore();
234 myTool.setProperty(
"PhotonScaleFactorTools", photonSFTools).ignore();
235 myTool.setProperty(
"TriggerCombination", triggerCombination).ignore();
236 myTool.setProperty(
"ListOfLegsPerTool", legsPerTool).ignore();
237 myTool.setProperty(
"OutputLevel",
quiet? MSG::WARNING : MSG::INFO).ignore();
239 return StatusCode::SUCCESS;