00001
00002
00003 #ifndef __ASGELECTRONCHARGEIDSELECTORTOOL__
00004 #define __ASGELECTRONCHARGEIDSELECTORTOOL__
00005
00006
00007
00008 #include "AsgTools/AsgTool.h"
00009 #include "MVAUtils/BDT.h"
00010 #include "ElectronPhotonSelectorTools/TElectronLikelihoodTool.h"
00011 #include "ElectronPhotonSelectorTools/IAsgElectronLikelihoodTool.h"
00012 #include <unordered_map>
00013
00014
00015 class AsgElectronChargeIDSelectorTool : public asg::AsgTool,
00016 virtual public IAsgElectronLikelihoodTool
00017 {
00018 ASG_TOOL_CLASS2(AsgElectronChargeIDSelectorTool, IAsgElectronLikelihoodTool, IAsgSelectionTool)
00019
00020 public:
00022 AsgElectronChargeIDSelectorTool( const std::string myname);
00023
00024
00026 virtual ~AsgElectronChargeIDSelectorTool();
00027 public:
00029 virtual StatusCode initialize();
00030
00032 virtual StatusCode finalize();
00033
00034
00036 const Root::TAccept& accept( const xAOD::IParticle* part ) const;
00037
00039 const Root::TAccept& accept( const xAOD::Electron* eg ) const {
00040 return accept (eg, -99);
00041 }
00042
00044 const Root::TAccept& accept( const xAOD::Egamma* eg ) const {
00045 return accept (eg, -99);
00046 }
00047
00049 const Root::TAccept& accept( const xAOD::Electron* eg, double mu ) const;
00050
00052 const Root::TAccept& accept( const xAOD::Egamma* eg, double mu ) const;
00053
00055 virtual const Root::TAccept& accept( const xAOD::IParticle& part ) const {
00056 return accept (&part);
00057 }
00058
00060 virtual const Root::TAccept& accept( const xAOD::Electron& part ) const {
00061 return accept (&part, -99);
00062 }
00063
00065 virtual const Root::TAccept& accept( const xAOD::Egamma& part ) const {
00066 return accept (&part, -99);
00067 }
00068
00070 virtual const Root::TAccept& accept( const xAOD::Electron& part, double mu ) const {
00071 return accept (&part, mu);
00072 }
00073
00075 virtual const Root::TAccept& accept( const xAOD::Egamma& part, double mu ) const {
00076 return accept (&part, mu);
00077 }
00078
00079
00080
00082 const Root::TResult& calculate( const xAOD::IParticle* part ) const;
00083
00085 const Root::TResult& calculate( const xAOD::Electron* eg ) const {
00086 return calculate (eg, -99);
00087 }
00088
00090 const Root::TResult& calculate( const xAOD::Egamma* eg ) const {
00091 return calculate (eg, -99);
00092 }
00093
00095 const Root::TResult& calculate( const xAOD::Electron* eg, double mu ) const;
00096
00098 const Root::TResult& calculate( const xAOD::Egamma* eg, double mu ) const;
00099
00101 inline virtual const Root::TAccept& getTAccept( ) const
00102 {
00103
00104 return m_acceptDummy;
00105 }
00106
00107
00109 inline virtual const Root::TResult& getTResult( ) const
00110 {
00111
00112 return m_resultDummy;
00113 }
00114
00116 inline virtual std::string getOperatingPointName( ) const
00117
00118 { return m_WorkingPoint; };
00119
00120
00121 private:
00123 unsigned int getNPrimVertices() const;
00124
00125
00126 const unsigned m_nfold =1;
00127 const unsigned bdt_index=0;
00128 std::vector<MVAUtils::BDT*> m_v_bdts;
00129
00130 TString m_pid_name;
00131 float m_cutOnBDT;
00132
00133 int m_cutPosition_bdt;
00134 int m_resultPosition_bdt;
00135
00137 std::string m_WorkingPoint;
00138
00140 Root::TAccept m_acceptDummy;
00141
00143 Root::TResult m_resultDummy;
00144
00146 mutable Root::TAccept m_acceptBDT;
00147 mutable Root::TResult m_resultBDT;
00148
00150 bool m_usePVCont;
00151
00153 unsigned int m_nPVdefault;
00154
00156 std::string m_primVtxContName;
00157
00159 std::string m_trainingFile;
00160
00162
00163
00164
00165 mutable std::unordered_map<std::string,float> m_map_inputs;
00166 mutable std::vector<std::string> m_inputVars;
00167
00168 bool SetVariableRefs(std::vector<std::string> inputs, std::vector<float*> &inputPointers);
00169
00170 };
00171
00172
00173
00174
00175
00176 #endif
00177