6 #include "CLHEP/Random/RandomEngine.h" 7 #include "CLHEP/Units/GlobalPhysicalConstants.h" 19 double Rcurv=pT*33.3*100/38;
23 if (fabs(etaIP)<1.479) {
24 deltaPhi=-charge*asin(0.5*
ecRad_/Rcurv);
25 double alpha1=2*asin(0.5*
ecRad_/Rcurv);
27 if (etaIP>0) zNew=z*(Rcurv*alpha1)/
ecRad_+vtxZ;
28 else zNew=-z*(Rcurv*alpha1)/
ecRad_+vtxZ;
29 double zAbs=fabs(zNew);
32 deltaPhi=-charge*asin(0.5*
ecRad_/Rcurv);
35 zAbs=(fabs(etaIP)/etaIP)*
ecDist_;
36 double Zflight=fabs(zAbs-vtxZ);
38 double Rec=2*Rcurv*
sin(alpha/2);
39 deltaPhi=-charge*alpha/2;
43 zNew=(fabs(etaIP)/etaIP)*
ecDist_;
44 double Zflight=fabs(zNew-vtxZ);
45 double Rvirt=fabs(Zflight*
tan(theta));
46 double Rec=2*Rcurv*
sin(Rvirt/(2*Rcurv));
47 deltaPhi=-(
charge)*(Rvirt/(2*Rcurv));
51 if (zNew<0) etaEC=-etaEC;
57 std::pair<double,double> retVal(etaEC,phiEC);
64 if (fabs(eta1)<1.479) Rec=
ecRad_;
66 double ce1=cosh(eta1);
67 double ce2=cosh(eta2);
68 double te1=tanh(eta1);
69 double te2=tanh(eta2);
71 double z=
cos(phi1-phi2)/ce1/ce2+te1*te2;
72 if(z!=0) dR=fabs(Rec*ce1*
sqrt(1./z/z-1.));
105 std::vector<const HepMC::GenParticle *> seeds;
108 for (HepMC::GenEvent::particle_const_iterator iter=myGenEvent->particles_begin(); iter!=myGenEvent->particles_end(); ++iter) {
110 if (!(pdt->particle(p->pdg_id())))
continue;
111 int charge3 = pdt->particle(p->pdg_id())->
ID().threeCharge();
113 double momentum = p->momentum().rho();
114 double abseta = fabs(p->momentum().eta());
118 chargedParticles.push_back(p);
126 unsigned int ntrk(0);
127 for (std::vector<const HepMC::GenParticle *>::const_iterator it1=seeds.begin(); it1!=seeds.end(); ++it1) {
129 if (!(pdt->particle(p1->pdg_id())))
continue;
130 if (p1->pdg_id() < -100 || p1->pdg_id() > 100 || (!
onlyHadrons_)) {
132 p1->momentum().phi(),
133 p1->momentum().perp(),
134 (pdt->particle(p1->pdg_id()))->ID().threeCharge()/3,
139 for (std::vector<const HepMC::GenParticle *>::const_iterator it2=chargedParticles.begin(); it2!=chargedParticles.end(); ++it2) {
146 p2->momentum().phi(),
147 p2->momentum().perp(),
148 (pdt->particle(p2->pdg_id()))->ID().threeCharge()/3,
161 if (!failsIso) ++ntrk;
173 globalCache()->nAll_ +=
nAll_;
174 globalCache()->nGood_ +=
nGood_;
178 edm::LogInfo(
"PythiaFilter") <<
"PythiaFilterIsolatedTrack::Accepts " 179 << count->
nGood_ <<
" events out of " 180 << count->
nAll_ << std::endl;
T getUntrackedParameter(std::string const &, T const &) const
static void globalEndJob(const PythiaFilterIsoTracks::Counters *counters)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Sin< T >::type sin(const T &t)
PythiaFilterIsolatedTrack(const edm::ParameterSet &, const PythiaFilterIsoTracks::Counters *count)
Geom::Theta< T > theta() const
void endStream() override
bool getData(T &iHolder) const
std::atomic< unsigned int > nAll_
Cos< T >::type cos(const T &t)
edm::EDGetTokenT< edm::HepMCProduct > token_
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
~PythiaFilterIsolatedTrack() override
std::atomic< unsigned int > nGood_
double getDistInCM(double eta1, double phi1, double eta2, double phi2)
const HepMC::GenEvent * GetEvent() const
bool filter(edm::Event &, edm::EventSetup const &) override
std::pair< double, double > GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ)