16 particleCharge(iConfig.getUntrackedParameter(
"ParticleCharge",0)),
17 minInvMass(iConfig.getUntrackedParameter(
"MinInvMass", 0.)),
18 maxInvMass(iConfig.getUntrackedParameter(
"MaxInvMass", 14000.)),
19 minDeltaPhi(iConfig.getUntrackedParameter(
"MinDeltaPhi", 0.)),
20 maxDeltaPhi(iConfig.getUntrackedParameter(
"MaxDeltaPhi", 6.3)),
21 minDeltaR(iConfig.getUntrackedParameter(
"MinDeltaR",0.)),
22 maxDeltaR(iConfig.getUntrackedParameter(
"MaxDeltaR",10000.)),
23 betaBoost(iConfig.getUntrackedParameter(
"BetaBoost",0.))
32 vector<double> defptmin;
33 defptmin.push_back(0.);
35 vector<double> defpmin;
36 defpmin.push_back(0.);
39 vector<double> defetamin;
40 defetamin.push_back(-10.);
42 vector<double> defetamax ;
43 defetamax.push_back(10.);
56 cout <<
"WARNING: MCParticlePairFilter : size of some vectors not matching with 2!!" << endl;
60 if (2 >
ptMin.size() ){
61 vector<double> defptmin2 ;
62 for (
unsigned int i = 0;
i < 2;
i++){ defptmin2.push_back(0.);}
66 if (2 >
pMin.size() ){
67 vector<double> defpmin2 ;
68 for (
unsigned int i = 0;
i < 2;
i++){ defpmin2.push_back(0.);}
73 vector<double> defetamin2 ;
74 for (
unsigned int i = 0;
i < 2;
i++){ defetamin2.push_back(-10.);}
79 vector<double> defetamax2 ;
80 for (
unsigned int i = 0;
i < 2;
i++){ defetamax2.push_back(10.);}
85 vector<int> defstat2 ;
86 for (
unsigned int i = 0;
i < 2;
i++){ defstat2.push_back(0);}
109 const double pi = 3.14159;
111 vector<HepMC::GenParticle*> typeApassed;
112 vector<HepMC::GenParticle*> typeBpassed;
118 for ( HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
119 p != myGenEvent->particles_end(); ++
p ) {
122 bool gottypeAID =
false;
131 if ( mom.perp() >
ptMin[0] && mom.rho() >
pMin[0] && mom.eta() >
etaMin[0]
137 double phi1 = mom.phi();
140 double eta1 = mom.eta();
151 while(!accepted && i<typeBpassed.size()) {
156 charge1 =
charge((*p)->pdg_id());
162 invmass=
sqrt(tot_e*tot_e-tot_x*tot_x-tot_y*tot_y-tot_z*tot_z);
163 combcharge = charge1 *
charge(typeBpassed[i]->
pdg_id());
166 deltaphi = fabs(phi1-phi2);
167 if(deltaphi > pi) deltaphi = 2.*pi-deltaphi;
170 deltaeta=fabs(eta1-eta2);
171 deltaR =
sqrt(deltaeta*deltaeta+deltaphi*deltaphi);
184 typeApassed.push_back(*
p);
191 bool gottypeBID =
false;
200 if ( mom.perp() >
ptMin[1] && mom.rho() >
pMin[1] && mom.eta() >
etaMin[1]
206 double phi1 = mom.phi();
209 double eta1 = mom.eta();
220 while(!accepted && i<typeApassed.size()) {
221 if((*
p) != typeApassed[
i]) {
226 charge1 =
charge((*p)->pdg_id());
232 invmass=
sqrt(tot_e*tot_e-tot_x*tot_x-tot_y*tot_y-tot_z*tot_z);
233 combcharge = charge1 *
charge(typeApassed[i]->
pdg_id());
236 deltaphi = fabs(phi1-phi2);
237 if(deltaphi > pi) deltaphi = 2.*pi-deltaphi;
240 deltaeta=fabs(eta1-eta2);
241 deltaR =
sqrt(deltaeta*deltaeta+deltaphi*deltaphi);
255 typeBpassed.push_back(*
p);
261 if (accepted){
return true; }
else {
return false;}
273 int kqa,kq1,kq2,kq3,kqj,irt,kqx,kqn;
277 constexpr const int ichg[109]={-1,2,-1,2,-1,2,-1,2,0,0,-3,0,-3,0,-3,0,
278 -3,0,0,0,0,0,0,3,0,0,0,0,0,0,3,0,3,6,0,0,3,6,0,0,-1,2,-1,2,-1,2,0,0,0,0,
279 -3,0,-3,0,-3,0,0,0,0,0,-1,2,-1,2,-1,2,0,0,0,0,
280 -3,0,-3,0,-3,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
286 kqn=kqa/1000000000%10;
296 if(kqa==0 || kqa >= 10000000) {
298 if(kqn==1) {hepchg=0;}
301 else if(kqa<=100) {hepchg = ichg[kqa-1];}
303 else if(kqj == 0) {hepchg = 0;}
305 else if(kqx>0 && irt<100)
307 hepchg = ichg[irt-1];
308 if(kqa==1000017 || kqa==1000018) {hepchg = 0;}
309 if(kqa==1000034 || kqa==1000052) {hepchg = 0;}
310 if(kqa==1000053 || kqa==1000054) {hepchg = 0;}
311 if(kqa==5100061 || kqa==5100062) {hepchg = 6;}
317 hepchg = ichg[kq2-1]-ichg[kq1-1];
319 if((kq2==3) || (kq2==5)) {hepchg = ichg[kq1-1]-ichg[kq2-1];}
323 hepchg = ichg[kq3-1] + ichg[kq2-1];
328 hepchg = ichg[kq3-1]+ichg[kq2-1]+ichg[kq1-1];
332 if(Id<0 && hepchg!=0) {hepchg = -1*hepchg;}
HepMC::FourVector zboost(const HepMC::FourVector &, double)
T getUntrackedParameter(std::string const &, T const &) const
std::vector< double > ptMin
std::vector< double > pMin
std::vector< double > etaMin
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MCParticlePairFilter(const edm::ParameterSet &)
bool filter(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
std::vector< int > particleID1
std::vector< double > etaMax
std::vector< int > particleID2
~MCParticlePairFilter() override
Abs< T >::type abs(const T &t)
const edm::EDGetTokenT< edm::HepMCProduct > token_
const HepMC::GenEvent * GetEvent() const
bool accepted(std::vector< std::string_view > const &, std::string_view)
std::vector< int > status