20 #include "Math/GenVector/VectorUtil.h"
21 #include "Math/GenVector/PxPyPzE4D.h"
43 tok_hlt_( consumes<trigger::TriggerFilterObjectWithRefs>(config.getParameter<edm::
InputTag>(
"L1GTSeedLabel")) ),
47 config.getParameter<std::vector<edm::
InputTag> >(
"PixelTracksSources"),
64 produces< reco::IsolatedPixelTrackCandidateCollection >();
76 const double rad (dynamic_cast<const EcalBarrelGeometry*>( pG->getSubdetectorGeometry(
DetId::Ecal,
EcalBarrel ))->avgRadiusXYFrontFaceCenter() ) ;
77 const double zz (dynamic_cast<const EcalEndcapGeometry*>( pG->getSubdetectorGeometry(
DetId::Ecal,
EcalEndcap ))->avgAbsZFrontFaceCenter() ) ;
94 std::vector<reco::TrackRef> pixelTrackRefs;
96 edm::LogInfo(
"HcalIsoTrack") <<
"IsolatedPixelTrakCandidate: with" <<
toks_pix_.size() <<
" candidates to start with\n";
98 for (
unsigned int iPix=0; iPix<
toks_pix_.size(); iPix++) {
101 for (reco::TrackCollection::const_iterator pit=iPixCol->begin(); pit!=iPixCol->end(); pit++) {
102 pixelTrackRefs.push_back(
reco::TrackRef(iPixCol,pit-iPixCol->begin()));
114 std::vector<seedAtEC> VecSeedsatEC;
116 for (
unsigned iS=0; iS<pixelTrackRefs.size(); iS++) {
117 bool vtxMatch =
false;
119 reco::VertexCollection::const_iterator vitSel;
122 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
123 if (
std::abs(pixelTrackRefs[iS]->dz(vit->position()))<minDZ) {
124 minDZ =
std::abs(pixelTrackRefs[iS]->dz(vit->position()));
138 l1extra::L1JetParticleCollection::const_iterator selj;
139 for (l1extra::L1JetParticleCollection::const_iterator tj=l1eTauJets->begin(); tj!=l1eTauJets->end(); tj++) {
140 if (
reco::deltaR(pixelTrackRefs[iS]->momentum().
eta(), pixelTrackRefs[iS]->momentum().
phi(), tj->momentum().eta(), tj->momentum().phi()) > drMaxL1Track_)
continue;
146 std::pair<double,double> seedCooAtEC;
148 if (found) seedCooAtEC=
GetEtaPhiAtEcal(pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi(), pixelTrackRefs[iS]->
pt(), pixelTrackRefs[iS]->
charge(), vitSel->z());
150 else seedCooAtEC=
GetEtaPhiAtEcal(pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi(), pixelTrackRefs[iS]->
pt(), pixelTrackRefs[iS]->
charge(), 0);
151 seedAtEC seed(iS,(tmatch||vtxMatch),seedCooAtEC.first,seedCooAtEC.second);
152 VecSeedsatEC.push_back(seed);
155 edm::LogInfo(
"HcalIsoTrack") <<
"IsolatedPixelTrakCandidate: " << VecSeedsatEC.size() <<
" seeds after propagation\n";
158 for (
unsigned int i=0;
i<VecSeedsatEC.size();
i++) {
159 unsigned int iSeed = VecSeedsatEC[
i].index;
160 if (!VecSeedsatEC[
i].
ok)
continue;
162 l1extra::L1JetParticleCollection::const_iterator selj;
163 for (l1extra::L1JetParticleCollection::const_iterator tj=l1eTauJets->begin(); tj!=l1eTauJets->end(); tj++) {
164 if (
reco::deltaR(pixelTrackRefs[iSeed]->momentum().
eta(),pixelTrackRefs[iSeed]->momentum().
phi(),tj->momentum().eta(),tj->momentum().phi()) > drMaxL1Track_)
continue;
169 for(
unsigned int j=0;
j<VecSeedsatEC.size();
j++) {
171 unsigned int iSurr = VecSeedsatEC[
j].index;
176 reco::VertexCollection::const_iterator vitSel2;
177 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
178 if (
std::abs(pixelTrackRefs[iSurr]->dz(vit->position()))<minDZ2) {
179 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->dz(vit->position()));
185 if (found&&
std::abs(pixelTrackRefs[iSurr]->dxy(vitSel2->position()))>
vtxCutIsol_)
continue;
188 sumP+=pixelTrackRefs[iSurr]->p();
189 if(pixelTrackRefs[iSurr]->
p()>maxP) maxP=pixelTrackRefs[iSurr]->p();
195 trackCollection->push_back(newCandidate);
200 std::auto_ptr< reco::IsolatedPixelTrackCandidateCollection > outCollection(trackCollection);
201 theEvent.
put(outCollection);
203 edm::LogInfo(
"HcalIsoTrack") <<
"IsolatedPixelTrackCandidate: Final # of candiates " << ntr <<
"\n";
210 double theta1=2*atan(
exp(-eta1));
211 double theta2=2*atan(
exp(-eta2));
229 double Rcurv = 9999999;
232 double ecDist =
zEE_;
238 if ((0.5*ecRad/Rcurv)>1) {
242 deltaPhi =-charge*asin(0.5*ecRad/Rcurv);
243 double alpha1 = 2*asin(0.5*ecRad/Rcurv);
244 double z = ecRad/
tan(theta);
245 if (etaIP>0) zNew = z*(Rcurv*alpha1)/ecRad+vtxZ;
246 else zNew =-z*(Rcurv*alpha1)/ecRad+vtxZ;
249 etaEC = -
log(
tan(0.5*atan(ecRad/zAbs)));
250 deltaPhi = -charge*asin(0.5*ecRad/Rcurv);
253 zAbs = (
std::abs(etaIP)/etaIP)*ecDist;
254 double Zflight =
std::abs(zAbs-vtxZ);
255 double alpha = (Zflight*ecRad)/(z*Rcurv);
256 double Rec = 2*Rcurv*
sin(alpha/2);
257 deltaPhi =-charge*alpha/2;
258 etaEC =-
log(
tan(0.5*atan(Rec/ecDist)));
262 zNew = (
std::abs(etaIP)/etaIP)*ecDist;
263 double Zflight =
std::abs(zNew-vtxZ);
265 double Rec = 2*Rcurv*
sin(Rvirt/(2*Rcurv));
266 deltaPhi =-(
charge)*(Rvirt/(2*Rcurv));
267 etaEC =-
log(
tan(0.5*atan(Rec/ecDist)));
270 if (zNew<0) etaEC=-etaEC;
273 if (phiEC<-
M_PI) phiEC += M_2_PI;
274 if (phiEC>
M_PI) phiEC -= M_2_PI;
276 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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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)