CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DiJetVarProducer Class Reference

#include <DiJetVarProducer.h>

Inheritance diagram for DiJetVarProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DiJetVarProducer (const edm::ParameterSet &)
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::InputTag inputJetTag_
 
edm::EDGetTokenT< reco::CaloJetCollectioninputJetTagToken_
 
double wideJetDeltaR_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 19 of file DiJetVarProducer.h.

Constructor & Destructor Documentation

◆ DiJetVarProducer()

DiJetVarProducer::DiJetVarProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 24 of file DiJetVarProducer.cc.

References edm::InputTag::encode(), edm::ParameterSet::getParameter(), inputJetTag_, inputJetTagToken_, LogDebug, and wideJetDeltaR_.

25  : inputJetTag_(iConfig.getParameter<edm::InputTag>("inputJetTag")),
26  wideJetDeltaR_(iConfig.getParameter<double>("wideJetDeltaR")) {
27  // register your products
28  // produces<std::vector<double> >("dijetvariables");
29  produces<std::vector<math::PtEtaPhiMLorentzVector>>("widejets");
30 
31  // set Token(-s)
32  inputJetTagToken_ = consumes<reco::CaloJetCollection>(iConfig.getParameter<edm::InputTag>("inputJetTag"));
33 
34  LogDebug("") << "Input Jet Tag: " << inputJetTag_.encode() << " ";
35  LogDebug("") << "Radius Parameter Wide Jet: " << wideJetDeltaR_ << ".";
36 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::string encode() const
Definition: InputTag.cc:159
edm::EDGetTokenT< reco::CaloJetCollection > inputJetTagToken_
edm::InputTag inputJetTag_
#define LogDebug(id)

Member Function Documentation

◆ produce()

void DiJetVarProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 39 of file DiJetVarProducer.cc.

References iEvent, inputJetTagToken_, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, eostools::move(), and wideJetDeltaR_.

39  {
40  using namespace std;
41  using namespace edm;
42  using namespace reco;
43 
44  // ## The output collections
45  // std::unique_ptr<std::vector<double> > dijetvariables(new
46  // std::vector<double>);
47  std::unique_ptr<std::vector<math::PtEtaPhiMLorentzVector>> widejets(new std::vector<math::PtEtaPhiMLorentzVector>);
48 
49  // ## Get jet collection
51  iEvent.getByToken(inputJetTagToken_, calojets_handle);
52  // cout << "size: " << calojets_handle->size() << endl;
53 
54  // ## Wide Jet Algorithm
55  // At least two jets
56  if (calojets_handle->size() >= 2) {
57  TLorentzVector wj1_tmp;
58  TLorentzVector wj2_tmp;
59  TLorentzVector wj1;
60  TLorentzVector wj2;
61  TLorentzVector wdijet;
62 
63  // // Loop over all the input jets
64  // for(reco::CaloJetCollection::const_iterator it =
65  // calojets_handle->begin(); it != calojets_handle->end(); ++it)
66  // {
67  // cout << "jet: " << it->pt() << " " << it->eta() << " " << it->phi()
68  // << endl;
69  // }
70 
71  // Find two leading jets
72  TLorentzVector jet1, jet2;
73 
74  reco::CaloJetCollection::const_iterator j1 = calojets_handle->begin();
75  reco::CaloJetCollection::const_iterator j2 = j1;
76  ++j2;
77 
78  jet1.SetPtEtaPhiM(j1->pt(), j1->eta(), j1->phi(), j1->mass());
79  jet2.SetPtEtaPhiM(j2->pt(), j2->eta(), j2->phi(), j2->mass());
80 
81  // cout << "j1: " << jet1.Pt() << " " << jet1.Eta() << " " << jet1.Phi() <<
82  // endl; cout << "j2: " << jet2.Pt() << " " << jet2.Eta() << " " <<
83  // jet2.Phi() << endl;
84 
85  // Create wide jets (radiation recovery algorithm)
86  for (reco::CaloJetCollection::const_iterator it = calojets_handle->begin(); it != calojets_handle->end(); ++it) {
87  TLorentzVector currentJet;
88  currentJet.SetPtEtaPhiM(it->pt(), it->eta(), it->phi(), it->mass());
89 
90  double DeltaR1 = currentJet.DeltaR(jet1);
91  double DeltaR2 = currentJet.DeltaR(jet2);
92 
93  if (DeltaR1 < DeltaR2 && DeltaR1 < wideJetDeltaR_) {
94  wj1_tmp += currentJet;
95  } else if (DeltaR2 < wideJetDeltaR_) {
96  wj2_tmp += currentJet;
97  }
98  }
99 
100  // Re-order the wide jets in pT
101  if (wj1_tmp.Pt() > wj2_tmp.Pt()) {
102  wj1 = wj1_tmp;
103  wj2 = wj2_tmp;
104  } else {
105  wj1 = wj2_tmp;
106  wj2 = wj1_tmp;
107  }
108 
109  // Create dijet system
110  wdijet = wj1 + wj2;
111 
112  // cout << "j1 wide: " << wj1.Pt() << " " << wj1.Eta() << " " <<
113  // wj1.Phi() << " " << wj1.M() << endl; cout << "j2 wide: " <<
114  // wj2.Pt() << " " << wj2.Eta() << " " << wj2.Phi() << " " << wj2.M()
115  // << endl; cout << "MJJWide: " << wdijet.M() << endl; cout <<
116  // "DeltaEtaJJWide: " << fabs(wj1.Eta()-wj2.Eta()) << endl; cout <<
117  // "DeltaPhiJJWide: " << fabs(wj1.DeltaPhi(wj2)) << endl;
118 
119  // // Put variables in the container
120  // dijetvariables->push_back( wdijet.M() ); //0 =
121  // MJJWide dijetvariables->push_back( fabs(wj1.Eta()-wj2.Eta()) );
122  // //1 = DeltaEtaJJWide dijetvariables->push_back(
123  // fabs(wj1.DeltaPhi(wj2)) ); //2 = DeltaPhiJJWide
124 
125  // Put widejets in the container
126  math::PtEtaPhiMLorentzVector wj1math(wj1.Pt(), wj1.Eta(), wj1.Phi(), wj1.M());
127  math::PtEtaPhiMLorentzVector wj2math(wj2.Pt(), wj2.Eta(), wj2.Phi(), wj2.M());
128  widejets->push_back(wj1math);
129  widejets->push_back(wj2math);
130  }
131  // else
132  // {
133  // // Put variables in the container
134  // dijetvariables->push_back( -1 ); //0 = MJJWide
135  // dijetvariables->push_back( -1 ); //1 = DeltaEtaJJWide
136  // dijetvariables->push_back( -1 ); //2 = DeltaPhiJJWide
137  // }
138 
139  // ## Put objects in the Event
140  // iEvent.put(std::move(dijetvariables), "dijetvariables");
141  iEvent.put(std::move(widejets), "widejets");
142 }
edm::EDGetTokenT< reco::CaloJetCollection > inputJetTagToken_
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
int iEvent
Definition: GenABIO.cc:224
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ inputJetTag_

edm::InputTag DiJetVarProducer::inputJetTag_
private

Definition at line 26 of file DiJetVarProducer.h.

Referenced by DiJetVarProducer().

◆ inputJetTagToken_

edm::EDGetTokenT<reco::CaloJetCollection> DiJetVarProducer::inputJetTagToken_
private

Definition at line 30 of file DiJetVarProducer.h.

Referenced by DiJetVarProducer(), and produce().

◆ wideJetDeltaR_

double DiJetVarProducer::wideJetDeltaR_
private

Definition at line 27 of file DiJetVarProducer.h.

Referenced by DiJetVarProducer(), and produce().