CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TTbarSpinCorrHepMCAnalyzer Class Reference

#include <TTbarSpinCorrHepMCAnalyzer.h>

Inheritance diagram for TTbarSpinCorrHepMCAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

 TTbarSpinCorrHepMCAnalyzer (const edm::ParameterSet &)
 ~TTbarSpinCorrHepMCAnalyzer ()

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

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.

                                                                                     :
  genEventInfoProductTag_(iConfig.getParameter<edm::InputTag>("genEventInfoProductTag")),
  genParticlesTag_(iConfig.getParameter<edm::InputTag>("genParticlesTag"))
{
  dbe = 0;
  dbe = edm::Service<DQMStore>().operator->();
}
TTbarSpinCorrHepMCAnalyzer::~TTbarSpinCorrHepMCAnalyzer ( )

Definition at line 15 of file TTbarSpinCorrHepMCAnalyzer.cc.

{
 
  // do anything here that needs to be done at desctruction time
  // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void TTbarSpinCorrHepMCAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

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.

{
  using namespace edm;

  // --- the MC weights ---
  Handle<GenEventInfoProduct> evt_info;
  iEvent.getByLabel(genEventInfoProductTag_, evt_info);
  if (evt_info.failedToGet())
    return;

  weight = evt_info->weight() ;
  
  // --- get genParticles ---
  Handle<reco::GenParticleCollection> genParticles;
  iEvent.getByLabel(genParticlesTag_, genParticles);   

  const reco::GenParticle * _lepton   (0) ;
  const reco::GenParticle * _leptonBar(0) ;

  bool hasTop(false), hasTopbar(false);
  for(size_t i = 0; i < genParticles->size(); ++ i) {
    const reco::GenParticle & p = (*genParticles)[i];
    if(p.pdgId() == 6) hasTop=true;
    if(p.pdgId() == -6) hasTopbar=true;
  }

  if(hasTop && hasTopbar){
    // --- get status 3 leptons
    for(size_t i = 0; i < genParticles->size(); ++ i) {
      const reco::GenParticle & p = (*genParticles)[i];
      if ( (p.pdgId() ==  11 ||
            p.pdgId() ==  13 ||
            p.pdgId() ==  15) && p.status() == 3) { _lepton    = &p ; }
      if ( (p.pdgId() == -11 ||
            p.pdgId() == -13 ||
            p.pdgId() == -15) && p.status() == 3) { _leptonBar = &p ; }
      
      if (_lepton && _leptonBar) break;
    }
    
    if (_lepton && _leptonBar) {
      
      math::XYZTLorentzVector lepton    = _lepton   ->p4() ;
      math::XYZTLorentzVector leptonBar = _leptonBar->p4() ;
      
      double deltaPhi = fabs(TVector2::Phi_mpi_pi(lepton.phi() - leptonBar.phi())) ;
      _h_deltaPhi->Fill(deltaPhi, weight) ;
      
      double asym = ( deltaPhi > CLHEP::halfpi ) ? 0.5 : -0.5 ;
      _h_asym->Fill(asym, weight) ;
      
      math::XYZTLorentzVector llpair    = lepton + leptonBar ;
      
      double llpairPt = llpair.pt() ;
      _h_llpairPt->Fill(llpairPt, weight) ;
      
      double llpairM  = llpair.M() ;
    _h_llpairM ->Fill(llpairM , weight) ;
    
    }
    nEvt->Fill(0.5 , weight) ;
  }
}
void TTbarSpinCorrHepMCAnalyzer::beginJob ( void  ) [private, virtual]

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().

{
  if(dbe){
    TString dir="Generator/";
    dir+="TTbarSpinCorr";
    dbe->setCurrentFolder(dir.Data());

    // Number of analyzed events
    nEvt = dbe->book1D("nEvt", "n analyzed Events", 1, 0., 1.);
    
    _h_asym = dbe->book1D("TTbar_asym","Asymmetr", 2, -1., 1.);
    _h_asym->setAxisTitle("Asymmetry");

    _h_deltaPhi = dbe->book1D("TTbar_deltaPhi","#Delta#phi(ll)", 320, 0, 3.2);
    _h_deltaPhi->setAxisTitle("#Delta#phi(ll)");
    
    _h_llpairPt = dbe->book1D("TTbar_llpairPt","Lepton pair transverse momentum", 1000, 0, 1000);
    _h_llpairPt->setAxisTitle("p_{T}(ll)");
    
    _h_llpairM  = dbe->book1D("TTbar_llpairM","Lepton pair invariant mass", 1000, 0, 1000);
    _h_llpairM->setAxisTitle("M(ll)");

  }
}
void TTbarSpinCorrHepMCAnalyzer::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 143 of file TTbarSpinCorrHepMCAnalyzer.cc.

{
}
void TTbarSpinCorrHepMCAnalyzer::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 131 of file TTbarSpinCorrHepMCAnalyzer.cc.

{
}
void TTbarSpinCorrHepMCAnalyzer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 125 of file TTbarSpinCorrHepMCAnalyzer.cc.

{
}
void TTbarSpinCorrHepMCAnalyzer::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 149 of file TTbarSpinCorrHepMCAnalyzer.cc.

{
}
void TTbarSpinCorrHepMCAnalyzer::endRun ( edm::Run const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 137 of file TTbarSpinCorrHepMCAnalyzer.cc.

{
}

Member Data Documentation

Definition at line 76 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 77 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 80 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 79 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 72 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by beginJob(), and TTbarSpinCorrHepMCAnalyzer().

Definition at line 82 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze().

Definition at line 82 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze().

Definition at line 75 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 73 of file TTbarSpinCorrHepMCAnalyzer.h.

Referenced by analyze().