12 hadronCuts.type = iConfig.
getParameter<
int >(
"hadronType");
13 hadronCuts.etaMin = iConfig.
getParameter<
double>(
"hadronEtaMin");
14 hadronCuts.etaMax = iConfig.
getParameter<
double>(
"hadronEtaMax");
15 hadronCuts.ptMin = iConfig.
getParameter<
double>(
"hadronPtMin");
16 leptonCuts.type = iConfig.
getParameter<
int >(
"leptonType");
17 leptonCuts.etaMin = iConfig.
getParameter<
double>(
"leptonEtaMin");
18 leptonCuts.etaMax = iConfig.
getParameter<
double>(
"leptonEtaMax");
19 leptonCuts.ptMin = iConfig.
getParameter<
double>(
"leptonPtMin");
27 std::cout <<
"Total number of accepted events = " << noAccepted << std::endl;
45 const int requested_id)
47 for(std::vector<GenParticle*>::const_iterator
p = vertex->particles_out_const_begin();
48 p != vertex->particles_out_const_end();
p++)
50 int event_particle_id =
abs( (*p)->pdg_id() );
51 cout <<
"isC "<<event_particle_id<<
"\n";
52 if (requested_id == event_particle_id)
return *
p;
57 HepMC::GenEvent::particle_const_iterator
59 const HepMC::GenEvent::particle_const_iterator
end)
61 HepMC::GenEvent::particle_const_iterator
p;
62 for (p = start; p !=
end; p++)
64 int event_particle_id =
abs( (*p)->pdg_id() );
66 if (event_particle_id == 531)
return p;
80 bool event_passed =
false;
81 HepMC::GenEvent::particle_const_iterator bs = getNextBs(generated_event->particles_begin(),
82 generated_event->particles_end());
83 while (bs!= generated_event->particles_end() ) {
88 HepMC::GenVertex* outVertex = (*bs)->end_vertex();
95 int numChildren = outVertex->particles_out_size();
96 cout<<
"bs size "<<numChildren<<endl;
106 if( (numChildren==2) && ((jpsi = findParticle(outVertex, 443))!=
nullptr) &&
107 ((phi = findParticle(outVertex, 333))!=
nullptr)) {
109 cout << jpsi->momentum().rho()<<
" "<<jpsi->momentum().eta()
110 <<
" "<<phi->momentum().rho() <<
" "<<phi->momentum().eta()<<endl;
111 cout <<
"bs dec trouve"<<endl;
112 if (
cuts(phi, hadronCuts) &&
cuts(jpsi, leptonCuts)) {
113 cout <<
"OK trouve"<<endl;
118 bs = getNextBs(++bs, generated_event->particles_end());
121 if (event_passed) noAccepted++;
122 cout <<
"End filter\n";
124 delete generated_event;
150 HepMC::GenVertex* myVertex = jpsi->end_vertex();
151 int numChildren = myVertex->particles_out_size();
152 std::vector<HepMC::GenParticle*> psiChild;
153 for(std::vector<GenParticle*>::const_iterator
p = myVertex->particles_out_const_begin();
154 p != myVertex->particles_out_const_end();
p++)
155 psiChild.push_back((*
p));
158 cout << psiChild[0]->pdg_id()<<
" "<<psiChild[1]->pdg_id()<<endl;
160 if (psiChild.size()==2 && (
abs(psiChild[0]->
pdg_id()) == cut.
type) &&
163 cout << psiChild[0]->momentum().rho()<<
" "<<psiChild[0]->momentum().eta()
164 <<
" "<<psiChild[1]->momentum().rho()<<
" "<<psiChild[1]->momentum().eta()<<endl;
165 return ( (etaInRange(psiChild[0]->momentum().
eta(), cut.
etaMin, cut.
etaMax)) &&
167 (psiChild[0]->momentum().perp()> cut.
ptMin) &&
168 (psiChild[1]->momentum().perp()> cut.
ptMin));
177 return ( (etamin < eta) && (eta < etamax) );
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool cuts(const HepMC::GenParticle *jpsi, const CutStruct &cut)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
HepMC::GenEvent::particle_const_iterator getNextBs(const HepMC::GenEvent::particle_const_iterator start, const HepMC::GenEvent::particle_const_iterator end)
bool filter(edm::Event &, const edm::EventSetup &) override
HepMC::GenParticle * findParticle(HepMC::GenVertex *, const int requested_id)
BsJpsiPhiFilter(const edm::ParameterSet &)
Abs< T >::type abs(const T &t)
bool etaInRange(float eta, float etamin, float etamax)
const HepMC::GenEvent * GetEvent() const
~BsJpsiPhiFilter() override