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

Public Member Functions

 TTbarSpinCorrHepMCAnalyzer (const edm::ParameterSet &)
 
 ~TTbarSpinCorrHepMCAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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::InputTag genParticlesTag_
 
MonitorElementnEvt
 
double weight
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 56 of file TTbarSpinCorrHepMCAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 6 of file TTbarSpinCorrHepMCAnalyzer.cc.

References dbe, and cppFunctionSkipper::operator.

6  :
7  genEventInfoProductTag_(iConfig.getParameter<edm::InputTag>("genEventInfoProductTag")),
8  genParticlesTag_(iConfig.getParameter<edm::InputTag>("genParticlesTag"))
9 {
10  dbe = 0;
12 }
T getParameter(std::string const &) const
TTbarSpinCorrHepMCAnalyzer::~TTbarSpinCorrHepMCAnalyzer ( )

Definition at line 15 of file TTbarSpinCorrHepMCAnalyzer.cc.

16 {
17 
18  // do anything here that needs to be done at desctruction time
19  // (e.g. close files, deallocate resources etc.)
20 
21 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 30 of file TTbarSpinCorrHepMCAnalyzer.cc.

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

31 {
32  using namespace edm;
33 
34  // --- the MC weights ---
36  iEvent.getByLabel(genEventInfoProductTag_, evt_info);
37  if (evt_info.failedToGet())
38  return;
39 
40  weight = evt_info->weight() ;
41 
42  // --- get genParticles ---
45 
46  const reco::GenParticle * _lepton (0) ;
47  const reco::GenParticle * _leptonBar(0) ;
48 
49  bool hasTop(false), hasTopbar(false);
50  for(size_t i = 0; i < genParticles->size(); ++ i) {
51  const reco::GenParticle & p = (*genParticles)[i];
52  if(p.pdgId() == 6) hasTop=true;
53  if(p.pdgId() == -6) hasTopbar=true;
54  }
55 
56  if(hasTop && hasTopbar){
57  // --- get status 3 leptons
58  for(size_t i = 0; i < genParticles->size(); ++ i) {
59  const reco::GenParticle & p = (*genParticles)[i];
60  if ( (p.pdgId() == 11 ||
61  p.pdgId() == 13 ||
62  p.pdgId() == 15) && p.status() == 3) { _lepton = &p ; }
63  if ( (p.pdgId() == -11 ||
64  p.pdgId() == -13 ||
65  p.pdgId() == -15) && p.status() == 3) { _leptonBar = &p ; }
66 
67  if (_lepton && _leptonBar) break;
68  }
69 
70  if (_lepton && _leptonBar) {
71 
72  math::XYZTLorentzVector lepton = _lepton ->p4() ;
73  math::XYZTLorentzVector leptonBar = _leptonBar->p4() ;
74 
75  double deltaPhi = fabs(TVector2::Phi_mpi_pi(lepton.phi() - leptonBar.phi())) ;
76  _h_deltaPhi->Fill(deltaPhi, weight) ;
77 
78  double asym = ( deltaPhi > CLHEP::halfpi ) ? 0.5 : -0.5 ;
79  _h_asym->Fill(asym, weight) ;
80 
81  math::XYZTLorentzVector llpair = lepton + leptonBar ;
82 
83  double llpairPt = llpair.pt() ;
84  _h_llpairPt->Fill(llpairPt, weight) ;
85 
86  double llpairM = llpair.M() ;
87  _h_llpairM ->Fill(llpairM , weight) ;
88 
89  }
90  nEvt->Fill(0.5 , weight) ;
91  }
92 }
int i
Definition: DBlmapReader.cc:9
virtual int pdgId() const
PDG identifier.
virtual int status() const
status word
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:30
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
void TTbarSpinCorrHepMCAnalyzer::beginJob ( void  )
privatevirtual

Setting the DQM top directories

Reimplemented from edm::EDAnalyzer.

Definition at line 97 of file TTbarSpinCorrHepMCAnalyzer.cc.

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

98 {
99  if(dbe){
101  TString dir="Generator/";
102  dir+="TTbarSpinCorr";
103  dbe->setCurrentFolder(dir.Data());
104 
105  // Number of analyzed events
106  nEvt = dbe->book1D("nEvt", "n analyzed Events", 1, 0., 1.);
107 
108  _h_asym = dbe->book1D("TTbar_asym","Asymmetr", 2, -1., 1.);
109  _h_asym->setAxisTitle("Asymmetry");
110 
111  _h_deltaPhi = dbe->book1D("TTbar_deltaPhi","#Delta#phi(ll)", 320, 0, 3.2);
112  _h_deltaPhi->setAxisTitle("#Delta#phi(ll)");
113 
114  _h_llpairPt = dbe->book1D("TTbar_llpairPt","Lepton pair transverse momentum", 1000, 0, 1000);
115  _h_llpairPt->setAxisTitle("p_{T}(ll)");
116 
117  _h_llpairM = dbe->book1D("TTbar_llpairM","Lepton pair invariant mass", 1000, 0, 1000);
118  _h_llpairM->setAxisTitle("M(ll)");
119 
120  }
121 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
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:429
void TTbarSpinCorrHepMCAnalyzer::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 143 of file TTbarSpinCorrHepMCAnalyzer.cc.

144 {
145 }
void TTbarSpinCorrHepMCAnalyzer::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 131 of file TTbarSpinCorrHepMCAnalyzer.cc.

132 {
133 }
void TTbarSpinCorrHepMCAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 125 of file TTbarSpinCorrHepMCAnalyzer.cc.

126 {
127 }
void TTbarSpinCorrHepMCAnalyzer::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 149 of file TTbarSpinCorrHepMCAnalyzer.cc.

150 {
151 }
void TTbarSpinCorrHepMCAnalyzer::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 137 of file TTbarSpinCorrHepMCAnalyzer.cc.

138 {
139 }

Member Data Documentation

MonitorElement* TTbarSpinCorrHepMCAnalyzer::_h_asym
private

Definition at line 76 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* TTbarSpinCorrHepMCAnalyzer::_h_deltaPhi
private

Definition at line 77 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* TTbarSpinCorrHepMCAnalyzer::_h_llpairM
private

Definition at line 80 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and beginJob().

MonitorElement* TTbarSpinCorrHepMCAnalyzer::_h_llpairPt
private

Definition at line 79 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and beginJob().

DQMStore* TTbarSpinCorrHepMCAnalyzer::dbe
private

Definition at line 72 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by beginJob(), and TTbarSpinCorrHepMCAnalyzer().

edm::InputTag TTbarSpinCorrHepMCAnalyzer::genEventInfoProductTag_
private

Definition at line 82 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze().

edm::InputTag TTbarSpinCorrHepMCAnalyzer::genParticlesTag_
private

Definition at line 82 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze().

MonitorElement* TTbarSpinCorrHepMCAnalyzer::nEvt
private

Definition at line 75 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and beginJob().

double TTbarSpinCorrHepMCAnalyzer::weight
private

Definition at line 73 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze().