ATLAS Offline Software
Loading...
Searching...
No Matches
egammaLayerRecalibTool Class Reference

#include <egammaLayerRecalibTool.h>

Inheritance diagram for egammaLayerRecalibTool:
Collaboration diagram for egammaLayerRecalibTool:

Public Types

typedef std::vector< std::pair< InputModifier *, GetAmountBase * > > ModifiersList

Public Member Functions

 egammaLayerRecalibTool (const std::string &name, const std::string &tune, int SaccEnable=1)
 egammaLayerRecalibTool (const std::string &tune, int SaccEnable=1)
 ~egammaLayerRecalibTool ()
CP::CorrectionCode applyCorrection (xAOD::Egamma &, const xAOD::EventInfo &event_info) const
CP::CorrectionCode read_and_scale_inputs (const xAOD::Egamma &particle, const xAOD::EventInfo &event_info, StdCalibrationInputs &inputs, bool &isData, std::string &fixT, double &addE2, double &addE3) const
std::array< double, 4 > getLayerCorrections (const xAOD::Egamma &particle, const xAOD::EventInfo &event_info) const
CP::CorrectionCode scale_inputs (StdCalibrationInputs &inputs) const
 apply layer calibration to the
void add_scale (InputModifier *modifier, GetAmountBase *amount)
 add custom layer scale correction.
void add_scale (const std::string &scale)
 add scale correction from string.
void clear_corrections ()
 remove all the scale corrections
void fixForMissingCells (bool fix=true)
void scaleMC (bool scaleMC=true)
void disable_PSCorrections ()
void disable_S12Corrections ()
void disable_SaccCorrections ()
void disable_LayerclEdecoration ()
void setLevel (MSG::Level lvl)
 Change the current logging level.
Functions providing the same interface as AthMessaging
bool msgLvl (const MSG::Level lvl) const
 Test the output level of the object.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.

Static Public Member Functions

static std::pair< std::string, egammaLayerRecalibTool * > create (const std::string &type, const std::string &args)
 helper to create a tool from a string (useful for command line arguments)

Private Member Functions

const std::string resolve_path (std::string filename) const
void initMessaging () const
 Initialize our message level and MessageSvc.

Static Private Member Functions

static std::string resolve_alias (const std::string &tune)

Private Attributes

std::string m_tune
bool m_doPSCorrections = true
bool m_doS12Corrections = true
bool m_doSaccCorrections = true
ModifiersList m_modifiers
corr_pileupShiftm_pileup_tool = nullptr
bool m_aodFixMissingCells = false
bool m_scaleMC = false
bool m_doLayerclEdecoration = true
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels).
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging).

Static Private Attributes

static const unsigned int m_Run2Run3runNumberTransition = 400000

Detailed Description

Definition at line 269 of file egammaLayerRecalibTool.h.

Member Typedef Documentation

◆ ModifiersList

Definition at line 272 of file egammaLayerRecalibTool.h.

Constructor & Destructor Documentation

◆ egammaLayerRecalibTool() [1/2]

egammaLayerRecalibTool::egammaLayerRecalibTool ( const std::string & name,
const std::string & tune,
int SaccEnable = 1 )
Parameters
tunestring to configure the tuning
  • "" the tool has no effect
  • as default it is "current_default"
  • "test1" just for testing

Definition at line 997 of file egammaLayerRecalibTool.cxx.

998 : asg::AsgMessaging(name), m_tune(tune), m_doSaccCorrections(SaccEnable)
999{
1000 add_scale(tune);
1001}
void add_scale(InputModifier *modifier, GetAmountBase *amount)
add custom layer scale correction.

◆ egammaLayerRecalibTool() [2/2]

egammaLayerRecalibTool::egammaLayerRecalibTool ( const std::string & tune,
int SaccEnable = 1 )

Definition at line 1004 of file egammaLayerRecalibTool.cxx.

1005 : egammaLayerRecalibTool("egammaLayerRecalibTool", tune, SaccEnable) { }
egammaLayerRecalibTool(const std::string &name, const std::string &tune, int SaccEnable=1)

◆ ~egammaLayerRecalibTool()

egammaLayerRecalibTool::~egammaLayerRecalibTool ( )
inline

Definition at line 281 of file egammaLayerRecalibTool.h.

281{ clear_corrections(); delete m_pileup_tool; }
void clear_corrections()
remove all the scale corrections

Member Function Documentation

◆ add_scale() [1/2]

void egammaLayerRecalibTool::add_scale ( const std::string & scale)

add scale correction from string.

Can be called multiple times. The list of valid values is on the twiki

Definition at line 246 of file egammaLayerRecalibTool.cxx.

