CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TTbarSpinCorrHepMCAnalyzer Class Reference

#include <TTbarSpinCorrHepMCAnalyzer.h>

Inheritance diagram for TTbarSpinCorrHepMCAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 TTbarSpinCorrHepMCAnalyzer (const edm::ParameterSet &)
 
 ~TTbarSpinCorrHepMCAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 

Private Attributes

MonitorElement_h_asym
 
MonitorElement_h_deltaPhi
 
MonitorElement_h_llpairM
 
MonitorElement_h_llpairPt
 
DQMStoredbe
 
edm::InputTag genEventInfoProductTag_
 
edm::EDGetTokenT
< GenEventInfoProduct
genEventInfoProductTagToken_
 
edm::InputTag genParticlesTag_
 
edm::EDGetTokenT
< reco::GenParticleCollection
genParticlesTagToken_
 
MonitorElementnEvt
 
double weight
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 55 of file TTbarSpinCorrHepMCAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 6 of file TTbarSpinCorrHepMCAnalyzer.cc.

References dbe, genEventInfoProductTag_, genEventInfoProductTagToken_, genParticlesTag_, genParticlesTagToken_, and cppFunctionSkipper::operator.

6  :
7  genEventInfoProductTag_(iConfig.getParameter<edm::InputTag>("genEventInfoProductTag")),
8  genParticlesTag_(iConfig.getParameter<edm::InputTag>("genParticlesTag"))
9 {
10  dbe = 0;
12 
13  genEventInfoProductTagToken_=consumes<GenEventInfoProduct>(genEventInfoProductTag_);
14  genParticlesTagToken_=consumes<reco::GenParticleCollection>(genParticlesTag_);
15 
16 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::GenParticleCollection > genParticlesTagToken_
edm::EDGetTokenT< GenEventInfoProduct > genEventInfoProductTagToken_
TTbarSpinCorrHepMCAnalyzer::~TTbarSpinCorrHepMCAnalyzer ( )

Definition at line 19 of file TTbarSpinCorrHepMCAnalyzer.cc.

20 {
21 
22  // do anything here that needs to be done at desctruction time
23  // (e.g. close files, deallocate resources etc.)
24 
25 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 34 of file TTbarSpinCorrHepMCAnalyzer.cc.

References _h_asym, _h_deltaPhi, _h_llpairM, _h_llpairPt, SiPixelRawToDigiRegional_cfi::deltaPhi, MonitorElement::Fill(), genEventInfoProductTagToken_, genParticleCandidates2GenParticles_cfi::genParticles, genParticlesTagToken_, edm::Event::getByToken(), i, nEvt, AlCaHLTBitMon_ParallelJobs::p, reco::LeafCandidate::p4(), reco::LeafCandidate::pdgId(), Phi_mpi_pi(), reco::LeafCandidate::status(), and weight.

35 {
36  using namespace edm;
37 
38  // --- the MC weights ---
40  iEvent.getByToken(genEventInfoProductTagToken_, evt_info);
41  if (evt_info.failedToGet())
42  return;
43 
44  weight = evt_info->weight() ;
45 
46  // --- get genParticles ---
49 
50  const reco::GenParticle * _lepton (0) ;
51  const reco::GenParticle * _leptonBar(0) ;
52 
53  bool hasTop(false), hasTopbar(false);
54  for(size_t i = 0; i < genParticles->size(); ++ i) {
55  const reco::GenParticle & p = (*genParticles)[i];
56  if(p.pdgId() == 6) hasTop=true;
57  if(p.pdgId() == -6) hasTopbar=true;
58  }
59 
60  if(hasTop && hasTopbar){
61  // --- get status 3 leptons
62  for(size_t i = 0; i < genParticles->size(); ++ i) {
63  const reco::GenParticle & p = (*genParticles)[i];
64  if ( (p.pdgId() == 11 ||
65  p.pdgId() == 13 ||
66  p.pdgId() == 15) && p.status() == 3) { _lepton = &p ; }
67  if ( (p.pdgId() == -11 ||
68  p.pdgId() == -13 ||
69  p.pdgId() == -15) && p.status() == 3) { _leptonBar = &p ; }
70 
71  if (_lepton && _leptonBar) break;
72  }
73 
74  if (_lepton && _leptonBar) {
75 
76  math::XYZTLorentzVector lepton = _lepton ->p4() ;
77  math::XYZTLorentzVector leptonBar = _leptonBar->p4() ;
78 
79  double deltaPhi = fabs(TVector2::Phi_mpi_pi(lepton.phi() - leptonBar.phi())) ;
80  _h_deltaPhi->Fill(deltaPhi, weight) ;
81 
82  double asym = ( deltaPhi > CLHEP::halfpi ) ? 0.5 : -0.5 ;
83  _h_asym->Fill(asym, weight) ;
84 
85  math::XYZTLorentzVector llpair = lepton + leptonBar ;
86 
87  double llpairPt = llpair.pt() ;
88  _h_llpairPt->Fill(llpairPt, weight) ;
89 
90  double llpairM = llpair.M() ;
91  _h_llpairM ->Fill(llpairM , weight) ;
92 
93  }
94  nEvt->Fill(0.5 , weight) ;
95  }
96 }
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< reco::GenParticleCollection > genParticlesTagToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
virtual int pdgId() const GCC11_FINAL
PDG identifier.
double Phi_mpi_pi(double x)
Definition: JetUtil.h:24
void Fill(long long x)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
virtual int status() const GCC11_FINAL
status word
edm::EDGetTokenT< GenEventInfoProduct > genEventInfoProductTagToken_
void TTbarSpinCorrHepMCAnalyzer::beginJob ( void  )
privatevirtual

Setting the DQM top directories

Reimplemented from edm::EDAnalyzer.

Definition at line 101 of file TTbarSpinCorrHepMCAnalyzer.cc.

References _h_asym, _h_deltaPhi, _h_llpairM, _h_llpairPt, DQMStore::book1D(), dbe, dir, nEvt, MonitorElement::setAxisTitle(), and DQMStore::setCurrentFolder().

102 {
103  if(dbe){
105  TString dir="Generator/";
106  dir+="TTbarSpinCorr";
107  dbe->setCurrentFolder(dir.Data());
108 
109  // Number of analyzed events
110  nEvt = dbe->book1D("nEvt", "n analyzed Events", 1, 0., 1.);
111 
112  _h_asym = dbe->book1D("TTbar_asym","Asymmetr", 2, -1., 1.);
113  _h_asym->setAxisTitle("Asymmetry");
114 
115  _h_deltaPhi = dbe->book1D("TTbar_deltaPhi","#Delta#phi(ll)", 320, 0, 3.2);
116  _h_deltaPhi->setAxisTitle("#Delta#phi(ll)");
117 
118  _h_llpairPt = dbe->book1D("TTbar_llpairPt","Lepton pair transverse momentum", 1000, 0, 1000);
119  _h_llpairPt->setAxisTitle("p_{T}(ll)");
120 
121  _h_llpairM = dbe->book1D("TTbar_llpairM","Lepton pair invariant mass", 1000, 0, 1000);
122  _h_llpairM->setAxisTitle("M(ll)");
123 
124  }
125 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
dbl *** dir
Definition: mlp_gen.cc:35
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
void TTbarSpinCorrHepMCAnalyzer::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 147 of file TTbarSpinCorrHepMCAnalyzer.cc.

148 {
149 }
void TTbarSpinCorrHepMCAnalyzer::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 135 of file TTbarSpinCorrHepMCAnalyzer.cc.

136 {
137 }
void TTbarSpinCorrHepMCAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 129 of file TTbarSpinCorrHepMCAnalyzer.cc.

130 {
131 }
void TTbarSpinCorrHepMCAnalyzer::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 153 of file TTbarSpinCorrHepMCAnalyzer.cc.

154 {
155 }
void TTbarSpinCorrHepMCAnalyzer::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 141 of file TTbarSpinCorrHepMCAnalyzer.cc.

142 {
143 }

Member Data Documentation

MonitorElement* TTbarSpinCorrHepMCAnalyzer::_h_asym
private

Definition at line 75 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* TTbarSpinCorrHepMCAnalyzer::_h_deltaPhi
private

Definition at line 76 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* TTbarSpinCorrHepMCAnalyzer::_h_llpairM
private

Definition at line 79 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* TTbarSpinCorrHepMCAnalyzer::_h_llpairPt
private

Definition at line 78 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and beginJob().

DQMStore* TTbarSpinCorrHepMCAnalyzer::dbe
private

Definition at line 71 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by beginJob(), and TTbarSpinCorrHepMCAnalyzer().

edm::InputTag TTbarSpinCorrHepMCAnalyzer::genEventInfoProductTag_
private

Definition at line 81 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by TTbarSpinCorrHepMCAnalyzer().

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

Definition at line 83 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and TTbarSpinCorrHepMCAnalyzer().

edm::InputTag TTbarSpinCorrHepMCAnalyzer::genParticlesTag_
private

Definition at line 81 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by TTbarSpinCorrHepMCAnalyzer().

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

Definition at line 84 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and TTbarSpinCorrHepMCAnalyzer().

MonitorElement* TTbarSpinCorrHepMCAnalyzer::nEvt
private

Definition at line 74 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and beginJob().

double TTbarSpinCorrHepMCAnalyzer::weight
private