32 #include "Math/GenVector/VectorUtil.h"
33 #include "Math/GenVector/PxPyPzE4D.h"
76 produces< reco::IsolatedPixelTrackCandidateCollection >();
91 const double rad (dynamic_cast<const EcalBarrelGeometry*>( pG->getSubdetectorGeometry(
DetId::Ecal,
EcalBarrel ))->avgRadiusXYFrontFaceCenter() ) ;
93 const double zz (dynamic_cast<const EcalEndcapGeometry*>( pG->getSubdetectorGeometry(
DetId::Ecal,
EcalEndcap ))->avgAbsZFrontFaceCenter() ) ;
105 std::vector<reco::TrackRef> pixelTrackRefs;
111 for (reco::TrackCollection::const_iterator pit=iPixCol->begin(); pit!=iPixCol->end(); pit++)
113 pixelTrackRefs.push_back(
reco::TrackRef(iPixCol,pit-iPixCol->begin()));
123 double ptTriggered = -10;
124 double etaTriggered = -100;
125 double phiTriggered = -100;
130 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1tauobjref;
131 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1jetobjref;
132 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1forjetobjref;
138 for (
unsigned int p=0;
p<l1tauobjref.size();
p++)
140 if (l1tauobjref[
p]->pt()>ptTriggered)
142 ptTriggered = l1tauobjref[
p]->pt();
143 phiTriggered = l1tauobjref[
p]->phi();
144 etaTriggered = l1tauobjref[
p]->eta();
147 for (
unsigned int p=0;
p<l1jetobjref.size();
p++)
149 if (l1jetobjref[
p]->pt()>ptTriggered)
151 ptTriggered = l1jetobjref[
p]->pt();
152 phiTriggered = l1jetobjref[
p]->phi();
153 etaTriggered = l1jetobjref[
p]->eta();
156 for (
unsigned int p=0;
p<l1forjetobjref.size();
p++)
158 if (l1forjetobjref[
p]->pt()>ptTriggered)
160 ptTriggered=l1forjetobjref[
p]->pt();
161 phiTriggered=l1forjetobjref[
p]->phi();
162 etaTriggered=l1forjetobjref[
p]->eta();
172 for (
unsigned iSeed=0; iSeed<pixelTrackRefs.size(); iSeed++)
174 if(pixelTrackRefs[iSeed]->
p()<minPTrack_)
continue;
177 bool vtxMatch =
false;
180 reco::VertexCollection::const_iterator vitSel;
182 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++)
184 if (fabs(pixelTrackRefs[iSeed]->dz(vit->position()))<minDZ)
186 minDZ = fabs(pixelTrackRefs[iSeed]->dz(vit->position()));
191 if (minDZ!=100&&fabs(pixelTrackRefs[iSeed]->dxy(vitSel->position()))<
vtxCutSeed_) vtxMatch=
true;
192 if (minDZ==100) vtxMatch=
true;
195 double R=
deltaR(etaTriggered, phiTriggered, pixelTrackRefs[iSeed]->
eta(), pixelTrackRefs[iSeed]->
phi());
200 l1extra::L1JetParticleCollection::const_iterator selj;
201 for (l1extra::L1JetParticleCollection::const_iterator tj=l1eTauJets->begin(); tj!=l1eTauJets->end(); tj++)
203 if(ROOT::Math::VectorUtil::DeltaR(pixelTrackRefs[iSeed]->momentum(),tj->momentum()) > drMaxL1Track_)
continue;
209 std::pair<double,double> seedCooAtEC;
211 if (minDZ!=100) seedCooAtEC=
GetEtaPhiAtEcal(theEventSetup, pixelTrackRefs[iSeed]->
eta(), pixelTrackRefs[iSeed]->
phi(), pixelTrackRefs[iSeed]->pt(), pixelTrackRefs[iSeed]->
charge(), vitSel->z());
213 else seedCooAtEC=
GetEtaPhiAtEcal(theEventSetup, pixelTrackRefs[iSeed]->
eta(), pixelTrackRefs[iSeed]->
phi(), pixelTrackRefs[iSeed]->pt(), pixelTrackRefs[iSeed]->
charge(), 0);
218 for (
unsigned iSurr=0; iSurr<pixelTrackRefs.size(); iSurr++)
220 if(iSeed==iSurr)
continue;
222 if (
deltaR(seedCooAtEC.first, seedCooAtEC.second, pixelTrackRefs[iSurr]->eta(), pixelTrackRefs[iSurr]->phi())>
prelimCone_)
continue;
225 reco::VertexCollection::const_iterator vitSel2;
226 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++)
228 if (fabs(pixelTrackRefs[iSurr]->dz(vit->position()))<minDZ2)
230 minDZ2 = fabs(pixelTrackRefs[iSurr]->dz(vit->position()));
235 if (minDZ2!=100&&fabs(pixelTrackRefs[iSurr]->dxy(vitSel2->position()))>
vtxCutIsol_)
continue;
237 std::pair<double,double> cooAtEC;
239 if (minDZ2!=100) cooAtEC=
GetEtaPhiAtEcal(theEventSetup, pixelTrackRefs[iSurr]->
eta(), pixelTrackRefs[iSurr]->
phi(), pixelTrackRefs[iSurr]->pt(), pixelTrackRefs[iSurr]->
charge(), vitSel2->z());
241 else cooAtEC=
GetEtaPhiAtEcal(theEventSetup, pixelTrackRefs[iSurr]->
eta(), pixelTrackRefs[iSurr]->
phi(), pixelTrackRefs[iSurr]->pt(), pixelTrackRefs[iSurr]->
charge(), 0);
246 sumP+=pixelTrackRefs[iSurr]->p();
247 if(pixelTrackRefs[iSurr]->
p()>maxP) maxP=pixelTrackRefs[iSurr]->p();
251 if (tmatch||vtxMatch) good=
true;
256 trackCollection->push_back(newCandidate);
262 std::auto_ptr< reco::IsolatedPixelTrackCandidateCollection > outCollection(trackCollection);
263 theEvent.
put(outCollection);
271 double theta1=2*atan(
exp(-eta1));
272 double theta2=2*atan(
exp(-eta2));
273 if (fabs(eta1)<1.479) Rec=129;
274 else if (fabs(eta1)>1.479&&fabs(eta1)<7.0) Rec=
tan(theta1)*317;
279 if (angle<acos(-1)/2)
return fabs((Rec/
sin(theta1))*
tan(angle));
284 std::pair<double,double>
294 double bfVal=BField.
mag();
300 double Rcurv = 9999999;
301 if (bfVal!=0) Rcurv=pT*33.3*100/(bfVal*10);
303 double ecDist =
zEE_;
307 if (theta>0.5*acos(-1)) theta=acos(-1)-
theta;
310 if ((0.5*ecRad/Rcurv)>1)
317 deltaPhi =-charge*asin(0.5*ecRad/Rcurv);
318 double alpha1 = 2*asin(0.5*ecRad/Rcurv);
319 double z = ecRad/
tan(theta);
320 if (etaIP>0) zNew = z*(Rcurv*alpha1)/ecRad+vtxZ;
321 else zNew =-z*(Rcurv*alpha1)/ecRad+vtxZ;
322 double zAbs=fabs(zNew);
325 etaEC = -
log(
tan(0.5*atan(ecRad/zAbs)));
326 deltaPhi = -charge*asin(0.5*ecRad/Rcurv);
330 zAbs = (fabs(etaIP)/etaIP)*ecDist;
331 double Zflight = fabs(zAbs-vtxZ);
332 double alpha = (Zflight*ecRad)/(z*Rcurv);
333 double Rec = 2*Rcurv*
sin(alpha/2);
334 deltaPhi =-charge*alpha/2;
335 etaEC =-
log(
tan(0.5*atan(Rec/ecDist)));
341 zNew = (fabs(etaIP)/etaIP)*ecDist;
342 double Zflight = fabs(zNew-vtxZ);
343 double Rvirt = fabs(Zflight*
tan(theta));
344 double Rec = 2*Rcurv*
sin(Rvirt/(2*Rcurv));
345 deltaPhi =-(
charge)*(Rvirt/(2*Rcurv));
346 etaEC =-
log(
tan(0.5*atan(Rec/ecDist)));
349 if (zNew<0) etaEC=-etaEC;
352 if (phiEC<-acos(-1)) phiEC = 2*acos(-1)+phiEC;
353 if (phiEC>acos(-1)) phiEC =-2*acos(-1)+phiEC;
355 std::pair<double,double> retVal(etaEC,phiEC);
T getParameter(std::string const &) const
virtual void beginRun(edm::Run &, const edm::EventSetup &)
edm::InputTag l1eTauJetsSource_
Sin< T >::type sin(const T &t)
IsolatedPixelTrackCandidateProducer(const edm::ParameterSet &ps)
~IsolatedPixelTrackCandidateProducer()
Global3DPoint GlobalPoint
Geom::Theta< T > theta() const
std::vector< edm::InputTag > pixelTracksSources_
std::pair< double, double > GetEtaPhiAtEcal(const edm::EventSetup &iSetup, double etaIP, double phiIP, double pT, int charge, double vtxZ)
edm::InputTag vertexLabel_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
double maxPForIsolationValue_
std::vector< IsolatedPixelTrackCandidate > IsolatedPixelTrackCandidateCollection
collectin of IsolatedPixelTrackCandidate objects
edm::InputTag hltGTseedlabel_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
GlobalVector inTesla(const GlobalPoint &g) const
Field value ad specified global point, in Tesla.
double deltaR(double eta1, double eta2, double phi1, double phi2)
virtual void produce(edm::Event &evt, const edm::EventSetup &es)
double getDistInCM(double eta1, double phi1, double eta2, double phi2)
double pixelIsolationConeSizeAtEC_
T angle(T x1, T y1, T z1, T x2, T y2, T z2)