247{
248 ATH_MSG_INFO("using scale " << tuneIn);
249 std::string tune = resolve_alias(tuneIn);
250
251 if (tune.empty()) { }
252 else if ("es2025_run3_extrapolate_gnn_v0" == tune) {
253 add_scale("run3_partial_ofc_extrapolate_gnn_v0");
254 }
255 else if ("es2024_run3_extrapolate_v0" == tune) {
256 add_scale("run3_partial_ofc_extrapolate_v0");
257 }
258 // R22 layer tune with fixed E1E2 and repeated acc
259 else if ("es2022_22.0_Precision_v1" == tune) {
260 add_scale("run2_alt_with_layer2_r22_Precision_v1");
261 }
262 else if ("es2022_22.0_Precision" == tune) {
263 add_scale("run2_alt_with_layer2_r22_Precision");
264 }
265 else if ("es2018_21.0_v0" == tune) {
266 add_scale("run2_alt_with_layer2_r21_v1");
267 }
268 else if ("es2017_21.0_v0" == tune) {
269 add_scale("run2_alt_with_layer2_r21_v0");
270 }
271 else if ("es2017_20.7_final" == tune) {
272 add_scale("pileup_20.7");
273 add_scale("run2_alt_with_layer2_modif");
274 }
275 else if ("es2017_20.7_improved" == tune) {
276 add_scale("pileup_20.7"); // new pileup correction Guillaume for 20.7
277 //TEMPORARY HACK REMOVED (two intermediate tags with this ES model use different layer corrections)
278 add_scale("2012_alt_with_layer2_modif"); // temporary old corrections from run1 + EMECPS HV
279 }
280 else if ("pileup_20.7" == tune) {
281 m_pileup_tool = new corr_pileupShift();
282 add_scale(new ScaleE0(InputModifier::SUBTRACT), new GetAmountPileupE0(m_pileup_tool));
283 add_scale(new ScaleE1(InputModifier::SUBTRACT), new GetAmountPileupE1(m_pileup_tool));
284 add_scale(new ScaleE2(InputModifier::SUBTRACT), new GetAmountPileupE2(m_pileup_tool));
285 add_scale(new ScaleE3(InputModifier::SUBTRACT), new GetAmountPileupE3(m_pileup_tool));
286 }
287 // Run3 2022+2023
288 else if ("run3_partial_ofc_extrapolate_gnn_v0" == tune) {
289 add_scale("layer2_run3_ofc_extrapolate_v0");
290 add_scale("ps_run3_ofc_extrapolate_v0");
291 if(m_doSaccCorrections) add_scale("acc_zee_run3_gnn_v0");
292 }
293 else if ("run3_partial_ofc_extrapolate_v0" == tune) {
294 add_scale("layer2_run3_ofc_extrapolate_v0");
295 add_scale("ps_run3_ofc_extrapolate_v0");
296 if(m_doSaccCorrections) add_scale("acc_zee_run3_v0");
297 }
298 //Run 2 release 22 with fixed E1E2 and repeated acc
299 else if ("run2_alt_with_layer2_r22_Precision_v1"==tune) {
300 add_scale("layer2_alt_el_mu_comb_r21_v0_fix");
301 add_scale("ps_mu_r21_v0");
302 if(m_doSaccCorrections) add_scale("acc_zee_r22_v1");
303 }
304 //Run 2 release 22
305 else if ("run2_alt_with_layer2_r22_Precision"==tune) {
306 add_scale("layer2_alt_el_mu_comb_r21_v0");
307 add_scale("ps_mu_r21_v0");
308 if(m_doSaccCorrections) add_scale("acc_zee_r22_v0");
309 }
310 else if ("run2_alt_with_layer2_r21_v1"==tune) {
311 add_scale("layer2_alt_run2_r21_v1");
312 add_scale("ps_2016_r21_v0");
313 }
314 else if ("run2_alt_with_layer2_r21_v0"==tune) {
315 add_scale("layer2_alt_run2_r21_v0");
316 add_scale("ps_2016_r21_v0");
317 }
318 else if("run2_alt_with_layer2_modif" == tune) {
319 add_scale("ps_EMECHV1");
320 add_scale("layer2_alt_run2_v1");
321 add_scale("ps_2016");
322 }
323 // 2012
324 else if ("2012" == tune) {
325 add_scale("ps_HV1");
326 add_scale("layer1_2012");
327 add_scale("ps_2012");
328 }
329 else if("2012_with_layer2" == tune) {
330 add_scale("ps_HV1");
331 add_scale("layer2_2012_v5");
332 add_scale("ps_2012");
333 }
334 else if ("2012_alt" == tune) {
335 add_scale("ps_HV1");
336 add_scale("layer1_alt_2012");
337 add_scale("ps_2012");
338 }
339 else if("2012_alt_with_layer2" == tune) {
340 add_scale("ps_HV1");
341 add_scale("layer2_alt_2012_v5");
342 add_scale("ps_2012");
343 }
344 else if("2012_alt_with_layer2_modif" == tune) {
345 add_scale("ps_HV1");
346 add_scale("ps_EMECHV1");
347 add_scale("layer2_alt_2012_v5");
348 add_scale("ps_2012");
349 }
350 else if("2010_with_layer2" == tune) {
351 add_scale("layer2_2010_v5");
352 add_scale("ps_2010");
353 }
354 else if ("2012_layer1_up" == tune) {
355 add_scale("ps_HV1");
356 add_scale("layer1_2012_up");
357 add_scale("ps_2012");
358 }
359 else if ("2012_layer1_down" == tune) {
360 add_scale("ps_HV1");
361 add_scale("layer1_2012_down");
362 add_scale("ps_2012");
363 }
364 else if ("2012_layer1_errup" == tune) {
365 add_scale("layer1_2012_errup");
366 }
367 else if ("2012_layer1_errdown" == tune) {
368 add_scale("layer1_2012_errdown");
369 }
370 else if ("2012_ps_down" == tune) {
371 add_scale("ps_HV1");
372 add_scale("layer1_2012");
373 add_scale("ps_2012_down");
374 }
375 else if ("2012_ps_up" == tune) {
376 add_scale("ps_HV1");
377 add_scale("layer1_2012");
378 add_scale("ps_2012_up");
379 }
380 else if ("2012_ps_errdown" == tune) {
381 add_scale("ps_2012_errdown");
382 }
383 else if ("2012_ps_errup" == tune) {
384 add_scale("ps_2012_errup");
385 }
386 else if ("2012_up" == tune) {
387 add_scale("ps_HV1");
388 add_scale("layer1_2012_up");
389 add_scale("ps_2012_up");
390 }
391 else if ("2012_down" == tune) {
392 add_scale("ps_HV1");
393 add_scale("layer1_2012_down");
394 add_scale("ps_2012_down");
395 }
396 else if ("2012_errup" == tune) {
397 add_scale("layer1_2012_errup");
398 add_scale("ps_2012_errup");
399 }
400 else if ("2012_errdown" == tune) {
401 add_scale("layer1_2012_errdown");
402 add_scale("ps_2012_errdown");
403 }
404 // 2011
405 else if ("2011" == tune) {
406 add_scale("layer1_2011");
407 add_scale("ps_2011");
408 }
409 else if("2011_with_layer2" == tune) {
410 add_scale("layer2_2011_v5");
411 add_scale("ps_2011");
412 }
413 else if ("2011_alt" == tune) {
414 add_scale("layer1_alt_2011");
415 add_scale("ps_2011");
416 }
417 else if("2011_alt_with_layer2" == tune) {
418 add_scale("layer2_alt_2011_v5");
419 add_scale("ps_2011");
420 }
421 else if ("2011_layer1_up" == tune) {
422 add_scale("layer1_2011_up");
423 add_scale("ps_2011");
424 }
425 else if ("2011_layer1_down" == tune) {
426 add_scale("layer1_2011_down");
427 add_scale("ps_2011");
428 }
429 else if ("2011_layer1_errup" == tune) {
430 add_scale("layer1_2011_errup");
431 }
432 else if ("2011_layer1_errdown" == tune) {
433 add_scale("layer1_2011_errdown");
434 }
435 else if ("2011_ps_down" == tune) {
436 add_scale("layer1_2011");
437 add_scale("ps_2011_down");
438 }
439 else if ("2011_ps_up" == tune) {
440 add_scale("layer1_2011");
441 add_scale("ps_2011_up");
442 }
443 else if ("2011_ps_errdown" == tune) {
444 add_scale("ps_2011_errdown");
445 }
446 else if ("2011_ps_errup" == tune) {
447 add_scale("ps_2011_errup");
448 }
449 else if ("2011_up" == tune) {
450 add_scale("layer1_2011_up");
451 add_scale("ps_2011_up");
452 }
453 else if ("2011_down" == tune) {
454 add_scale("layer1_2011_down");
455 add_scale("ps_2011_down");
456 }
457 else if ("2011_errup" == tune) {
458 add_scale("layer1_2011_errup");
459 add_scale("ps_2011_errup");
460 }
461 else if ("2011_errdown" == tune) {
462 add_scale("layer1_2011_errdown");
463 add_scale("ps_2011_errdown");
464 }
465 // 2010
466 else if ("2010" == tune) {
467 add_scale("layer1_2010");
468 add_scale("ps_2010");
469 }
470 else if ("2010_layer1_up" == tune) {
471 add_scale("layer1_2010_up");
472 add_scale("ps_2010");
473 }
474 else if ("2010_layer1_down" == tune) {
475 add_scale("layer1_2010_down");
476 add_scale("ps_2010");
477 }
478 else if ("2010_layer1_errup" == tune) {
479 add_scale("layer1_2010_errup");
480 }
481 else if ("2010_layer1_errdown" == tune) {
482 add_scale("layer1_2010_errdown");
483 }
484 else if ("2010_ps_down" == tune) {
485 add_scale("layer1_2010");
486 add_scale("ps_2010_down");
487 }
488 else if ("2010_ps_up" == tune) {
489 add_scale("layer1_2010");
490 add_scale("ps_2010_up");
491 }
492 else if ("2010_ps_errdown" == tune) {
493 add_scale("ps_2010_errdown");
494 }
495 else if ("2010_ps_errup" == tune) {
496 add_scale("ps_2010_errup");
497 }
498 else if ("2010_up" == tune) {
499 add_scale("layer1_2010_up");
500 add_scale("ps_2010_up");
501 }
502 else if ("2010_down" == tune) {
503 add_scale("layer1_2010_down");
504 add_scale("ps_2010_down");
505 }
506 else if ("2010_errup" == tune) {
507 add_scale("layer1_2010_errup");
508 add_scale("ps_2010_errup");
509 }
510 else if ("2010_errdown" == tune) {
511 add_scale("layer1_2010_errdown");
512 add_scale("ps_2010_errdown");
513 }
514 else if ("ps_HV1" == tune) {
515 add_scale(new ScaleE0(InputModifier::ONEBASED), new GetAmountHVPSGuillaume());
516 }
517 else if ("ps_EMECHV1" == tune) {
518 add_scale(new ScaleE0(InputModifier::ONEBASED), new GetAmountHVEMECPS207());
519 }
520 else if ("test1" == tune) {
521 TH1F h_presampler("h_presampler", "h_presampler", 10, -2.5, 2.5);
522 // just as an example, correct E0 by 0.1 * sign(eta)
523 // and E1 by 1%
524 for (int ibin = 1; ibin <= 5; ++ibin) {
525 h_presampler.SetBinContent(ibin, -0.1);
526 h_presampler.SetBinContent(ibin + 5, 0.1);
527 }
528 add_scale(new ScaleE0(InputModifier::ZEROBASED), new GetAmountHisto1D(h_presampler));
529 add_scale(new ScaleE1(InputModifier::ZEROBASED), new GetAmountFixed(0.01));
530 }
531 else if ("acc_zee_run3_gnn_v0" == tune){
532 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v14/egammaLayerRecalibTunes_transformerTune.root");
533 TFile f(file.c_str());
534 TH2F* histo_acc = static_cast<TH2F*>(f.Get("hACC_Zee_rel23_gnn"));
535 assert(histo_acc);
536 add_scale(new ScaleEaccordion(InputModifier::ZEROBASED_ALPHA),
537 new GetAmountHisto2DEtaCaloRunNumber(*histo_acc));
538 }
539 else if ("acc_zee_run3_v0" == tune){
540 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v13/egammaLayerRecalibTunes.root");
541 TFile f(file.c_str());
542 TH2F* histo_acc = static_cast<TH2F*>(f.Get("hACC_Zee_rel23"));
543 assert(histo_acc);
544 add_scale(new ScaleEaccordion(InputModifier::ZEROBASED_ALPHA),
545 new GetAmountHisto2DEtaCaloRunNumber(*histo_acc));
546 }
547 // repeated acc scale based on layer2_alt_el_mu_comb_r21_v0_fix
548 else if ("acc_zee_r22_v1" == tune) {
549 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v12/egammaLayerRecalibTunes.root");
550 TFile f(file.c_str());
551 TH2F* histo_acc = static_cast<TH2F*>(f.Get("hACC_Zee_rel22"));
552 assert(histo_acc);
553 add_scale(new ScaleEaccordion(InputModifier::ZEROBASED_ALPHA),
554 new GetAmountHisto2DEtaCaloRunNumber(*histo_acc));
555 }
556 else if ("acc_zee_r22_v0" == tune) {
557 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v11/egammaLayerRecalibTunes.root");
558 TFile f(file.c_str());
559 TH2F* histo_acc = static_cast<TH2F*>(f.Get("hACC_Zee_rel22"));
560 assert(histo_acc);
561 add_scale(new ScaleEaccordion(InputModifier::ZEROBASED_ALPHA),
562 new GetAmountHisto2DEtaCaloRunNumber(*histo_acc));
563 }
564 else if ("layer1_1" == tune) {
565 TFormula f("formula_layer1_1", "(abs(x)<1.425) ? 0.97 : 1");
566 add_scale(new ScaleE1(InputModifier::ONEBASED_ALPHA), new GetAmountFormula(f));
567 }
568 else if ("layer1_2" == tune) {
569 TFormula f("formula_layer1_2", "(abs(x)<1.425) ? 0.97 : 1.05");
570 add_scale(new ScaleE1(InputModifier::ONEBASED_ALPHA), new GetAmountFormula(f));
571 }
572 else if ("layer1_alt_2012_v5" == tune) {
573 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
574 TFile f(file.c_str());
575 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_alt_2012"));
577 new GetAmountHisto1D(*histo));
578 }
579 else if ("layer1_2012_v5" == tune) {
580 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
581 TFile f(file.c_str());
582 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
584 new GetAmountHisto1D(*histo));
585 }
586 else if ("layer1_2012_v5_down" == tune) {
587 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
588 TFile f(file.c_str());
589 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
591 new GetAmountHisto1DUp(*histo));
592 }
593 else if ("layer1_2012_v5_up" == tune) {
594 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
595 TFile f(file.c_str());
596 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
598 new GetAmountHisto1DDown(*histo));
599 }
600 else if ("layer1_2012_v5_errdown" == tune) {
601 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
602 TFile f(file.c_str());
603 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
605 new GetAmountHisto1DErrorUp(*histo));
606 }
607 else if ("layer1_2012_v5_errup" == tune) {
608 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
609 TFile f(file.c_str());
610 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
612 new GetAmountHisto1DErrorDown(*histo));
613 }
614 else if ("layer1_alt_2011_v5" == tune) {
615 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
616 TFile f(file.c_str());
617 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_alt_2011"));
619 new GetAmountHisto1D(*histo));
620 }
621 else if ("layer1_2011_v5" == tune) {
622 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
623 TFile f(file.c_str());
624 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
626 new GetAmountHisto1D(*histo));
627 }
628 else if ("layer1_2011_v5_down" == tune) {
629 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
630 TFile f(file.c_str());
631 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
633 new GetAmountHisto1DUp(*histo));
634 }
635 else if ("layer1_2011_v5_up" == tune) {
636 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
637 TFile f(file.c_str());
638 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
640 new GetAmountHisto1DDown(*histo));
641 }
642 else if ("layer1_2011_v5_errdown" == tune) {
643 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
644 TFile f(file.c_str());
645 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
647 new GetAmountHisto1DErrorUp(*histo));
648 }
649 else if ("layer1_2011_v5_errup" == tune) {
650 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
651 TFile f(file.c_str());
652 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
654 new GetAmountHisto1DErrorDown(*histo));
655 }
656 else if ("layer1_2010_v5" == tune) {
657 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
658 TFile f(file.c_str());
659 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
661 new GetAmountHisto1D(*histo));
662 }
663 else if ("layer1_2010_v5_down" == tune) {
664 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
665 TFile f(file.c_str());
666 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
668 new GetAmountHisto1DUp(*histo));
669 }
670 else if ("layer1_2010_v5_up" == tune) {
671 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
672 TFile f(file.c_str());
673 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
675 new GetAmountHisto1DDown(*histo));
676 }
677 else if ("layer1_2010_v5_errdown" == tune) {
678 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
679 TFile f(file.c_str());
680 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
682 new GetAmountHisto1DErrorUp(*histo));
683 }
684 else if ("layer1_2010_v5_errup" == tune) {
685 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
686 TFile f(file.c_str());
687 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
689 new GetAmountHisto1DErrorDown(*histo));
690 }
691 else if ("layer2_run3_ofc_extrapolate_v0"==tune){
692 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v12/egammaLayerRecalibTunes.root");
693 TFile f(file.c_str());
694 TH1D* histo = static_cast<TH1D*>(f.Get("hE1E2_emu_run2_rel21_v1_run3ofc"));
695 assert(histo);
697 new GetAmountHisto1D(*histo));
698 }
699 // fix E1E2 scale from R21 precision model
700 else if("layer2_alt_el_mu_comb_r21_v0_fix"==tune) {
701 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v12/egammaLayerRecalibTunes.root");
702 TFile f(file.c_str());
703 TH1D* histo = static_cast<TH1D*>(f.Get("hE1E2_emu_run2_rel21_v0_fix"));
704 assert(histo);
706 new GetAmountHisto1D(*histo));
707 }
708 else if("layer2_alt_el_mu_comb_r21_v0"==tune) {
709 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v11/egammaLayerRecalibTunes.root");
710 TFile f(file.c_str());
711 TH1D* histo = static_cast<TH1D*>(f.Get("hE1E2_emu_run2_rel21_v0"));
712 assert(histo);
714 new GetAmountHisto1D(*histo));
715 }
716 else if("layer2_alt_run2_r21_v1"==tune) {
717 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v6/egammaLayerRecalibTunes.root");
718 TFile f(file.c_str());
719 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2_mu_run2_rel21_v1"));
721 new GetAmountHisto1D(*histo));
722 }
723 else if("layer2_alt_run2_r21_v0"==tune) {
724 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v5/egammaLayerRecalibTunes.root");
725 TFile f(file.c_str());
726 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2mu_2016_rel21_v1"));
728 new GetAmountHisto1D(*histo));
729 }
730 else if("layer2_alt_run2_v1" == tune) {
731 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v3/egammaLayerRecalibTunes.root");
732 TFile f(file.c_str());
733 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2mu_2016_v1"));
735 new GetAmountHisto1D(*histo));
736 }
737 else if("layer2_alt_2012_v5" == tune) {
738 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
739 TFile f(file.c_str());
740 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_alt_2012"));
742 new GetAmountHisto1D(*histo));
743 }
744 else if("layer2_2012_v5" == tune) {
745 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
746 TFile f(file.c_str());
747 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
749 new GetAmountHisto1D(*histo));
750 }
751 else if("layer2_2012_v5_down" == tune) {
752 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
753 TFile f(file.c_str());
754 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
756 new GetAmountHisto1DDown(*histo));
757 }
758 else if("layer2_2012_v5_up" == tune) {
759 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
760 TFile f(file.c_str());
761 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
763 new GetAmountHisto1DUp(*histo));
764 }
765 else if ("layer2_2012_v5_errdown" == tune) {
766 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
767 TFile f(file.c_str());
768 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
770 new GetAmountHisto1DErrorDown(*histo));
771 }
772 else if ("layer2_2012_v5_errup" == tune) {
773 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
774 TFile f(file.c_str());
775 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2012"));
777 new GetAmountHisto1DErrorUp(*histo));
778 }
779 else if("layer2_alt_2011_v5" == tune) {
780 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
781 TFile f(file.c_str());
782 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_alt_2011"));
784 new GetAmountHisto1D(*histo));
785 }
786 else if("layer2_2011_v5" == tune) {
787 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
788 TFile f(file.c_str());
789 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
791 new GetAmountHisto1D(*histo));
792 }
793 else if("layer2_2011_v5_down" == tune) {
794 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
795 TFile f(file.c_str());
796 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
798 new GetAmountHisto1DDown(*histo));
799 }
800 else if("layer2_2011_v5_up" == tune) {
801 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
802 TFile f(file.c_str());
803 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
805 new GetAmountHisto1DUp(*histo));
806 }
807 else if ("layer2_2011_v5_errdown" == tune) {
808 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
809 TFile f(file.c_str());
810 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
812 new GetAmountHisto1DErrorDown(*histo));
813 }
814 else if ("layer2_2011_v5_errup" == tune) {
815 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
816 TFile f(file.c_str());
817 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2011"));
819 new GetAmountHisto1DErrorUp(*histo));
820 }
821 else if("layer2_2010_v5" == tune) {
822 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
823 TFile f(file.c_str());
824 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
826 new GetAmountHisto1D(*histo));
827 }
828 else if("layer2_2010_v5_down" == tune) {
829 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
830 TFile f(file.c_str());
831 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
833 new GetAmountHisto1DDown(*histo));
834 }
835 else if("layer2_2010_v5_up" == tune) {
836 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
837 TFile f(file.c_str());
838 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
840 new GetAmountHisto1DUp(*histo));
841 }
842 else if ("layer2_2010_v5_errdown" == tune) {
843 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
844 TFile f(file.c_str());
845 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
847 new GetAmountHisto1DErrorDown(*histo));
848 }
849 else if ("layer2_2010_v5_errup" == tune) {
850 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
851 TFile f(file.c_str());
852 TH1* histo = checked_cast<TH1*>(f.Get("hE1E2ave_2010"));
854 new GetAmountHisto1DErrorUp(*histo));
855 }
856 else if ("ps_2016_r21_v0" == tune) {
857 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v5/egammaLayerRecalibTunes.root");
858 TFile f(file.c_str());
859 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2016_rel21"));
861 new GetAmountHisto1D(*histo_ps_tot_error));
862 }
863 else if ("ps_run3_ofc_extrapolate_v0" == tune){
864 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v12/egammaLayerRecalibTunes.root");
865 TFile f(file.c_str());
866 TH1* histo_ps_tot_error = static_cast<TH1*>(f.Get("hPS_MuonLowMu_rel21_run3ofc"));
867 assert(histo_ps_tot_error);
869 new GetAmountHisto1D(*histo_ps_tot_error));
870 }
871 else if ("ps_mu_r21_v0" == tune) {
872 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v11/egammaLayerRecalibTunes.root");
873 TFile f(file.c_str());
874 TH1* histo_ps_tot_error = static_cast<TH1*>(f.Get("hPS_MuonLowMu_rel21"));
875 assert(histo_ps_tot_error);
877 new GetAmountHisto1D(*histo_ps_tot_error));
878 }
879 else if ("ps_2016_v1" == tune) {
880 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v4/egammaLayerRecalibTunes.root");
881 TFile f(file.c_str());
882 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2016"));
884 new GetAmountHisto1D(*histo_ps_tot_error));
885 }
886 else if ("ps_2012_v3" == tune) {
887 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
888 TFile f(file.c_str());
889 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2012"));
891 new GetAmountHisto1D(*histo_ps_tot_error));
892 }
893 else if ("ps_2012_v3_down" == tune) {
894 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
895 TFile f(file.c_str());
896 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2012"));
898 new GetAmountHisto1DUp(*histo_ps_tot_error));
899 }
900 else if ("ps_2012_v3_up" == tune){
901 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
902 TFile f(file.c_str());
903 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2012"));
905 new GetAmountHisto1DDown(*histo_ps_tot_error));
906 }
907 else if ("ps_2012_v3_errdown" == tune){
908 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
909 TFile f(file.c_str());
910 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2012"));
912 new GetAmountHisto1DErrorUp(*histo_ps_tot_error));
913 }
914 else if ("ps_2012_v3_errup" == tune){
915 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
916 TFile f(file.c_str());
917 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2012"));
919 new GetAmountHisto1DErrorDown(*histo_ps_tot_error));
920 }
921 else if ("ps_2011_v3" == tune) {
922 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
923 TFile f(file.c_str());
924 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2011"));
926 new GetAmountHisto1D(*histo_ps_tot_error));
927 }
928 else if ("ps_2011_v3_down" == tune) {
929 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
930 TFile f(file.c_str());
931 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2011"));
933 new GetAmountHisto1DUp(*histo_ps_tot_error));
934 }
935 else if ("ps_2011_v3_up" == tune){
936 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
937 TFile f(file.c_str());
938 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2011"));
940 new GetAmountHisto1DDown(*histo_ps_tot_error));
941 }
942 else if ("ps_2011_v3_errdown" == tune){
943 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
944 TFile f(file.c_str());
945 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2011"));
947 new GetAmountHisto1DErrorUp(*histo_ps_tot_error));
948 }
949 else if ("ps_2011_v3_errup" == tune){
950 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
951 TFile f(file.c_str());
952 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2011"));
954 new GetAmountHisto1DErrorDown(*histo_ps_tot_error));
955 }
956 // 2010
957 else if ("ps_2010_v3" == tune) {
958 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
959 TFile f(file.c_str());
960 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2010"));
962 new GetAmountHisto1D(*histo_ps_tot_error));
963 }
964 else if ("ps_2010_v3_down" == tune) {
965 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
966 TFile f(file.c_str());
967 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2010"));
969 new GetAmountHisto1DUp(*histo_ps_tot_error));
970 }
971 else if ("ps_2010_v3_up" == tune) {
972 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
973 TFile f(file.c_str());
974 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2010"));
976 new GetAmountHisto1DDown(*histo_ps_tot_error));
977 }
978 else if ("ps_2010_v3_errdown" == tune){
979 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
980 TFile f(file.c_str());
981 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2010"));
983 new GetAmountHisto1DErrorUp(*histo_ps_tot_error));
984 }
985 else if ("ps_2010_v3_errup" == tune){
986 const std::string file = PathResolverFindCalibFile("egammaLayerRecalibTool/v1/egammaLayerRecalibTunes.root");
987 TFile f(file.c_str());
988 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get("hPS_2010"));
990 new GetAmountHisto1DErrorDown(*histo_ps_tot_error));
991 }
992 else {
993 throw std::runtime_error(tune+" is not a valid tune");
994 }
995}
#define ATH_MSG_INFO(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
static std::string resolve_alias(const std::string &tune)
TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
TFile * file

◆ add_scale() [2/2]

void egammaLayerRecalibTool::add_scale ( InputModifier * modifier,
GetAmountBase * amount )

add custom layer scale correction.

Can be called multiple times.

Definition at line 1008 of file egammaLayerRecalibTool.cxx.

1009{
1010 m_modifiers.emplace_back(modifier, amount);
1011}

◆ applyCorrection()

CP::CorrectionCode egammaLayerRecalibTool::applyCorrection ( xAOD::Egamma & particle,
const xAOD::EventInfo & event_info ) const

Definition at line 1089 of file egammaLayerRecalibTool.cxx.

1090{
1091
1092 StdCalibrationInputs inputs{};
1093 bool isData = true;
1094 std::string fixT;
1095 double addE2 = 0.0, addE3 = 0.0;
1096
1097 CP::CorrectionCode status = read_and_scale_inputs(particle, event_info, inputs, isData, fixT, addE2, addE3);
1098
1100 return status;
1101
1102 const xAOD::CaloCluster* cluster = particle.caloCluster();
1103
1104 static const SG::AuxElement::Decorator<double> deco_E0("correctedcl_Es0");
1105 static const SG::AuxElement::Decorator<double> deco_E1("correctedcl_Es1");
1106 static const SG::AuxElement::Decorator<double> deco_E2("correctedcl_Es2");
1107 static const SG::AuxElement::Decorator<double> deco_E3("correctedcl_Es3");
1108 static const SG::AuxElement::Decorator<std::string>
1109 deco_layer_correction("layer_correction");
1110
1111 if (status == CP::CorrectionCode::Ok) {
1112 ATH_MSG_DEBUG("decorating cluster with corrected layer energies");
1113 deco_E0(*cluster) = m_doPSCorrections ?
1114 inputs.E0raw : cluster->energyBE(0);
1115 deco_E1(*cluster) = m_doS12Corrections or m_doSaccCorrections ?
1116 inputs.E1raw : cluster->energyBE(1);
1117 deco_E2(*cluster) = m_doS12Corrections or m_doSaccCorrections ?
1118 inputs.E2raw : cluster->energyBE(2) + addE2;
1119 deco_E3(*cluster) = m_doSaccCorrections ?
1120 inputs.E3raw : cluster->energyBE(3) + addE3;
1121 deco_layer_correction(*cluster) = isData ? m_tune+fixT : fixT;
1122 return status;
1123 }
1124
1125 ATH_MSG_DEBUG("cannot correct layer energies:"
1126 " decorating particle with non-corrected layer energies");
1127 // this is done for safety, since when a particle is decorated
1128 // all the particle in the container are decorated
1129 // it is not possible to distinguish between decorated / non-decorated
1130 // since all are decorated
1131 deco_E0(*cluster) = cluster->energyBE(0);
1132 deco_E1(*cluster) = cluster->energyBE(1);
1133 deco_E2(*cluster) = cluster->energyBE(2) + addE2;
1134 deco_E3(*cluster) = cluster->energyBE(3) + addE3;
1135 deco_layer_correction(*cluster) = isData ? m_tune + "_Err" + fixT : fixT;
1136 return status;
1137
1138}
#define ATH_MSG_DEBUG(x)
@ Ok
The correction was done successfully.
CP::CorrectionCode read_and_scale_inputs(const xAOD::Egamma &particle, const xAOD::EventInfo &event_info, StdCalibrationInputs &inputs, bool &isData, std::string &fixT, double &addE2, double &addE3) const
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
status
Definition merge.py:16
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.

