CMS 3D CMS Logo

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

#include <CMSDAS11DijetAnalyzer.h>

Inheritance diagram for CMSDAS11DijetAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
 CMSDAS11DijetAnalyzer (const edm::ParameterSet &)
 
void endJob (void) override
 
 ~CMSDAS11DijetAnalyzer () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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
 
ESProxyIndex const * esGetTokenIndices (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::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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static bool compare_JetPt (const reco::CaloJet &jet1, const reco::CaloJet &jet2)
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Private Attributes

TH1D * hCorDijetMass
 
TH1D * hCorDijetXsec
 
TH1D * hDijetDeltaEta
 
TH1D * hDijetDeltaPhi
 
TH1D * hInnerDijetMass
 
TH1D * hJet1EMF
 
TH1D * hJet1Eta
 
TH1D * hJet1Phi
 
TH1D * hJet1Pt
 
TH1D * hJet2EMF
 
TH1D * hJet2Eta
 
TH1D * hJet2Phi
 
TH1D * hJet2Pt
 
TH1D * hJetCorrPt
 
TH1D * hJetEMF
 
TH1D * hJetEta
 
TH1D * hJetPhi
 
TH1D * hJetRawPt
 
TH1D * hOuterDijetMass
 
TH1D * hRawDijetMass
 
TH1D * hVertexZ
 
double innerDeltaEta
 
double JESbias
 
std::string jetCorrections
 
edm::InputTag jetSrc
 
double outerDeltaEta
 
edm::InputTag vertexSrc
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 20 of file CMSDAS11DijetAnalyzer.h.

Constructor & Destructor Documentation

CMSDAS11DijetAnalyzer::CMSDAS11DijetAnalyzer ( const edm::ParameterSet )

Definition at line 20 of file CMSDAS11DijetAnalyzer.cc.

References hCorDijetMass, hDijetDeltaEta, hDijetDeltaPhi, hInnerDijetMass, hJet1EMF, hJet1Eta, hJet1Phi, hJet1Pt, hJet2EMF, hJet2Eta, hJet2Phi, hJet2Pt, hJetCorrPt, hJetEMF, hJetEta, hJetPhi, hJetRawPt, hOuterDijetMass, hVertexZ, TFileService::make(), and NBINS.

21  : edm::EDAnalyzer(),
22  jetSrc(params.getParameter<edm::InputTag>("jetSrc")),
23  vertexSrc(params.getParameter<edm::InputTag>("vertexSrc")),
24  jetCorrections(params.getParameter<std::string>("jetCorrections")),
25  innerDeltaEta(params.getParameter<double>("innerDeltaEta")),
26  outerDeltaEta(params.getParameter<double>("outerDeltaEta")),
27  JESbias(params.getParameter<double>("JESbias")) {
28  // setup file service
30 
31  const int NBINS = 36;
32  Double_t BOUNDARIES[NBINS] = {220, 244, 270, 296, 325, 354, 386, 419, 453, 489, 526, 565,
33  606, 649, 693, 740, 788, 838, 890, 944, 1000, 1058, 1118, 1181,
34  1246, 1313, 1383, 1455, 1530, 1607, 1687, 1770, 1856, 1945, 2037, 2132};
35 
36  // setup histograms
37  hVertexZ = fs->make<TH1D>("hVertexZ", "Z position of the Vertex", 50, -20, 20);
38  hJetRawPt = fs->make<TH1D>("hJetRawPt", "Raw Jet Pt", 50, 0, 1000);
39  hJetCorrPt = fs->make<TH1D>("hJetCorrPt", "Corrected Jet Pt", 50, 0, 1000);
40  hJet1Pt = fs->make<TH1D>("hJet1Pt", "Corrected Jet1 Pt", 50, 0, 1000);
41  hJet2Pt = fs->make<TH1D>("hJet2Pt", "Corrected Jet2 Pt", 50, 0, 1000);
42 
43  hJetEta = fs->make<TH1D>("hJetEta", "Corrected Jet Eta", 10, -5, 5);
44  hJet1Eta = fs->make<TH1D>("hJet1Eta", "Corrected Jet1 Eta", 10, -5, 5);
45  hJet2Eta = fs->make<TH1D>("hJet2Eta", "Corrected Jet2 Eta", 10, -5, 5);
46 
47  hJetPhi = fs->make<TH1D>("hJetPhi", "Corrected Jet Phi", 10, -3.1415, 3.1415);
48  hJet1Phi = fs->make<TH1D>("hJet1Phi", "Corrected Jet1 Phi", 10, -3.1415, 3.1415);
49  hJet2Phi = fs->make<TH1D>("hJet2Phi", "Corrected Jet2 Phi", 10, -3.1415, 3.1415);
50 
51  hJetEMF = fs->make<TH1D>("hJetEMF", "EM Fraction of Jets", 50, 0, 1);
52  hJet1EMF = fs->make<TH1D>("hJet1EMF", "EM Fraction of Jet1", 50, 0, 1);
53  hJet2EMF = fs->make<TH1D>("hJet2EMF", "EM Fraction of Jet2", 50, 0, 1);
54 
55  hCorDijetMass = fs->make<TH1D>("hCorDijetMass", "Corrected Dijet Mass", NBINS - 1, BOUNDARIES);
56  hDijetDeltaPhi = fs->make<TH1D>("hDijetDeltaPhi", "Dijet |#Delta #phi|", 50, 0, 3.1415);
57  hDijetDeltaEta = fs->make<TH1D>("hDijetDeltaEta", "Dijet |#Delta #eta|", 50, 0, 6);
58 
59  hInnerDijetMass = fs->make<TH1D>("hInnerDijetMass", "Corrected Inner Dijet Mass", NBINS - 1, BOUNDARIES);
60  hOuterDijetMass = fs->make<TH1D>("hOuterDijetMass", "Corrected Outer Dijet Mass", NBINS - 1, BOUNDARIES);
61 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
const int NBINS
CMSDAS11DijetAnalyzer::~CMSDAS11DijetAnalyzer ( )
inlineoverride

Definition at line 24 of file CMSDAS11DijetAnalyzer.h.

24 {}

Member Function Documentation

void CMSDAS11DijetAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 65 of file CMSDAS11DijetAnalyzer.cc.

References compare_JetPt(), JetCorrector::correction(), mitigatedMETSequence_cff::corrector, gather_cfg::cout, DEFINE_FWK_MODULE, spr::deltaEta, reco::CaloJet::emEnergyFraction(), PVValHelper::eta, reco::LeafCandidate::eta(), edm::Event::getByLabel(), JetCorrector::getJetCorrector(), hCorDijetMass, hDijetDeltaEta, hDijetDeltaPhi, hInnerDijetMass, hJet1EMF, hJet1Eta, hJet1Phi, hJet1Pt, hJet2EMF, hJet2Eta, hJet2Phi, hJet2Pt, hJetCorrPt, hJetEMF, hJetEta, hJetPhi, hJetRawPt, hOuterDijetMass, hVertexZ, innerDeltaEta, edm::HandleBase::isValid(), JESbias, metsig::jet, jetCorrections, jetSrc, reco::Vertex::ndof(), outerDeltaEta, reco::LeafCandidate::p4(), phi, reco::LeafCandidate::phi(), reco::Vertex::position(), DiDispStaMuonMonitor_cfi::pt, reco::LeafCandidate::pt(), Scenarios_cff::scale, reco::Jet::scaleEnergy(), objectSelection_cff::selectedJets, vertexSrc, GenEventInfoProduct::weight(), and reco::Vertex::z().

65  {
67  double mWeight;
69  iEvent.getByLabel("generator", hEventInfo);
70  if (hEventInfo.isValid())
71  mWeight = hEventInfo->weight();
72  else
73  mWeight = 1.;
74 
76  // Get event ID information
78  //int nrun=iEvent.id().run();
79  //int nlumi=iEvent.luminosityBlock();
80  //int nevent=iEvent.id().event();
81 
83  // Get Primary Vertex Information
85 
86  // magic to get the vertices from EDM
88  iEvent.getByLabel(vertexSrc, vertices_h);
89  if (!vertices_h.isValid()) {
90  std::cout << "Didja hear the one about the empty vertex collection?\n";
91  return;
92  }
93 
94  // require in the event that there is at least one reconstructed vertex
95  if (vertices_h->empty())
96  return;
97 
98  // pick the first (i.e. highest sum pt) verte
99  const reco::Vertex* theVertex = &(vertices_h->front());
100 
101  // require that the vertex meets certain criteria
102  if (theVertex->ndof() < 5)
103  return;
104  if (fabs(theVertex->z()) > 24.0)
105  return;
106  if (fabs(theVertex->position().rho()) > 2.0)
107  return;
108 
110  // Get Jet Information
112 
113  // magic to get the jets from EDM
115  iEvent.getByLabel(jetSrc, jets_h);
116  if (!jets_h.isValid()) {
117  std::cout << "Didja hear the one about the empty jet collection?\n";
118  return;
119  }
120 
121  // magic to get the jet energy corrections
123 
124  // collection of selected jets
125  std::vector<reco::CaloJet> selectedJets;
126 
127  // loop over the jet collection
128  for (reco::CaloJetCollection::const_iterator j_it = jets_h->begin(); j_it != jets_h->end(); j_it++) {
129  reco::CaloJet jet = *j_it;
130 
131  // calculate and apply the correction
132  double scale = corrector->correction(jet.p4());
133 
134  // Introduce a purposeful bias to the correction, to show what happens
135  scale *= JESbias;
136 
137  // fill the histograms
138  hJetRawPt->Fill(jet.pt(), mWeight);
139  hJetEta->Fill(jet.eta(), mWeight);
140  hJetPhi->Fill(jet.phi(), mWeight);
141  hJetEMF->Fill(jet.emEnergyFraction(), mWeight);
142 
143  // correct the jet energy
144  jet.scaleEnergy(scale);
145 
146  // now fill the correct jet pt after the correction
147  hJetCorrPt->Fill(jet.pt(), mWeight);
148 
149  // put the selected jets into a collection
150  selectedJets.push_back(jet);
151  }
152 
153  // require at least two jets to continue
154  if (selectedJets.size() < 2)
155  return;
156 
157  //sort by corrected pt (not the same order as raw pt, sometimes)
158  sort(selectedJets.begin(), selectedJets.end(), compare_JetPt);
159 
160  // select high pt, central, non-noise-like jets
161  if (selectedJets[0].pt() < 50.0)
162  return;
163  if (fabs(selectedJets[0].eta()) > 2.5)
164  return;
165  if (selectedJets[0].emEnergyFraction() < 0.01)
166  return;
167  if (selectedJets[1].pt() < 50.0)
168  return;
169  if (fabs(selectedJets[1].eta()) > 2.5)
170  return;
171  if (selectedJets[1].emEnergyFraction() < 0.01)
172  return;
173 
174  // fill histograms for the jets in our dijets, only
175  hJet1Pt->Fill(selectedJets[0].pt(), mWeight);
176  hJet1Eta->Fill(selectedJets[0].eta(), mWeight);
177  hJet1Phi->Fill(selectedJets[0].phi(), mWeight);
178  hJet1EMF->Fill(selectedJets[0].emEnergyFraction(), mWeight);
179  hJet2Pt->Fill(selectedJets[1].pt(), mWeight);
180  hJet2Eta->Fill(selectedJets[1].eta(), mWeight);
181  hJet2Phi->Fill(selectedJets[1].phi(), mWeight);
182  hJet2EMF->Fill(selectedJets[1].emEnergyFraction(), mWeight);
183 
184  //Get the mass of the two leading jets. Needs their 4-vectors...
185  double corMass = (selectedJets[0].p4() + selectedJets[1].p4()).M();
186  double deltaEta = fabs(selectedJets[0].eta() - selectedJets[1].eta());
187  if (corMass < 489)
188  return;
189  if (deltaEta > 1.3)
190  return;
191  hCorDijetMass->Fill(corMass, mWeight);
192  hDijetDeltaPhi->Fill(fabs(selectedJets[0].phi() - selectedJets[1].phi()), mWeight);
193  hDijetDeltaEta->Fill(deltaEta, mWeight);
194 
195  //Fill the inner and outer dijet mass spectra, to make the ratio from
196  if (deltaEta < innerDeltaEta)
197  hInnerDijetMass->Fill(corMass, mWeight);
198  else if (deltaEta < outerDeltaEta)
199  hOuterDijetMass->Fill(corMass, mWeight);
200 
201  hVertexZ->Fill(theVertex->z(), mWeight);
202  return;
203 }
double eta() const final
momentum pseudorapidity
Jets made from CaloTowers.
Definition: CaloJet.h:27
virtual void scaleEnergy(double fScale)
scale energy of the jet
static bool compare_JetPt(const reco::CaloJet &jet1, const reco::CaloJet &jet2)
double pt() const final
transverse momentum
double weight() const
const Point & position() const
position
Definition: Vertex.h:113
static const double deltaEta
Definition: CaloConstants.h:8
double z() const
z coordinate
Definition: Vertex.h:119
const LorentzVector & p4() const final
four-momentum Lorentz vector
bool isValid() const
Definition: HandleBase.h:70
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
double ndof() const
Definition: Vertex.h:109
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
Definition: JetCorrector.cc:48
double phi() const final
momentum azimuthal angle
float emEnergyFraction() const
Definition: CaloJet.h:97
void CMSDAS11DijetAnalyzer::beginJob ( void  )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 25 of file CMSDAS11DijetAnalyzer.h.

References endJob().

25 {}
static bool CMSDAS11DijetAnalyzer::compare_JetPt ( const reco::CaloJet jet1,
const reco::CaloJet jet2 
)
inlinestatic

Definition at line 28 of file CMSDAS11DijetAnalyzer.h.

References reco::LeafCandidate::pt().

Referenced by analyze().

28 { return (jet1.pt() > jet2.pt()); }
double pt() const final
transverse momentum
void CMSDAS11DijetAnalyzer::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 63 of file CMSDAS11DijetAnalyzer.cc.

Referenced by beginJob().

63 {}

Member Data Documentation

TH1D* CMSDAS11DijetAnalyzer::hCorDijetMass
private

Definition at line 48 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hCorDijetXsec
private

Definition at line 49 of file CMSDAS11DijetAnalyzer.h.

TH1D* CMSDAS11DijetAnalyzer::hDijetDeltaEta
private

Definition at line 59 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hDijetDeltaPhi
private

Definition at line 58 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hInnerDijetMass
private

Definition at line 61 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hJet1EMF
private

Definition at line 53 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hJet1Eta
private

Definition at line 51 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hJet1Phi
private

Definition at line 52 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hJet1Pt
private

Definition at line 50 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hJet2EMF
private

Definition at line 57 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hJet2Eta
private

Definition at line 55 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hJet2Phi
private

Definition at line 56 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hJet2Pt
private

Definition at line 54 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hJetCorrPt
private

Definition at line 41 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hJetEMF
private

Definition at line 45 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hJetEta
private

Definition at line 43 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hJetPhi
private

Definition at line 44 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hJetRawPt
private

Definition at line 42 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hOuterDijetMass
private

Definition at line 62 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

TH1D* CMSDAS11DijetAnalyzer::hRawDijetMass
private

Definition at line 47 of file CMSDAS11DijetAnalyzer.h.

TH1D* CMSDAS11DijetAnalyzer::hVertexZ
private

Definition at line 40 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze(), and CMSDAS11DijetAnalyzer().

double CMSDAS11DijetAnalyzer::innerDeltaEta
private

Definition at line 35 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze().

double CMSDAS11DijetAnalyzer::JESbias
private

Definition at line 37 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze().

std::string CMSDAS11DijetAnalyzer::jetCorrections
private

Definition at line 34 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze().

edm::InputTag CMSDAS11DijetAnalyzer::jetSrc
private

Definition at line 32 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze().

double CMSDAS11DijetAnalyzer::outerDeltaEta
private

Definition at line 36 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze().

edm::InputTag CMSDAS11DijetAnalyzer::vertexSrc
private

Definition at line 33 of file CMSDAS11DijetAnalyzer.h.

Referenced by analyze().