19 #include "CLHEP/Vector/LorentzVector.h"
33 ECALBARRELMAXETA_=1.479;
34 ECALBARRELRADIUS_=129.0;
39 isoGenParETMin_=(float) iConfig.
getParameter<
double>(
"isoGenParETMin");
40 isoGenParConeSize_=(float) iConfig.
getParameter<
double>(
"isoGenParConeSize");
41 clusterThreshold_=(float) iConfig.
getParameter<
double>(
"clusterThreshold");
42 isoConeSize_=(float) iConfig.
getParameter<
double>(
"isoConeSize");
43 hOverEMax_=(float) iConfig.
getParameter<
double>(
"hOverEMax");
44 tkIsoMax_=(float) iConfig.
getParameter<
double>(
"tkIsoMax");
45 caloIsoMax_=(float) iConfig.
getParameter<
double>(
"caloIsoMax");
46 requireTrackMatch_=iConfig.
getParameter<
bool>(
"requireTrackMatch");
59 iEvent.
getByLabel(genParSource_,genParsHandle);
63 std::vector<reco::GenParticle> genParsCurved=applyBFieldCurv(genPars,iSetup);
65 bool result1=filterPhotonElectronSeed(clusterThreshold_,
74 bool result2=filterIsoGenPar(isoGenParETMin_,isoGenParConeSize_,genPars,genParsCurved);
77 bool result=result1 || result2;
96 bool requiretrackmatch,
97 const std::vector<reco::GenParticle> &genPars,
98 const std::vector<reco::GenParticle> &genParsCurved) {
100 float seedthreshold=5;
101 float conesizeendcap=15;
105 vector<reco::GenParticle> seeds;
107 for (uint32_t is=0;is<genParsCurved.size();is++) {
109 if (gp.
status()!=1 || fabs(gp.
eta()) > FILTER_ETA_MAX_ || fabs(gp.
eta()) < FILTER_ETA_MIN_)
continue;
111 if (absid!=11 && absid!=22)
continue;
112 if (gp.
et()>seedthreshold) seeds.push_back(gp);
115 bool matchtrack=
false;
118 for (uint32_t is=0;is<seeds.size();is++) {
123 bool isBarrel=fabs(seeds.at(is).eta())<ECALBARRELMAXETA_;
124 for (uint32_t ig=0;ig<genParsCurved.size();ig++) {
127 if (gp.
status()!=1)
continue;
129 if (gp.
et()<1)
continue;
132 float dr=
deltaR(seeds.at(is),gp);
134 float deta=fabs(seeds.at(is).eta()-gp.
eta());
135 if (deta<0.03 && dphi<0.2) {
136 if (gpabsid==22 || gpabsid==11 || gpabsid==211 || gpabsid==321) {
140 if ((gpabsid==11 || gpabsid==211 || gpabsid==321) && gp.
et()>5) matchtrack=
true;
146 float drUnCurv=
deltaR(seeds.at(is),gpUnCurv);
147 if ((gp.
charge()==0 && dr<isoConeSize && gpabsid!=22) ||
148 (gp.
charge()!=0 && drUnCurv<isoConeSize)) {
152 if (gp.
charge()!=0 && drUnCurv<isoConeSize) {
159 float drxy=deltaRxyAtEE(seeds.at(is),gp);
160 float dr=
deltaR(seeds.at(is),gp);
161 if (drxy<conesizeendcap) {
162 if (gpabsid==22 || gpabsid==11 || gpabsid==211 || gpabsid==321) {
166 if ((gpabsid==11 || gpabsid==211 || gpabsid==321) && gp.
et()>5) matchtrack=
true;
172 float drUnCurv=
deltaR(seeds.at(is),gpUnCurv);
173 if ((gp.
charge()==0 && dr<isoConeSize && gpabsid!=22) ||
174 (gp.
charge()!=0 && drUnCurv<isoConeSize)) {
178 if (gp.
charge()!=0 && drUnCurv<isoConeSize) {
186 if (eTInCone>clusterthreshold && (!requiretrackmatch || matchtrack)) {
188 if (hadET/eTInCone<hOverEMax && tkIsoET<tkIsoMax && caloIsoET<caloIsoMax) retval=
true;
204 vector<reco::GenParticle> curvedPars;
215 for (uint32_t ig=0;ig<genPars.size();ig++) {
221 curvedPars.push_back(gp);
229 if (fabs(gp.
eta())<ECALBARRELMAXETA_) {
230 impact=propagator.propagate(fts,*theBarrel);
231 }
else if (gp.
eta()>0) {
232 impact=propagator.propagate(fts,*endCapPlus);
234 impact=propagator.propagate(fts,*endCapMinus);
238 if (!impact.isValid()) {
239 curvedPars.push_back(gp);
248 float phinew=impact.globalPosition().phi();
249 float pxnew=et*
cos(phinew);
250 float pynew=et*
sin(phinew);
253 newp4.SetPz(gp.
pz());
257 curvedPars.push_back(gpnew);
268 if (gp1.
pz()*gp2.
pz() < 0)
return 9999.;
270 float rxy1=ECALENDCAPZ_*
tan(gp1.
theta());
271 float x1=
cos(gp1.
phi())*rxy1;
272 float y1=
sin(gp1.
phi())*rxy1;
274 float rxy2=ECALENDCAPZ_*
tan(gp2.
theta());
275 float x2=
cos(gp2.
phi())*rxy2;
276 float y2=
sin(gp2.
phi())*rxy2;
278 float dxy=
sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
295 for (uint32_t ip=0;ip<gph.size();ip++) {
301 if (gp.
et()<=etmin || gp.
status()!=1)
continue;
302 if (gpabsid!=11 && gpabsid != 211 && gpabsid!= 321)
continue;
303 if (fabs(gp.
eta()) < FILTER_ETA_MIN_)
continue;
304 if (fabs(gp.
eta()) > FILTER_ETA_MAX_)
continue;
309 for (uint32_t jp=0;jp<gph.size();jp++) {
310 if (jp==ip)
continue;
313 if (pp.
status() != 1)
continue;
315 float drCurved=
deltaR(gpCurved,ppCurved);
316 if (
abs(pp.
charge())==1 && pp.
et()>2 && dr<conesize) {
319 if (pp.
et()>2 &&
abs(pp.
pdgId())!=22 && drCurved<conesize) {
323 if (tkiso<FILTER_TKISOCUT_ && caloiso<FILTER_CALOISOCUT_)
return true;
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
virtual int pdgId() const
PDG identifier.
virtual double et() const
transverse energy
EMEnrichingFilterAlgo(const edm::ParameterSet &)
virtual int status() const
status word
bool isBarrel(GeomDetEnumerators::SubDetector m)
Sin< T >::type sin(const T &t)
float deltaRxyAtEE(const reco::GenParticle &gp1, const reco::GenParticle &gp2)
virtual void setP4(const LorentzVector &p4)
set 4-momentum
virtual double vy() const
y coordinate of vertex position
virtual double eta() const
momentum pseudorapidity
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=0)
virtual double energy() const
energy
bool filterIsoGenPar(float etmin, float conesize, const reco::GenParticleCollection &gph, const reco::GenParticleCollection &gphCurved)
Cos< T >::type cos(const T &t)
virtual int charge() const
electric charge
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
bool filter(const edm::Event &iEvent, const edm::EventSetup &iSetup)
virtual double vz() const
z coordinate of vertex position
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual double theta() const
momentum polar angle
double deltaR(double eta1, double eta2, double phi1, double phi2)
virtual double px() const
x coordinate of momentum vector
virtual double pz() const
z coordinate of momentum vector
virtual double vx() const
x coordinate of vertex position
std::vector< reco::GenParticle > applyBFieldCurv(const std::vector< reco::GenParticle > &genPars, const edm::EventSetup &iSetup)
virtual double phi() const
momentum azimuthal angle
bool filterPhotonElectronSeed(float clusterthreshold, float isoConeSize, float hOverEMax, float tkIsoMax, float caloIsoMax, bool requiretrackmatch, const std::vector< reco::GenParticle > &genPars, const std::vector< reco::GenParticle > &genParsCurved)
virtual double py() const
y coordinate of momentum vector
tuple AnalyticalPropagator