◆ clear_corrections()

void egammaLayerRecalibTool::clear_corrections ( )

remove all the scale corrections

Definition at line 1169 of file egammaLayerRecalibTool.cxx.

1170{
1171 for (auto modifier : m_modifiers) {
1172 delete modifier.first;
1173 delete modifier.second;
1174 }
1175 m_modifiers.clear();
1176}

◆ create()

std::pair< std::string, egammaLayerRecalibTool * > egammaLayerRecalibTool::create ( const std::string & type,
const std::string & args )
static

helper to create a tool from a string (useful for command line arguments)

Definition at line 1214 of file egammaLayerRecalibTool.cxx.

1215{
1216 auto args_map = parse(args);
1217 egammaLayerRecalibTool* tool = new egammaLayerRecalibTool("egammaLayerRecalibTool", "");
1218 std::string name = "";
1219 std::string amount_name = "";
1220 std::string type_name = "";
1221
1222 GetAmountBase* amount_getter = nullptr;
1223 InputModifier* modifier = nullptr;
1224
1225 if (auto pa = args_map.find("amount"); pa != args_map.end()) {
1226 std::string amount_str = pa->second;
1227 bool perc = false;
1228 if (amount_str.back()=='%') {
1229 perc = true;
1230 amount_str.pop_back();
1231 }
1232 const float amount = TString(amount_str).Atof() * (perc ? 0.01 : 1);
1233
1234 amount_getter = new GetAmountFixed(amount);
1235 std::stringstream amount_stream;
1236 amount_stream << amount;
1237 amount_name = amount_stream.str();
1238 std::replace(amount_name.begin(), amount_name.end(), '-', 'n');
1239 std::replace(amount_name.begin(), amount_name.end(), '.', 'p');
1240 }
1241 else if (auto pn = args_map.find("name"); pn != args_map.end()) {
1242 name = pn->second;
1243 }
1244 else if (args_map.find("histo") != args_map.end()) {
1245 int dim = 0;
1246 if (not args_map.contains("file")) {
1247 std::cerr << "with histo you must specify file" << std::endl;
1248 assert(false);
1249 }
1250 if (args_map.contains("formulax") ) dim = 1;
1251
1252 if (dim == 0)
1253 {
1254 std::cerr << "with histo you must specify formulax" << std::endl;
1255 assert(false);
1256 }
1257 if (dim == 1) {
1258 TFile f(args_map["file"].c_str());
1259 std::cout << "opening histo " << args_map["histo"] << " from file " << args_map["file"] << std::endl;
1260 TH1F* histo = dynamic_cast<TH1F*>(f.Get(args_map["histo"].c_str()));
1261
1262 if(histo){
1263 histo->SetDirectory(nullptr);
1264 amount_getter = new GetAmountHisto1D(*histo);
1265 }
1266 else{assert(false); }
1267 }
1268 else { assert(false); }
1269 }
1270 else {
1271 std::cerr << "cannot understand argument " << args << std::endl;
1272 assert(false);
1273 }
1274
1275 if ("bias-E0" == type) { modifier = new ScaleE0(InputModifier::ZEROBASED); type_name = "E0"; }
1276 else if ("bias-E1" == type) { modifier = new ScaleE1(InputModifier::ZEROBASED); type_name = "E1"; }
1277 else if ("bias-E2" == type) { modifier = new ScaleE2(InputModifier::ZEROBASED); type_name = "E2"; }
1278 else if ("bias-E3" == type) { modifier = new ScaleE3(InputModifier::ZEROBASED); type_name = "E3"; }
1279 else if ("bias-E1overE2" == type) { modifier = new ScaleE1overE2(InputModifier::ZEROBASED); type_name = "E1overE2"; }
1280 else if ("bias-Eaccordion" == type) { modifier = new ScaleEaccordion(InputModifier::ZEROBASED); type_name = "Eaccordion"; }
1281 else if ("bias-Ecalorimeter" == type) { modifier = new ScaleEcalorimeter(InputModifier::ZEROBASED); type_name = "Ecalorimeter"; }
1282
1283 if (not type_name.empty() and not amount_name.empty()) {
1284 name = type_name + "_" + amount_name;
1285 }
1286
1287 if (name.empty()) {
1288 std::cerr << "you need to specify a name for the bias with type " << type << std::endl;
1289 }
1290
1291 if (modifier and amount_getter) {
1292 tool->add_scale(modifier, amount_getter);
1293 }
1294 else{
1295 tool->add_scale(type);
1296 //release resources, if modifier false need to release amount_getter and vice versa
1297 //since they are not passed to the tool
1298 if(modifier) delete modifier;
1299 if(amount_getter) delete amount_getter;
1300 }
1301
1302 return {name, tool};
1303}
std::map< std::string, std::string, std::less<> > parse(const std::string &list)

