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 996 of file egammaLayerRecalibTool.cxx.

997 : asg::AsgMessaging(name), m_tune(tune), m_doSaccCorrections(SaccEnable)
998{
999 add_scale(tune);
1000}
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 1003 of file egammaLayerRecalibTool.cxx.

1004 : 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 245 of file egammaLayerRecalibTool.cxx.

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

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

◆ applyCorrection()

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

Definition at line 1088 of file egammaLayerRecalibTool.cxx.

1089{
1090
1091 StdCalibrationInputs inputs{};
1092 bool isData = true;
1093 std::string fixT;
1094 double addE2 = 0.0, addE3 = 0.0;
1095
1096 CP::CorrectionCode status = read_and_scale_inputs(particle, event_info, inputs, isData, fixT, addE2, addE3);
1097
1099 return status;
1100
1101 const xAOD::CaloCluster* cluster = particle.caloCluster();
1102
1103 static const SG::AuxElement::Decorator<double> deco_E0("correctedcl_Es0");
1104 static const SG::AuxElement::Decorator<double> deco_E1("correctedcl_Es1");
1105 static const SG::AuxElement::Decorator<double> deco_E2("correctedcl_Es2");
1106 static const SG::AuxElement::Decorator<double> deco_E3("correctedcl_Es3");
1108 deco_layer_correction("layer_correction");
1109
1110 if (status == CP::CorrectionCode::Ok) {
1111 ATH_MSG_DEBUG("decorating cluster with corrected layer energies");
1112 deco_E0(*cluster) = m_doPSCorrections ?
1113 inputs.E0raw : cluster->energyBE(0);
1114 deco_E1(*cluster) = m_doS12Corrections or m_doSaccCorrections ?
1115 inputs.E1raw : cluster->energyBE(1);
1116 deco_E2(*cluster) = m_doS12Corrections or m_doSaccCorrections ?
1117 inputs.E2raw : cluster->energyBE(2) + addE2;
1118 deco_E3(*cluster) = m_doSaccCorrections ?
1119 inputs.E3raw : cluster->energyBE(3) + addE3;
1120 deco_layer_correction(*cluster) = isData ? m_tune+fixT : fixT;
1121 return status;
1122 }
1123
1124 ATH_MSG_DEBUG("cannot correct layer energies:"
1125 " decorating particle with non-corrected layer energies");
1126 // this is done for safety, since when a particle is decorated
1127 // all the particle in the container are decorated
1128 // it is not possible to distinguish between decorated / non-decorated
1129 // since all are decorated
1130 deco_E0(*cluster) = cluster->energyBE(0);
1131 deco_E1(*cluster) = cluster->energyBE(1);
1132 deco_E2(*cluster) = cluster->energyBE(2) + addE2;
1133 deco_E3(*cluster) = cluster->energyBE(3) + addE3;
1134 deco_layer_correction(*cluster) = isData ? m_tune + "_Err" + fixT : fixT;
1135 return status;
1136
1137}
#define ATH_MSG_DEBUG(x)
@ Ok
The correction was done successfully.
SG::Decorator< T, ALLOC > Decorator
Definition AuxElement.h:576
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 1168 of file egammaLayerRecalibTool.cxx.

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

◆ 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 1213 of file egammaLayerRecalibTool.cxx.

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

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

1033{
1034 const xAOD::CaloCluster* cluster = particle.caloCluster();
1035 if (!cluster) {
1036 ATH_MSG_ERROR("egamma particle without CaloCluster");
1038 }
1039
1042 fixT = "_egFixForTopoTimingCut";
1043 unsigned short stat =
1044 xAOD::EgammaHelpers::energyInMissingCells(particle,addE2,addE3);
1045 if (stat) {
1046 ATH_MSG_WARNING("Fix for missing cells required"
1047 " but some layer info is not available,"
1048 " from L2 : " << stat%2 << " from L3 : " << stat/2);
1049 }
1050 }
1051
1052 double eta_calo;
1053 static const SG::AuxElement::Accessor<float> accEtaCalo("etaCalo");
1055 eta_calo = cluster->eta();
1056 }
1057 else if (cluster->retrieveMoment(xAOD::CaloCluster::ETACALOFRAME, eta_calo)){
1058
1059 }
1060 else if (accEtaCalo.isAvailable(*cluster)) {
1061 eta_calo = accEtaCalo(*cluster);
1062 }
1063 else{
1064 ATH_MSG_ERROR("etaCalo not available as auxilliary variable,"
1065 " using cluster eta as eta calo!");
1066 eta_calo=cluster->eta();
1067 }
1068
1069 inputs = StdCalibrationInputs{
1070 event_info.averageInteractionsPerCrossing(),
1071 event_info.runNumber(),
1072 cluster->eta(),
1073 cluster->phi(),
1074 cluster->energyBE(0),
1075 cluster->energyBE(1),
1076 cluster->energyBE(2) + addE2,
1077 cluster->energyBE(3) + addE3,
1078 eta_calo};
1079
1080 isData = !event_info.eventType(xAOD::EventInfo::IS_SIMULATION);
1081 CP::CorrectionCode status = CP::CorrectionCode::Ok;
1082 if (isData || m_scaleMC)
1083 status = scale_inputs(inputs);
1084
1085 return status;
1086}
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 207 of file egammaLayerRecalibTool.cxx.

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

◆ 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 1012 of file egammaLayerRecalibTool.cxx.

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

◆ 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: