CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes | Private Attributes
FWLite.ElectronMVAID Class Reference

Public Member Functions

def __call__
 
def __init__
 

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 
14  def __init__(self, name, tag, categoryCuts, xmls, variablesFile, debug=False):
15  self.name = name
16  self.tag = tag
17  self.categoryCuts = categoryCuts
18  self.variablesFile = variablesFile
19  self.xmls = ROOT.vector(ROOT.string)()
20  for x in xmls: self.xmls.push_back(x)
21  self._init = False
22  self._debug = debug

Member Function Documentation

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, AlignableObjectId::entry.name, average.Average.name, counter.Counter.name, histograms.Histograms.name, cond::persistency::RUN_INFO::RUN_NUMBER.name, cond::persistency::TAG::NAME.name, FWLite.ElectronMVAID.name, TmModule.name, cond::persistency::GTEditorData.name, cond::persistency::GLOBAL_TAG::NAME.name, cond::persistency::RUN_INFO::START_TIME.name, cond::persistency::TAG::TIME_TYPE.name, cond::persistency::GLOBAL_TAG::VALIDITY.name, core.autovars.NTupleVariable.name, cond::persistency::GLOBAL_TAG::DESCRIPTION.name, cond::persistency::RUN_INFO::END_TIME.name, cond::persistency::TAG::OBJECT_TYPE.name, cond::persistency::GLOBAL_TAG::RELEASE.name, cond::persistency::TAG::SYNCHRONIZATION.name, DQMRivetClient::NormOption.name, cond::persistency::GLOBAL_TAG::SNAPSHOT_TIME.name, cond::persistency::TAG::END_OF_VALIDITY.name, MEPSet.name, cond::persistency::GLOBAL_TAG::INSERTION_TIME.name, cond::persistency::O2O_RUN::JOB_NAME.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, ParameterSet.name, cond::persistency::O2O_RUN::LOG.name, nanoaod::MergeableCounterTable::SingleColumn< T >.name, cond::persistency::TAG::PROTECTION_CODE.name, OutputMEPSet.name, preexistingValidation.PreexistingValidation.name, AlignmentConstraint.name, dataset.BaseDataset.name, PixelDCSObject< class >::Item.name, SummaryTableOutputBranches::NamedBranchPtr.name, fit::RootMinuitCommand.name, cms::dd::ValuePair< T, U >.name, personalPlayback.Applet.name, EventStringOutputBranches::NamedBranchPtr.name, Types._Untracked.name, MagCylinder.name, analyzer.Analyzer.name, production_tasks.Task.name, heppy::ParSet.name, DQMRivetClient::LumiOption.name, o2olib.O2OJob.name, cond::persistency::GTProxyData.name, LumiOutputBranches::NamedBranchPtr.name, TableOutputBranches::NamedBranchPtr.name, TriggerOutputBranches::NamedBranchPtr.name, CharmTagger::MVAVar.name, SingleObjectCondition.name, HeavyIonCSVTagger::MVAVar.name, EgHLTOfflineSummaryClient::SumHistBinData.name, edm::PathTimingSummary.name, DQMRivetClient::ScaleFactorOption.name, cms::DDAlgoArguments.name, Barrel.name, perftools::EdmEventSize::BranchRecord.name, core.autovars.NTupleObjectType.name, cond::TimeTypeSpecs.name, edm::PathSummary.name, EcalLogicID.name, alignment.Alignment.name, lumi::TriggerInfo.name, XMLProcessor::_loaderBaseConfig.name, PixelEndcapLinkMaker::Item.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, genericValidation.GenericValidation.name, options.ConnectionHLTMenu.name, cond::persistency::GLOBAL_TAG_MAP::RECORD.name, cms::DDParsingContext::CompositeMaterial.name, cond::persistency::GLOBAL_TAG_MAP::LABEL.name, MVAVar.name, cond::persistency::GLOBAL_TAG_MAP::TAG_NAME.name, cond::Tag_t.name, dqmoffline::l1t::HistDefinition.name, DQMGenericClient::ProfileOption.name, nanoaod::MergeableCounterTable::VectorColumn< T >.name, magneticfield::BaseVolumeHandle.name, FastHFShowerLibrary.name, emtf::Node.name, PhysicsTools::Variable::Value.name, h4DSegm.name, BTagProbabilityToDiscriminator::Discriminator.name, DQMGenericClient::NormOption.name, DQMGenericClient::CDOption.name, CounterChecker.name, TriggerObjectTableProducer::SelectedObject.name, PhysicsTools::Calibration::Variable.name, cond::TagInfo_t.name, TrackerSectorStruct.name, MuonGeometrySanityCheckPoint.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, EDMtoMEConverter.name, cond::persistency::PAYLOAD::STREAMER_INFO.name, python.rootplot.tree2hists.Plot.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, 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, 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, config.Service.name, BulkSilicon.name, APD.name, core.autovars.NTupleCollection.name, nanoaod::FlatTable::Column.name, BPHRecoBuilder::BPHRecoSource.name, NanoAODDQM::SelGroupConfig.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, 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, 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, BeautifulSoup.Tag.name, SummaryOutputProducer::GenericSummary.name, BeautifulSoup.SoupStrainer.name, print(), FWLite.ElectronMVAID.tag, Entry< T >.tag, tnp::TagProbePair.tag, cond::persistency::IOVEditorData.tag, DQMNet::CoreObject.tag, and personalPlayback.FrameworkJob.tag.

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

Member Data Documentation

FWLite.ElectronMVAID._debug
private

Definition at line 21 of file FWLite.py.

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 48 of file FWLite.py.

FWLite.ElectronMVAID.name

Definition at line 14 of file FWLite.py.

Referenced by FWLite.ElectronMVAID.__call__(), dirstructure.Directory.__create_pie_image(), DisplayManager.DisplayManager.__del__(), dqm_interfaces.DirID.__eq__(), dirstructure.Directory.__get_full_path(), dirstructure.Comparison.__get_img_name(), dirstructure.Comparison.__make_image(), dirstructure.Directory.__repr__(), dqm_interfaces.DirID.__repr__(), dirstructure.Comparison.__repr__(), config.CFG.__str__(), FWLite.WorkingPoints._reformat_cut_definitions(), dirstructure.Directory.calcStats(), geometryComparison.GeometryComparison.createScript(), validation.Sample.digest(), DisplayManager.DisplayManager.Draw(), utils.StatisticalTest.get_status(), primaryVertexResolution.PrimaryVertexResolution.getRepMap(), primaryVertexValidation.PrimaryVertexValidation.getRepMap(), zMuMuValidation.ZMuMuValidation.getRepMap(), VIDSelectorBase.VIDSelectorBase.initialize(), and dirstructure.Directory.print_report().

FWLite.ElectronMVAID.tag

Definition at line 15 of file FWLite.py.

Referenced by FWLite.ElectronMVAID.__call__(), Inspector.Inspector.Loop(), DTTtrigWorkflow.DTttrigWorkflow.prepare_timeboxes_correction(), and DTWorkflow.DTWorkflow.remote_out_path().

FWLite.ElectronMVAID.variablesFile

Definition at line 17 of file FWLite.py.

FWLite.ElectronMVAID.xmls

Definition at line 18 of file FWLite.py.