Go to the documentation of this file.00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <memory>
00023 #include "GeneratorInterface/GenFilters/interface/Zto2lFilter.h"
00024
00025 #include <vector>
00026 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
00027 #include "TLorentzVector.h"
00028
00029
00030
00031
00032
00033 using namespace std;
00034 using namespace edm;
00035
00036
00037
00038
00039
00040
00041
00042 Zto2lFilter::Zto2lFilter(const edm::ParameterSet& iConfig)
00043 {
00044
00045 fLabel_ = iConfig.getUntrackedParameter("moduleLabel",std::string("generator"));
00046 maxEtaLepton_ = iConfig.getUntrackedParameter<double>("MaxEtaLepton");
00047 minInvariantMass_ = iConfig.getUntrackedParameter<double>("MindiLeptonInvariantMass");
00048
00049 }
00050
00051
00052 Zto2lFilter::~Zto2lFilter()
00053 {
00054
00055
00056
00057
00058 }
00059
00060
00061
00062
00063
00064
00065
00066 bool
00067 Zto2lFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup)
00068 {
00069 using namespace edm;
00070
00071 bool accept = false;
00072
00073 Handle<HepMCProduct> EvtHandle ;
00074 iEvent.getByLabel( fLabel_, EvtHandle ) ;
00075 const HepMC::GenEvent* evt = EvtHandle->GetEvent();
00076
00077 vector<TLorentzVector> Lepton; Lepton.clear();
00078 for (HepMC::GenEvent::particle_const_iterator p = evt->particles_begin();
00079 p != evt->particles_end(); ++p) {
00080 if((*p)->status()==3){
00081 if ( abs((*p)->pdg_id()) == 11 || abs((*p)->pdg_id()) == 13 || abs((*p)->pdg_id()) == 15 ){
00082 if(fabs((*p)->momentum().eta()) < maxEtaLepton_){
00083 TLorentzVector LeptP((*p)->momentum().px(), (*p)->momentum().py(), (*p)->momentum().pz(), (*p)->momentum().e());
00084 Lepton.push_back(LeptP);
00085 }
00086 }
00087 }
00088 }
00089 if(Lepton.size() == 2){
00090 if((Lepton[0]+Lepton[1]).M() > minInvariantMass_ )accept = true;
00091 }
00092 delete evt;
00093 return accept;
00094 }
00095
00096
00097
00098
00099 void
00100 Zto2lFilter::endJob() {
00101 }
00102
00103
00104