![]() |
![]() |
00001 #include "Validation/EventGenerator/interface/TTbar_P4Violation.h" 00002 00003 // 00004 // constants, enums and typedefs 00005 // 00006 00007 // 00008 // static data member definitions 00009 // 00010 00011 // 00012 // constructors and destructor 00013 // 00014 TTbar_P4Violation::TTbar_P4Violation(const edm::ParameterSet& iConfig) 00015 { 00016 //now do what ever initialization is needed 00017 00018 } 00019 00020 00021 TTbar_P4Violation::~TTbar_P4Violation() 00022 { 00023 00024 // do anything here that needs to be done at desctruction time 00025 // (e.g. close files, deallocate resources etc.) 00026 00027 } 00028 00029 00030 // 00031 // member functions 00032 // 00033 00034 // ------------ method called on each new Event ------------ 00035 bool 00036 TTbar_P4Violation::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) 00037 { 00038 using namespace edm; 00039 00040 // --- get TopQuarkAnalysis TtGenEvent 00041 Handle<TtGenEvent> genEvt; 00042 iEvent.getByLabel("genEvt", genEvt); 00043 00044 if(!genEvt.isValid()) return false; 00045 00046 const reco::GenParticle* top = 0; 00047 const reco::GenParticle* antitop = 0; 00048 const reco::GenParticle* bottom = 0; 00049 const reco::GenParticle* antibottom = 0; 00050 const reco::GenParticle* Wplus = 0; 00051 const reco::GenParticle* Wmin = 0; 00052 00053 top = genEvt->top(); 00054 antitop = genEvt->topBar(); 00055 bottom = genEvt->b(); 00056 antibottom = genEvt->bBar(); 00057 Wplus = genEvt->wPlus(); 00058 Wmin = genEvt->wMinus(); 00059 00060 00061 if(top && antitop && bottom && antibottom && Wplus && Wmin){ 00062 const reco::Particle::LorentzVector topP4 = bottom->p4() + Wplus->p4() ; 00063 const reco::Particle::LorentzVector antitopP4 = antibottom->p4() + Wmin ->p4() ; 00064 00065 double tolerance = 0.1 ; 00066 00067 bool topViolated = false ; 00068 bool antitopViolated = false ; 00069 00070 if ( (top->p4().px() - topP4.px() > tolerance) || 00071 (top->p4().py() - topP4.py() > tolerance) || 00072 (top->p4().pz() - topP4.pz() > tolerance) || 00073 (top->p4().e () - topP4.e () > tolerance) ) { 00074 00075 topViolated = true ; 00076 00077 //printf( "momentum not conserved for top:\n" ) ; 00078 //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() ) ; 00079 //printf( " %5.5f\t %5.5f \t %5.5f \t %5.5f \n", topP4.px(), topP4.py(), topP4.pz(), topP4.e() ) ; 00080 } 00081 00082 if ( (antitop->p4().px() - antitopP4.px() > tolerance) || 00083 (antitop->p4().py() - antitopP4.py() > tolerance) || 00084 (antitop->p4().pz() - antitopP4.pz() > tolerance) || 00085 (antitop->p4().e () - antitopP4.e () > tolerance) ) { 00086 00087 antitopViolated = true ; 00088 00089 //printf( "momentum not conserved for anti-top:\n" ) ; 00090 //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() ) ; 00091 //printf( " %5.5f\t %5.5f \t %5.5f \t %5.5f \n ", antitopP4.px(), antitopP4.py(), antitopP4.pz(), antitopP4.e() ) ; 00092 } 00093 00094 return (topViolated || antitopViolated); 00095 00096 00097 // GOSSIE temp 00098 bool bottomOK = true ; 00099 bool antibottomOK = true ; 00100 if ( fabs( bottom->p4().pz()) < 1. ) bottomOK = false ; 00101 if ( fabs(antibottom->p4().pz()) < 1. ) antibottomOK = false ; 00102 return (bottomOK && antibottomOK); 00103 } 00104 return false; 00105 } 00106 00107 // ------------ method called once each job just before starting event loop ------------ 00108 void 00109 TTbar_P4Violation::beginJob() 00110 { 00111 } 00112 00113 // ------------ method called once each job just after ending the event loop ------------ 00114 void 00115 TTbar_P4Violation::endJob() { 00116 } 00117 00118 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ 00119 void 00120 TTbar_P4Violation::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { 00121 //The following says we do not know what parameters are allowed so do no validation 00122 // Please change this to state exactly what you do use, even if it is no parameters 00123 edm::ParameterSetDescription desc; 00124 desc.setUnknown(); 00125 descriptions.addDefault(desc); 00126 } 00127