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::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () 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
 
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)
 
 ~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
 
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)
 

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::one::EDProducerBase
typedef EDProducerBase 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::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 53 of file TTbarSpinCorrHepMCAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 6 of file TTbarSpinCorrHepMCAnalyzer.cc.

References genEventInfoProductTag_, genEventInfoProductTagToken_, genParticlesTag_, and genParticlesTagToken_.

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 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::GenParticleCollection > genParticlesTagToken_
edm::EDGetTokenT< GenEventInfoProduct > genEventInfoProductTagToken_
TTbarSpinCorrHepMCAnalyzer::~TTbarSpinCorrHepMCAnalyzer ( )
override

Definition at line 13 of file TTbarSpinCorrHepMCAnalyzer.cc.

13 {}

Member Function Documentation

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

Definition at line 20 of file TTbarSpinCorrHepMCAnalyzer.cc.

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

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 ---
33  iEvent.getByToken(genParticlesTagToken_, 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()));
67  _h_deltaPhi->Fill(deltaPhi, weight);
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 }
int pdgId() const final
PDG identifier.
edm::EDGetTokenT< reco::GenParticleCollection > genParticlesTagToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
Definition: weight.py:1
double weight() const
void Fill(long long x)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
bool failedToGet() const
Definition: HandleBase.h:72
HLT enums.
int status() const final
status word
edm::EDGetTokenT< GenEventInfoProduct > genEventInfoProductTagToken_
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.

References _h_asym, _h_deltaPhi, _h_llpairM, _h_llpairPt, DQMHelper::book1dHisto(), DeadROC_duringRun::dir, nEvt, dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

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 }

Member Data Documentation

MonitorElement* TTbarSpinCorrHepMCAnalyzer::_h_asym
private

Definition at line 66 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* TTbarSpinCorrHepMCAnalyzer::_h_deltaPhi
private

Definition at line 67 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* TTbarSpinCorrHepMCAnalyzer::_h_llpairM
private

Definition at line 70 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* TTbarSpinCorrHepMCAnalyzer::_h_llpairPt
private

Definition at line 69 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and bookHistograms().

edm::InputTag TTbarSpinCorrHepMCAnalyzer::genEventInfoProductTag_
private

Definition at line 72 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by TTbarSpinCorrHepMCAnalyzer().

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

Definition at line 74 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and TTbarSpinCorrHepMCAnalyzer().

edm::InputTag TTbarSpinCorrHepMCAnalyzer::genParticlesTag_
private

Definition at line 72 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by TTbarSpinCorrHepMCAnalyzer().

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

Definition at line 75 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and TTbarSpinCorrHepMCAnalyzer().

MonitorElement* TTbarSpinCorrHepMCAnalyzer::nEvt
private

Definition at line 65 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and bookHistograms().

double TTbarSpinCorrHepMCAnalyzer::weight
private

Definition at line 63 of file TTbarSpinCorrHepMCAnalyzer.h.