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 29 of file LHEProxy.cc.

29  {
30  boost::mutex::scoped_lock scoped_lock(mutex);
31 
33  if (map)
34  map->erase(id);
35 }

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

◆ LHEProxy() [1/2]

LHEProxy::LHEProxy ( ProxyID  id)
private

Definition at line 27 of file LHEProxy.cc.

27 : 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 37 of file LHEProxy.cc.

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

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

◆ find()

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

Definition at line 51 of file LHEProxy.cc.

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

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:27
getProxyMapInstance
static ProxyMap * getProxyMapInstance()
Definition: LHEProxy.cc:13
pos
Definition: PixelAliasList.h:18
lhef::LHEProxy::id
const ProxyID id
Definition: LHEProxy.h:50
lhef::LHEProxy::event
std::shared_ptr< LHEEvent > event
Definition: LHEProxy.h:53
mutex
static boost::mutex mutex
Definition: LHEProxy.cc:9
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:11
lhef::LHEProxy::runInfo
std::shared_ptr< LHERunInfo > runInfo
Definition: LHEProxy.h:52
mps_fire.result
result
Definition: mps_fire.py:303
genParticles_cff.map
map
Definition: genParticles_cff.py:11
event
Definition: event.py:1