CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
FWLite.ElectronMVAID Class Reference

Public Member Functions

def __call__ (self, ele, rho, debug=False)
 
def __init__ (self, name, tag, categoryCuts, xmls, variablesFile, debug=False)
 

Public Attributes

 categoryCuts
 
 estimator
 
 name
 
 tag
 
 variablesFile
 
 xmls
 

Private Attributes

 _debug
 
 _init
 

Detailed Description

Electron MVA wrapper class.

Definition at line 9 of file FWLite.py.

Constructor & Destructor Documentation

◆ __init__()

def FWLite.ElectronMVAID.__init__ (   self,
  name,
  tag,
  categoryCuts,
  xmls,
  variablesFile,
  debug = False 
)

Definition at line 13 of file FWLite.py.

13  def __init__(self, name, tag, categoryCuts, xmls, variablesFile, debug=False):
14  self.name = name
15  self.tag = tag
16  self.categoryCuts = categoryCuts
17  self.variablesFile = variablesFile
18  self.xmls = ROOT.vector(ROOT.string)()
19  for x in xmls: self.xmls.push_back(x)
20  self._init = False
21  self._debug = debug
22 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})

Member Function Documentation

◆ __call__()

def FWLite.ElectronMVAID.__call__ (   self,
  ele,
  rho,
  debug = False 
)
returns a tuple mva_value, category 
ele: a reco::GsfElectron
convs: conversions
beam_spot: beam spot
rho: energy density in the event
debug: enable debugging mode. 

example: 

    event.getByLabel(('slimmedElectrons'),       ele_handle)
    event.getByLabel(('fixedGridRhoFastjetAll'), rho_handle)
    
    electrons = ele_handle.product()
    rho       = rho_handle.product()

    mva, category = electron_mva_id(electron[0], rho)

Definition at line 23 of file FWLite.py.

