ATLAS Offline Software
Classes | Functions
ElectronEfficiencyHelpers Namespace Reference

Classes

struct  ROOT6_NamespaceAutoloadHook
 

Functions

CP::CorrectionCode getEleTruthCharge (const xAOD::Electron &ele, int &truthcharge)
 Get the charge of the original electron. More...
 
CP::CorrectionCode isGoodEle (const xAOD::Electron &ele, bool &goodEle)
 Return true if it's good ele for charge flip measurements. More...
 

Function Documentation

◆ getEleTruthCharge()

CP::CorrectionCode ElectronEfficiencyHelpers::getEleTruthCharge ( const xAOD::Electron ele,
int &  truthcharge 
)

Get the charge of the original electron.

Definition at line 14 of file ElectronEfficiencyHelpers.cxx.

15 {
16 
17  // Define an AsgMessaging instance
18  static const asg::AsgMessaging msg("ElectronEfficiencyHelpers");
19 
20  static const SG::ConstAccessor<int> firstEgMotherPdgIdAcc("firstEgMotherPdgId");
21  if ( !(firstEgMotherPdgIdAcc.isAvailable(ele)) ) {
22  msg.msg(MSG::ERROR) << "Link not available for firstEgMotherPdgId...BAD!!!" << endmsg;
23  msg.msg(MSG::ERROR) << "Need to have present: ( !(ele.isAvailable<int>('firstEgMotherPdgId')) )" << endmsg;
25  }
26 
27  truthcharge = (-1)*firstEgMotherPdgIdAcc(ele);
28  // Make truthcharge -1, 0, +1
29  truthcharge = (0 < truthcharge) - (truthcharge < 0);
30 
32 
33 }

◆ isGoodEle()

CP::CorrectionCode ElectronEfficiencyHelpers::isGoodEle ( const xAOD::Electron ele,
bool &  goodEle 
)

Return true if it's good ele for charge flip measurements.

Definition at line 36 of file ElectronEfficiencyHelpers.cxx.

37 {
38 
39  // good ele => (firstEgMotherPdgId) == 11
40  // this is the case for type 2,3 and 4 electrons, so is not a real truth match!!!
41  // but we believe that it doesn't hurt to apply scale factors for all these cases
42  goodEle = false;
43  int firstEgPdgId = -9999;
44 
45  // Define an AsgMessaging instance
46  static const asg::AsgMessaging msg("ElectronEfficiencyHelpers");
47 
48  static const SG::ConstAccessor<int> firstEgMotherPdgIdAcc("firstEgMotherPdgId");
49  if ( !(firstEgMotherPdgIdAcc.isAvailable(ele)) ) {
50  msg.msg(MSG::ERROR) << "firstEgMotherPdgId IS NOT AVAILABLE!!" << endmsg;
52  }
53  else {
54 
55  firstEgPdgId = firstEgMotherPdgIdAcc(ele);
56 
57  if ( std::abs(firstEgPdgId) != 11) {
58 
59  goodEle = false;
61 
62  }
63  else {
64 
65  goodEle = true;
67 
68  }
69  }
70 
72 }
SG::ConstAccessor< int >
CP::CorrectionCode::OutOfValidityRange
@ OutOfValidityRange
Input object is out of validity range.
Definition: CorrectionCode.h:37
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7