19 #include "Math/GenVector/VectorUtil.h"
20 #include "Math/GenVector/PxPyPzE4D.h"
45 prelimCone_(
config.getParameter<
double>(
"ExtrapolationConeSize")),
46 pixelIsolationConeSizeAtEC_(
config.getParameter<
double>(
"PixelIsolationConeSizeAtEC")),
47 vtxCutSeed_(
config.getParameter<
double>(
"MaxVtxDXYSeed")),
48 vtxCutIsol_(
config.getParameter<
double>(
"MaxVtxDXYIsol")),
49 tauAssocCone_(
config.getParameter<
double>(
"tauAssociationCone")),
50 tauUnbiasCone_(
config.getParameter<
double>(
"tauUnbiasCone")),
51 minPTrackValue_(
config.getParameter<
double>(
"minPTrack")),
52 maxPForIsolationValue_(
config.getParameter<
double>(
"maxPTrackForIsolation")),
53 ebEtaBoundary_(
config.getParameter<
double>(
"EBEtaBoundary")),
58 produces<reco::IsolatedPixelTrackCandidateCollection>();
67 desc.add<
double>(
"tauAssociationCone", 0.0);
68 desc.add<
double>(
"tauUnbiasCone", 1.2);
69 desc.add<std::vector<edm::InputTag> >(
"PixelTracksSources",
tracksrc);
70 desc.add<
double>(
"ExtrapolationConeSize", 1.0);
71 desc.add<
double>(
"PixelIsolationConeSizeAtEC", 40);
73 desc.add<
double>(
"MaxVtxDXYSeed", 101.0);
74 desc.add<
double>(
"MaxVtxDXYIsol", 101.0);
76 desc.add<
std::string>(
"MagFieldRecordName",
"VolumeBasedMagneticField");
77 desc.add<
double>(
"minPTrack", 5.0);
78 desc.add<
double>(
"maxPTrackForIsolation", 3.0);
79 desc.add<
double>(
"EBEtaBoundary", 1.479);
80 descriptions.
add(
"isolPixelTrackProd",
desc);
88 ->avgRadiusXYFrontFaceCenter());
90 ->avgAbsZFrontFaceCenter());
103 auto trackCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
106 std::vector<reco::TrackRef> pixelTrackRefs;
109 <<
" candidates to start with\n";
111 for (
unsigned int iPix = 0; iPix <
toks_pix_.size(); iPix++) {
114 for (reco::TrackCollection::const_iterator pit = iPixCol->begin(); pit != iPixCol->end(); pit++) {
115 pixelTrackRefs.push_back(
reco::TrackRef(iPixCol, pit - iPixCol->begin()));
128 std::vector<seedAtEC> VecSeedsatEC;
130 for (
unsigned iS = 0; iS < pixelTrackRefs.size(); iS++) {
131 bool vtxMatch =
false;
133 reco::VertexCollection::const_iterator vitSel;
136 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
137 if (
std::abs(pixelTrackRefs[iS]->
dz(vit->position())) < minDZ) {
138 minDZ =
std::abs(pixelTrackRefs[iS]->
dz(vit->position()));
153 l1extra::L1JetParticleCollection::const_iterator selj;
154 for (l1extra::L1JetParticleCollection::const_iterator tj = l1eTauJets->begin(); tj != l1eTauJets->end(); tj++) {
156 pixelTrackRefs[iS]->momentum().
phi(),
157 tj->momentum().eta(),
158 tj->momentum().phi()) > drMaxL1Track_)
165 std::pair<double, double> seedCooAtEC;
169 pixelTrackRefs[iS]->
phi(),
170 pixelTrackRefs[iS]->
pt(),
171 pixelTrackRefs[iS]->
charge(),
176 pixelTrackRefs[iS]->
phi(),
177 pixelTrackRefs[iS]->
pt(),
178 pixelTrackRefs[iS]->
charge(),
180 seedAtEC seed(iS, (tmatch || vtxMatch), seedCooAtEC.first, seedCooAtEC.second);
181 VecSeedsatEC.push_back(
seed);
184 edm::LogInfo(
"HcalIsoTrack") <<
"IsolatedPixelTrakCandidate: " << VecSeedsatEC.size() <<
" seeds after propagation\n";
187 for (
unsigned int i = 0;
i < VecSeedsatEC.size();
i++) {
188 unsigned int iSeed = VecSeedsatEC[
i].index;
189 if (!VecSeedsatEC[
i].
ok)
193 l1extra::L1JetParticleCollection::const_iterator selj;
194 for (l1extra::L1JetParticleCollection::const_iterator tj = l1eTauJets->begin(); tj != l1eTauJets->end(); tj++) {
196 pixelTrackRefs[iSeed]->momentum().
phi(),
197 tj->momentum().eta(),
198 tj->momentum().phi()) > drMaxL1Track_)
204 for (
unsigned int j = 0;
j < VecSeedsatEC.size();
j++) {
207 unsigned int iSurr = VecSeedsatEC[
j].index;
210 pixelTrackRefs[iSeed]->
phi(),
211 pixelTrackRefs[iSurr]->
eta(),
216 reco::VertexCollection::const_iterator vitSel2;
217 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
218 if (
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position())) < minDZ2) {
219 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()));
230 sumP += pixelTrackRefs[iSurr]->p();
231 if (pixelTrackRefs[iSurr]->
p() >
maxP)
232 maxP = pixelTrackRefs[iSurr]->p();
246 edm::LogInfo(
"HcalIsoTrack") <<
"IsolatedPixelTrackCandidate: Final # of candiates " << ntr <<
"\n";
252 double theta1 = 2 * atan(
exp(-
eta1));
253 double theta2 = 2 * atan(
exp(-
eta2));
271 double etaIP,
double phiIP,
double pT,
int charge,
double vtxZ) {
276 double Rcurv = 9999999;
278 Rcurv =
pT * 33.3 * 100 / (
bfVal_ * 10);
280 double ecDist =
zEE_;
282 double theta = 2 * atan(
exp(-etaIP));
287 if ((0.5 * ecRad / Rcurv) > 1) {
292 double alpha1 = 2 * asin(0.5 * ecRad / Rcurv);
295 zNew =
z * (Rcurv * alpha1) / ecRad + vtxZ;
297 zNew = -
z * (Rcurv * alpha1) / ecRad + vtxZ;
300 etaEC = -
log(
tan(0.5 * atan(ecRad / zAbs)));
304 zAbs = (
std::abs(etaIP) / etaIP) * ecDist;
305 double Zflight =
std::abs(zAbs - vtxZ);
306 double alpha = (Zflight * ecRad) / (
z * Rcurv);
307 double Rec = 2 * Rcurv *
sin(
alpha / 2);
309 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
313 zNew = (
std::abs(etaIP) / etaIP) * ecDist;
314 double Zflight =
std::abs(zNew - vtxZ);
316 double Rec = 2 * Rcurv *
sin(Rvirt / (2 * Rcurv));
318 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
330 std::pair<double, double> retVal(etaEC, phiEC);