ATLAS Offline Software
MuonSelectorToolsTester.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 // System include(s):
9 #include <cstdlib>
10 #include <iomanip>
11 #include <map>
12 #include <memory>
13 #include <string>
14 
15 // ROOT include(s):
16 #include <TError.h>
17 #include <TFile.h>
18 #include <TStopwatch.h>
19 #include <TString.h>
20 
21 // Infrastructure include(s):
22 #ifdef XAOD_STANDALONE
23 #include "xAODRootAccess/Init.h"
24 #include "xAODRootAccess/TEvent.h"
25 #else
26 #include "POOLRootAccess/TEvent.h"
27 #include "StoreGate/StoreGateSvc.h"
28 #endif
29 
30 // EDM include(s):
32 #include "xAODMuon/MuonContainer.h"
36 
37 // Local include(s):
39 
40 // Needed for Smart Slimming
41 #include "xAODCore/tools/IOStats.h"
43 
44 // Truth classification
46 
48 int main(int argc, char* argv[]) {
49  // The application's name:
50  const char* APP_NAME = argv[0];
51 
52  // Check if we received a file name:
53  if (argc < 2) {
54  Error(APP_NAME, "No file name received!");
55  Error(APP_NAME, " Usage: %s [xAOD file name] [Nevts to process]", APP_NAME);
56  return 1;
57  }
58 
59  // Create a TEvent object:
60 #ifdef XAOD_STANDALONE
61  if ( xAOD::Init( APP_NAME ).isFailure() ) {
62  Error( APP_NAME, "Failed to do xAOD::Init!" );
63  return 1;
64  }
66 #else
68 #endif
69 
70  // Open the input file:
71  const TString fileName = argv[1];
72  Info(APP_NAME, "Opening file: %s", fileName.Data());
73  std::unique_ptr<TFile> ifile(TFile::Open(fileName, "READ"));
74  if ( !ifile.get() ) {
75  Error( APP_NAME, "Failed to open input file!" );
76  return 1;
77  }
78 
79  //Read from input file with TEvent
80  if ( event.readFrom( ifile.get() ).isFailure() ) {
81  Error( APP_NAME, "Failed to read from input file!" );
82  return 1;
83  }
84  Info(APP_NAME, "Number of events in the file: %i", static_cast<int>(event.getEntries()));
85 
86  // Decide how many events to run over:
87  Long64_t entries = event.getEntries();
88  if (argc > 2) {
89  const Long64_t e = atoll(argv[2]);
90  if (e < entries) { entries = e; }
91  }
92 
93 
94  const int Nwp = 7; // number of working points (tool instances)
95  std::vector<std::string> WPnames = {"Tight", "Medium", "Loose", "VeryLoose", "HighPt", "LowPt", "LowPtMVA"};
96 
97 
98 
99  // done setting up selector tools
100 
101  // Create "padding" strings to facilitate easy table view of results
102  std::vector<std::string> padding;
103  padding.clear();
104 
105  unsigned int maxNameLength = 0;
106  for (int wp = 0; wp < Nwp; wp++)
107  if (WPnames[wp].size() > maxNameLength) maxNameLength = WPnames[wp].size();
108 
109  for (int wp = 0; wp < Nwp; wp++) {
110  std::string pad = "";
111  for (unsigned int i = 0; i < maxNameLength - WPnames[wp].size(); i++) pad += " ";
112 
113  padding.push_back(pad);
114  }
115 
116  // string with names of working points for selection results display
117  std::string namesString = " ";
118  for (int wp = 0; wp < Nwp; wp++) namesString += WPnames[wp] + " ";
119 
120  // Muon counters
121  int allMuons = 0;
122  int nPositive = 0;
123  int nNegative = 0;
124 
125  // Summary information - how many muons passed each working point (with and without vetoing bad muons)
126  int selectedMuons[Nwp];
127  for (int wp = 0; wp < Nwp; wp++) selectedMuons[wp] = 0;
128 
129  int selectedMuonsNotBad[Nwp];
130  for (int wp = 0; wp < Nwp; wp++) selectedMuonsNotBad[wp] = 0;
131 
132  // Obtain summary information also split by muon type
133  const int Ntype = 5;
134 
135  std::string typeNames[Ntype];
136  for (int type = 0; type < Ntype; type++) {
137  if (type == xAOD::Muon::Combined)
138  typeNames[type] = "combined";
139  else if (type == xAOD::Muon::MuonStandAlone)
140  typeNames[type] = "stand-alone";
141  else if (type == xAOD::Muon::SegmentTagged)
142  typeNames[type] = "segment-tagged";
143  else if (type == xAOD::Muon::CaloTagged)
144  typeNames[type] = "calo-tagged";
145  else if (type == xAOD::Muon::SiliconAssociatedForwardMuon)
146  typeNames[type] = "forward";
147  else
148  typeNames[type] = "unknown";
149  }
150 
151  // Muon counters for each type
152  int allMuonsType[Ntype];
153  for (int type = 0; type < Ntype; type++) allMuonsType[type] = 0;
154 
155  // Muon counters for muons of each type passing each working point
156  int selectedMuonsType[Ntype][Nwp];
157  for (int type = 0; type < Ntype; type++)
158  for (int wp = 0; wp < Nwp; wp++) selectedMuonsType[type][wp] = 0;
159 
160  int selectedMuonsTypeNotBad[Ntype][Nwp];
161  for (int type = 0; type < Ntype; type++)
162  for (int wp = 0; wp < Nwp; wp++) selectedMuonsTypeNotBad[type][wp] = 0;
163 
164 
165  // Obtain summary information also split by primary author
166  const int Nauthor = xAOD::Muon::NumberOfMuonAuthors;
167 
168  std::string authorNames[Nauthor];
169  for (int author = 0; author < Nauthor; author++) {
170  if (author == xAOD::Muon::MuidCo)
171  authorNames[author] = "MuidCo";
172  else if (author == xAOD::Muon::STACO)
173  authorNames[author] = "STACO";
174  else if (author == xAOD::Muon::MuTag)
175  authorNames[author] = "MuTag";
176  else if (author == xAOD::Muon::MuTagIMO)
177  authorNames[author] = "MuTagIMO";
178  else if (author == xAOD::Muon::MuidSA)
179  authorNames[author] = "MuidSA";
180  else if (author == xAOD::Muon::MuGirl)
181  authorNames[author] = "MuGirl";
182  else if (author == xAOD::Muon::MuGirlLowBeta)
183  authorNames[author] = "MuGirlLowBeta";
184  else if (author == xAOD::Muon::CaloTag)
185  authorNames[author] = "CaloTag";
187  authorNames[author] = "CaloLikelihood";
188  else if (author == xAOD::Muon::CaloScore)
189  authorNames[author] = "CaloScore";
191  authorNames[author] = "ExtrapolateMuonToIP";
192  else
193  authorNames[author] = "unknown";
194  }
195 
196  // Muon counters for each author
197  int allMuonsAuthor[Nauthor];
198  for (int author = 0; author < Nauthor; author++) allMuonsAuthor[author] = 0;
199 
200  // Muon counters for muons of each author passing each working point
201  int selectedMuonsAuthor[Nauthor][Nwp];
202  for (int author = 0; author < Nauthor; author++)
203  for (int wp = 0; wp < Nwp; wp++) selectedMuonsAuthor[author][wp] = 0;
204 
205  int selectedMuonsAuthorNotBad[Nauthor][Nwp];
206  for (int author = 0; author < Nauthor; author++)
207  for (int wp = 0; wp < Nwp; wp++) selectedMuonsAuthorNotBad[author][wp] = 0;
208 
209 
210  // Obtain summary information also split by muon |eta|
211  const int Neta = 4;
212  double etaCuts[Neta - 1] = {1.0, 2.0, 2.5};
213 
214  std::string etaRegions = "|eta| < 1.0 1.0 < |eta| < 2.0 2.0 < |eta| < 2.5 |eta| > 2.5";
215 
216  // Muon counters for each eta region
217  int allMuonsEta[Neta];
218  for (int eta = 0; eta < Neta; eta++) allMuonsEta[eta] = 0;
219 
220  // Muon counters for muons in each eta region passing each working point
221  int selectedMuonsEta[Neta][Nwp];
222  for (int eta = 0; eta < Neta; eta++)
223  for (int wp = 0; wp < Nwp; wp++) selectedMuonsEta[eta][wp] = 0;
224 
225  int selectedMuonsEtaNotBad[Neta][Nwp];
226  for (int eta = 0; eta < Neta; eta++)
227  for (int wp = 0; wp < Nwp; wp++) selectedMuonsEtaNotBad[eta][wp] = 0;
228 
229  // Obtain summary information also split by muon truth type
230  const int NtruthType = 5;
231 
232  std::string truthTypeNames[NtruthType] = {"Prompt", "Non-isolated", "Hadron", "Background", "Other"};
233 
234  // Muon counters for each truth type
235  int allMuonsTruthType[NtruthType];
236  for (int truthType = 0; truthType < NtruthType; truthType++) allMuonsTruthType[truthType] = 0;
237 
238  // Muon counters for muons of each type passing each working point
239  int selectedMuonsTruthType[NtruthType][Nwp];
240  for (int truthType = 0; truthType < NtruthType; truthType++)
241  for (int wp = 0; wp < Nwp; wp++) selectedMuonsTruthType[truthType][wp] = 0;
242 
243  int selectedMuonsTruthTypeNotBad[NtruthType][Nwp];
244  for (int truthType = 0; truthType < NtruthType; truthType++)
245  for (int wp = 0; wp < Nwp; wp++) selectedMuonsTruthTypeNotBad[truthType][wp] = 0;
246 
247  //To determine whether to print truth classification table
248  bool isMC = false;
249 
250  std::vector<std::unique_ptr<CP::MuonSelectionTool> > selectorTools;
251  selectorTools.clear();
252 
253  // Loop over the events:
254  for (Long64_t entry = 0; entry < entries; ++entry) {
255  // Tell the object which entry to look at:
256  event.getEntry(entry);
257 
258  // Counters for selected muons within each event
259  int selectedMuonsEvent[Nwp];
260  for (int wp = 0; wp < Nwp; wp++) selectedMuonsEvent[wp] = 0;
261 
262  int selectedMuonsEventNotBad[Nwp];
263  for (int wp = 0; wp < Nwp; wp++) selectedMuonsEventNotBad[wp] = 0;
264 
265  // Print some event information for fun:
266  const xAOD::EventInfo* ei = 0;
267  if ( event.retrieve( ei, "EventInfo" ).isFailure() ) {
268  Error( APP_NAME, "Failed to read EventInfo!" );
269  return 1;
270  }
271 
272  if(entry==0)
273  {
274  bool isRun3=false;
275  if(!ei->eventType(xAOD::EventInfo::IS_SIMULATION) && ei->runNumber()>=400000) isRun3=true; //in data we expect to be in run3 for datasets with runnumber>=400000
276  if(ei->eventType(xAOD::EventInfo::IS_SIMULATION) && ei->runNumber()>=330000) isRun3=true; //in MC run numbers >= 330000 should correspond to mc21
277 
278  if(isRun3) Info(APP_NAME, "setting up muon selection tools for Run3 geometry");
279  else Info(APP_NAME, "setting up muon selection tools for Run2 geometry");
280 
281  for (int wp = 0; wp < Nwp; wp++) {
282  Info(APP_NAME, "Creating selector tool for working point: %s ...", WPnames[wp].c_str());
283 
284  CP::MuonSelectionTool* muonSelection = new CP::MuonSelectionTool("MuonSelection_" + WPnames[wp]);
285  muonSelection->msg().setLevel(MSG::INFO);
286 
287  bool failed = false;
288  failed = failed || muonSelection->setProperty("IsRun3Geo",isRun3).isFailure();
289  failed = failed || muonSelection->setProperty("MaxEta", 2.7).isFailure();
290  if (WPnames[wp] == "LowPtMVA") {
291  failed = failed || muonSelection->setProperty( "MuQuality", 5).isFailure();
292  failed = failed || muonSelection->setProperty( "UseMVALowPt", true).isFailure();
293  }
294  else
295  failed = failed || muonSelection->setProperty("MuQuality", wp).isFailure();
296 
297  failed = failed || muonSelection->setProperty("TurnOffMomCorr", true).isFailure();
298  failed = failed || muonSelection->initialize().isFailure();
299 
300  if (failed) {
301  Error( APP_NAME, "Failed to set up MuonSelectorTool for working point: %s !", WPnames[wp].c_str() );
302  return 1;
303  }
304 
305  selectorTools.emplace_back(muonSelection);
306  }
307  }
308 
309  Info(APP_NAME,
310  "===>>> start processing event #%i, "
311  "run #%i %i events processed so far <<<===",
312  static_cast<int>(ei->eventNumber()), static_cast<int>(ei->runNumber()), static_cast<int>(entry));
313 
314  // Get the Muons from the event:
315  const xAOD::MuonContainer* muons = 0;
316  if ( event.retrieve( muons, "Muons" ).isFailure() ) {
317  Error( APP_NAME, "Failed to read Muons container!" );
318  return 1;
319  }
320  Info(APP_NAME, "Number of muons: %i", static_cast<int>(muons->size()));
321 
322  xAOD::Muon::Quality my_quality;
323  bool passesIDRequirements;
324  bool passesPreselectionCuts;
325 
326  int muCounter = 0; // muon counter for each event
327 
328  // Print their properties, using the tools:
329  xAOD::MuonContainer::const_iterator mu_itr = muons->begin();
330  xAOD::MuonContainer::const_iterator mu_end = muons->end();
331  for (; mu_itr != mu_end; ++mu_itr) {
332  int etaIndex = Neta - 1;
333  for (int eta = 0; eta < Neta - 1; eta++)
334  if (std::abs((*mu_itr)->eta()) < etaCuts[eta]) {
335  etaIndex = eta;
336  break;
337  }
338 
339  allMuons++;
340  allMuonsType[(*mu_itr)->muonType()]++;
341  allMuonsAuthor[(*mu_itr)->author()]++;
342  allMuonsEta[etaIndex]++;
343  muCounter++;
344 
345  Info(APP_NAME, "===== Muon number: %i", static_cast<int>(muCounter));
346 
347  // Check truth origin
349  static const SG::ConstAccessor<int> truthTypeAcc ("truthType");
350  int truthClass = isMC ? truthTypeAcc (**mu_itr) : -999;
351 
352  int truthType;
353  if (truthClass == MCTruthPartClassifier::IsoMuon)
354  truthType = 0;
355  else if (truthClass == MCTruthPartClassifier::NonIsoMuon)
356  truthType = 1;
357  else if (truthClass == MCTruthPartClassifier::Hadron)
358  truthType = 2;
359  else if (truthClass == MCTruthPartClassifier::BkgMuon)
360  truthType = 3;
361  else
362  truthType = 4;
363 
364  allMuonsTruthType[truthType]++;
365 
366  if ((*mu_itr)->charge() > 0)
367  nPositive++;
368  else
369  nNegative++;
370 
371  passesIDRequirements = selectorTools[0]->passedIDCuts(**mu_itr);
372  passesPreselectionCuts = selectorTools[0]->passedMuonCuts(**mu_itr);
373  my_quality = selectorTools[0]->getQuality(**mu_itr);
374 
375  // Print some general information about the muon
376  if (isMC) Info(APP_NAME, "Muon truthType: %d (%s)", truthClass, truthTypeNames[truthType].c_str());
377  Info(APP_NAME, "Muon pT [GeV]: %g ", std::abs((*mu_itr)->pt()) / 1000.);
378  Info(APP_NAME, "Muon eta, phi: %g, %g ", (*mu_itr)->eta(), (*mu_itr)->phi());
379  Info(APP_NAME, "Muon muonType: %d (%s)", (*mu_itr)->muonType(), typeNames[(*mu_itr)->muonType()].c_str());
380  Info(APP_NAME, "Muon primary author: %d (%s)", (*mu_itr)->author(), authorNames[(*mu_itr)->author()].c_str());
381 
382  Info(APP_NAME, "Muon quality (from tool, from xAOD): %d, %d", my_quality, (*mu_itr)->quality());
383  Info(APP_NAME, "Muon passes cuts (ID hits, preselection): %d, %d", passesIDRequirements, passesPreselectionCuts);
384 
385 
386  // Now, let's check whether the muon passes the different working points and also whether it is flagged as bad
387 
388  std::string selectionResults = "Muon selection acceptance: ";
389  std::string badMuonResults = "Bad muon flag: ";
390 
391  for (int wp = 0; wp < Nwp; wp++) {
392  if (selectorTools[wp]->accept(*mu_itr)) {
393  selectedMuons[wp]++;
394  selectedMuonsEvent[wp]++;
395  selectedMuonsType[(*mu_itr)->muonType()][wp]++;
396  selectedMuonsAuthor[(*mu_itr)->author()][wp]++;
397  selectedMuonsTruthType[truthType][wp]++;
398  selectedMuonsEta[etaIndex][wp]++;
399  selectionResults += "pass ";
400 
401  if (!selectorTools[wp]->isBadMuon(**mu_itr)) {
402  selectedMuonsNotBad[wp]++;
403  selectedMuonsEventNotBad[wp]++;
404  selectedMuonsTypeNotBad[(*mu_itr)->muonType()][wp]++;
405  selectedMuonsAuthorNotBad[(*mu_itr)->author()][wp]++;
406  selectedMuonsTruthTypeNotBad[truthType][wp]++;
407  selectedMuonsEtaNotBad[etaIndex][wp]++;
408  }
409  } else
410  selectionResults += "fail ";
411 
412  if (!selectorTools[wp]->isBadMuon(**mu_itr))
413  badMuonResults += "good ";
414  else
415  badMuonResults += "bad ";
416  }
417 
418  // Print table of selection results for this muon
419  Info(APP_NAME, "%s", namesString.c_str());
420  Info(APP_NAME, "%s", selectionResults.c_str());
421  Info(APP_NAME, "%s", badMuonResults.c_str());
422 
423  } // done loop over muons
424 
425  // Print table of number of selected muons in this event
426  std::string NselectedString = "Number of selected muons: ";
427  std::string NselectedStringNotBad = "Including bad muon veto: ";
428  for (int wp = 0; wp < Nwp; wp++) {
429  NselectedString += std::to_string(selectedMuonsEvent[wp]) + " ";
430  NselectedStringNotBad += std::to_string(selectedMuonsEventNotBad[wp]) + " ";
431  }
432 
433  Info(APP_NAME, "===== Event summary:");
434  Info(APP_NAME, "%s", namesString.c_str());
435  Info(APP_NAME, "%s", NselectedString.c_str());
436  Info(APP_NAME, "%s", NselectedStringNotBad.c_str());
437 
438  // Close with a message:
439  Info(APP_NAME,
440  "===>>> done processing event #%i, "
441  "run #%i %i events processed so far <<<===",
442  static_cast<int>(ei->eventNumber()), static_cast<int>(ei->runNumber()), static_cast<int>(entry + 1));
443 
444  } // done loop over events
445 
446  // Now, let's summarize all we have found in the processed events
447 
448  Info(APP_NAME, "======================================");
449  Info(APP_NAME, "========= Full run summary ===========");
450  Info(APP_NAME, "======================================");
451 
452  Info(APP_NAME, "Processed %i events and %i muons", static_cast<int>(entries), allMuons);
453 
454  Info(APP_NAME, "%i positive and %i negative muons", nPositive, nNegative);
455 
456  Info(APP_NAME, "Selected muons by working point (numbers in parenthesis include bad muon veto):");
457  Info(APP_NAME, "--------------------------");
458  for (int wp = 0; wp < Nwp; wp++)
459  Info(APP_NAME, "%s: %s %i (%i)", WPnames[wp].c_str(), padding[wp].c_str(), selectedMuons[wp], selectedMuonsNotBad[wp]);
460  Info(APP_NAME, "--------------------------");
461 
462  // Make table of selected muons by type and working point
463  Info(APP_NAME, "Selected muons by type and working point (numbers in parenthesis include bad muon veto):");
464  Info(APP_NAME, "---------------------------------------------------------------------------------------");
465  for (int l = 0; l < Nwp + 2; l++) {
466  std::string line = "";
467  if (l == 0) { // line with type names
468  line += " ";
469  for (int type = 0; type < Ntype; type++) line += typeNames[type] + " ";
470  } else if (l == 1) { // line for all muons inclusive
471  line += "All muons: ";
472  for (int type = 0; type < Ntype; type++) {
473  std::stringstream ss;
474  ss << std::left << std::setw(16) << std::to_string(allMuonsType[type]);
475  line += ss.str();
476  }
477  } else { // lines for each of the working points
478  int wp = l - 2;
479  line += WPnames[wp] + ":" + padding[wp] + " ";
480  for (int type = 0; type < Ntype; type++) {
481  std::stringstream ss;
482  ss << std::left << std::setw(16)
483  << (std::to_string(selectedMuonsType[type][wp]) + " (" + std::to_string(selectedMuonsTypeNotBad[type][wp]) + ")");
484  line += ss.str();
485  }
486  }
487 
488  Info(APP_NAME, "%s", line.c_str());
489  }
490  Info(APP_NAME, "---------------------------------------------------------------------------------------");
491 
492 
493  // Make table of selected muons by author and working point
494  Info(APP_NAME, "Selected muons by primary author and working point (numbers in parenthesis include bad muon veto):");
495  Info(APP_NAME, "---------------------------------------------------------------------------------------");
496  for (int l = 0; l < Nwp + 2; l++) {
497  std::string line = "";
498  if (l == 0) { // line with author names
499  line += " ";
500  for (int author = 0; author < Nauthor; author++) {
501 
502  //Do not print unrepresented authors, since the table can be quite wide
503  if (allMuonsAuthor[author] == 0) continue;
504 
505  std::stringstream ss;
506  ss << std::left << std::setw(16);
507  ss << authorNames[author];
508  line += ss.str();
509  }
510  } else if (l == 1) { // line for all muons inclusive
511  line += "All muons: ";
512  for (int author = 0; author < Nauthor; author++) {
513 
514  if (allMuonsAuthor[author] == 0) continue;
515 
516  std::stringstream ss;
517  ss << std::left << std::setw(16);
518  ss << std::to_string(allMuonsAuthor[author]);
519  line += ss.str();
520  }
521  } else { // lines for each of the working points
522  int wp = l - 2;
523  line += WPnames[wp] + ":" + padding[wp] + " ";
524  for (int author = 0; author < Nauthor; author++) {
525 
526  if (allMuonsAuthor[author] == 0) continue;
527 
528  std::stringstream ss;
529  ss << std::left << std::setw(16);
530  ss << (std::to_string(selectedMuonsAuthor[author][wp]) + " (" + std::to_string(selectedMuonsAuthorNotBad[author][wp]) + ")");
531  line += ss.str();
532  }
533  }
534 
535  Info(APP_NAME, "%s", line.c_str());
536  }
537  Info(APP_NAME, "---------------------------------------------------------------------------------------");
538 
539 
540  // Make table of selected muons by |eta| and working point
541  Info(APP_NAME, "Selected muons by |eta| and working point (numbers in parenthesis include bad muon veto):");
542  Info(APP_NAME, "---------------------------------------------------------------------------------------");
543  for (int l = 0; l < Nwp + 2; l++) {
544  std::string line = "";
545  if (l == 0) { // line with eta regions
546  line += " ";
547  line += etaRegions;
548  } else if (l == 1) { // line for all muons inclusive
549  line += "All muons: ";
550  for (int eta = 0; eta < Neta; eta++) {
551  std::stringstream ss;
552  ss << std::left << std::setw(20) << std::to_string(allMuonsEta[eta]);
553  line += ss.str();
554  }
555  } else { // lines for each of the working points
556  int wp = l - 2;
557  line += WPnames[wp] + ":" + padding[wp] + " ";
558  for (int eta = 0; eta < Neta; eta++) {
559  std::stringstream ss;
560  ss << std::left << std::setw(20)
561  << (std::to_string(selectedMuonsEta[eta][wp]) + " (" + std::to_string(selectedMuonsEtaNotBad[eta][wp]) + ")");
562  line += ss.str();
563  }
564  }
565 
566  Info(APP_NAME, "%s", line.c_str());
567  }
568  Info(APP_NAME, "---------------------------------------------------------------------------------------");
569 
570  // Make table of selected muons by truth type and working point
571  if (isMC) {
572  Info(APP_NAME, "Selected muons by truth classification and working point (numbers in parenthesis include bad muon veto):");
573  Info(APP_NAME, "---------------------------------------------------------------------------------------");
574  for (int l = 0; l < Nwp + 2; l++) {
575  std::string line = "";
576  if (l == 0) { // line with truth classification labels
577  line += " ";
578  for (int truthType = 0; truthType < NtruthType; truthType++) line += truthTypeNames[truthType] + " ";
579  } else if (l == 1) { // line for all muons inclusive
580  line += "All muons: ";
581  for (int truthType = 0; truthType < NtruthType; truthType++) {
582  std::stringstream ss;
583  ss << std::left << std::setw(16) << std::to_string(allMuonsTruthType[truthType]);
584  line += ss.str();
585  }
586  } else { // lines for each of the working points
587  int wp = l - 2;
588  line += WPnames[wp] + ":" + padding[wp] + " ";
589  for (int truthType = 0; truthType < NtruthType; truthType++) {
590  std::stringstream ss;
591  ss << std::left << std::setw(16)
592  << (std::to_string(selectedMuonsTruthType[truthType][wp]) + " (" +
593  std::to_string(selectedMuonsTruthTypeNotBad[truthType][wp]) + ")");
594  line += ss.str();
595  }
596  }
597 
598  Info(APP_NAME, "%s", line.c_str());
599  }
600  Info(APP_NAME, "---------------------------------------------------------------------------------------");
601  }
602 
603  // Needed for Smart Slimming
605 
606  // Return gracefully:
607  return 0;
608 }
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
CP::MuonSelectionTool
Implementation of the muon selector tool.
Definition: MuonSelectionTool.h:31
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
checkFileSG.line
line
Definition: checkFileSG.py:75
xAOD::MuGirl
@ MuGirl
MuGirl.
Definition: TrackingPrimitives.h:141
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
xAOD::MuTag
@ MuTag
Tracks produced by MuTag.
Definition: TrackingPrimitives.h:103
xAOD::IOStats::stats
ReadStats & stats()
Access the object belonging to the current thread.
Definition: IOStats.cxx:17
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
CutsMETMaker::accept
StatusCode accept(const xAOD::Muon *mu)
Definition: CutsMETMaker.cxx:18
xAOD::MuGirlLowBeta
@ MuGirlLowBeta
MuGirlLowBeta.
Definition: TrackingPrimitives.h:145
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
SG::ConstAccessor< int >
IOStats.h
xAOD::TEvent::kClassAccess
@ kClassAccess
Access auxiliary data using the aux containers.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:100
Hadron
@ Hadron
Definition: TruthClasses.h:26
xAOD::EventInfo_v1::IS_SIMULATION
@ IS_SIMULATION
true: simulation, false: data
Definition: EventInfo_v1.h:151
MuonParameters::CaloTag
@ CaloTag
Definition: MuonParamDefs.h:64
BkgMuon
@ BkgMuon
Definition: TruthClasses.h:17
dqutils::padding
std::atomic< int > padding
Definition: MonitoringFile_MoveVertexMonitoring.cxx:20
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
IDTPM::truthType
int truthType(const U &p)
Definition: TrackParametersHelper.h:274
MuonParameters::MuTagIMO
@ MuTagIMO
Definition: MuonParamDefs.h:66
POOL::TEvent::kClassAccess
@ kClassAccess
Definition: PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:46
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
MCTruthClassifierDefs.h
POOL::TEvent::readFrom
StatusCode readFrom(TFile *file)
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:133
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
main
int main(int argc, char *argv[])
a simple testing macro for the MuonSelectorTools_xAOD package shamelessly stolen from CPToolTests....
Definition: MuonSelectorToolsTester.cxx:48
ReadStats.h
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
lumiFormat.i
int i
Definition: lumiFormat.py:85
POOL::TEvent::getEntries
long getEntries()
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:124
LArCellNtuple.argv
argv
Definition: LArCellNtuple.py:152
APP_NAME
#define APP_NAME
Definition: BoostedXbbTag.cxx:23
TEvent.h
Init.h
MuonSelectionTool.h
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
IsoMuon
@ IsoMuon
Definition: TruthClasses.h:15
PlotSFuncertainty.wp
wp
Definition: PlotSFuncertainty.py:112
xAOD::IOStats::instance
static IOStats & instance()
Singleton object accessor.
Definition: IOStats.cxx:11
NonIsoMuon
@ NonIsoMuon
Definition: TruthClasses.h:16
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
MuonParameters::NumberOfMuonAuthors
@ NumberOfMuonAuthors
Definition: MuonParamDefs.h:69
xAOD::ReadStats::printSmartSlimmingBranchList
void printSmartSlimmingBranchList(bool autoIncludeLinks=false) const
Print the accessed variables, formatted for smart slimming.
Trk::Combined
@ Combined
Definition: TrackSummaryTool.h:32
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
POOL::TEvent
Definition: PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:40
TEvent.h
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
MuonParameters::ExtrapolateMuonToIP
@ ExtrapolateMuonToIP
Definition: MuonParamDefs.h:68
MuonParameters::MuidSA
@ MuidSA
Definition: MuonParamDefs.h:59
EventInfo.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
MuonContainer.h
CP::MuonSelectionTool::initialize
virtual StatusCode initialize() override
Function initialising the tool.
Definition: MuonSelectionTool.cxx:59
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
MuonParameters::MuidCo
@ MuidCo
Definition: MuonParamDefs.h:60
POOL::TEvent::retrieve
StatusCode retrieve(const T *&obj)
Definition: PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:74
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CaloCondBlobAlgs_fillNoiseFromASCII.author
string author
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:26
AthCommonMsg::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
entries
double entries
Definition: listroot.cxx:49
EventInfoRead.isMC
isMC
Definition: EventInfoRead.py:11
L1Topo::Error
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition: Error.h:16
xAOD::STACO
@ STACO
Tracks produced by STACO.
Definition: TrackingPrimitives.h:99
LArCellNtuple.ifile
string ifile
Definition: LArCellNtuple.py:133
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
MuonParameters::CaloLikelihood
@ CaloLikelihood
Definition: MuonParamDefs.h:65
RunTileMonitoring.typeNames
typeNames
Definition: RunTileMonitoring.py:285
StoreGateSvc.h
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
TrackingPrimitives.h
TrackParticleContainer.h
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:84
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
xAOD::EventInfo_v1::eventType
bool eventType(EventType type) const
Check for one particular bitmask value.
xAOD::Init
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
Definition: Init.cxx:31