![]() |
![]() |
#include <XtoFFbarFilter.h>
Public Member Functions | |
virtual bool | filter (edm::Event &iEvent, const edm::EventSetup &iSetup) |
XtoFFbarFilter (const edm::ParameterSet &) | |
~XtoFFbarFilter () | |
Private Member Functions | |
virtual void | endJob () |
bool | found (const std::vector< int > v, int j) |
bool | foundXtoFFbar (const reco::GenParticleRef &moth, const std::vector< int > &idMotherX, const std::vector< int > &idDaughterF) |
Private Attributes | |
edm::Handle < reco::GenParticleCollection > | genParticles_ |
std::vector< int > | idDaughterF_ |
std::vector< int > | idDaughterG_ |
std::vector< int > | idMotherX_ |
std::vector< int > | idMotherY_ |
unsigned int | rejectedEvents_ |
bool | requireY_ |
edm::InputTag | src_ |
unsigned int | totalEvents_ |
double | xSumPt_ |
double | xSumR_ |
unsigned int | xTotal_ |
XtoFFbarFilter A GenParticle-based filter that searches for X -> f fbar where X and f are any particle you choose. Can optionally also require a second decay Y -> g g-bar to be present in same event.
Definition at line 30 of file XtoFFbarFilter.h.
XtoFFbarFilter::XtoFFbarFilter | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 6 of file XtoFFbarFilter.cc.
References idDaughterG_, idMotherY_, and requireY_.
: src_(iConfig.getParameter<edm::InputTag>("src")), idMotherX_(iConfig.getParameter<vector<int> >("idMotherX")), idDaughterF_(iConfig.getParameter<vector<int> >("idDaughterF")), idMotherY_(iConfig.getParameter<vector<int> >("idMotherY")), idDaughterG_(iConfig.getParameter<vector<int> >("idDaughterG")), xTotal_(0), xSumPt_(0.), xSumR_(0.), totalEvents_(0),rejectedEvents_(0) { // Note if if not searching for Y --> g-gbar. requireY_ = (idMotherY_.size() > 0 && idDaughterG_.size() > 0); }
XtoFFbarFilter::~XtoFFbarFilter | ( | ) | [inline] |
Definition at line 33 of file XtoFFbarFilter.h.
{}
void XtoFFbarFilter::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDFilter.
Definition at line 101 of file XtoFFbarFilter.cc.
References gather_cfg::cout, rejectedEvents_, totalEvents_, xSumPt_, xSumR_, and xTotal_.
{ cout<<endl; cout<<"=== XtoFFbarFilter statistics of selected X->ffbar or Y->ggbar"<<endl; if (xTotal_ > 0) { cout<<"=== mean X & Y Pt = "<<xSumPt_/xTotal_<<" and transverse decay length = "<<xSumR_/xTotal_<<endl; } else { cout<<"=== WARNING: NONE FOUND !"<<endl; } cout<<"=== events rejected = "<<rejectedEvents_<<"/"<<totalEvents_<<endl; }
bool XtoFFbarFilter::filter | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDFilter.
Definition at line 19 of file XtoFFbarFilter.cc.
References foundXtoFFbar(), genParticles_, edm::Event::getByLabel(), idDaughterF_, idDaughterG_, idMotherX_, idMotherY_, j, rejectedEvents_, requireY_, src_, and totalEvents_.
{ iEvent.getByLabel(src_, genParticles_); totalEvents_++; unsigned int numX = 0; unsigned int numY = 0; unsigned int numXorY = 0; for (unsigned int j = 0; j < genParticles_->size(); j++) { GenParticleRef moth(genParticles_, j); // Is it X -> f fbar ? bool isXtoFFbar = this->foundXtoFFbar(moth, idMotherX_, idDaughterF_); if (isXtoFFbar) numX++; if (!requireY_) { // Has X been found already ? if (numX >= 1) return true; } else { // Is it Y -> g gbar ? bool isYtoGGbar = this->foundXtoFFbar(moth, idMotherY_, idDaughterG_); if (isYtoGGbar) numY++; if (isXtoFFbar || isYtoGGbar) numXorY++; // Have X and Y been found already ? if (numX >= 1 && numY >= 1 && numXorY >= 2) return true; } } rejectedEvents_++; // cout<<"REJECTED "<<totalEvents_<<endl; return false; }
bool XtoFFbarFilter::found | ( | const std::vector< int > | v, |
int | j | ||
) | [inline, private] |
Definition at line 40 of file XtoFFbarFilter.h.
References spr::find(), and j.
Referenced by foundXtoFFbar().
bool XtoFFbarFilter::foundXtoFFbar | ( | const reco::GenParticleRef & | moth, |
const std::vector< int > & | idMotherX, | ||
const std::vector< int > & | idDaughterF | ||
) | [private] |
Definition at line 59 of file XtoFFbarFilter.cc.
References found(), i, j, rho, xSumPt_, xSumR_, and xTotal_.
Referenced by filter().
{ // Check if given particle "moth" is X-->f fbar bool isXtoFFbar = false; int pdgIdMoth = moth->pdgId(); double rho = -9.9e9; if (this->found(idMother, pdgIdMoth)) { bool foundF = false; bool foundFbar = false; unsigned int nDau = moth->numberOfDaughters(); for (unsigned int i = 0; i < nDau; i++) { GenParticleRef dau = moth->daughterRef(i); int pdgIdDau = dau->pdgId(); if (this->found(idDaughter, -pdgIdDau)) foundFbar = true; if (this->found(idDaughter, pdgIdDau)) {foundF = true; // Just for statistics, get transverse decay length. // This is the normal case rho = dau->vertex().Rho(); // Unfortunately, duplicate particles can appear in the event record. Handle this as follows: for (unsigned int j = 0; j < dau->numberOfDaughters(); j++) { GenParticleRef granddau = dau->daughterRef(j); if (granddau->pdgId() == pdgIdDau) rho = granddau->vertex().Rho(); } } } if (foundF && foundFbar) isXtoFFbar = true; } if (isXtoFFbar) { // Get statistics xTotal_++; xSumPt_ += moth->pt(); xSumR_ += rho; } return isXtoFFbar; }
Definition at line 60 of file XtoFFbarFilter.h.
Referenced by filter().
std::vector<int> XtoFFbarFilter::idDaughterF_ [private] |
Definition at line 55 of file XtoFFbarFilter.h.
Referenced by filter().
std::vector<int> XtoFFbarFilter::idDaughterG_ [private] |
Definition at line 57 of file XtoFFbarFilter.h.
Referenced by filter(), and XtoFFbarFilter().
std::vector<int> XtoFFbarFilter::idMotherX_ [private] |
Definition at line 54 of file XtoFFbarFilter.h.
Referenced by filter().
std::vector<int> XtoFFbarFilter::idMotherY_ [private] |
Definition at line 56 of file XtoFFbarFilter.h.
Referenced by filter(), and XtoFFbarFilter().
unsigned int XtoFFbarFilter::rejectedEvents_ [private] |
Definition at line 67 of file XtoFFbarFilter.h.
bool XtoFFbarFilter::requireY_ [private] |
Definition at line 58 of file XtoFFbarFilter.h.
Referenced by filter(), and XtoFFbarFilter().
edm::InputTag XtoFFbarFilter::src_ [private] |
Definition at line 53 of file XtoFFbarFilter.h.
Referenced by filter().
unsigned int XtoFFbarFilter::totalEvents_ [private] |
Definition at line 66 of file XtoFFbarFilter.h.
double XtoFFbarFilter::xSumPt_ [private] |
Definition at line 64 of file XtoFFbarFilter.h.
Referenced by endJob(), and foundXtoFFbar().
double XtoFFbarFilter::xSumR_ [private] |
Definition at line 65 of file XtoFFbarFilter.h.
Referenced by endJob(), and foundXtoFFbar().
unsigned int XtoFFbarFilter::xTotal_ [private] |
Definition at line 63 of file XtoFFbarFilter.h.
Referenced by endJob(), and foundXtoFFbar().