◆ disable_LayerclEdecoration()

void egammaLayerRecalibTool::disable_LayerclEdecoration ( )
inline

Definition at line 321 of file egammaLayerRecalibTool.h.

◆ disable_PSCorrections()

void egammaLayerRecalibTool::disable_PSCorrections ( )
inline

Definition at line 318 of file egammaLayerRecalibTool.h.

318{m_doPSCorrections=false;}

◆ disable_S12Corrections()

void egammaLayerRecalibTool::disable_S12Corrections ( )
inline

Definition at line 319 of file egammaLayerRecalibTool.h.

319{m_doS12Corrections=false;}

◆ disable_SaccCorrections()

void egammaLayerRecalibTool::disable_SaccCorrections ( )
inline

Definition at line 320 of file egammaLayerRecalibTool.h.

320{m_doSaccCorrections=false;}

◆ fixForMissingCells()

void egammaLayerRecalibTool::fixForMissingCells ( bool fix = true)
inline

Definition at line 316 of file egammaLayerRecalibTool.h.

◆ getLayerCorrections()

std::array< double, 4 > egammaLayerRecalibTool::getLayerCorrections ( const xAOD::Egamma & particle,
const xAOD::EventInfo & event_info ) const

Definition at line 1140 of file egammaLayerRecalibTool.cxx.

