19 #include "Math/GenVector/VectorUtil.h"
20 #include "Math/GenVector/PxPyPzE4D.h"
43 prelimCone_(
config.getParameter<
double>(
"ExtrapolationConeSize")),
44 pixelIsolationConeSizeAtEC_(
config.getParameter<
double>(
"PixelIsolationConeSizeAtEC")),
45 vtxCutSeed_(
config.getParameter<
double>(
"MaxVtxDXYSeed")),
46 vtxCutIsol_(
config.getParameter<
double>(
"MaxVtxDXYIsol")),
47 tauAssocCone_(
config.getParameter<
double>(
"tauAssociationCone")),
48 tauUnbiasCone_(
config.getParameter<
double>(
"tauUnbiasCone")),
49 minPTrackValue_(
config.getParameter<
double>(
"minPTrack")),
50 maxPForIsolationValue_(
config.getParameter<
double>(
"maxPTrackForIsolation")),
51 ebEtaBoundary_(
config.getParameter<
double>(
"EBEtaBoundary")),
56 produces<reco::IsolatedPixelTrackCandidateCollection>();
65 desc.add<
double>(
"tauAssociationCone", 0.0);
66 desc.add<
double>(
"tauUnbiasCone", 1.2);
67 desc.add<std::vector<edm::InputTag> >(
"PixelTracksSources",
tracksrc);
68 desc.add<
double>(
"ExtrapolationConeSize", 1.0);
69 desc.add<
double>(
"PixelIsolationConeSizeAtEC", 40);
71 desc.add<
double>(
"MaxVtxDXYSeed", 101.0);
72 desc.add<
double>(
"MaxVtxDXYIsol", 101.0);
74 desc.add<
std::string>(
"MagFieldRecordName",
"VolumeBasedMagneticField");
75 desc.add<
double>(
"minPTrack", 5.0);
76 desc.add<
double>(
"maxPTrackForIsolation", 3.0);
77 desc.add<
double>(
"EBEtaBoundary", 1.479);
78 descriptions.
add(
"isolPixelTrackProdL1T",
desc);
86 ->avgRadiusXYFrontFaceCenter());
88 ->avgAbsZFrontFaceCenter());
102 auto trackCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
105 std::vector<reco::TrackRef> pixelTrackRefs;
107 for (
unsigned int iPix = 0; iPix <
toks_pix_.size(); iPix++) {
110 for (reco::TrackCollection::const_iterator pit = iPixCol->begin(); pit != iPixCol->end(); pit++) {
111 pixelTrackRefs.push_back(
reco::TrackRef(iPixCol, pit - iPixCol->begin()));
121 double ptTriggered = -10;
122 double etaTriggered = -100;
123 double phiTriggered = -100;
128 std::vector<edm::Ref<l1t::TauBxCollection> > l1tauobjref;
129 std::vector<edm::Ref<l1t::JetBxCollection> > l1jetobjref;
136 for (
const auto&
p : l1tauobjref) {
137 if (
p->pt() > ptTriggered) {
138 ptTriggered =
p->pt();
139 phiTriggered =
p->phi();
140 etaTriggered =
p->eta();
143 for (
const auto&
p : l1jetobjref) {
144 if (
p->pt() > ptTriggered) {
145 ptTriggered =
p->pt();
146 phiTriggered =
p->phi();
147 etaTriggered =
p->eta();
150 LogTrace(
"IsoTrack") <<
"Sizes " << l1tauobjref.size() <<
":" << l1jetobjref.size() <<
" Trig " << ptTriggered <<
":"
151 << etaTriggered <<
":" << phiTriggered << std::endl;
155 std::vector<seedAtEC> VecSeedsatEC;
157 for (
unsigned iS = 0; iS < pixelTrackRefs.size(); iS++) {
158 bool vtxMatch =
false;
160 reco::VertexCollection::const_iterator vitSel;
163 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
164 if (
std::abs(pixelTrackRefs[iS]->
dz(vit->position())) < minDZ) {
165 minDZ =
std::abs(pixelTrackRefs[iS]->
dz(vit->position()));
177 LogTrace(
"IsoTrack") <<
"minZD " << minDZ <<
" Found " <<
found <<
":" << vtxMatch << std::endl;
180 double R =
reco::deltaR(etaTriggered, phiTriggered, pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi());
191 pixelTrackRefs[iS]->momentum().
phi(),
192 tj->momentum().eta(),
193 tj->momentum().phi()) > drMaxL1Track_)
198 LogTrace(
"IsoTrack") <<
"tMatch " << tmatch << std::endl;
201 std::pair<double, double> seedCooAtEC;
205 pixelTrackRefs[iS]->
phi(),
206 pixelTrackRefs[iS]->
pt(),
207 pixelTrackRefs[iS]->
charge(),
212 pixelTrackRefs[iS]->
phi(),
213 pixelTrackRefs[iS]->
pt(),
214 pixelTrackRefs[iS]->
charge(),
216 seedAtEC seed(iS, (tmatch || vtxMatch), seedCooAtEC.first, seedCooAtEC.second);
217 VecSeedsatEC.push_back(
seed);
218 LogTrace(
"IsoTrack") <<
"Seed " << seedCooAtEC.first << seedCooAtEC.second << std::endl;
220 for (
unsigned int i = 0;
i < VecSeedsatEC.size();
i++) {
221 unsigned int iSeed = VecSeedsatEC[
i].index;
222 if (!VecSeedsatEC[
i].
ok)
229 pixelTrackRefs[iSeed]->momentum().
phi(),
230 tj->momentum().eta(),
231 tj->momentum().phi()) > drMaxL1Track_)
237 for (
unsigned int j = 0;
j < VecSeedsatEC.size();
j++) {
240 unsigned int iSurr = VecSeedsatEC[
j].index;
243 pixelTrackRefs[iSeed]->
phi(),
244 pixelTrackRefs[iSurr]->
eta(),
249 reco::VertexCollection::const_iterator vitSel2;
250 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
251 if (
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position())) < minDZ2) {
252 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()));
263 sumP += pixelTrackRefs[iSurr]->p();
264 if (pixelTrackRefs[iSurr]->
p() >
maxP)
265 maxP = pixelTrackRefs[iSurr]->p();
276 LogTrace(
"IsoTrack") <<
"Number of Isolated Track " << ntr <<
"\n";
283 double theta1 = 2 * atan(
exp(-
eta1));
284 double theta2 = 2 * atan(
exp(-
eta2));
302 double etaIP,
double phiIP,
double pT,
int charge,
double vtxZ) {
307 double Rcurv = 9999999;
309 Rcurv =
pT * 33.3 * 100 / (
bfVal_ * 10);
311 double ecDist =
zEE_;
313 double theta = 2 * atan(
exp(-etaIP));
318 if ((0.5 * ecRad / Rcurv) > 1) {
323 double alpha1 = 2 * asin(0.5 * ecRad / Rcurv);
326 zNew =
z * (Rcurv * alpha1) / ecRad + vtxZ;
328 zNew = -
z * (Rcurv * alpha1) / ecRad + vtxZ;
331 etaEC = -
log(
tan(0.5 * atan(ecRad / zAbs)));
335 zAbs = (
std::abs(etaIP) / etaIP) * ecDist;
336 double Zflight =
std::abs(zAbs - vtxZ);
337 double alpha = (Zflight * ecRad) / (
z * Rcurv);
338 double Rec = 2 * Rcurv *
sin(
alpha / 2);
340 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
344 zNew = (
std::abs(etaIP) / etaIP) * ecDist;
345 double Zflight =
std::abs(zNew - vtxZ);
347 double Rec = 2 * Rcurv *
sin(Rvirt / (2 * Rcurv));
349 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
361 std::pair<double, double> retVal(etaEC, phiEC);