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
JetDeltaRTagInfoValueMapProducer< T, I > Class Template Reference
Inheritance diagram for JetDeltaRTagInfoValueMapProducer< T, I >:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector< TJetsInput
 
typedef std::vector< I > TagInfosCollection
 
- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 JetDeltaRTagInfoValueMapProducer (edm::ParameterSet const &params)
 
virtual ~JetDeltaRTagInfoValueMapProducer ()
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 

Private Attributes

const double distMax_
 
const edm::EDGetTokenT
< typename edm::View< I > > 
matchedTagInfosToken_
 
const edm::EDGetTokenT
< typename edm::View< T > > 
matchedToken_
 
const edm::EDGetTokenT
< typename edm::View< T > > 
srcToken_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 I>
class JetDeltaRTagInfoValueMapProducer< T, I >

Definition at line 37 of file JetDeltaRTagInfoValueMapProducer.cc.

Member Typedef Documentation

template<class T , class I >
typedef std::vector<T> JetDeltaRTagInfoValueMapProducer< T, I >::JetsInput

Definition at line 41 of file JetDeltaRTagInfoValueMapProducer.cc.

template<class T , class I >
typedef std::vector<I> JetDeltaRTagInfoValueMapProducer< T, I >::TagInfosCollection

Definition at line 42 of file JetDeltaRTagInfoValueMapProducer.cc.

Constructor & Destructor Documentation

template<class T , class I >
JetDeltaRTagInfoValueMapProducer< T, I >::JetDeltaRTagInfoValueMapProducer ( edm::ParameterSet const &  params)
inline

Definition at line 44 of file JetDeltaRTagInfoValueMapProducer.cc.

44  :
45  srcToken_( consumes< typename edm::View<T> >( params.getParameter<edm::InputTag>("src") ) ),
46  matchedToken_( consumes< typename edm::View<T> >( params.getParameter<edm::InputTag>( "matched" ) ) ),
47  matchedTagInfosToken_( consumes< typename edm::View<I> >( params.getParameter<edm::InputTag>( "matchedTagInfos" ) ) ),
48  distMax_( params.getParameter<double>( "distMax" ) )
49  {
50  produces< TagInfosCollection >();
51  }
const edm::EDGetTokenT< typename edm::View< T > > srcToken_
const edm::EDGetTokenT< typename edm::View< I > > matchedTagInfosToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< typename edm::View< T > > matchedToken_
template<class T , class I >
virtual JetDeltaRTagInfoValueMapProducer< T, I >::~JetDeltaRTagInfoValueMapProducer ( )
inlinevirtual

Definition at line 53 of file JetDeltaRTagInfoValueMapProducer.cc.

53 {}

Member Function Documentation

template<class T , class I >
virtual void JetDeltaRTagInfoValueMapProducer< T, I >::beginJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 57 of file JetDeltaRTagInfoValueMapProducer.cc.

57 {}
template<class T , class I >
virtual void JetDeltaRTagInfoValueMapProducer< T, I >::endJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 58 of file JetDeltaRTagInfoValueMapProducer.cc.

58 {}
template<class T , class I >
virtual void JetDeltaRTagInfoValueMapProducer< T, I >::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
inlineoverrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 60 of file JetDeltaRTagInfoValueMapProducer.cc.

References reco::deltaR2(), JetDeltaRTagInfoValueMapProducer< T, I >::distMax_, edm::false, edm::Event::getByToken(), Exhume::I, cmsHarvester::index, LogDebug, JetDeltaRTagInfoValueMapProducer< T, I >::matchedTagInfosToken_, JetDeltaRTagInfoValueMapProducer< T, I >::matchedToken_, edm::Event::put(), and JetDeltaRTagInfoValueMapProducer< T, I >::srcToken_.

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

60  {
61 
62  std::auto_ptr< TagInfosCollection > mappedTagInfos ( new TagInfosCollection() );
63 
64 
66  iEvent.getByToken( srcToken_, h_jets1 );
68  iEvent.getByToken( matchedToken_, h_jets2 );
70  iEvent.getByToken( matchedTagInfosToken_, h_tagInfos );
71 
72  const double distMax2 = distMax_*distMax_;
73 
74  std::vector<bool> jets2_locks( h_jets2->size(), false );
75 
76  for ( typename edm::View<T>::const_iterator ibegin = h_jets1->begin(),
77  iend = h_jets1->end(), ijet = ibegin;
78  ijet != iend; ++ijet )
79  {
80  float matched_dR2 = 1e9;
81  int matched_index = -1;
82 
83  //std::cout << "Looking at jet " << ijet - ibegin << ", mass = " << ijet->mass() << std::endl;
84 
85  for ( typename edm::View<T>::const_iterator jbegin = h_jets2->begin(),
86  jend = h_jets2->end(), jjet = jbegin;
87  jjet != jend; ++jjet )
88  {
89  int index=jjet - jbegin;
90 
91  //std::cout << "Checking jet " << index << ", mass = " << jjet->mass() << std::endl;
92 
93  if( jets2_locks.at(index) ) continue; // skip jets that have already been matched
94 
95  float temp_dR2 = reco::deltaR2(ijet->eta(),ijet->phi(),jjet->eta(),jjet->phi());
96  if ( temp_dR2 < matched_dR2 )
97  {
98  matched_dR2 = temp_dR2;
99  matched_index = index;
100  }
101  }// end loop over src jets
102 
103  I mappedTagInfo;
104 
105  if( matched_index>=0 && static_cast<size_t>(matched_index) < h_tagInfos->size() )
106  {
107  if ( matched_dR2 > distMax2 )
108  LogDebug("MatchedJetsFarApart") << "Matched jets separated by dR greater than distMax=" << distMax_;
109  else
110  {
111  jets2_locks.at(matched_index) = true;
112 
113  auto otherTagInfo = h_tagInfos->at( matched_index );
114  otherTagInfo.setJetRef( h_jets1->refAt( ijet - ibegin) );
115  mappedTagInfo = otherTagInfo;
116  //std::cout << "Matched! : " << matched_index << ", mass = " << mappedTagInfo.properties().topMass << std::endl;
117  }
118  }
119 
120  mappedTagInfos->push_back( mappedTagInfo );
121 
122  }// end loop over matched jets
123 
124 
125  // put in Event
126  iEvent.put(mappedTagInfos);
127  }
#define LogDebug(id)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
const edm::EDGetTokenT< typename edm::View< T > > srcToken_
const edm::EDGetTokenT< typename edm::View< I > > matchedTagInfosToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
const std::complex< double > I
Definition: I.h:8
double deltaR2(const T1 &t1, const T2 &t2)
Definition: deltaR.h:36
volatile std::atomic< bool > shutdown_flag false
const edm::EDGetTokenT< typename edm::View< T > > matchedToken_

Member Data Documentation

template<class T , class I >
const double JetDeltaRTagInfoValueMapProducer< T, I >::distMax_
private
template<class T , class I >
const edm::EDGetTokenT< typename edm::View<I> > JetDeltaRTagInfoValueMapProducer< T, I >::matchedTagInfosToken_
private
template<class T , class I >
const edm::EDGetTokenT< typename edm::View<T> > JetDeltaRTagInfoValueMapProducer< T, I >::matchedToken_
private
template<class T , class I >
const edm::EDGetTokenT< typename edm::View<T> > JetDeltaRTagInfoValueMapProducer< T, I >::srcToken_
private