5 src_(iConfig.getUntrackedParameter<
edm::InputTag>(
"src",
edm::InputTag(
std::
string(
"generator"),
"unsmeared"))),
7 numRequired_(iConfig.getParameter<
int>(
"NumRequired")),
8 acceptMore_(iConfig.getParameter<
bool>(
"AcceptMore")),
9 particleID_(iConfig.getParameter<
std::vector<
int> >(
"ParticleID")),
10 ptMin_(iConfig.getParameter<
std::vector<double> >(
"PtMin")),
11 etaMax_(iConfig.getParameter<
std::vector<double> >(
"EtaMax")),
12 status_(iConfig.getParameter<
std::vector<
int> >(
"Status")),
13 totalEvents_(0), passedEvents_(0)
18 std::vector<double> defptmin(1, 0);
19 std::vector<double> defetamax(1, 999.0);
20 std::vector<int> defstat(1, 0);
21 std::vector<int> defmother;
22 defmother.push_back(0);
25 std::vector<double> defDecayRadiusmin;
26 defDecayRadiusmin.push_back(-1.);
29 std::vector<double> defDecayRadiusmax;
30 defDecayRadiusmax.push_back(1.e5);
33 std::vector<double> defDecayZmin;
34 defDecayZmin.push_back(-1.e5);
37 std::vector<double> defDecayZmax;
38 defDecayZmax.push_back(1.e5);
51 edm::LogWarning(
"MCMultiParticleFilter") <<
"WARNING: MCMultiParticleFilter: size of PtMin, EtaMax, motherID, decayRadiusMin, decayRadiusMax, decayZMin, decayZMax and/or Status does not match ParticleID size!" << std::endl;
56 ptMin_.push_back(defptmin[0]);
58 etaMax_.push_back(defetamax[0]);
111 for ( HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
112 p != myGenEvent->particles_end(); ++
p ) {
116 (*p)->momentum().perp() >
ptMin_[
i] &&
117 fabs((*p)->momentum().eta()) <
etaMax_[i] &&
119 if (!((*p)->production_vertex()))
122 double decx = (*p)->production_vertex()->position().x();
123 double decy = (*p)->production_vertex()->position().y();
124 double decrad =
sqrt(decx * decx + decy * decy);
130 double decz = (*p)->production_vertex()->position().z();
141 bool hascorrectmother=
false;
142 for ( HepMC::GenVertex::particles_in_const_iterator mo = (*p)->production_vertex()->particles_in_const_begin(); mo != (*p)->production_vertex()->particles_in_const_end(); ++mo){
144 hascorrectmother =
true;
148 if(hascorrectmother){
170 edm::LogInfo(
"MCMultiParticleFilter") <<
"=== Results of MCMultiParticleFilter: passed " T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::HepMCProduct > token_
~MCMultiParticleFilter() override
bool filter(edm::Event &, const edm::EventSetup &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< double > decayRadiusMin
#define DEFINE_FWK_MODULE(type)
std::vector< int > status_
Abs< T >::type abs(const T &t)
std::vector< double > decayZMax
std::vector< int > particleID_
const HepMC::GenEvent * GetEvent() const
std::vector< double > decayRadiusMax
std::vector< int > motherID_
MCMultiParticleFilter(const edm::ParameterSet &)
std::vector< double > decayZMin
std::vector< double > ptMin_
std::vector< double > etaMax_