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, convs, beam_spot, 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

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, name, tag, categoryCuts, xmls, variablesFile, debug=False)
Definition: FWLite.py:13

Member Function Documentation

def FWLite.ElectronMVAID.__call__ (   self,
  ele,
  convs,
  beam_spot,
  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)
    event.getByLabel(('reducedEgamma:reducedConversions'), conv_handle)
    event.getByLabel(('offlineBeamSpot'),                  bs_handle)
    
    electrons = ele_handle.product()
    convs     = conv_handle.product()
    beam_spot = bs_handle.product()
    rho       = rho_handle.product()

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

Definition at line 23 of file FWLite.py.

References ElectronMVAID.ElectronMVAID._init, FWLite.ElectronMVAID._init, FWLite.ElectronMVAID.categoryCuts, ElectronMVAID.ElectronMVAID.name, average.Average.name, counter.Counter.name, histograms.Histograms.name, AlignableObjectId::entry.name, FWLite.ElectronMVAID.name, cond::persistency::TAG::NAME.name, TmModule.name, cond::persistency::GLOBAL_TAG::NAME.name, cond::persistency::RUN_INFO::RUN_NUMBER.name, cond::persistency::RUN_INFO::START_TIME.name, cond::persistency::TAG::TIME_TYPE.name, core.autovars.NTupleVariable.name, cond::persistency::GLOBAL_TAG::VALIDITY.name, cond::persistency::RUN_INFO::END_TIME.name, cond::persistency::TAG::OBJECT_TYPE.name, cond::persistency::GLOBAL_TAG::DESCRIPTION.name, cond::persistency::TAG::SYNCHRONIZATION.name, cond::persistency::GLOBAL_TAG::RELEASE.name, MEPSet.name, cond::persistency::TAG::END_OF_VALIDITY.name, cond::persistency::GLOBAL_TAG::SNAPSHOT_TIME.name, cond::persistency::GLOBAL_TAG::INSERTION_TIME.name, cond::persistency::TAG::DESCRIPTION.name, cond::persistency::GTEditorData.name, nanoaod::MergeableCounterTable::SingleColumn< T >.name, cond::persistency::TAG::LAST_VALIDATED_TIME.name, cond::persistency::TAG::INSERTION_TIME.name, cond::persistency::TAG::MODIFICATION_TIME.name, FWTGeoRecoGeometry::Info.name, preexistingValidation.PreexistingValidation.name, OutputMEPSet.name, EventStringOutputBranches::NamedBranchPtr.name, SummaryTableOutputBranches::NamedBranchPtr.name, dataset.BaseDataset.name, fit::RootMinuitCommand.name, personalPlayback.Applet.name, Types._Untracked.name, ParameterSet.name, PixelDCSObject< T >::Item.name, DQMRivetClient::LumiOption.name, MagCylinder.name, analyzer.Analyzer.name, production_tasks.Task.name, CharmTagger::MVAVar.name, TriggerOutputBranches::NamedBranchPtr.name, ParSet.name, TableOutputBranches::NamedBranchPtr.name, edm::PathTimingSummary.name, DQMRivetClient::ScaleFactorOption.name, EgHLTOfflineSummaryClient::SumHistBinData.name, PhysicsTools::Source.name, SingleObjectCondition.name, cond::persistency::GTProxyData.name, MyWatcher.name, core.autovars.NTupleObjectType.name, edm::PathSummary.name, nanoaod::MergeableCounterTable::VectorColumn< T >.name, cond::TimeTypeSpecs.name, lumi::TriggerInfo.name, alignment.Alignment.name, cond::persistency::GLOBAL_TAG_MAP::GLOBAL_TAG_NAME.name, PixelEndcapLinkMaker::Item.name, perftools::EdmEventSize::BranchRecord.name, DQMGenericClient::EfficOption.name, FWTableViewManager::TableEntry.name, cond::persistency::GLOBAL_TAG_MAP::RECORD.name, PixelBarrelLinkMaker::Item.name, EcalLogicID.name, cond::persistency::GLOBAL_TAG_MAP::LABEL.name, MEtoEDM< T >::MEtoEDMObject.name, cond::persistency::GLOBAL_TAG_MAP::TAG_NAME.name, cms::DDAlgoArguments.name, ExpressionHisto< T >.name, validateAlignments.ParallelMergeJob.name, XMLProcessor::_loaderBaseConfig.name, cond::persistency::PAYLOAD::HASH.name, python.rootplot.utilities.Hist2D.name, cond::persistency::PAYLOAD::OBJECT_TYPE.name, cond::persistency::PAYLOAD::DATA.name, cond::persistency::PAYLOAD::STREAMER_INFO.name, TreeCrawler.Package.name, genericValidation.GenericValidation.name, cond::persistency::PAYLOAD::VERSION.name, options.ConnectionHLTMenu.name, MagGeoBuilderFromDDD::volumeHandle.name, cond::persistency::PAYLOAD::INSERTION_TIME.name, MVAVar.name, DQMGenericClient::ProfileOption.name, dqmoffline::l1t::HistDefinition.name, DQMGenericClient::NormOption.name, BTagProbabilityToDiscriminator::Discriminator.name, emtf::Node.name, h4DSegm.name, FastHFShowerLibrary.name, PhysicsTools::Calibration::Variable.name, PhysicsTools::Variable::Value.name, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.name, DQMGenericClient::CDOption.name, TriggerObjectTableProducer::SelectedObject.name, CounterChecker.name, cond::TagInfo_t.name, TrackerSectorStruct.name, ProcTMVA::Method.name, TreeSaver::Var.name, DQMGenericClient::NoFlowOption.name, looper.Looper.name, python.rootplot.tree2hists.Plot.name, cond::persistency::IOV::TAG_NAME.name, EDMtoMEConverter.name, cond::persistency::IOV::SINCE.name, Mapper::definition< ScannerT >.name, cond::persistency::IOV::PAYLOAD_HASH.name, classes.MonitorData.name, PhysicsTools::TreeReader::Value.name, cond::persistency::IOV::INSERTION_TIME.name, HistogramManager.name, MuonGeometrySanityCheckPoint.name, PhysicsTools::TrainProcessor.name, classes.OutputData.name, PhysicsTools::MVAModuleHelper< Record, Object, Filler >::Value.name, PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >.name, PhysicsTools::MVATrainer.name, options.HLTProcessOptions.name, h2DSegm.name, core.TriggerBitAnalyzer.TriggerBitAnalyzer.name, python.rootplot.utilities.Hist.name, nanoaod::FlatTable::Column.name, geometry.Structure.name, config.Analyzer.name, core.autovars.NTupleSubObject.name, DQMNet::WaitObject.name, AlpgenParameterName.name, NanoAODDQM::SelGroupConfig.name, SiStripMonitorDigi.name, core.autovars.NTupleObject.name, config.Service.name, PhysicsTools::Variable.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, PhysicsTools::TrainerMonitoring::Object.name, cond::persistency::TAG_LOG::USER_TEXT.name, core.autovars.NTupleCollection.name, BPHRecoBuilder::BPHRecoSource.name, BPHRecoBuilder::BPHCompSource.name, personalPlayback.FrameworkJob.name, plotscripts.SawTeethFunction.name, python.rootplot.utilities.RootFile.name, crabFunctions.CrabTask.name, hTMaxCell.name, cscdqm::ParHistoDef.name, BeautifulSoup.Tag.name, Id.name, SummaryOutputProducer::GenericSummary.name, BeautifulSoup.SoupStrainer.name, edm.print(), FWLite.ElectronMVAID.tag, tnp::TagProbePair.tag, cond::persistency::IOVProxyData.tag, cond::persistency::IOVEditorData.tag, Entry< T >.tag, cond::Tag_t.tag, DQMNet::CoreObject.tag, and personalPlayback.FrameworkJob.tag.

23  def __call__(self, ele, convs, beam_spot, 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  event.getByLabel(('reducedEgamma:reducedConversions'), conv_handle)
36  event.getByLabel(('offlineBeamSpot'), bs_handle)
37 
38  electrons = ele_handle.product()
39  convs = conv_handle.product()
40  beam_spot = bs_handle.product()
41  rho = rho_handle.product()
42 
43  mva, category = electron_mva_id(electron[0], convs, beam_spot, rho)
44  '''
45  if not self._init:
46  print('Initializing ' + self.name + self.tag)
47  ROOT.gSystem.Load("libRecoEgammaElectronIdentification")
48  categoryCutStrings = ROOT.vector(ROOT.string)()
49  for x in self.categoryCuts :
50  categoryCutStrings.push_back(x)
51  self.estimator = ROOT.ElectronMVAEstimatorRun2(
52  self.tag, self.name, len(self.xmls),
53  self.variablesFile, categoryCutStrings, self.xmls, self._debug)
54  self._init = True
55  extra_vars = self.estimator.getExtraVars(ele, convs, beam_spot, rho[0])
56  category = ctypes.c_int(0)
57  mva = self.estimator.mvaValue(ele, extra_vars, category)
58  return mva, category.value
59 
60 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def __call__(self, ele, convs, beam_spot, rho, debug=False)
Definition: FWLite.py:23

Member Data Documentation

FWLite.ElectronMVAID._debug
private
FWLite.ElectronMVAID._init
private

Definition at line 20 of file FWLite.py.

Referenced by FWLite.ElectronMVAID.__call__().

FWLite.ElectronMVAID.categoryCuts

Definition at line 16 of file FWLite.py.

Referenced by FWLite.ElectronMVAID.__call__().

FWLite.ElectronMVAID.estimator

Definition at line 51 of file FWLite.py.

FWLite.ElectronMVAID.name
FWLite.ElectronMVAID.tag
FWLite.ElectronMVAID.variablesFile

Definition at line 17 of file FWLite.py.

FWLite.ElectronMVAID.xmls

Definition at line 18 of file FWLite.py.