CMS 3D CMS Logo

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

#include <DiJetVarProducer.h>

Inheritance diagram for DiJetVarProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DiJetVarProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~DiJetVarProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
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::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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.

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 }

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

◆ ~DiJetVarProducer()

DiJetVarProducer::~DiJetVarProducer ( )
override

Definition at line 38 of file DiJetVarProducer.cc.

38 {}

Member Function Documentation

◆ produce()

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

Implements edm::EDProducer.

Definition at line 41 of file DiJetVarProducer.cc.

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

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

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().

DiJetVarProducer::inputJetTag_
edm::InputTag inputJetTag_
Definition: DiJetVarProducer.h:26
edm
HLT enums.
Definition: AlignableModifier.h:19
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
edm::Handle< reco::CaloJetCollection >
DiJetVarProducer::wideJetDeltaR_
double wideJetDeltaR_
Definition: DiJetVarProducer.h:27
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::InputTag::encode
std::string encode() const
Definition: InputTag.cc:159
DiJetVarProducer::inputJetTagToken_
edm::EDGetTokenT< reco::CaloJetCollection > inputJetTagToken_
Definition: DiJetVarProducer.h:30
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
math::PtEtaPhiMLorentzVector
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
edm::InputTag
Definition: InputTag.h:15