CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
lhef::LHEProxy Class Reference

#include <LHEProxy.h>

Public Types

typedef unsigned long ProxyID
 

Public Member Functions

void clearEvent ()
 
void clearRunInfo ()
 
const std::shared_ptr< LHEEvent > & getEvent () const
 
ProxyID getID () const
 
const std::shared_ptr< LHERunInfo > & getRunInfo () const
 
void loadEvent (const std::shared_ptr< LHEEvent > &event)
 
void loadRunInfo (const std::shared_ptr< LHERunInfo > &runInfo)
 
std::shared_ptr< LHEEventreleaseEvent ()
 
std::shared_ptr< LHERunInforeleaseRunInfo ()
 
 ~LHEProxy ()
 

Static Public Member Functions

static std::shared_ptr< LHEProxycreate ()
 
static std::shared_ptr< LHEProxyfind (ProxyID id)
 

Private Member Functions

 LHEProxy (const LHEProxy &orig)=delete
 
 LHEProxy (ProxyID id)
 
LHEProxyoperator= (const LHEProxy &orig)=delete
 

Private Attributes

std::shared_ptr< LHEEventevent
 
const ProxyID id
 
std::shared_ptr< LHERunInforunInfo
 

Detailed Description

Definition at line 12 of file LHEProxy.h.

Member Typedef Documentation

◆ ProxyID

typedef unsigned long lhef::LHEProxy::ProxyID

Definition at line 14 of file LHEProxy.h.

Constructor & Destructor Documentation

◆ ~LHEProxy()

LHEProxy::~LHEProxy ( )

Definition at line 28 of file LHEProxy.cc.

28  {
29  std::scoped_lock scoped_lock(mutex);
30 
32  if (map)
33  map->erase(id);
34 }

References getProxyMapInstance(), genParticles_cff::map, and mutex.

◆ LHEProxy() [1/2]

LHEProxy::LHEProxy ( ProxyID  id)
private

Definition at line 26 of file LHEProxy.cc.

26 : id(id) {}

Referenced by create().

◆ LHEProxy() [2/2]

lhef::LHEProxy::LHEProxy ( const LHEProxy orig)
privatedelete

Member Function Documentation

◆ clearEvent()

void lhef::LHEProxy::clearEvent ( )
inline

Definition at line 33 of file LHEProxy.h.

33 { event.reset(); }

◆ clearRunInfo()

void lhef::LHEProxy::clearRunInfo ( )
inline

Definition at line 32 of file LHEProxy.h.

32 { runInfo.reset(); }

References runInfo.

◆ create()

std::shared_ptr< LHEProxy > LHEProxy::create ( )
static

Definition at line 36 of file LHEProxy.cc.

36  {
37  static LHEProxy::ProxyID nextProxyID = 0;
38 
39  std::scoped_lock scoped_lock(mutex);
40 
41  std::shared_ptr<LHEProxy> proxy(new LHEProxy(++nextProxyID));
42 
44  if (map)
45  map->insert(ProxyMap::value_type(proxy->getID(), proxy));
46 
47  return proxy;
48 }

References getProxyMapInstance(), LHEProxy(), genParticles_cff::map, and mutex.

◆ find()

std::shared_ptr< LHEProxy > LHEProxy::find ( ProxyID  id)
static

Definition at line 50 of file LHEProxy.cc.

50  {
51  std::scoped_lock scoped_lock(mutex);
52 
54  if (!map)
55  return std::shared_ptr<LHEProxy>();
56 
57  ProxyMap::const_iterator pos = map->find(id);
58  if (pos == map->end())
59  return std::shared_ptr<LHEProxy>();
60 
61  return std::shared_ptr<LHEProxy>(pos->second);
62 }

References getProxyMapInstance(), genParticles_cff::map, and mutex.

◆ getEvent()

const std::shared_ptr<LHEEvent>& lhef::LHEProxy::getEvent ( ) const
inline

Definition at line 19 of file LHEProxy.h.

19 { return event; }

References event.

◆ getID()

ProxyID lhef::LHEProxy::getID ( ) const
inline

Definition at line 38 of file LHEProxy.h.

38 { return id; }

References id.

◆ getRunInfo()

const std::shared_ptr<LHERunInfo>& lhef::LHEProxy::getRunInfo ( ) const
inline

Definition at line 18 of file LHEProxy.h.

18 { return runInfo; }

References runInfo.

◆ loadEvent()

void lhef::LHEProxy::loadEvent ( const std::shared_ptr< LHEEvent > &  event)
inline

Definition at line 36 of file LHEProxy.h.

36 { this->event = event; }

References event.

◆ loadRunInfo()

void lhef::LHEProxy::loadRunInfo ( const std::shared_ptr< LHERunInfo > &  runInfo)
inline

Definition at line 35 of file LHEProxy.h.

35 { this->runInfo = runInfo; }

References runInfo.

◆ operator=()

LHEProxy& lhef::LHEProxy::operator= ( const LHEProxy orig)
privatedelete

◆ releaseEvent()

std::shared_ptr<LHEEvent> lhef::LHEProxy::releaseEvent ( )
inline

Definition at line 26 of file LHEProxy.h.

26  {
27  std::shared_ptr<LHEEvent> result(event);
28  event.reset();
29  return result;
30  }

References mps_fire::result.

◆ releaseRunInfo()

std::shared_ptr<LHERunInfo> lhef::LHEProxy::releaseRunInfo ( )
inline

Definition at line 21 of file LHEProxy.h.

21  {
22  std::shared_ptr<LHERunInfo> result(runInfo);
23  runInfo.reset();
24  return result;
25  }

References mps_fire::result, and runInfo.

Member Data Documentation

◆ event

std::shared_ptr<LHEEvent> lhef::LHEProxy::event
private

◆ id

const ProxyID lhef::LHEProxy::id
private

Definition at line 50 of file LHEProxy.h.

Referenced by getID().

◆ runInfo

std::shared_ptr<LHERunInfo> lhef::LHEProxy::runInfo
private

Definition at line 52 of file LHEProxy.h.

Referenced by clearRunInfo(), getRunInfo(), loadRunInfo(), and releaseRunInfo().

lhef::LHEProxy::LHEProxy
LHEProxy(ProxyID id)
Definition: LHEProxy.cc:26
getProxyMapInstance
static ProxyMap * getProxyMapInstance()
Definition: LHEProxy.cc:12
pos
Definition: PixelAliasList.h:18
mutex
static std::mutex mutex
Definition: LHEProxy.cc:8
lhef::LHEProxy::id
const ProxyID id
Definition: LHEProxy.h:50
lhef::LHEProxy::event
std::shared_ptr< LHEEvent > event
Definition: LHEProxy.h:53
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
lhef::LHEProxy::ProxyID
unsigned long ProxyID
Definition: LHEProxy.h:14
ProxyMap
std::map< ProxyBase::ProxyID, std::weak_ptr< ProxyBase > > ProxyMap
Definition: Proxy.cc:10
lhef::LHEProxy::runInfo
std::shared_ptr< LHERunInfo > runInfo
Definition: LHEProxy.h:52
mps_fire.result
result
Definition: mps_fire.py:311
genParticles_cff.map
map
Definition: genParticles_cff.py:11
event
Definition: event.py:1