20 #include "Math/GenVector/VectorUtil.h"
21 #include "Math/GenVector/PxPyPzE4D.h"
42 tok_hlt_( consumes<trigger::TriggerFilterObjectWithRefs>(config.getParameter<edm::
InputTag>(
"L1GTSeedLabel")) ),
46 config.getParameter<std::vector<edm::
InputTag> >(
"PixelTracksSources"),
63 produces< reco::IsolatedPixelTrackCandidateCollection >();
75 const double rad (dynamic_cast<const EcalBarrelGeometry*>( pG->getSubdetectorGeometry(
DetId::Ecal,
EcalBarrel ))->avgRadiusXYFrontFaceCenter() ) ;
76 const double zz (dynamic_cast<const EcalEndcapGeometry*>( pG->getSubdetectorGeometry(
DetId::Ecal,
EcalEndcap ))->avgAbsZFrontFaceCenter() ) ;
93 std::vector<reco::TrackRef> pixelTrackRefs;
95 for (
unsigned int iPix=0; iPix<
toks_pix_.size(); iPix++) {
98 for (reco::TrackCollection::const_iterator pit=iPixCol->begin(); pit!=iPixCol->end(); pit++) {
99 pixelTrackRefs.push_back(
reco::TrackRef(iPixCol,pit-iPixCol->begin()));
109 double ptTriggered = -10;
110 double etaTriggered = -100;
111 double phiTriggered = -100;
116 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1tauobjref;
117 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1jetobjref;
118 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1forjetobjref;
124 for (
unsigned int p=0;
p<l1tauobjref.size();
p++) {
125 if (l1tauobjref[
p]->
pt()>ptTriggered) {
126 ptTriggered = l1tauobjref[
p]->pt();
127 phiTriggered = l1tauobjref[
p]->phi();
128 etaTriggered = l1tauobjref[
p]->eta();
131 for (
unsigned int p=0;
p<l1jetobjref.size();
p++) {
132 if (l1jetobjref[
p]->
pt()>ptTriggered) {
133 ptTriggered = l1jetobjref[
p]->pt();
134 phiTriggered = l1jetobjref[
p]->phi();
135 etaTriggered = l1jetobjref[
p]->eta();
138 for (
unsigned int p=0;
p<l1forjetobjref.size();
p++) {
139 if (l1forjetobjref[
p]->
pt()>ptTriggered) {
140 ptTriggered=l1forjetobjref[
p]->pt();
141 phiTriggered=l1forjetobjref[
p]->phi();
142 etaTriggered=l1forjetobjref[
p]->eta();
149 std::vector<seedAtEC> VecSeedsatEC;
151 for (
unsigned iS=0; iS<pixelTrackRefs.size(); iS++) {
152 bool vtxMatch =
false;
154 reco::VertexCollection::const_iterator vitSel;
157 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
158 if (
std::abs(pixelTrackRefs[iS]->dz(vit->position()))<minDZ) {
159 minDZ =
std::abs(pixelTrackRefs[iS]->dz(vit->position()));
173 pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi());
178 l1extra::L1JetParticleCollection::const_iterator selj;
179 for (l1extra::L1JetParticleCollection::const_iterator tj=l1eTauJets->begin(); tj!=l1eTauJets->end(); tj++) {
180 if (
reco::deltaR(pixelTrackRefs[iS]->momentum().
eta(), pixelTrackRefs[iS]->momentum().
phi(), tj->momentum().eta(), tj->momentum().phi()) > drMaxL1Track_)
continue;
187 std::pair<double,double> seedCooAtEC;
189 if (found) seedCooAtEC=
GetEtaPhiAtEcal(pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi(), pixelTrackRefs[iS]->
pt(), pixelTrackRefs[iS]->
charge(), vitSel->z());
191 else seedCooAtEC=
GetEtaPhiAtEcal(pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi(), pixelTrackRefs[iS]->
pt(), pixelTrackRefs[iS]->
charge(), 0);
192 seedAtEC seed(iS,(tmatch||vtxMatch),seedCooAtEC.first,seedCooAtEC.second);
193 VecSeedsatEC.push_back(seed);
196 for (
unsigned int i=0;
i<VecSeedsatEC.size();
i++) {
197 unsigned int iSeed = VecSeedsatEC[
i].index;
198 if (!VecSeedsatEC[
i].
ok)
continue;
200 l1extra::L1JetParticleCollection::const_iterator selj;
201 for (l1extra::L1JetParticleCollection::const_iterator tj=l1eTauJets->begin(); tj!=l1eTauJets->end(); tj++) {
202 if (
reco::deltaR(pixelTrackRefs[iSeed]->momentum().
eta(),pixelTrackRefs[iSeed]->momentum().
phi(),tj->momentum().eta(),tj->momentum().phi()) > drMaxL1Track_)
continue;
207 for(
unsigned int j=0;
j<VecSeedsatEC.size();
j++) {
209 unsigned int iSurr = VecSeedsatEC[
j].index;
214 reco::VertexCollection::const_iterator vitSel2;
215 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
216 if (
std::abs(pixelTrackRefs[iSurr]->dz(vit->position()))<minDZ2) {
217 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->dz(vit->position()));
223 if (found&&
std::abs(pixelTrackRefs[iSurr]->dxy(vitSel2->position()))>
vtxCutIsol_)
continue;
226 sumP+=pixelTrackRefs[iSurr]->p();
227 if(pixelTrackRefs[iSurr]->
p()>maxP) maxP=pixelTrackRefs[iSurr]->p();
233 trackCollection->push_back(newCandidate);
238 std::auto_ptr< reco::IsolatedPixelTrackCandidateCollection > outCollection(trackCollection);
239 theEvent.
put(outCollection);
245 double theta1=2*atan(
exp(-eta1));
246 double theta2=2*atan(
exp(-eta2));
264 double Rcurv = 9999999;
267 double ecDist =
zEE_;
273 if ((0.5*ecRad/Rcurv)>1) {
277 deltaPhi =-charge*asin(0.5*ecRad/Rcurv);
278 double alpha1 = 2*asin(0.5*ecRad/Rcurv);
279 double z = ecRad/
tan(theta);
280 if (etaIP>0) zNew = z*(Rcurv*alpha1)/ecRad+vtxZ;
281 else zNew =-z*(Rcurv*alpha1)/ecRad+vtxZ;
284 etaEC = -
log(
tan(0.5*atan(ecRad/zAbs)));
285 deltaPhi = -charge*asin(0.5*ecRad/Rcurv);
288 zAbs = (
std::abs(etaIP)/etaIP)*ecDist;
289 double Zflight =
std::abs(zAbs-vtxZ);
290 double alpha = (Zflight*ecRad)/(z*Rcurv);
291 double Rec = 2*Rcurv*
sin(alpha/2);
292 deltaPhi =-charge*alpha/2;
293 etaEC =-
log(
tan(0.5*atan(Rec/ecDist)));
297 zNew = (
std::abs(etaIP)/etaIP)*ecDist;
298 double Zflight =
std::abs(zNew-vtxZ);
300 double Rec = 2*Rcurv*
sin(Rvirt/(2*Rcurv));
301 deltaPhi =-(
charge)*(Rvirt/(2*Rcurv));
302 etaEC =-
log(
tan(0.5*atan(Rec/ecDist)));
305 if (zNew<0) etaEC=-etaEC;
308 if (phiEC<-
M_PI) phiEC += M_2_PI;
309 if (phiEC>
M_PI) phiEC -= M_2_PI;
311 std::pair<double,double> retVal(etaEC,phiEC);
std::pair< double, double > GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ)
const std::vector< edm::EDGetTokenT< reco::TrackCollection > > toks_pix_
const double ebEtaBoundary_
tauAssocCone_(config.getParameter< double >("tauAssociationCone"))
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
const double tauUnbiasCone_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_
const edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_l1_
Sin< T >::type sin(const T &t)
IsolatedPixelTrackCandidateProducer(const edm::ParameterSet &ps)
~IsolatedPixelTrackCandidateProducer()
Global3DPoint GlobalPoint
Geom::Theta< T > theta() const
std::vector< Vertex > VertexCollection
collection of Vertex objects
vtxCutIsol_(config.getParameter< double >("MaxVtxDXYIsol"))
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
const double tauAssocCone_
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)
Abs< T >::type abs(const T &t)
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
std::vector< IsolatedPixelTrackCandidate > IsolatedPixelTrackCandidateCollection
collectin of IsolatedPixelTrackCandidate objects
void setEtaPhiEcal(double eta, double phi)
eta, phi at ECAL surface
minPTrackValue_(config.getParameter< double >("minPTrack"))
vtxCutSeed_(config.getParameter< double >("MaxVtxDXYSeed"))
GlobalVector inTesla(const GlobalPoint &g) const
Field value ad specified global point, in Tesla.
prelimCone_(config.getParameter< double >("ExtrapolationConeSize"))
const edm::EDGetTokenT< reco::VertexCollection > tok_vert_
const double minPTrackValue_
const double pixelIsolationConeSizeAtEC_
const double maxPForIsolationValue_
bfield_(config.getParameter< std::string >("MagFieldRecordName"))
double getDistInCM(double eta1, double phi1, double eta2, double phi2)
tauUnbiasCone_(config.getParameter< double >("tauUnbiasCone"))
pixelIsolationConeSizeAtEC_(config.getParameter< double >("PixelIsolationConeSizeAtEC"))
virtual void produce(edm::Event &evt, const edm::EventSetup &es) override
maxPForIsolationValue_(config.getParameter< double >("maxPTrackForIsolation"))
ebEtaBoundary_(config.getParameter< double >("EBEtaBoundary"))
T angle(T x1, T y1, T z1, T x2, T y2, T z2)