12 motherParticle = iConfig.
getParameter<
int >(
"motherParticle");
14 firstDaughter.type = iConfig.
getParameter<
int >(
"firstDaughter");
15 firstDaughter.decayProduct = iConfig.
getParameter< vector<int> >(
"firstDaughterDecay");
16 firstDaughter.etaMin = iConfig.
getParameter<
double>(
"firstDaughterDecayEtaMin");
17 firstDaughter.etaMax = iConfig.
getParameter<
double>(
"firstDaughterDecayEtaMax");
18 firstDaughter.ptMin = iConfig.
getParameter<
double>(
"firstDaughterDecayPtMin");
20 secondDaughter.type = iConfig.
getParameter<
int >(
"secondDaughter");
21 secondDaughter.decayProduct = iConfig.
getParameter< vector<int> >(
"secondDaughterDecay");
22 secondDaughter.etaMin = iConfig.
getParameter<
double>(
"secondDaughterDecayEtaMin");
23 secondDaughter.etaMax = iConfig.
getParameter<
double>(
"secondDaughterDecayEtaMax");
24 secondDaughter.ptMin = iConfig.
getParameter<
double>(
"secondDaughterDecayPtMin");
32 std::cout <<
"Total number of accepted events = " << noAccepted << std::endl;
50 const int requested_id)
53 for(GenVertex::particles_out_const_iterator
p = vertex->particles_out_const_begin();
54 p != vertex->particles_out_const_end();
p++)
56 int event_particle_id =
abs( (*p)->pdg_id() );
57 cout <<
"particle Id: "<<event_particle_id<<
"\n";
58 if (requested_id == event_particle_id)
return *
p;
63 HepMC::GenEvent::particle_const_iterator
BdecayFilter::getNextBs(
const HepMC::GenEvent::particle_const_iterator
start,
const HepMC::GenEvent::particle_const_iterator
end)
65 HepMC::GenEvent::particle_const_iterator
p;
66 for (p = start; p !=
end; p++)
68 int event_particle_id =
abs( (*p)->pdg_id() );
70 if (event_particle_id == motherParticle)
return p;
84 bool event_passed =
false;
85 HepMC::GenEvent::particle_const_iterator bs = getNextBs(generated_event->particles_begin(), generated_event->particles_end());
86 while (bs!= generated_event->particles_end() ) {
91 HepMC::GenVertex* outVertex = (*bs)->end_vertex();
98 int numChildren = outVertex->particles_out_size();
99 cout<<
"B children "<<numChildren<<endl;
109 if( (numChildren==2) && ((jpsi = findParticle(outVertex, firstDaughter.type))!=
nullptr) &&
110 ((phi = findParticle(outVertex, secondDaughter.type))!=
nullptr)) {
112 cout << jpsi->momentum().rho() <<
" "<<jpsi->momentum().eta() <<
" "<<phi->momentum().rho()<<
" "<<phi->momentum().eta()<<endl;
114 if (
cuts(phi, secondDaughter) &&
cuts(jpsi, firstDaughter)) {
115 cout <<
"decay found"<<endl;
120 bs = getNextBs(++bs, generated_event->particles_end());
123 if (event_passed) noAccepted++;
124 cout <<
"End filter\n";
126 delete generated_event;
134 cout <<
"start cuts" << endl;
135 HepMC::GenVertex* myVertex = jpsi->end_vertex();
136 int numChildren = myVertex->particles_out_size();
138 std::vector<HepMC::GenParticle*> psiChild;
140 for(GenVertex::particles_out_const_iterator
p = myVertex->particles_out_const_begin();
141 p != myVertex->particles_out_const_end();
p++)
142 psiChild.push_back((*
p));
144 if (numChildren!=numDecProd)
return false;
145 cout << psiChild[0]->pdg_id()<<
" "<<psiChild[1]->pdg_id()<<endl;
147 for (
int i=0;
i<numChildren; ++
i) {
148 bool goodPart =
false;
149 for (
int j=0; j < numChildren; ++j){
152 cout << psiChild[
i]->momentum().perp() << endl;
153 if ( !goodPart || (!etaInRange(psiChild[
i]->momentum().
eta(), cut.
etaMin, cut.
etaMax)) || (psiChild[
i]->momentum().perp() < cut.
ptMin) )
return false;
155 cout <<
"cuts true" << endl;
161 return ( (etamin < eta) && (eta < etamax) );
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool filter(edm::Event &, const edm::EventSetup &) override
bool cuts(const HepMC::GenParticle *jpsi, const CutStruct &cut)
HepMC::GenParticle * findParticle(HepMC::GenVertex *, const int requested_id)
std::vector< int > decayProduct
Abs< T >::type abs(const T &t)
HepMC::GenEvent::particle_const_iterator getNextBs(const HepMC::GenEvent::particle_const_iterator start, const HepMC::GenEvent::particle_const_iterator end)
BdecayFilter(const edm::ParameterSet &)
const HepMC::GenEvent * GetEvent() const
bool etaInRange(float eta, float etamin, float etamax)