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(
"isolPixelTrackProd",
desc);
83 ->avgRadiusXYFrontFaceCenter());
85 ->avgAbsZFrontFaceCenter());
97 auto trackCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
100 std::vector<reco::TrackRef> pixelTrackRefs;
103 <<
" candidates to start with\n";
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()));
122 std::vector<seedAtEC> VecSeedsatEC;
124 for (
unsigned iS = 0; iS < pixelTrackRefs.size(); iS++) {
125 bool vtxMatch =
false;
127 reco::VertexCollection::const_iterator vitSel;
130 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
131 if (
std::abs(pixelTrackRefs[iS]->
dz(vit->position())) < minDZ) {
132 minDZ =
std::abs(pixelTrackRefs[iS]->
dz(vit->position()));
147 l1extra::L1JetParticleCollection::const_iterator selj;
148 for (l1extra::L1JetParticleCollection::const_iterator tj = l1eTauJets->begin(); tj != l1eTauJets->end(); tj++) {
150 pixelTrackRefs[iS]->momentum().
phi(),
151 tj->momentum().eta(),
152 tj->momentum().phi()) > drMaxL1Track_)
159 std::pair<double, double> seedCooAtEC;
163 pixelTrackRefs[iS]->
phi(),
164 pixelTrackRefs[iS]->
pt(),
165 pixelTrackRefs[iS]->
charge(),
170 pixelTrackRefs[iS]->
phi(),
171 pixelTrackRefs[iS]->
pt(),
172 pixelTrackRefs[iS]->
charge(),
174 seedAtEC seed(iS, (tmatch || vtxMatch), seedCooAtEC.first, seedCooAtEC.second);
175 VecSeedsatEC.push_back(
seed);
178 edm::LogVerbatim(
"HcalIsoTrack") <<
"IsolatedPixelTrakCandidate: " << VecSeedsatEC.size()
179 <<
" seeds after propagation\n";
182 for (
unsigned int i = 0;
i < VecSeedsatEC.size();
i++) {
183 unsigned int iSeed = VecSeedsatEC[
i].index;
184 if (!VecSeedsatEC[
i].
ok)
188 l1extra::L1JetParticleCollection::const_iterator selj;
189 for (l1extra::L1JetParticleCollection::const_iterator tj = l1eTauJets->begin(); tj != l1eTauJets->end(); tj++) {
191 pixelTrackRefs[iSeed]->momentum().
phi(),
192 tj->momentum().eta(),
193 tj->momentum().phi()) > drMaxL1Track_)
199 for (
unsigned int j = 0;
j < VecSeedsatEC.size();
j++) {
202 unsigned int iSurr = VecSeedsatEC[
j].index;
205 pixelTrackRefs[iSeed]->
phi(),
206 pixelTrackRefs[iSurr]->
eta(),
211 reco::VertexCollection::const_iterator vitSel2;
212 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
213 if (
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position())) < minDZ2) {
214 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()));
225 sumP += pixelTrackRefs[iSurr]->p();
226 if (pixelTrackRefs[iSurr]->
p() >
maxP)
227 maxP = pixelTrackRefs[iSurr]->p();
241 edm::LogVerbatim(
"HcalIsoTrack") <<
"IsolatedPixelTrackCandidate: Final # of candiates " << ntr <<
"\n";
247 double theta1 = 2 * atan(
exp(-
eta1));
248 double theta2 = 2 * atan(
exp(-
eta2));
266 double etaIP,
double phiIP,
double pT,
int charge,
double vtxZ) {
271 double Rcurv = 9999999;
273 Rcurv =
pT * 33.3 * 100 / (
bfVal_ * 10);
275 double ecDist =
zEE_;
277 double theta = 2 * atan(
exp(-etaIP));
282 if ((0.5 * ecRad / Rcurv) > 1) {
287 double alpha1 = 2 * asin(0.5 * ecRad / Rcurv);
290 zNew =
z * (Rcurv * alpha1) / ecRad + vtxZ;
292 zNew = -
z * (Rcurv * alpha1) / ecRad + vtxZ;
295 etaEC = -
log(
tan(0.5 * atan(ecRad / zAbs)));
299 zAbs = (
std::abs(etaIP) / etaIP) * ecDist;
300 double Zflight =
std::abs(zAbs - vtxZ);
301 double alpha = (Zflight * ecRad) / (
z * Rcurv);
302 double Rec = 2 * Rcurv *
sin(
alpha / 2);
304 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
308 zNew = (
std::abs(etaIP) / etaIP) * ecDist;
309 double Zflight =
std::abs(zNew - vtxZ);
311 double Rec = 2 * Rcurv *
sin(Rvirt / (2 * Rcurv));
313 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
325 std::pair<double, double> retVal(etaEC, phiEC);