19 #include "Math/GenVector/VectorUtil.h"
20 #include "Math/GenVector/PxPyPzE4D.h"
46 const unsigned nLabels = pixelTracksSources_.size();
47 for (
unsigned i=0;
i != nLabels;
i++ )
48 toks_pix_.push_back(consumes<reco::TrackCollection>(pixelTracksSources_[
i]));
62 produces< reco::IsolatedPixelTrackCandidateCollection >();
76 const double rad (dynamic_cast<const EcalBarrelGeometry*>( pG->getSubdetectorGeometry(
DetId::Ecal,
EcalBarrel ))->avgRadiusXYFrontFaceCenter() ) ;
78 const double zz (dynamic_cast<const EcalEndcapGeometry*>( pG->getSubdetectorGeometry(
DetId::Ecal,
EcalEndcap ))->avgAbsZFrontFaceCenter() ) ;
95 std::vector<reco::TrackRef> pixelTrackRefs;
100 for (reco::TrackCollection::const_iterator pit=iPixCol->begin(); pit!=iPixCol->end(); pit++) {
101 pixelTrackRefs.push_back(
reco::TrackRef(iPixCol,pit-iPixCol->begin()));
111 double ptTriggered = -10;
112 double etaTriggered = -100;
113 double phiTriggered = -100;
118 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1tauobjref;
119 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1jetobjref;
120 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1forjetobjref;
126 for (
unsigned int p=0;
p<l1tauobjref.size();
p++) {
127 if (l1tauobjref[
p]->
pt()>ptTriggered) {
128 ptTriggered = l1tauobjref[
p]->pt();
129 phiTriggered = l1tauobjref[
p]->phi();
130 etaTriggered = l1tauobjref[
p]->eta();
133 for (
unsigned int p=0;
p<l1jetobjref.size();
p++) {
134 if (l1jetobjref[
p]->
pt()>ptTriggered) {
135 ptTriggered = l1jetobjref[
p]->pt();
136 phiTriggered = l1jetobjref[
p]->phi();
137 etaTriggered = l1jetobjref[
p]->eta();
140 for (
unsigned int p=0;
p<l1forjetobjref.size();
p++) {
141 if (l1forjetobjref[
p]->
pt()>ptTriggered) {
142 ptTriggered=l1forjetobjref[
p]->pt();
143 phiTriggered=l1forjetobjref[
p]->phi();
144 etaTriggered=l1forjetobjref[
p]->eta();
151 std::vector<seedAtEC> VecSeedsatEC;
153 for (
unsigned iS=0; iS<pixelTrackRefs.size(); iS++) {
154 bool vtxMatch =
false;
156 reco::VertexCollection::const_iterator vitSel;
159 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
160 if (
std::abs(pixelTrackRefs[iS]->dz(vit->position()))<minDZ) {
161 minDZ =
std::abs(pixelTrackRefs[iS]->dz(vit->position()));
175 pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi());
180 l1extra::L1JetParticleCollection::const_iterator selj;
181 for (l1extra::L1JetParticleCollection::const_iterator tj=l1eTauJets->begin(); tj!=l1eTauJets->end(); tj++) {
182 if (
reco::deltaR(pixelTrackRefs[iS]->momentum().
eta(), pixelTrackRefs[iS]->momentum().
phi(), tj->momentum().eta(), tj->momentum().phi()) > drMaxL1Track_)
continue;
189 std::pair<double,double> seedCooAtEC;
191 if (found) seedCooAtEC=
GetEtaPhiAtEcal(pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi(), pixelTrackRefs[iS]->
pt(), pixelTrackRefs[iS]->charge(), vitSel->z());
193 else seedCooAtEC=
GetEtaPhiAtEcal(pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi(), pixelTrackRefs[iS]->
pt(), pixelTrackRefs[iS]->charge(), 0);
194 seedAtEC seed(iS,(tmatch||vtxMatch),seedCooAtEC.first,seedCooAtEC.second);
195 VecSeedsatEC.push_back(seed);
198 for (
unsigned int i=0;
i<VecSeedsatEC.size();
i++) {
199 unsigned int iSeed = VecSeedsatEC[
i].index;
200 if (!VecSeedsatEC[
i].
ok)
continue;
202 l1extra::L1JetParticleCollection::const_iterator selj;
203 for (l1extra::L1JetParticleCollection::const_iterator tj=l1eTauJets->begin(); tj!=l1eTauJets->end(); tj++) {
204 if (
reco::deltaR(pixelTrackRefs[iSeed]->momentum().
eta(),pixelTrackRefs[iSeed]->momentum().
phi(),tj->momentum().eta(),tj->momentum().phi()) > drMaxL1Track_)
continue;
209 for(
unsigned int j=0;
j<VecSeedsatEC.size();
j++) {
211 unsigned int iSurr = VecSeedsatEC[
j].index;
216 reco::VertexCollection::const_iterator vitSel2;
217 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
218 if (
std::abs(pixelTrackRefs[iSurr]->dz(vit->position()))<minDZ2) {
219 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->dz(vit->position()));
225 if (found&&
std::abs(pixelTrackRefs[iSurr]->dxy(vitSel2->position()))>
vtxCutIsol_)
continue;
228 sumP+=pixelTrackRefs[iSurr]->p();
229 if(pixelTrackRefs[iSurr]->
p()>maxP) maxP=pixelTrackRefs[iSurr]->p();
235 trackCollection->push_back(newCandidate);
240 std::auto_ptr< reco::IsolatedPixelTrackCandidateCollection > outCollection(trackCollection);
241 theEvent.
put(outCollection);
247 double theta1=2*atan(
exp(-eta1));
248 double theta2=2*atan(
exp(-eta2));
266 double Rcurv = 9999999;
269 double ecDist =
zEE_;
275 if ((0.5*ecRad/Rcurv)>1) {
279 deltaPhi =-charge*asin(0.5*ecRad/Rcurv);
280 double alpha1 = 2*asin(0.5*ecRad/Rcurv);
281 double z = ecRad/
tan(theta);
282 if (etaIP>0) zNew = z*(Rcurv*alpha1)/ecRad+vtxZ;
283 else zNew =-z*(Rcurv*alpha1)/ecRad+vtxZ;
286 etaEC = -
log(
tan(0.5*atan(ecRad/zAbs)));
287 deltaPhi = -charge*asin(0.5*ecRad/Rcurv);
290 zAbs = (
std::abs(etaIP)/etaIP)*ecDist;
291 double Zflight =
std::abs(zAbs-vtxZ);
292 double alpha = (Zflight*ecRad)/(z*Rcurv);
293 double Rec = 2*Rcurv*
sin(alpha/2);
294 deltaPhi =-charge*alpha/2;
295 etaEC =-
log(
tan(0.5*atan(Rec/ecDist)));
299 zNew = (
std::abs(etaIP)/etaIP)*ecDist;
300 double Zflight =
std::abs(zNew-vtxZ);
302 double Rec = 2*Rcurv*
sin(Rvirt/(2*Rcurv));
303 deltaPhi =-(charge)*(Rvirt/(2*Rcurv));
304 etaEC =-
log(
tan(0.5*atan(Rec/ecDist)));
307 if (zNew<0) etaEC=-etaEC;
310 if (phiEC<-
M_PI) phiEC += M_2_PI;
311 if (phiEC>
M_PI) phiEC -= M_2_PI;
313 std::pair<double,double> retVal(etaEC,phiEC);
std::pair< double, double > GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ)
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Sin< T >::type sin(const T &t)
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
IsolatedPixelTrackCandidateProducer(const edm::ParameterSet &ps)
~IsolatedPixelTrackCandidateProducer()
Global3DPoint GlobalPoint
Geom::Theta< T > theta() const
std::vector< edm::EDGetTokenT< reco::TrackCollection > > toks_pix_
double deltaR(const T1 &t1, const T2 &t2)
edm::EDGetTokenT< reco::VertexCollection > tok_vert_
std::vector< edm::InputTag > pixelTracksSources_
edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_l1_
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_
Abs< T >::type abs(const T &t)
std::vector< IsolatedPixelTrackCandidate > IsolatedPixelTrackCandidateCollection
collectin of IsolatedPixelTrackCandidate objects
GlobalVector inTesla(const GlobalPoint &g) const
Field value ad specified global point, in Tesla.
virtual void produce(edm::Event &evt, const edm::EventSetup &es)
double getDistInCM(double eta1, double phi1, double eta2, double phi2)
double pixelIsolationConeSizeAtEC_
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_
void SetEtaPhiEcal(double eta, double phi)
eta, phi at ECAL surface
T angle(T x1, T y1, T z1, T x2, T y2, T z2)