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 &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~DiJetVarProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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
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)
 
- 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

Definition at line 19 of file DiJetVarProducer.h.

Constructor & Destructor Documentation

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_.

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

Definition at line 39 of file DiJetVarProducer.cc.

40 {
41 }

Member Function Documentation

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

Definition at line 45 of file DiJetVarProducer.cc.

References DEFINE_FWK_MODULE, edm::Event::getByToken(), inputJetTagToken_, eostools::move(), edm::Event::put(), and wideJetDeltaR_.

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

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

Member Data Documentation

edm::InputTag DiJetVarProducer::inputJetTag_
private

Definition at line 27 of file DiJetVarProducer.h.

Referenced by DiJetVarProducer().

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

Definition at line 31 of file DiJetVarProducer.h.

Referenced by DiJetVarProducer(), and produce().

double DiJetVarProducer::wideJetDeltaR_
private

Definition at line 28 of file DiJetVarProducer.h.

Referenced by DiJetVarProducer(), and produce().