329{
330 if (argc != 7 && argc != 8 && argc != 9)
331 {
332 printf("Expected arguments:\n");
333 printf("\t1. Output file (ps, pdf, eps)\n");
334 printf("\t2. Jet definition(s), semicolon delimited\n");
335 printf("\t3. MC type\n");
336 printf("\t4. Config file(s), semicolon delimited\n");
337 printf("\t\tDifferences will be performed by left minus right\n");
338 printf("\t\tExample: A;B;C --> A,B,C,A-B,B-C\n");
339 printf("\t5. Fixed eta values to consider for pT correlations, semicolon delimited\n");
340 printf("\t Note: Comma-delimited pairs if specifying both eta1 and eta2\n");
341 printf("\t6. Fixed pT values to consider for eta correlations, semicolon delimited\n");
342 printf("\t Note: Comma-delimited pairs if specifying both pt1 and pt2\n");
343 printf("\t Note: Expected units are GeV, not MeV\n");
344 printf("\t7. Output histogram root file (OPTIONAL)\n");
345 printf("\t8. Whether to switch to relative differences (OPTIONAL, default \"false\")\n");
346 return 1;
347 }
348 TFile* outHistFile = nullptr;
351 TString mcType =
argv[3];
355 if (argc > 7)
356 outHistFile = TFile::Open(argv[7],"RECREATE");
357 if (argc > 8)
359
360#ifdef XAOD_STANDALONE
361 StatusCode::enableFailure();
362#endif
363
365 {
366 printf("Failed to find any configs: %s\n",argv[4]);
367 return 2;
368 }
369
370
371 if (fixedEtaS.empty() && fixedPtS.empty())
372 {
373 printf("No fixed pT or eta values were specified, nothing to do.\n");
374 return 2;
375 }
376
377
378 std::vector< std::pair<double,double> > fixedEta;
379 std::vector< std::pair<double,double> > fixedPt;
381 {
382 for (size_t iEta1 = 0; iEta1 < fixedEtaS.size(); ++iEta1)
383 for (size_t iEta2 = 0; iEta2 < fixedEtaS.size(); ++iEta2)
385 }
386 else
387 {
388 for (
size_t iEta = 0;
iEta < fixedEtaS.size(); ++
iEta)
389 {
392 fixedEta.emplace_back(temp.at(0),temp.at(0));
393 else if (temp.size() == 2)
394 fixedEta.emplace_back(temp.at(0),temp.at(1));
395 else
396 {
397 printf("Specified a fixed eta term which is not 1 or 2 values: %s\n",fixedEtaS.at(iEta).Data());
398 printf("Unsure of how to interpret this term, exiting.\n");
399 return 3;
400 }
401 }
402 }
403
405 {
406 for (size_t iPt1 = 0; iPt1 < fixedPtS.size(); ++iPt1)
407 for (size_t iPt2 = 0; iPt2 < fixedPtS.size(); ++iPt2)
409 }
410 else
411 {
412 for (size_t iPt = 0; iPt < fixedPtS.size(); ++iPt)
413 {
415 if (temp.size() == 1)
416 fixedPt.emplace_back(temp.at(0),temp.at(0));
417 else if (temp.size() == 2)
418 fixedPt.emplace_back(temp.at(0),temp.at(1));
419 else
420 {
421 printf("Specified a fixed pt term which is not 1 or 2 values: %s\n",fixedPtS.at(iPt).Data());
422 printf("Unsure of how to interpret this term, exiting.\n");
423 return 4;
424 }
425 }
426 }
427
428
430 gStyle->SetPalette(1);
431 TCanvas*
canvas =
new TCanvas(
"canvas");
433 canvas->SetFillStyle(4000);
435 canvas->SetFrameBorderMode(0);
437
438
439 if (outFile !=
"NONE" && !
outFile.EndsWith(
".eps"))
440 canvas->Print(outFile+
"[");
441
442
443
444 for (
size_t iJetDef = 0; iJetDef <
jetDefs.size(); ++iJetDef)
445 {
447
448
449 std::vector<JetUncertaintiesTool*> providers;
450 printf(
"Processing %zu config(s)...\n",
configs.size());
451 for (
size_t iConfig = 0; iConfig <
configs.size(); ++iConfig)
452 {
453
455
456
457 if (providers.back()->setProperty(
"JetDefinition",
jetDef.Data()).isFailure())
458 {
459 printf(
"Failed to set JetDefinition to %s\n",
jetDef.Data());
460 return 5;
461 }
462 if (providers.back()->setProperty("MCType",mcType.Data()).isFailure())
463 {
464 printf("Failed to set MCType to %s\n",mcType.Data());
465 return 6;
466 }
467 if (providers.back()->setProperty(
"ConfigFile",
configs.at(iConfig).Data()).isFailure())
468 {
469 printf(
"Failed to set ConfigFile to %s\n",
configs.at(iConfig).Data());
470 return 7;
471 }
472
474
475
476
477
478
479
480
481
482
483
484
485 if (providers.back()->setScaleToGeV().isFailure())
486 {
487 printf(
"Failed to set tool scale to GeV for config: %s\n",
configs.at(iConfig).Data());
488 return 8;
489 }
490
491
492 if (providers.back()->initialize().isFailure())
493 {
494 printf(
"Failed to initialize tool for config: %s\n",
configs.at(iConfig).Data());
495 return 9;
496 }
497 }
498
499
501
502
503 for (size_t iProv = 0; iProv < providers.size(); ++iProv)
504 delete providers.at(iProv);
505 providers.clear();
506 }
507
508
509 if (outFile !=
"NONE" && !
outFile.EndsWith(
".eps"))
510 canvas->Print(outFile+
"]");
511
512
513 if (outHistFile)
514 {
515 outHistFile->Close();
516 outHistFile = nullptr;
517 }
518
519 return 0;
520}
void MakeCorrelationPlots(const TString &outFile, TCanvas *canvas, TFile *outHistFile, const std::vector< JetUncertaintiesTool * > &providers, const std::vector< std::pair< double, double > > &fixedEta, const std::vector< std::pair< double, double > > &fixedPt)
outFile
Comment Out Those You do not wish to run.
bool getTypeObjFromString(const std::string &str, T &obj)
bool getTypeObjFromString< bool >(const std::string &str, bool &obj)
bool vectorize(const TString &str, const TString &sep, std::vector< T > &result)
setScale setgFexType iEta