CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
pat::helper::AnyNumberAssociationAdaptor Class Reference

Classes

struct  AssoVec
 

Public Types

typedef edm::View< reco::CandidateCollection
 
typedef float value_type
 

Public Member Functions

 AnyNumberAssociationAdaptor (const edm::InputTag &in, const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
 
const std::string & label ()
 
bool run (const edm::Event &iEvent, const Collection &coll, std::vector< value_type > &ret)
 

Private Types

enum  Type {
  Uninitialized = 0, ValueMapDouble, ValueMapFloat, ValueMapInt,
  ValueMapBool, AssoVecDouble, AssoVecFloat, AssoVecInt,
  Nothing
}
 

Private Member Functions

template<typename T >
bool run_ (const edm::EDGetTokenT< T > &token, const edm::Event &iEvent, const Collection &coll, std::vector< value_type > &ret)
 

Private Attributes

edm::InputTag in_
 
std::string label_
 
edm::EDGetTokenT< AssoVec< double >::typetokenAVd_
 
edm::EDGetTokenT< AssoVec< float >::typetokenAVf_
 
edm::EDGetTokenT< AssoVec< int >::typetokenAVi_
 
edm::EDGetTokenT< edm::ValueMap< bool > > tokenVMb_
 
edm::EDGetTokenT< edm::ValueMap< double > > tokenVMd_
 
edm::EDGetTokenT< edm::ValueMap< float > > tokenVMf_
 
edm::EDGetTokenT< edm::ValueMap< int > > tokenVMi_
 
Type type_
 

Detailed Description

Definition at line 10 of file AnythingToValueMap.cc.

Member Typedef Documentation

Definition at line 13 of file AnythingToValueMap.cc.

Definition at line 12 of file AnythingToValueMap.cc.

Member Enumeration Documentation

Constructor & Destructor Documentation

pat::helper::AnyNumberAssociationAdaptor::AnyNumberAssociationAdaptor ( const edm::InputTag in,
const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 16 of file AnythingToValueMap.cc.

16  :
17  type_(Uninitialized), in_(in), label_(in.label() + in.instance()),
25  { }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< AssoVec< double >::type > tokenAVd_
edm::EDGetTokenT< edm::ValueMap< float > > tokenVMf_
edm::AssociationVector< reco::CandidateBaseRefProd, typename std::vector< T > > type
edm::EDGetTokenT< edm::ValueMap< bool > > tokenVMb_
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< AssoVec< float >::type > tokenAVf_
std::string const & instance() const
Definition: InputTag.h:37
edm::EDGetTokenT< edm::ValueMap< double > > tokenVMd_
edm::EDGetTokenT< AssoVec< int >::type > tokenAVi_
edm::EDGetTokenT< edm::ValueMap< int > > tokenVMi_

Member Function Documentation

const std::string& pat::helper::AnyNumberAssociationAdaptor::label ( )
inline

Definition at line 27 of file AnythingToValueMap.cc.

References label_.

bool pat::helper::AnyNumberAssociationAdaptor::run ( const edm::Event iEvent,
const Collection coll,
std::vector< value_type > &  ret 
)
inline

Definition at line 29 of file AnythingToValueMap.cc.

References AssoVecDouble, AssoVecFloat, AssoVecInt, coll, iEvent, Nothing, run_(), tokenAVd_, tokenAVf_, tokenAVi_, tokenVMb_, tokenVMd_, tokenVMf_, tokenVMi_, type_, Uninitialized, ValueMapBool, ValueMapDouble, ValueMapFloat, and ValueMapInt.

29  {
30  switch (type_) {
31  case Uninitialized:
32  if (run_<edm::ValueMap<double> >(tokenVMd_, iEvent, coll, ret)) { type_ = ValueMapDouble; return true; }
33  if (run_<edm::ValueMap<float> >(tokenVMf_, iEvent, coll, ret)) { type_ = ValueMapFloat; return true; }
34  if (run_<edm::ValueMap<int> >(tokenVMi_, iEvent, coll, ret)) { type_ = ValueMapInt; return true; }
35  if (run_<edm::ValueMap<bool> >(tokenVMb_, iEvent, coll, ret)) { type_ = ValueMapBool; return true; }
36  if (run_<AssoVec<double>::type >(tokenAVd_, iEvent, coll, ret)) { type_ = AssoVecDouble; return true; }
37  if (run_<AssoVec<float>::type >(tokenAVf_, iEvent, coll, ret)) { type_ = AssoVecFloat; return true; }
38  if (run_<AssoVec<int>::type >(tokenAVi_, iEvent, coll, ret)) { type_ = AssoVecInt; return true; }
39  type_ = Nothing; return false;
40  break;
41  case ValueMapDouble : return run_<edm::ValueMap<double> >(tokenVMd_, iEvent, coll, ret);
42  case ValueMapFloat : return run_<edm::ValueMap<float> >(tokenVMf_, iEvent, coll, ret);
43  case ValueMapInt : return run_<edm::ValueMap<int> >(tokenVMi_, iEvent, coll, ret);
44  case ValueMapBool : return run_<edm::ValueMap<bool> >(tokenVMb_, iEvent, coll, ret);
47  case AssoVecInt : return run_<AssoVec<int>::type >(tokenAVi_, iEvent, coll, ret);
48  case Nothing : return false;
49  }
50  return false;
51  }
type
Definition: HCALResponse.h:21
edm::EDGetTokenT< AssoVec< double >::type > tokenAVd_
bool run_(const edm::EDGetTokenT< T > &token, const edm::Event &iEvent, const Collection &coll, std::vector< value_type > &ret)
edm::EDGetTokenT< edm::ValueMap< float > > tokenVMf_
int iEvent
Definition: GenABIO.cc:224
edm::AssociationVector< reco::CandidateBaseRefProd, typename std::vector< T > > type
JetCorrectorParametersCollection coll
Definition: classes.h:10
edm::EDGetTokenT< edm::ValueMap< bool > > tokenVMb_
edm::EDGetTokenT< AssoVec< float >::type > tokenAVf_
edm::EDGetTokenT< edm::ValueMap< double > > tokenVMd_
edm::EDGetTokenT< AssoVec< int >::type > tokenAVi_
edm::EDGetTokenT< edm::ValueMap< int > > tokenVMi_
template<typename T >
bool pat::helper::AnyNumberAssociationAdaptor::run_ ( const edm::EDGetTokenT< T > &  token,
const edm::Event iEvent,
const Collection coll,
std::vector< value_type > &  ret 
)
private

Definition at line 72 of file AnythingToValueMap.cc.

References edm::HandleBase::failedToGet(), edm::Event::getByToken(), cmsBatch::handle, mps_fire::i, gen::n, edm::View< T >::refAt(), and edm::View< T >::size().

Referenced by run().

72  {
74  iEvent.getByToken(token, handle);
75  if (handle.failedToGet()) return false;
76 
77  for (size_t i = 0, n = coll.size(); i < n; ++i) {
78  reco::CandidateBaseRef ref = coll.refAt(i);
79  ret.push_back( (*handle)[ref] );
80  }
81  return true;
82 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
void push_back(key_type i, value_type const &j, label_type const &flav="")
bool failedToGet() const
Definition: HandleBase.h:78
JetCorrectorParametersCollection coll
Definition: classes.h:10

Member Data Documentation

edm::InputTag pat::helper::AnyNumberAssociationAdaptor::in_
private

Definition at line 59 of file AnythingToValueMap.cc.

std::string pat::helper::AnyNumberAssociationAdaptor::label_
private
edm::EDGetTokenT<AssoVec<double>::type > pat::helper::AnyNumberAssociationAdaptor::tokenAVd_
private

Definition at line 65 of file AnythingToValueMap.cc.

Referenced by run().

edm::EDGetTokenT<AssoVec<float>::type > pat::helper::AnyNumberAssociationAdaptor::tokenAVf_
private

Definition at line 66 of file AnythingToValueMap.cc.

Referenced by run().

edm::EDGetTokenT<AssoVec<int>::type > pat::helper::AnyNumberAssociationAdaptor::tokenAVi_
private

Definition at line 67 of file AnythingToValueMap.cc.

Referenced by run().

edm::EDGetTokenT<edm::ValueMap<bool> > pat::helper::AnyNumberAssociationAdaptor::tokenVMb_
private

Definition at line 64 of file AnythingToValueMap.cc.

Referenced by run().

edm::EDGetTokenT<edm::ValueMap<double> > pat::helper::AnyNumberAssociationAdaptor::tokenVMd_
private

Definition at line 61 of file AnythingToValueMap.cc.

Referenced by run().

edm::EDGetTokenT<edm::ValueMap<float> > pat::helper::AnyNumberAssociationAdaptor::tokenVMf_
private

Definition at line 62 of file AnythingToValueMap.cc.

Referenced by run().

edm::EDGetTokenT<edm::ValueMap<int> > pat::helper::AnyNumberAssociationAdaptor::tokenVMi_
private

Definition at line 63 of file AnythingToValueMap.cc.

Referenced by run().

Type pat::helper::AnyNumberAssociationAdaptor::type_
private