References ElectronMVAID.ElectronMVAID._init, FWLite.ElectronMVAID._init, lhef::H5Handler._init, FWLite.ElectronMVAID.categoryCuts, ElectronMVAID.ElectronMVAID.name, HcalOfflineHarvesting.name, HcalOnlineHarvesting.name, HFRaddamTask.name, NoCQTask.name, PedestalTask.name, QIE10Task.name, QIE11Task.name, RecHitTask.name, LaserTask.name, UMNioTask.name, ZDCTask.name, AlignableObjectId::entry.name, RawTask.name, average.Average.name, counter.Counter.name, TPTask.name, histograms.Histograms.name, DigiTask.name, LEDTask.name, cond::persistency::TAG::NAME.name, cond::persistency::RUN_INFO::RUN_NUMBER.name, TmModule.name, cond::persistency::GTEditorData.name, FWLite.ElectronMVAID.name, cond::persistency::GLOBAL_TAG::NAME.name, cond::persistency::TAG::TIME_TYPE.name, cond::persistency::RUN_INFO::START_TIME.name, cond::persistency::GLOBAL_TAG::VALIDITY.name, cond::persistency::RUN_INFO::END_TIME.name, cond::persistency::TAG::OBJECT_TYPE.name, core.autovars.NTupleVariable.name, cond::persistency::GLOBAL_TAG::DESCRIPTION.name, DQMRivetClient::NormOption.name, cond::persistency::TAG::SYNCHRONIZATION.name, cond::persistency::GLOBAL_TAG::RELEASE.name, cond::persistency::TAG::END_OF_VALIDITY.name, MEPSet.name, cond::persistency::GLOBAL_TAG::SNAPSHOT_TIME.name, cond::persistency::O2O_RUN::JOB_NAME.name, cond::persistency::GLOBAL_TAG::INSERTION_TIME.name, cond::persistency::TAG::DESCRIPTION.name, cms::dd::NameValuePair< T >.name, cond::persistency::O2O_RUN::START_TIME.name, cond::persistency::TAG::LAST_VALIDATED_TIME.name, cond::persistency::O2O_RUN::END_TIME.name, cond::persistency::TAG::INSERTION_TIME.name, FWTGeoRecoGeometry::Info.name, cond::persistency::O2O_RUN::STATUS_CODE.name, cond::persistency::TAG::MODIFICATION_TIME.name, cond::persistency::O2O_RUN::LOG.name, ParameterSet.name, nanoaod::MergeableCounterTable::SingleColumn< T >.name, cond::persistency::TAG::PROTECTION_CODE.name, OutputMEPSet.name, AlignmentConstraint.name, PixelDCSObject< T >::Item.name, dataset.BaseDataset.name, SummaryTableOutputBranches::NamedBranchPtr.name, cms::dd::ValuePair< T, U >.name, fit::RootMinuitCommand.name, personalPlayback.Applet.name, Types._Untracked.name, EventStringOutputBranches::NamedBranchPtr.name, MagCylinder.name, analyzer.Analyzer.name, production_tasks.Task.name, DQMRivetClient::LumiOption.name, heppy::ParSet.name, cond::persistency::GTProxyData.name, TriggerOutputBranches::NamedBranchPtr.name, CharmTagger::MVAVar.name, SingleObjectCondition.name, edm::PathTimingSummary.name, DQMRivetClient::ScaleFactorOption.name, TableOutputBranches::NamedBranchPtr.name, HeavyIonCSVTagger::MVAVar.name, cms::DDAlgoArguments.name, EgHLTOfflineSummaryClient::SumHistBinData.name, Barrel.name, cond::TimeTypeSpecs.name, perftools::EdmEventSize::BranchRecord.name, core.autovars.NTupleObjectType.name, EcalLogicID.name, LumiOutputBranches::NamedBranchPtr.name, edm::PathSummary.name, lumi::TriggerInfo.name, PixelEndcapLinkMaker::Item.name, XMLProcessor::_loaderBaseConfig.name, MEtoEDM< T >::MEtoEDMObject.name, FWTableViewManager::TableEntry.name, PixelBarrelLinkMaker::Item.name, ExpressionHisto< T >.name, DQMGenericClient::EfficOption.name, python.rootplot.utilities.Hist2D.name, TreeCrawler.Package.name, Supermodule.name, cond::persistency::GLOBAL_TAG_MAP::GLOBAL_TAG_NAME.name, cond::persistency::GLOBAL_TAG_MAP::RECORD.name, options.ConnectionHLTMenu.name, cond::persistency::GLOBAL_TAG_MAP::LABEL.name, cms::DDParsingContext::CompositeMaterial.name, MVAVar.name, cond::persistency::GLOBAL_TAG_MAP::TAG_NAME.name, cond::Tag_t.name, dqmoffline::l1t::HistDefinition.name, DQMGenericClient::ProfileOption.name, magneticfield::BaseVolumeHandle.name, nanoaod::MergeableCounterTable::VectorColumn< T >.name, FastHFShowerLibrary.name, emtf::Node.name, PhysicsTools::Variable::Value.name, h4DSegm.name, BTagProbabilityToDiscriminator::Discriminator.name, DQMGenericClient::NormOption.name, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.name, DQMGenericClient::CDOption.name, CounterChecker.name, cond::TagInfo_t.name, TrackerSectorStruct.name, MuonGeometrySanityCheckPoint.name, EDMtoMEConverter.name, PhysicsTools::Calibration::Variable.name, FCDTask.name, cond::persistency::PAYLOAD::HASH.name, DQMGenericClient::NoFlowOption.name, looper.Looper.name, Mapper::definition< ScannerT >.name, cond::persistency::PAYLOAD::OBJECT_TYPE.name, cond::persistency::PAYLOAD::DATA.name, python.rootplot.tree2hists.Plot.name, cond::persistency::PAYLOAD::STREAMER_INFO.name, cond::persistency::PAYLOAD::VERSION.name, cond::persistency::PAYLOAD::INSERTION_TIME.name, PhysicsTools::TreeReader::Value.name, classes.MonitorData.name, PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >.name, HistogramManager.name, classes.OutputData.name, BPHDecayToResResBuilderBase::DZSelect.name, Crystal.name, h2DSegm.name, options.HLTProcessOptions.name, cond::persistency::IOV::TAG_NAME.name, cond::persistency::IOV::SINCE.name, cond::persistency::IOV::PAYLOAD_HASH.name, cond::persistency::IOV::INSERTION_TIME.name, DQMNet::WaitObject.name, core.TriggerBitAnalyzer.TriggerBitAnalyzer.name, python.rootplot.utilities.Hist.name, AlpgenParameterName.name, config.Analyzer.name, geometry.Structure.name, core.autovars.NTupleSubObject.name, Capsule.name, core.autovars.NTupleObject.name, Ceramic.name, PhysicsTools::Variable.name, SiStripMonitorDigi.name, BulkSilicon.name, config.Service.name, APD.name, core.autovars.NTupleCollection.name, BPHRecoBuilder::BPHRecoSource.name, nanoaod::FlatTable::Column.name, BPHRecoBuilder::BPHCompSource.name, StraightTrackAlignment::RPSetPlots.name, cond::persistency::TAG_AUTHORIZATION::TAG_NAME.name, cond::persistency::TAG_AUTHORIZATION::ACCESS_TYPE.name, cond::persistency::TAG_AUTHORIZATION::CREDENTIAL.name, cond::persistency::TAG_AUTHORIZATION::CREDENTIAL_TYPE.name, InnerLayerVolume.name, NanoAODDQM::SelGroupConfig.name, cond::payloadInspector::TagReference.name, cond::persistency::TAG_LOG::TAG_NAME.name, cond::persistency::TAG_LOG::EVENT_TIME.name, cond::persistency::TAG_LOG::USER_NAME.name, cond::persistency::TAG_LOG::HOST_NAME.name, cond::persistency::TAG_LOG::COMMAND.name, cond::persistency::TAG_LOG::ACTION.name, cond::persistency::TAG_LOG::USER_TEXT.name, personalPlayback.FrameworkJob.name, Grid.name, trklet::TrackletConfigBuilder::DTCinfo.name, Grille.name, BackPipe.name, plotscripts.SawTeethFunction.name, PatchPanel.name, BackCoolTank.name, DryAirTube.name, python.rootplot.utilities.RootFile.name, crabFunctions.CrabTask.name, MBCoolTube.name, MBManif.name, cscdqm::ParHistoDef.name, hTMaxCell.name, SummaryOutputProducer::GenericSummary.name, print(), FWLite.ElectronMVAID.tag, tnp::TagProbePair.tag, Entry< T >.tag, cond::persistency::IOVEditorData.tag, DQMNet::CoreObject.tag, and personalPlayback.FrameworkJob.tag.