1141{
1142 StdCalibrationInputs inputs{};
1143 bool isData = true;
1144 std::string fixT;
1145 double addE2 = 0.0, addE3 = 0.0;
1146
1147 CP::CorrectionCode status = read_and_scale_inputs(particle, event_info, inputs, isData, fixT, addE2, addE3);
1148
1149 if (status != CP::CorrectionCode::Ok) {
1150 if (status == CP::CorrectionCode::Error) {
1151 ATH_MSG_ERROR("Failed to read inputs, returning 1 for all layers, please check if this is expected!");
1152 }
1153 else if (status == CP::CorrectionCode::OutOfValidityRange) {
1154 ATH_MSG_WARNING("Some inputs are out of validity range, returning 1 for all layers; object eta: " << inputs.eta);
1155 }
1156 return {1.,1.,1.,1.};
1157 }
1158
1159 auto safe_divide = [](float a, float b) { return b != 0 ? a/b : 1.f; };
1160 return {
1161 safe_divide(inputs.E0raw, particle.caloCluster()->energyBE(0)),
1162 safe_divide(inputs.E1raw, particle.caloCluster()->energyBE(1)),
1163 safe_divide(inputs.E2raw, particle.caloCluster()->energyBE(2) + addE2),
1164 safe_divide(inputs.E3raw, particle.caloCluster()->energyBE(3) + addE3)
1165 };
1166
1167}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
static Double_t a
@ Error
Some error happened during the object correction.
@ OutOfValidityRange
Input object is out of validity range.

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ msg() [1/2]

