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"),
48 [this](
edm::InputTag const &
tag){
return consumes<reco::TrackCollection>(
tag);}) ),
64 produces< reco::IsolatedPixelTrackCandidateCollection >();
91 auto trackCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
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()));
115 std::vector<seedAtEC> VecSeedsatEC;
117 for (
unsigned iS=0; iS<pixelTrackRefs.size(); iS++) {
118 bool vtxMatch =
false;
120 reco::VertexCollection::const_iterator vitSel;
123 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
124 if (
std::abs(pixelTrackRefs[iS]->
dz(vit->position()))<minDZ) {
125 minDZ =
std::abs(pixelTrackRefs[iS]->
dz(vit->position()));
139 l1extra::L1JetParticleCollection::const_iterator selj;
140 for (l1extra::L1JetParticleCollection::const_iterator tj=l1eTauJets->begin(); tj!=l1eTauJets->end(); tj++) {
141 if (
reco::deltaR(pixelTrackRefs[iS]->momentum().
eta(), pixelTrackRefs[iS]->momentum().
phi(), tj->momentum().eta(), tj->momentum().phi()) > drMaxL1Track_)
continue;
147 std::pair<double,double> seedCooAtEC;
149 if (found) seedCooAtEC=
GetEtaPhiAtEcal(pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi(), pixelTrackRefs[iS]->
pt(), pixelTrackRefs[iS]->
charge(), vitSel->z());
151 else seedCooAtEC=
GetEtaPhiAtEcal(pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi(), pixelTrackRefs[iS]->
pt(), pixelTrackRefs[iS]->
charge(), 0);
152 seedAtEC seed(iS,(tmatch||vtxMatch),seedCooAtEC.first,seedCooAtEC.second);
153 VecSeedsatEC.push_back(seed);
156 edm::LogInfo(
"HcalIsoTrack") <<
"IsolatedPixelTrakCandidate: " << VecSeedsatEC.size() <<
" seeds after propagation\n";
159 for (
unsigned int i=0;
i<VecSeedsatEC.size();
i++) {
160 unsigned int iSeed = VecSeedsatEC[
i].index;
161 if (!VecSeedsatEC[
i].
ok)
continue;
163 l1extra::L1JetParticleCollection::const_iterator selj;
164 for (l1extra::L1JetParticleCollection::const_iterator tj=l1eTauJets->begin(); tj!=l1eTauJets->end(); tj++) {
165 if (
reco::deltaR(pixelTrackRefs[iSeed]->momentum().
eta(),pixelTrackRefs[iSeed]->momentum().
phi(),tj->momentum().eta(),tj->momentum().phi()) > drMaxL1Track_)
continue;
170 for(
unsigned int j=0; j<VecSeedsatEC.size(); j++) {
172 unsigned int iSurr = VecSeedsatEC[j].index;
177 reco::VertexCollection::const_iterator vitSel2;
178 for (reco::VertexCollection::const_iterator vit=pVert->begin(); vit!=pVert->end(); vit++) {
179 if (
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()))<minDZ2) {
180 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()));
189 sumP+=pixelTrackRefs[iSurr]->p();
190 if(pixelTrackRefs[iSurr]->
p()>maxP) maxP=pixelTrackRefs[iSurr]->p();
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 CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
const std::vector< edm::EDGetTokenT< reco::TrackCollection > > toks_pix_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const double ebEtaBoundary_
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
const double tauUnbiasCone_
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
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_
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())
void setEtaPhiEcal(double eta, double phi)
eta, phi at ECAL surface
GlobalVector inTesla(const GlobalPoint &g) const
Field value ad specified global point, in Tesla.
const std::string bfield_
const edm::EDGetTokenT< reco::VertexCollection > tok_vert_
const double minPTrackValue_
const double pixelIsolationConeSizeAtEC_
const double maxPForIsolationValue_
double getDistInCM(double eta1, double phi1, double eta2, double phi2)
virtual void produce(edm::Event &evt, const edm::EventSetup &es) override
T angle(T x1, T y1, T z1, T x2, T y2, T z2)