20 #include "Math/GenVector/VectorUtil.h" 21 #include "Math/GenVector/PxPyPzE4D.h" 43 : tok_hlt_(consumes<
trigger::TriggerFilterObjectWithRefs>(config.getParameter<
edm::InputTag>(
"L1GTSeedLabel"))),
48 [this](
edm::InputTag const&
tag) {
return consumes<reco::TrackCollection>(
tag); })),
63 produces<reco::IsolatedPixelTrackCandidateCollection>();
70 std::vector<edm::InputTag> tracksrc = {
edm::InputTag(
"hltPixelTracks")};
72 desc.
add<
double>(
"tauAssociationCone", 0.0);
73 desc.
add<
double>(
"tauUnbiasCone", 1.2);
74 desc.
add<std::vector<edm::InputTag> >(
"PixelTracksSources", tracksrc);
75 desc.
add<
double>(
"ExtrapolationConeSize", 1.0);
76 desc.
add<
double>(
"PixelIsolationConeSizeAtEC", 40);
78 desc.
add<
double>(
"MaxVtxDXYSeed", 101.0);
79 desc.
add<
double>(
"MaxVtxDXYIsol", 101.0);
81 desc.
add<
std::string>(
"MagFieldRecordName",
"VolumeBasedMagneticField");
82 desc.
add<
double>(
"minPTrack", 5.0);
83 desc.
add<
double>(
"maxPTrackForIsolation", 3.0);
84 desc.
add<
double>(
"EBEtaBoundary", 1.479);
85 descriptions.
add(
"isolPixelTrackProd", desc);
93 ->avgRadiusXYFrontFaceCenter());
95 ->avgAbsZFrontFaceCenter());
108 auto trackCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
111 std::vector<reco::TrackRef> pixelTrackRefs;
114 <<
" candidates to start with\n";
116 for (
unsigned int iPix = 0; iPix <
toks_pix_.size(); iPix++) {
119 for (reco::TrackCollection::const_iterator pit = iPixCol->begin(); pit != iPixCol->end(); pit++) {
120 pixelTrackRefs.push_back(
reco::TrackRef(iPixCol, pit - iPixCol->begin()));
133 std::vector<seedAtEC> VecSeedsatEC;
135 for (
unsigned iS = 0; iS < pixelTrackRefs.size(); iS++) {
136 bool vtxMatch =
false;
138 reco::VertexCollection::const_iterator vitSel;
141 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
142 if (
std::abs(pixelTrackRefs[iS]->
dz(vit->position())) < minDZ) {
143 minDZ =
std::abs(pixelTrackRefs[iS]->
dz(vit->position()));
158 l1extra::L1JetParticleCollection::const_iterator selj;
159 for (l1extra::L1JetParticleCollection::const_iterator tj = l1eTauJets->begin(); tj != l1eTauJets->end(); tj++) {
161 pixelTrackRefs[iS]->momentum().
phi(),
162 tj->momentum().eta(),
163 tj->momentum().phi()) > drMaxL1Track_)
170 std::pair<double, double> seedCooAtEC;
174 pixelTrackRefs[iS]->
phi(),
175 pixelTrackRefs[iS]->
pt(),
176 pixelTrackRefs[iS]->
charge(),
181 pixelTrackRefs[iS]->
phi(),
182 pixelTrackRefs[iS]->
pt(),
183 pixelTrackRefs[iS]->
charge(),
185 seedAtEC seed(iS, (tmatch || vtxMatch), seedCooAtEC.first, seedCooAtEC.second);
186 VecSeedsatEC.push_back(seed);
189 edm::LogInfo(
"HcalIsoTrack") <<
"IsolatedPixelTrakCandidate: " << VecSeedsatEC.size() <<
" seeds after propagation\n";
192 for (
unsigned int i = 0;
i < VecSeedsatEC.size();
i++) {
193 unsigned int iSeed = VecSeedsatEC[
i].index;
194 if (!VecSeedsatEC[
i].
ok)
198 l1extra::L1JetParticleCollection::const_iterator selj;
199 for (l1extra::L1JetParticleCollection::const_iterator tj = l1eTauJets->begin(); tj != l1eTauJets->end(); tj++) {
201 pixelTrackRefs[iSeed]->momentum().
phi(),
202 tj->momentum().eta(),
203 tj->momentum().phi()) > drMaxL1Track_)
209 for (
unsigned int j = 0; j < VecSeedsatEC.size(); j++) {
212 unsigned int iSurr = VecSeedsatEC[j].index;
215 pixelTrackRefs[iSeed]->
phi(),
216 pixelTrackRefs[iSurr]->
eta(),
221 reco::VertexCollection::const_iterator vitSel2;
222 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
223 if (
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position())) < minDZ2) {
224 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()));
233 if (
getDistInCM(VecSeedsatEC[
i].
eta, VecSeedsatEC[
i].
phi, VecSeedsatEC[j].eta, VecSeedsatEC[j].phi) <
235 sumP += pixelTrackRefs[iSurr]->p();
236 if (pixelTrackRefs[iSurr]->
p() > maxP)
237 maxP = pixelTrackRefs[iSurr]->p();
251 edm::LogInfo(
"HcalIsoTrack") <<
"IsolatedPixelTrackCandidate: Final # of candiates " << ntr <<
"\n";
257 double theta1 = 2 * atan(
exp(-eta1));
258 double theta2 = 2 * atan(
exp(-eta2));
276 double etaIP,
double phiIP,
double pT,
int charge,
double vtxZ) {
281 double Rcurv = 9999999;
283 Rcurv = pT * 33.3 * 100 / (
bfVal_ * 10);
285 double ecDist =
zEE_;
287 double theta = 2 * atan(
exp(-etaIP));
292 if ((0.5 * ecRad / Rcurv) > 1) {
296 deltaPhi = -charge * asin(0.5 * ecRad / Rcurv);
297 double alpha1 = 2 * asin(0.5 * ecRad / Rcurv);
298 double z = ecRad /
tan(theta);
300 zNew = z * (Rcurv * alpha1) / ecRad + vtxZ;
302 zNew = -z * (Rcurv * alpha1) / ecRad + vtxZ;
305 etaEC = -
log(
tan(0.5 * atan(ecRad / zAbs)));
306 deltaPhi = -charge * asin(0.5 * ecRad / Rcurv);
309 zAbs = (
std::abs(etaIP) / etaIP) * ecDist;
310 double Zflight =
std::abs(zAbs - vtxZ);
311 double alpha = (Zflight * ecRad) / (z * Rcurv);
312 double Rec = 2 * Rcurv *
sin(alpha / 2);
313 deltaPhi = -charge * alpha / 2;
314 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
318 zNew = (
std::abs(etaIP) / etaIP) * ecDist;
319 double Zflight =
std::abs(zNew - vtxZ);
321 double Rec = 2 * Rcurv *
sin(Rvirt / (2 * Rcurv));
322 deltaPhi = -(
charge) * (Rvirt / (2 * Rcurv));
323 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
335 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_
void beginRun(const edm::Run &, const edm::EventSetup &) override
const double tauUnbiasCone_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
GlobalVector inTesla(const GlobalPoint &g) const override
Field value ad specified global point, in Tesla.
const edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_l1_
Sin< T >::type sin(const T &t)
IsolatedPixelTrackCandidateProducer(const edm::ParameterSet &ps)
Global3DPoint GlobalPoint
Geom::Theta< T > theta() const
std::vector< Vertex > VertexCollection
collection of Vertex objects
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const double tauAssocCone_
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
void setEtaPhiEcal(double eta, double phi)
eta, phi at ECAL surface
ParameterDescriptionBase * add(U const &iLabel, T const &value)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
const std::string bfield_
~IsolatedPixelTrackCandidateProducer() override
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 >
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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)
void produce(edm::Event &evt, const edm::EventSetup &es) override
T angle(T x1, T y1, T z1, T x2, T y2, T z2)