23  def __call__(self, ele, rho, debug=False):
24  '''returns a tuple mva_value, category
25  ele: a reco::GsfElectron
26  convs: conversions
27  beam_spot: beam spot
28  rho: energy density in the event
29  debug: enable debugging mode.
30 
31  example:
32 
33  event.getByLabel(('slimmedElectrons'), ele_handle)
34  event.getByLabel(('fixedGridRhoFastjetAll'), rho_handle)
35 
36  electrons = ele_handle.product()
37  rho = rho_handle.product()
38 
39  mva, category = electron_mva_id(electron[0], rho)
40  '''
41  if not self._init:
42  print('Initializing ' + self.name + self.tag)
43  ROOT.gInterpreter.Declare('#include "RecoEgamma/ElectronIdentification/interface/ElectronMVAEstimatorRun2.h"')
44  ROOT.gSystem.Load("libRecoEgammaElectronIdentification")
45  categoryCutStrings = ROOT.vector(ROOT.string)()
46  for x in self.categoryCuts :
47  categoryCutStrings.push_back(x)
48  self.estimator = ROOT.ElectronMVAEstimatorRun2(
49  self.tag, self.name, len(self.xmls),
50  self.variablesFile, categoryCutStrings, self.xmls, self._debug)
51  self._init = True
52  category = ctypes.c_int(0)
53  mva = self.estimator.mvaValue(ele, rho[0], category)
54  return mva, category.value
55 
56 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

Member Data Documentation

◆ _debug

FWLite.ElectronMVAID._debug
private

Definition at line 21 of file FWLite.py.

◆ _init

FWLite.ElectronMVAID._init
private

Definition at line 20 of file FWLite.py.

Referenced by FWLite.ElectronMVAID.__call__().

◆ categoryCuts

FWLite.ElectronMVAID.categoryCuts

Definition at line 16 of file FWLite.py.

Referenced by FWLite.ElectronMVAID.__call__().

◆ estimator

FWLite.ElectronMVAID.estimator

Definition at line 48 of file FWLite.py.

◆ name

FWLite.ElectronMVAID.name

◆ tag

FWLite.ElectronMVAID.tag

◆ variablesFile

FWLite.ElectronMVAID.variablesFile

Definition at line 17 of file FWLite.py.

◆ xmls

FWLite.ElectronMVAID.xmls

Definition at line 18 of file FWLite.py.