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<l1t::TauBxCollection> > l1tauobjref;
117 std::vector< edm::Ref<l1t::JetBxCollection> > l1jetobjref;
122 for (
unsigned int p=0;
p<l1tauobjref.size();
p++) {
123 if (l1tauobjref[
p]->
pt()>ptTriggered) {
124 ptTriggered = l1tauobjref[
p]->pt();
125 phiTriggered = l1tauobjref[
p]->phi();
126 etaTriggered = l1tauobjref[
p]->eta();
129 for (
unsigned int p=0;
p<l1jetobjref.size();
p++) {
130 if (l1jetobjref[
p]->
pt()>ptTriggered) {
131 ptTriggered = l1jetobjref[
p]->pt();
132 phiTriggered = l1jetobjref[
p]->phi();
133 etaTriggered = l1jetobjref[
p]->eta();
140 std::vector<seedAtEC> VecSeedsatEC;
142 for (
unsigned iS=0; iS<pixelTrackRefs.size(); iS++) {
143 bool vtxMatch =
false;
145 reco::VertexCollection::const_iterator vitSel;
148 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
149 if (
std::abs(pixelTrackRefs[iS]->dz(vit->position()))<minDZ) {
150 minDZ =
std::abs(pixelTrackRefs[iS]->dz(vit->position()));
164 pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi());
171 if (
reco::deltaR(pixelTrackRefs[iS]->momentum().
eta(), pixelTrackRefs[iS]->momentum().
phi(), tj->momentum().eta(), tj->momentum().phi()) > drMaxL1Track_)
continue;
178 std::pair<double,double> seedCooAtEC;
180 if (found) seedCooAtEC=
GetEtaPhiAtEcal(pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi(), pixelTrackRefs[iS]->
pt(), pixelTrackRefs[iS]->
charge(), vitSel->z());
182 else seedCooAtEC=
GetEtaPhiAtEcal(pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi(), pixelTrackRefs[iS]->
pt(), pixelTrackRefs[iS]->
charge(), 0);
183 seedAtEC seed(iS,(tmatch||vtxMatch),seedCooAtEC.first,seedCooAtEC.second);
184 VecSeedsatEC.push_back(seed);
187 for (
unsigned int i=0;
i<VecSeedsatEC.size();
i++) {
188 unsigned int iSeed = VecSeedsatEC[
i].index;
189 if (!VecSeedsatEC[
i].
ok)
continue;
193 if (
reco::deltaR(pixelTrackRefs[iSeed]->momentum().
eta(),pixelTrackRefs[iSeed]->momentum().
phi(),tj->momentum().eta(),tj->momentum().phi()) > drMaxL1Track_)
continue;
198 for(
unsigned int j=0;
j<VecSeedsatEC.size();
j++) {
200 unsigned int iSurr = VecSeedsatEC[
j].index;
205 reco::VertexCollection::const_iterator vitSel2;
206 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
207 if (
std::abs(pixelTrackRefs[iSurr]->dz(vit->position()))<minDZ2) {
208 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->dz(vit->position()));
214 if (found&&
std::abs(pixelTrackRefs[iSurr]->dxy(vitSel2->position()))>
vtxCutIsol_)
continue;
217 sumP+=pixelTrackRefs[iSurr]->p();
218 if(pixelTrackRefs[iSurr]->
p()>maxP) maxP=pixelTrackRefs[iSurr]->p();
224 trackCollection->push_back(newCandidate);
229 std::auto_ptr< reco::IsolatedPixelTrackCandidateCollection > outCollection(trackCollection);
230 theEvent.
put(outCollection);
236 double theta1=2*atan(
exp(-eta1));
237 double theta2=2*atan(
exp(-eta2));
255 double Rcurv = 9999999;
258 double ecDist =
zEE_;
264 if ((0.5*ecRad/Rcurv)>1) {
268 deltaPhi =-charge*asin(0.5*ecRad/Rcurv);
269 double alpha1 = 2*asin(0.5*ecRad/Rcurv);
270 double z = ecRad/
tan(theta);
271 if (etaIP>0) zNew = z*(Rcurv*alpha1)/ecRad+vtxZ;
272 else zNew =-z*(Rcurv*alpha1)/ecRad+vtxZ;
275 etaEC = -
log(
tan(0.5*atan(ecRad/zAbs)));
276 deltaPhi = -charge*asin(0.5*ecRad/Rcurv);
279 zAbs = (
std::abs(etaIP)/etaIP)*ecDist;
280 double Zflight =
std::abs(zAbs-vtxZ);
281 double alpha = (Zflight*ecRad)/(z*Rcurv);
282 double Rec = 2*Rcurv*
sin(alpha/2);
283 deltaPhi =-charge*alpha/2;
284 etaEC =-
log(
tan(0.5*atan(Rec/ecDist)));
288 zNew = (
std::abs(etaIP)/etaIP)*ecDist;
289 double Zflight =
std::abs(zNew-vtxZ);
291 double Rec = 2*Rcurv*
sin(Rvirt/(2*Rcurv));
292 deltaPhi =-(
charge)*(Rvirt/(2*Rcurv));
293 etaEC =-
log(
tan(0.5*atan(Rec/ecDist)));
296 if (zNew<0) etaEC=-etaEC;
299 if (phiEC<-
M_PI) phiEC += M_2_PI;
300 if (phiEC>
M_PI) phiEC -= M_2_PI;
302 std::pair<double,double> retVal(etaEC,phiEC);
virtual void produce(edm::Event &evt, const edm::EventSetup &es) override
tauAssocCone_(config.getParameter< double >("tauAssociationCone"))
IsolatedPixelTrackCandidateL1TProducer(const edm::ParameterSet &ps)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
const double maxPForIsolationValue_
double getDistInCM(double eta1, double phi1, double eta2, double phi2)
const double pixelIsolationConeSizeAtEC_
Sin< T >::type sin(const T &t)
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 minPTrackValue_
BXVector< Tau > TauBxCollection
const edm::EDGetTokenT< reco::VertexCollection > tok_vert_
~IsolatedPixelTrackCandidateL1TProducer()
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
const edm::EDGetTokenT< l1t::TauBxCollection > tok_l1_
Cos< T >::type cos(const T &t)
const std::vector< edm::EDGetTokenT< reco::TrackCollection > > toks_pix_
const double tauUnbiasCone_
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
std::pair< double, double > GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ)
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 double tauAssocCone_
const double ebEtaBoundary_
bfield_(config.getParameter< std::string >("MagFieldRecordName"))
tauUnbiasCone_(config.getParameter< double >("tauUnbiasCone"))
pixelIsolationConeSizeAtEC_(config.getParameter< double >("PixelIsolationConeSizeAtEC"))
maxPForIsolationValue_(config.getParameter< double >("maxPTrackForIsolation"))
ebEtaBoundary_(config.getParameter< double >("EBEtaBoundary"))
std::vector< Tau >::const_iterator const_iterator
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_