CMS 3D CMS Logo

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

#include <TTbarSpinCorrHepMCAnalyzer.h>

Inheritance diagram for TTbarSpinCorrHepMCAnalyzer:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
 
 TTbarSpinCorrHepMCAnalyzer (const edm::ParameterSet &)
 
 ~TTbarSpinCorrHepMCAnalyzer () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

MonitorElement_h_asym
 
MonitorElement_h_deltaPhi
 
MonitorElement_h_llpairM
 
MonitorElement_h_llpairPt
 
edm::InputTag genEventInfoProductTag_
 
edm::EDGetTokenT< GenEventInfoProductgenEventInfoProductTagToken_
 
edm::InputTag genParticlesTag_
 
edm::EDGetTokenT< reco::GenParticleCollectiongenParticlesTagToken_
 
MonitorElementnEvt
 
double weight
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 53 of file TTbarSpinCorrHepMCAnalyzer.h.

Constructor & Destructor Documentation

◆ TTbarSpinCorrHepMCAnalyzer()

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

Definition at line 6 of file TTbarSpinCorrHepMCAnalyzer.cc.

7  : genEventInfoProductTag_(iConfig.getParameter<edm::InputTag>("genEventInfoProductTag")),
8  genParticlesTag_(iConfig.getParameter<edm::InputTag>("genParticlesTag")) {
9  genEventInfoProductTagToken_ = consumes<GenEventInfoProduct>(genEventInfoProductTag_);
10  genParticlesTagToken_ = consumes<reco::GenParticleCollection>(genParticlesTag_);
11 }

References genEventInfoProductTag_, genEventInfoProductTagToken_, genParticlesTag_, and genParticlesTagToken_.

◆ ~TTbarSpinCorrHepMCAnalyzer()

TTbarSpinCorrHepMCAnalyzer::~TTbarSpinCorrHepMCAnalyzer ( )
override

Definition at line 13 of file TTbarSpinCorrHepMCAnalyzer.cc.

13 {}

Member Function Documentation

◆ analyze()

void TTbarSpinCorrHepMCAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 20 of file TTbarSpinCorrHepMCAnalyzer.cc.

20  {
21  using namespace edm;
22 
23  // --- the MC weights ---
25  iEvent.getByToken(genEventInfoProductTagToken_, evt_info);
26  if (evt_info.failedToGet())
27  return;
28 
29  weight = evt_info->weight();
30 
31  // --- get genParticles ---
34 
35  const reco::GenParticle* _lepton(nullptr);
36  const reco::GenParticle* _leptonBar(nullptr);
37 
38  bool hasTop(false), hasTopbar(false);
39  for (size_t i = 0; i < genParticles->size(); ++i) {
40  const reco::GenParticle& p = (*genParticles)[i];
41  if (p.pdgId() == 6)
42  hasTop = true;
43  if (p.pdgId() == -6)
44  hasTopbar = true;
45  }
46 
47  if (hasTop && hasTopbar) {
48  // --- get status 3 leptons
49  for (size_t i = 0; i < genParticles->size(); ++i) {
50  const reco::GenParticle& p = (*genParticles)[i];
51  if ((p.pdgId() == 11 || p.pdgId() == 13 || p.pdgId() == 15) && p.status() == 3) {
52  _lepton = &p;
53  }
54  if ((p.pdgId() == -11 || p.pdgId() == -13 || p.pdgId() == -15) && p.status() == 3) {
55  _leptonBar = &p;
56  }
57 
58  if (_lepton && _leptonBar)
59  break;
60  }
61 
62  if (_lepton && _leptonBar) {
63  const math::XYZTLorentzVector& lepton = _lepton->p4();
64  const math::XYZTLorentzVector& leptonBar = _leptonBar->p4();
65 
66  double deltaPhi = fabs(TVector2::Phi_mpi_pi(lepton.phi() - leptonBar.phi()));
68 
69  double asym = (deltaPhi > CLHEP::halfpi) ? 0.5 : -0.5;
70  _h_asym->Fill(asym, weight);
71 
72  math::XYZTLorentzVector llpair = lepton + leptonBar;
73 
74  double llpairPt = llpair.pt();
75  _h_llpairPt->Fill(llpairPt, weight);
76 
77  double llpairM = llpair.M();
78  _h_llpairM->Fill(llpairM, weight);
79  }
80  nEvt->Fill(0.5, weight);
81  }
82 }

References _h_asym, _h_deltaPhi, _h_llpairM, _h_llpairPt, SiPixelRawToDigiRegional_cfi::deltaPhi, edm::HandleBase::failedToGet(), dqm::impl::MonitorElement::Fill(), genEventInfoProductTagToken_, genParticles2HepMC_cfi::genParticles, genParticlesTagToken_, mps_fire::i, iEvent, nEvt, AlCaHLTBitMon_ParallelJobs::p, reco::LeafCandidate::p4(), and GenEventInfoProduct::weight().

◆ bookHistograms()