MsgStream & asg::AsgMessaging::msg ( ) const
inherited

The standard message stream.

Returns
A reference to the default message stream of this object.

Definition at line 49 of file AsgMessaging.cxx.

49 {
50#ifndef XAOD_STANDALONE
51 return ::AthMessaging::msg();
52#else // not XAOD_STANDALONE
53 return m_msg;
54#endif // not XAOD_STANDALONE
55 }

◆ msg() [2/2]

MsgStream & asg::AsgMessaging::msg ( const MSG::Level lvl) const
inherited

The standard message stream.

Parameters
lvlThe message level to set the stream to
Returns
A reference to the default message stream, set to level "lvl"

Definition at line 57 of file AsgMessaging.cxx.

57 {
58#ifndef XAOD_STANDALONE
59 return ::AthMessaging::msg( lvl );
60#else // not XAOD_STANDALONE
61 m_msg << lvl;
62 return m_msg;
63#endif // not XAOD_STANDALONE
64 }

◆ msgLvl()

bool asg::AsgMessaging::msgLvl ( const MSG::Level lvl) const
inherited

Test the output level of the object.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
true If messages at level "lvl" will be printed

Definition at line 41 of file AsgMessaging.cxx.

41 {
42#ifndef XAOD_STANDALONE
43 return ::AthMessaging::msgLvl( lvl );
44#else // not XAOD_STANDALONE
45 return m_msg.msgLevel( lvl );
46#endif // not XAOD_STANDALONE
47 }

◆ read_and_scale_inputs()

CP::CorrectionCode egammaLayerRecalibTool::read_and_scale_inputs ( const xAOD::Egamma & particle,
const xAOD::EventInfo & event_info,
StdCalibrationInputs & inputs,
bool & isData,
std::string & fixT,
double & addE2,
double & addE3 ) const

Definition at line 1027 of file egammaLayerRecalibTool.cxx.

1034{
1035 const xAOD::CaloCluster* cluster = particle.caloCluster();
1036 if (!cluster) {
1037 ATH_MSG_ERROR("egamma particle without CaloCluster");
1039 }
1040
1043 fixT = "_egFixForTopoTimingCut";
1044 unsigned short stat =
1045 xAOD::EgammaHelpers::energyInMissingCells(particle,addE2,addE3);
1046 if (stat) {
1047 ATH_MSG_WARNING("Fix for missing cells required"
1048 " but some layer info is not available,"
1049 " from L2 : " << stat%2 << " from L3 : " << stat/2);
1050 }
1051 }
1052
1053 double eta_calo;
1054 static const SG::AuxElement::Accessor<float> accEtaCalo("etaCalo");
1056 eta_calo = cluster->eta();
1057 }
1058 else if (cluster->retrieveMoment(xAOD::CaloCluster::ETACALOFRAME, eta_calo)){
1059
1060 }
1061 else if (accEtaCalo.isAvailable(*cluster)) {
1062 eta_calo = accEtaCalo(*cluster);
1063 }
1064 else{
1065 ATH_MSG_ERROR("etaCalo not available as auxilliary variable,"
1066 " using cluster eta as eta calo!");
1067 eta_calo=cluster->eta();
1068 }
1069
1070 inputs = StdCalibrationInputs{
1071 event_info.averageInteractionsPerCrossing(),
1072 event_info.runNumber(),
1073 cluster->eta(),
1074 cluster->phi(),
1075 cluster->energyBE(0),
1076 cluster->energyBE(1),
1077 cluster->energyBE(2) + addE2,
1078 cluster->energyBE(3) + addE3,
1079 eta_calo};
1080
1081 isData = !event_info.eventType(xAOD::EventInfo::IS_SIMULATION);
1082 CP::CorrectionCode status = CP::CorrectionCode::Ok;
1083 if (isData || m_scaleMC)
1084 status = scale_inputs(inputs);
1085
1086 return status;
1087}
static const unsigned int m_Run2Run3runNumberTransition
CP::CorrectionCode scale_inputs(StdCalibrationInputs &inputs) const
apply layer calibration to the
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
@ ETACALOFRAME
Eta in the calo frame (for egamma).
bool eventType(EventType type) const
Check for one particular bitmask value.
float averageInteractionsPerCrossing() const
Average interactions per crossing for all BCIDs - for out-of-time pile-up.
@ IS_SIMULATION
true: simulation, false: data
uint32_t runNumber() const
The current event's run number.
unsigned short energyInMissingCells(const xAOD::Egamma &eg, double &e2, double &e3)
Get the energies in sampling 2 and 3 that are in cells rejected by the topo-cluster timing cut but th...
const uint16_t AuthorFwdElectron
Electron reconstructed by the Forward cluster-based algorithm.
Definition EgammaDefs.h:30

