CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
JetDeltaRValueMapProducer< T > Class Template Reference
Inheritance diagram for JetDeltaRValueMapProducer< T >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector< TJetsInput
 
typedef edm::ValueMap< float > JetValueMap
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

 JetDeltaRValueMapProducer (edm::ParameterSet const &params)
 
virtual ~JetDeltaRValueMapProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginJob () override
 
virtual void endJob () override
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 

Private Attributes

double distMax_
 
StringObjectFunction< Tevaluation_
 
edm::EDGetTokenT< typename
edm::View< T > > 
matchedToken_
 
edm::EDGetTokenT< typename
edm::View< T > > 
srcToken_
 
std::string value_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

template<class T>
class JetDeltaRValueMapProducer< T >

Definition at line 32 of file JetDeltaRValueMapProducer.cc.

Member Typedef Documentation

template<class T >
typedef std::vector<T> JetDeltaRValueMapProducer< T >::JetsInput

Definition at line 36 of file JetDeltaRValueMapProducer.cc.

template<class T >
typedef edm::ValueMap<float> JetDeltaRValueMapProducer< T >::JetValueMap

Definition at line 37 of file JetDeltaRValueMapProducer.cc.

Constructor & Destructor Documentation

template<class T >
JetDeltaRValueMapProducer< T >::JetDeltaRValueMapProducer ( edm::ParameterSet const &  params)
inline

Definition at line 39 of file JetDeltaRValueMapProducer.cc.

39  :
40  srcToken_( consumes< typename edm::View<T> >( params.getParameter<edm::InputTag>("src") ) ),
41  matchedToken_( consumes< typename edm::View<T> >( params.getParameter<edm::InputTag>( "matched" ) ) ),
42  distMax_( params.getParameter<double>( "distMax" ) ),
43  value_( params.getParameter<std::string>("value") ),
45  {
46  produces< JetValueMap >();
47  }
StringObjectFunction< T > evaluation_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< typename edm::View< T > > matchedToken_
edm::EDGetTokenT< typename edm::View< T > > srcToken_
template<class T >
virtual JetDeltaRValueMapProducer< T >::~JetDeltaRValueMapProducer ( )
inlinevirtual

Definition at line 49 of file JetDeltaRValueMapProducer.cc.

49 {}

Member Function Documentation

template<class T >
virtual void JetDeltaRValueMapProducer< T >::beginJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 53 of file JetDeltaRValueMapProducer.cc.

53 {}
template<class T >
virtual void JetDeltaRValueMapProducer< T >::endJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 54 of file JetDeltaRValueMapProducer.cc.

54 {}
template<class T >
virtual void JetDeltaRValueMapProducer< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
inlineoverrideprivatevirtual

Implements edm::EDProducer.

Definition at line 56 of file JetDeltaRValueMapProducer.cc.

References reco::deltaR2(), JetDeltaRValueMapProducer< T >::distMax_, JetDeltaRValueMapProducer< T >::evaluation_, edm::false, edm::helper::Filler< Map >::fill(), edm::Event::getByToken(), cmsHarvester::index, edm::helper::Filler< Map >::insert(), JetDeltaRValueMapProducer< T >::matchedToken_, edm::Event::put(), JetDeltaRValueMapProducer< T >::srcToken_, and makeHLTPrescaleTable::values.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

56  {
57 
58  std::auto_ptr< JetValueMap > jetValueMap ( new JetValueMap() );
59  edm::ValueMap<float>::Filler filler(*jetValueMap);
60 
61 
63  iEvent.getByToken( srcToken_, h_jets1 );
65  iEvent.getByToken( matchedToken_, h_jets2 );
66 
67  std::vector<float> values( h_jets1->size(), -99999 );
68  std::vector<bool> jets1_locks( h_jets1->size(), false );
69 
70  for ( typename edm::View<T>::const_iterator ibegin = h_jets2->begin(),
71  iend = h_jets2->end(), ijet = ibegin;
72  ijet != iend; ++ijet )
73  {
74  float matched_dR2 = 1e9;
75  int matched_index = -1;
76 
77  for ( typename edm::View<T>::const_iterator jbegin = h_jets1->begin(),
78  jend = h_jets1->end(), jjet = jbegin;
79  jjet != jend; ++jjet )
80  {
81  int index=jjet - jbegin;
82 
83  if( jets1_locks.at(index) ) continue; // skip jets that have already been matched
84 
85  float temp_dR2 = reco::deltaR2(ijet->eta(),ijet->phi(),jjet->eta(),jjet->phi());
86  if ( temp_dR2 < matched_dR2 )
87  {
88  matched_dR2 = temp_dR2;
89  matched_index = index;
90  }
91  }// end loop over src jets
92 
93  if( matched_index>=0 )
94  {
95  if ( matched_dR2 > distMax_*distMax_ )
96  edm::LogWarning("MatchedJetsFarApart") << "Matched jets separated by dR greater than distMax=" << distMax_;
97  else
98  {
99  jets1_locks.at(matched_index) = true;
100  values.at(matched_index) = evaluation_(*ijet);
101  }
102  }
103  }// end loop over matched jets
104 
105  filler.insert(h_jets1, values.begin(), values.end());
106  filler.fill();
107 
108  // put in Event
109  iEvent.put(jetValueMap);
110  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
StringObjectFunction< T > evaluation_
edm::ValueMap< float > JetValueMap
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:58
edm::EDGetTokenT< typename edm::View< T > > matchedToken_
edm::EDGetTokenT< typename edm::View< T > > srcToken_
volatile std::atomic< bool > shutdown_flag false

Member Data Documentation

template<class T >
double JetDeltaRValueMapProducer< T >::distMax_
private
template<class T >
StringObjectFunction<T> JetDeltaRValueMapProducer< T >::evaluation_
private
template<class T >
edm::EDGetTokenT< typename edm::View<T> > JetDeltaRValueMapProducer< T >::matchedToken_
private
template<class T >
edm::EDGetTokenT< typename edm::View<T> > JetDeltaRValueMapProducer< T >::srcToken_
private
template<class T >
std::string JetDeltaRValueMapProducer< T >::value_
private

Definition at line 115 of file JetDeltaRValueMapProducer.cc.