void TTbarSpinCorrHepMCAnalyzer::bookHistograms ( DQMStore::IBooker i,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Setting the DQM top directories

Implements DQMEDAnalyzer.

Definition at line 85 of file TTbarSpinCorrHepMCAnalyzer.cc.

85  {
87  std::string dir = "Generator/";
88  dir += "TTbarSpinCorr";
89  DQMHelper dqm(&i);
90  i.setCurrentFolder(dir);
91 
92  // Number of analyzed events
93  nEvt = dqm.book1dHisto("nEvt", "n analyzed Events", 1, 0., 1., "bin", "Number of Events");
94  _h_asym = dqm.book1dHisto("TTbar_asym", "Asymmetr", 2, -1., 1., "Asymmetry", "Number of Events");
95  _h_deltaPhi =
96  dqm.book1dHisto("TTbar_deltaPhi", "#Delta#phi(ll)", 320, 0, 3.2, "#Delta#phi_{ll} (rad)", "Number of Events");
97  _h_llpairPt = dqm.book1dHisto(
98  "TTbar_llpairPt", "Lepton pair transverse momentum", 1000, 0, 1000, "p_{T}^{ll} (GeV)", "Number of Events");
99  _h_llpairM =
100  dqm.book1dHisto("TTbar_llpairM", "Lepton pair invariant mass", 1000, 0, 1000, "M_{ll} (GeV)", "Number of Events");
101 }

References _h_asym, _h_deltaPhi, _h_llpairM, _h_llpairPt, DeadROC_duringRun::dir, mps_fire::i, nEvt, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ _h_asym

MonitorElement* TTbarSpinCorrHepMCAnalyzer::_h_asym
private

Definition at line 66 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and bookHistograms().

◆ _h_deltaPhi

MonitorElement* TTbarSpinCorrHepMCAnalyzer::_h_deltaPhi
private

Definition at line 67 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and bookHistograms().

◆ _h_llpairM

MonitorElement* TTbarSpinCorrHepMCAnalyzer::_h_llpairM
private

Definition at line 70 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and bookHistograms().

◆ _h_llpairPt

MonitorElement* TTbarSpinCorrHepMCAnalyzer::_h_llpairPt
private

Definition at line 69 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and bookHistograms().

◆ genEventInfoProductTag_

edm::InputTag TTbarSpinCorrHepMCAnalyzer::genEventInfoProductTag_
private

Definition at line 72 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by TTbarSpinCorrHepMCAnalyzer().

◆ genEventInfoProductTagToken_

edm::EDGetTokenT<GenEventInfoProduct> TTbarSpinCorrHepMCAnalyzer::genEventInfoProductTagToken_
private

Definition at line 74 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and TTbarSpinCorrHepMCAnalyzer().

◆ genParticlesTag_

edm::InputTag TTbarSpinCorrHepMCAnalyzer::genParticlesTag_
private

Definition at line 72 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by TTbarSpinCorrHepMCAnalyzer().

◆ genParticlesTagToken_

edm::EDGetTokenT<reco::GenParticleCollection> TTbarSpinCorrHepMCAnalyzer::genParticlesTagToken_
private

Definition at line 75 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and TTbarSpinCorrHepMCAnalyzer().

◆ nEvt

MonitorElement* TTbarSpinCorrHepMCAnalyzer::nEvt
private

Definition at line 65 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and bookHistograms().

◆ weight

double TTbarSpinCorrHepMCAnalyzer::weight
private

Definition at line 63 of file TTbarSpinCorrHepMCAnalyzer.h.

mps_fire.i
i
Definition: mps_fire.py:355
genParticles2HepMC_cfi.genParticles
genParticles
Definition: genParticles2HepMC_cfi.py:4
reco::GenParticle
Definition: GenParticle.h:21
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
TTbarSpinCorrHepMCAnalyzer::genEventInfoProductTagToken_
edm::EDGetTokenT< GenEventInfoProduct > genEventInfoProductTagToken_
Definition: TTbarSpinCorrHepMCAnalyzer.h:74
TTbarSpinCorrHepMCAnalyzer::genParticlesTag_
edm::InputTag genParticlesTag_
Definition: TTbarSpinCorrHepMCAnalyzer.h:72
TTbarSpinCorrHepMCAnalyzer::_h_asym
MonitorElement * _h_asym
Definition: TTbarSpinCorrHepMCAnalyzer.h:66
edm::Handle
Definition: AssociativeIterator.h:50
TTbarSpinCorrHepMCAnalyzer::_h_llpairM
MonitorElement * _h_llpairM
Definition: TTbarSpinCorrHepMCAnalyzer.h:70
TTbarSpinCorrHepMCAnalyzer::nEvt
MonitorElement * nEvt
Definition: TTbarSpinCorrHepMCAnalyzer.h:65
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::HandleBase::failedToGet
bool failedToGet() const
Definition: HandleBase.h:72
TTbarSpinCorrHepMCAnalyzer::_h_deltaPhi
MonitorElement * _h_deltaPhi
Definition: TTbarSpinCorrHepMCAnalyzer.h:67
TTbarSpinCorrHepMCAnalyzer::genEventInfoProductTag_
edm::InputTag genEventInfoProductTag_
Definition: TTbarSpinCorrHepMCAnalyzer.h:72
iEvent
int iEvent
Definition: GenABIO.cc:224
DQMHelper
Definition: DQMHelper.h:15
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
TTbarSpinCorrHepMCAnalyzer::genParticlesTagToken_
edm::EDGetTokenT< reco::GenParticleCollection > genParticlesTagToken_
Definition: TTbarSpinCorrHepMCAnalyzer.h:75
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
TTbarSpinCorrHepMCAnalyzer::_h_llpairPt
MonitorElement * _h_llpairPt
Definition: TTbarSpinCorrHepMCAnalyzer.h:69
dqm
Definition: DQMStore.h:18
edm::InputTag
Definition: InputTag.h:15
weight
Definition: weight.py:1
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
GenEventInfoProduct::weight
double weight() const
Definition: GenEventInfoProduct.h:35