◆ resolve_alias()

std::string egammaLayerRecalibTool::resolve_alias ( const std::string & tune)
staticprivate

Definition at line 208 of file egammaLayerRecalibTool.cxx.

208 {
209
210 if ("layer1_2012" == tune) return "layer1_2012_v5";
211 if ("layer1_alt_2012" == tune) return "layer1_alt_2012_v5";
212 if ("layer1_2011" == tune) return "layer1_2011_v5";
213 if ("layer1_alt_2011" == tune) return "layer1_alt_2011_v5";
214 if ("layer1_2010" == tune) return "layer1_2010_v5";
215 if ("ps_2012" == tune) return "ps_2012_v3";
216 if ("ps_2011" == tune) return "ps_2011_v3";
217 if ("ps_2010" == tune) return "ps_2010_v3";
218 if ("layer1_2012_up" == tune) return "layer1_2012_v5_up";
219 if ("layer1_2012_down" == tune) return "layer1_2012_v5_down";
220 if ("layer1_2012_errup" == tune) return "layer1_2012_v5_errup";
221 if ("layer1_2012_errdown" == tune) return "layer1_2012_v5_errdown";
222 if ("layer1_2011_up" == tune) return "layer1_2011_v5_up";
223 if ("layer1_2011_down" == tune) return "layer1_2011_v5_down";
224 if ("layer1_2011_errup" == tune) return "layer1_2011_v5_errup";
225 if ("layer1_2011_errdown" == tune) return "layer1_2011_v5_errdown";
226 if ("layer1_2010_up" == tune) return "layer1_2010_v5_up";
227 if ("layer1_2010_down" == tune) return "layer1_2010_v5_down";
228 if ("layer1_2010_errup" == tune) return "layer1_2010_v5_errup";
229 if ("layer1_2010_errdown" == tune) return "layer1_2010_v5_errdown";
230 if ("ps_2012_up" == tune) return "ps_2012_v3_up";
231 if ("ps_2012_down" == tune) return "ps_2012_v3_down";
232 if ("ps_2012_errup" == tune) return "ps_2012_v3_errup";
233 if ("ps_2012_errdown" == tune) return "ps_2012_v3_errdown";
234 if ("ps_2011_up" == tune) return "ps_2011_v3_up";
235 if ("ps_2011_down" == tune) return "ps_2011_v3_down";
236 if ("ps_2011_errup" == tune) return "ps_2011_v3_errup";
237 if ("ps_2011_errdown" == tune) return "ps_2011_v3_errdown";
238 if ("ps_2010_up" == tune) return "ps_2010_v3_up";
239 if ("ps_2010_down" == tune) return "ps_2010_v3_down";
240 if ("ps_2010_errup" == tune) return "ps_2010_v3_errup";
241 if ("ps_2010_errdown" == tune) return "ps_2010_v3_errdown";
242
243 return tune;
244}

◆ resolve_path()

const std::string egammaLayerRecalibTool::resolve_path ( std::string filename) const
private

◆ scale_inputs()

CP::CorrectionCode egammaLayerRecalibTool::scale_inputs ( StdCalibrationInputs & inputs) const

apply layer calibration to the

Parameters
inputs

Definition at line 1013 of file egammaLayerRecalibTool.cxx.

1014{
1015 CP::CorrectionCode status = CP::CorrectionCode::Ok;
1016 for (const auto& modifier : m_modifiers) {
1017 const float amount = (*modifier.second)(inputs);
1018 const auto s = (*modifier.first)(inputs, amount);
1019 ATH_MSG_DEBUG(" after E0|E1|E2|E3 = " << inputs.E0raw << "|" << inputs.E1raw << "|" << inputs.E2raw << "|" << inputs.E3raw);
1020 if (s != CP::CorrectionCode::Ok) {
1021 if (status != CP::CorrectionCode::Error) { status = s; }
1022 }
1023 }
1024 return status;
1025}

◆ scaleMC()

void egammaLayerRecalibTool::scaleMC ( bool scaleMC = true)
inline

Definition at line 317 of file egammaLayerRecalibTool.h.

317{ m_scaleMC = scaleMC; }
void scaleMC(bool scaleMC=true)

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging).

Definition at line 141 of file AthMessaging.h.

◆ m_aodFixMissingCells

bool egammaLayerRecalibTool::m_aodFixMissingCells = false
private

Definition at line 337 of file egammaLayerRecalibTool.h.

◆ m_doLayerclEdecoration

bool egammaLayerRecalibTool::m_doLayerclEdecoration = true
private

Definition at line 340 of file egammaLayerRecalibTool.h.

◆ m_doPSCorrections

bool egammaLayerRecalibTool::m_doPSCorrections = true
private

Definition at line 328 of file egammaLayerRecalibTool.h.

◆ m_doS12Corrections

bool egammaLayerRecalibTool::m_doS12Corrections = true
private

Definition at line 329 of file egammaLayerRecalibTool.h.

◆ m_doSaccCorrections

bool egammaLayerRecalibTool::m_doSaccCorrections = true
private

Definition at line 330 of file egammaLayerRecalibTool.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_modifiers

ModifiersList egammaLayerRecalibTool::m_modifiers
private

Definition at line 333 of file egammaLayerRecalibTool.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels).

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_pileup_tool

corr_pileupShift* egammaLayerRecalibTool::m_pileup_tool = nullptr
private

Definition at line 335 of file egammaLayerRecalibTool.h.

◆ m_Run2Run3runNumberTransition

const unsigned int egammaLayerRecalibTool::m_Run2Run3runNumberTransition = 400000
staticprivate

Definition at line 325 of file egammaLayerRecalibTool.h.

◆ m_scaleMC

bool egammaLayerRecalibTool::m_scaleMC = false
private

Definition at line 338 of file egammaLayerRecalibTool.h.

◆ m_tune

std::string egammaLayerRecalibTool::m_tune
private

Definition at line 327 of file egammaLayerRecalibTool.h.


The documentation for this class was generated from the following files: