17 #include "Math/GenVector/VectorUtil.h"
18 #include "Math/GenVector/PxPyPzE4D.h"
38 tok_bFieldH_(esConsumes<MagneticField, IdealMagneticFieldRecord, edm::Transition::BeginRun>()),
39 tok_geom_(esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>()),
41 prelimCone_(
config.getParameter<
double>(
"ExtrapolationConeSize")),
42 pixelIsolationConeSizeAtEC_(
config.getParameter<
double>(
"PixelIsolationConeSizeAtEC")),
43 vtxCutSeed_(
config.getParameter<
double>(
"MaxVtxDXYSeed")),
44 vtxCutIsol_(
config.getParameter<
double>(
"MaxVtxDXYIsol")),
45 tauAssocCone_(
config.getParameter<
double>(
"tauAssociationCone")),
46 tauUnbiasCone_(
config.getParameter<
double>(
"tauUnbiasCone")),
47 minPTrackValue_(
config.getParameter<
double>(
"minPTrack")),
48 maxPForIsolationValue_(
config.getParameter<
double>(
"maxPTrackForIsolation")),
49 ebEtaBoundary_(
config.getParameter<
double>(
"EBEtaBoundary")),
54 produces<reco::IsolatedPixelTrackCandidateCollection>();
63 desc.add<
double>(
"tauAssociationCone", 0.0);
64 desc.add<
double>(
"tauUnbiasCone", 1.2);
65 desc.add<std::vector<edm::InputTag> >(
"PixelTracksSources",
tracksrc);
66 desc.add<
double>(
"ExtrapolationConeSize", 1.0);
67 desc.add<
double>(
"PixelIsolationConeSizeAtEC", 40);
69 desc.add<
double>(
"MaxVtxDXYSeed", 101.0);
70 desc.add<
double>(
"MaxVtxDXYIsol", 101.0);
72 desc.add<
std::string>(
"MagFieldRecordName",
"VolumeBasedMagneticField");
73 desc.add<
double>(
"minPTrack", 5.0);
74 desc.add<
double>(
"maxPTrackForIsolation", 3.0);
75 desc.add<
double>(
"EBEtaBoundary", 1.479);
76 descriptions.
add(
"isolPixelTrackProdL1T",
desc);
83 ->avgRadiusXYFrontFaceCenter());
85 ->avgAbsZFrontFaceCenter());
100 auto trackCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
103 std::vector<reco::TrackRef> pixelTrackRefs;
105 for (
unsigned int iPix = 0; iPix <
toks_pix_.size(); iPix++) {
108 for (reco::TrackCollection::const_iterator pit = iPixCol->begin(); pit != iPixCol->end(); pit++) {
109 pixelTrackRefs.push_back(
reco::TrackRef(iPixCol, pit - iPixCol->begin()));
119 double ptTriggered = -10;
120 double etaTriggered = -100;
121 double phiTriggered = -100;
126 std::vector<edm::Ref<l1t::TauBxCollection> > l1tauobjref;
127 std::vector<edm::Ref<l1t::JetBxCollection> > l1jetobjref;
134 for (
const auto&
p : l1tauobjref) {
135 if (
p->pt() > ptTriggered) {
136 ptTriggered =
p->pt();
137 phiTriggered =
p->phi();
138 etaTriggered =
p->eta();
141 for (
const auto&
p : l1jetobjref) {
142 if (
p->pt() > ptTriggered) {
143 ptTriggered =
p->pt();
144 phiTriggered =
p->phi();
145 etaTriggered =
p->eta();
149 edm::LogVerbatim(
"IsoTrack") <<
"Sizes " << l1tauobjref.size() <<
":" << l1jetobjref.size() <<
" Trig " << ptTriggered
150 <<
":" << etaTriggered <<
":" << phiTriggered;
154 std::vector<seedAtEC> VecSeedsatEC;
156 for (
unsigned iS = 0; iS < pixelTrackRefs.size(); iS++) {
157 bool vtxMatch =
false;
159 reco::VertexCollection::const_iterator vitSel;
162 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
163 if (
std::abs(pixelTrackRefs[iS]->
dz(vit->position())) < minDZ) {
164 minDZ =
std::abs(pixelTrackRefs[iS]->
dz(vit->position()));
180 double R =
reco::deltaR(etaTriggered, phiTriggered, pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi());
193 pixelTrackRefs[iS]->momentum().
phi(),
194 tj->momentum().eta(),
195 tj->momentum().phi()) > drMaxL1Track_)
204 std::pair<double, double> seedCooAtEC;
208 pixelTrackRefs[iS]->
phi(),
209 pixelTrackRefs[iS]->
pt(),
210 pixelTrackRefs[iS]->
charge(),
215 pixelTrackRefs[iS]->
phi(),
216 pixelTrackRefs[iS]->
pt(),
217 pixelTrackRefs[iS]->
charge(),
219 seedAtEC seed(iS, (tmatch || vtxMatch), seedCooAtEC.first, seedCooAtEC.second);
220 VecSeedsatEC.push_back(
seed);
222 edm::LogVerbatim(
"IsoTrack") <<
"Seed " << seedCooAtEC.first << seedCooAtEC.second;
225 for (
unsigned int i = 0;
i < VecSeedsatEC.size();
i++) {
226 unsigned int iSeed = VecSeedsatEC[
i].index;
227 if (!VecSeedsatEC[
i].
ok)
234 pixelTrackRefs[iSeed]->momentum().
phi(),
235 tj->momentum().eta(),
236 tj->momentum().phi()) > drMaxL1Track_)
242 for (
unsigned int j = 0;
j < VecSeedsatEC.size();
j++) {
245 unsigned int iSurr = VecSeedsatEC[
j].index;
248 pixelTrackRefs[iSeed]->
phi(),
249 pixelTrackRefs[iSurr]->
eta(),
254 reco::VertexCollection::const_iterator vitSel2;
255 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
256 if (
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position())) < minDZ2) {
257 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()));
268 sumP += pixelTrackRefs[iSurr]->p();
269 if (pixelTrackRefs[iSurr]->
p() >
maxP)
270 maxP = pixelTrackRefs[iSurr]->p();
290 double theta1 = 2 * atan(
exp(-
eta1));
291 double theta2 = 2 * atan(
exp(-
eta2));
309 double etaIP,
double phiIP,
double pT,
int charge,
double vtxZ) {
314 double Rcurv = 9999999;
316 Rcurv =
pT * 33.3 * 100 / (
bfVal_ * 10);
318 double ecDist =
zEE_;
320 double theta = 2 * atan(
exp(-etaIP));
325 if ((0.5 * ecRad / Rcurv) > 1) {
330 double alpha1 = 2 * asin(0.5 * ecRad / Rcurv);
333 zNew =
z * (Rcurv * alpha1) / ecRad + vtxZ;
335 zNew = -
z * (Rcurv * alpha1) / ecRad + vtxZ;
338 etaEC = -
log(
tan(0.5 * atan(ecRad / zAbs)));
342 zAbs = (
std::abs(etaIP) / etaIP) * ecDist;
343 double Zflight =
std::abs(zAbs - vtxZ);
344 double alpha = (Zflight * ecRad) / (
z * Rcurv);
345 double Rec = 2 * Rcurv *
sin(
alpha / 2);
347 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
351 zNew = (
std::abs(etaIP) / etaIP) * ecDist;
352 double Zflight =
std::abs(zNew - vtxZ);
354 double Rec = 2 * Rcurv *
sin(Rvirt / (2 * Rcurv));
356 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
368 std::pair<double, double> retVal(etaEC, phiEC);