CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Member Functions

TTbar_P4Violation Class Reference

#include <TTbar_P4Violation.h>

Inheritance diagram for TTbar_P4Violation:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

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

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

Private Member Functions

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

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 43 of file TTbar_P4Violation.h.


Constructor & Destructor Documentation

TTbar_P4Violation::TTbar_P4Violation ( const edm::ParameterSet iConfig) [explicit]

Definition at line 14 of file TTbar_P4Violation.cc.

{
   //now do what ever initialization is needed

}
TTbar_P4Violation::~TTbar_P4Violation ( )

Definition at line 21 of file TTbar_P4Violation.cc.

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

}

Member Function Documentation

void TTbar_P4Violation::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 109 of file TTbar_P4Violation.cc.

{
}
bool TTbar_P4Violation::beginLuminosityBlock ( edm::LuminosityBlock ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 134 of file TTbar_P4Violation.cc.

{
  return true;
}
bool TTbar_P4Violation::beginRun ( edm::Run ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 120 of file TTbar_P4Violation.cc.

{ 
  return true;
}
void TTbar_P4Violation::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 115 of file TTbar_P4Violation.cc.

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

Reimplemented from edm::EDFilter.

Definition at line 141 of file TTbar_P4Violation.cc.

{
  return true;
}
bool TTbar_P4Violation::endRun ( edm::Run ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDFilter.

Definition at line 127 of file TTbar_P4Violation.cc.

{
  return true;
}
void TTbar_P4Violation::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Reimplemented from edm::EDFilter.

Definition at line 148 of file TTbar_P4Violation.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

                                                                              {
  //The following says we do not know what parameters are allowed so do no validation
  // Please change this to state exactly what you do use, even if it is no parameters
  edm::ParameterSetDescription desc;
  desc.setUnknown();
  descriptions.addDefault(desc);
}
bool TTbar_P4Violation::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDFilter.

Definition at line 36 of file TTbar_P4Violation.cc.

References funct::false, TtGenEvtProducer_cfi::genEvt, edm::Event::getByLabel(), and funct::true.

{
   using namespace edm;

   // --- get TopQuarkAnalysis TtGenEvent
   Handle<TtGenEvent> genEvt;
   iEvent.getByLabel("genEvt", genEvt);

   if(!genEvt.isValid()) return false;

   const reco::GenParticle*        top = 0;
   const reco::GenParticle*    antitop = 0;
   const reco::GenParticle*     bottom = 0;
   const reco::GenParticle* antibottom = 0;
   const reco::GenParticle*      Wplus = 0;
   const reco::GenParticle*      Wmin  = 0;

   top        = genEvt->top();
   antitop    = genEvt->topBar();
   bottom     = genEvt->b();
   antibottom = genEvt->bBar();
   Wplus      = genEvt->wPlus();
   Wmin       = genEvt->wMinus();
   

   if(top && antitop && bottom && antibottom && Wplus && Wmin){
     const reco::Particle::LorentzVector     topP4 =     bottom->p4() + Wplus->p4() ;
     const reco::Particle::LorentzVector antitopP4 = antibottom->p4() + Wmin ->p4() ;
     
     double tolerance = 0.1 ;
     
     bool     topViolated = false ;
     bool antitopViolated = false ;
     
     if ( (top->p4().px() - topP4.px() > tolerance) || 
          (top->p4().py() - topP4.py() > tolerance) ||
          (top->p4().pz() - topP4.pz() > tolerance) ||
          (top->p4().e () - topP4.e () > tolerance) )  {
       
       topViolated = true ;
       
       //printf( "momentum not conserved for top:\n" ) ;
       //printf( " %5.5f\t %5.5f \t %5.5f \t %5.5f \n",      top->p4().px(),     top->p4().py(),     top->p4().pz(),     top->p4().e() ) ;
       //printf( " %5.5f\t %5.5f \t %5.5f \t %5.5f \n",          topP4.px(),         topP4.py(),         topP4.pz(),         topP4.e() ) ;
     }
     
     if ( (antitop->p4().px() - antitopP4.px() > tolerance) || 
          (antitop->p4().py() - antitopP4.py() > tolerance) ||
          (antitop->p4().pz() - antitopP4.pz() > tolerance) ||
          (antitop->p4().e () - antitopP4.e () > tolerance) )  {
       
       antitopViolated = true ;
       
       //printf( "momentum not conserved for anti-top:\n" ) ;
       //printf( " %5.5f\t %5.5f \t %5.5f \t %5.5f \n ", antitop->p4().px(), antitop->p4().py(), antitop->p4().pz(), antitop->p4().e() ) ;
       //printf( " %5.5f\t %5.5f \t %5.5f \t %5.5f \n ",     antitopP4.px(),     antitopP4.py(),     antitopP4.pz(),     antitopP4.e() ) ;
     }
     
     return (topViolated || antitopViolated);
     
     
     // GOSSIE temp
     bool     bottomOK = true ;
     bool antibottomOK = true ;
     if ( fabs(    bottom->p4().pz()) < 1. )     bottomOK = false ;
     if ( fabs(antibottom->p4().pz()) < 1. ) antibottomOK = false ;
     return (bottomOK && antibottomOK);
   }
   return false;
}