20 #include "Math/GenVector/VectorUtil.h" 21 #include "Math/GenVector/PxPyPzE4D.h" 41 : tok_hlt_(consumes<
trigger::TriggerFilterObjectWithRefs>(config.getParameter<
edm::InputTag>(
"L1GTSeedLabel"))),
46 [this](
edm::InputTag const&
tag) {
return consumes<reco::TrackCollection>(
tag); })),
61 produces<reco::IsolatedPixelTrackCandidateCollection>();
68 std::vector<edm::InputTag> tracksrc = {
edm::InputTag(
"hltPixelTracks")};
70 desc.
add<
double>(
"tauAssociationCone", 0.0);
71 desc.
add<
double>(
"tauUnbiasCone", 1.2);
72 desc.
add<std::vector<edm::InputTag> >(
"PixelTracksSources", tracksrc);
73 desc.
add<
double>(
"ExtrapolationConeSize", 1.0);
74 desc.
add<
double>(
"PixelIsolationConeSizeAtEC", 40);
76 desc.
add<
double>(
"MaxVtxDXYSeed", 101.0);
77 desc.
add<
double>(
"MaxVtxDXYIsol", 101.0);
79 desc.
add<
std::string>(
"MagFieldRecordName",
"VolumeBasedMagneticField");
80 desc.
add<
double>(
"minPTrack", 5.0);
81 desc.
add<
double>(
"maxPTrackForIsolation", 3.0);
82 desc.
add<
double>(
"EBEtaBoundary", 1.479);
83 descriptions.
add(
"isolPixelTrackProdL1T", desc);
91 ->avgRadiusXYFrontFaceCenter());
93 ->avgAbsZFrontFaceCenter());
107 auto trackCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
110 std::vector<reco::TrackRef> pixelTrackRefs;
112 for (
unsigned int iPix = 0; iPix <
toks_pix_.size(); iPix++) {
115 for (reco::TrackCollection::const_iterator pit = iPixCol->begin(); pit != iPixCol->end(); pit++) {
116 pixelTrackRefs.push_back(
reco::TrackRef(iPixCol, pit - iPixCol->begin()));
126 double ptTriggered = -10;
127 double etaTriggered = -100;
128 double phiTriggered = -100;
133 std::vector<edm::Ref<l1t::TauBxCollection> > l1tauobjref;
134 std::vector<edm::Ref<l1t::JetBxCollection> > l1jetobjref;
141 for (
auto p : l1tauobjref) {
142 if (
p->pt() > ptTriggered) {
143 ptTriggered =
p->pt();
144 phiTriggered =
p->phi();
145 etaTriggered =
p->eta();
148 for (
auto p : l1jetobjref) {
149 if (
p->pt() > ptTriggered) {
150 ptTriggered =
p->pt();
151 phiTriggered =
p->phi();
152 etaTriggered =
p->eta();
155 edm::LogVerbatim(
"IsoTrack") <<
"Sizes " << l1tauobjref.size() <<
":" << l1jetobjref.size() <<
" Trig " << ptTriggered
156 <<
":" << etaTriggered <<
":" << phiTriggered << std::endl;
160 std::vector<seedAtEC> VecSeedsatEC;
162 for (
unsigned iS = 0; iS < pixelTrackRefs.size(); iS++) {
163 bool vtxMatch =
false;
165 reco::VertexCollection::const_iterator vitSel;
168 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
169 if (
std::abs(pixelTrackRefs[iS]->
dz(vit->position())) < minDZ) {
170 minDZ =
std::abs(pixelTrackRefs[iS]->
dz(vit->position()));
182 edm::LogVerbatim(
"IsoTrack") <<
"minZD " << minDZ <<
" Found " << found <<
":" << vtxMatch << std::endl;
185 double R =
reco::deltaR(etaTriggered, phiTriggered, pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi());
196 pixelTrackRefs[iS]->momentum().
phi(),
197 tj->momentum().eta(),
198 tj->momentum().phi()) > drMaxL1Track_)
206 std::pair<double, double> seedCooAtEC;
210 pixelTrackRefs[iS]->
phi(),
211 pixelTrackRefs[iS]->
pt(),
212 pixelTrackRefs[iS]->
charge(),
217 pixelTrackRefs[iS]->
phi(),
218 pixelTrackRefs[iS]->
pt(),
219 pixelTrackRefs[iS]->
charge(),
221 seedAtEC seed(iS, (tmatch || vtxMatch), seedCooAtEC.first, seedCooAtEC.second);
222 VecSeedsatEC.push_back(seed);
223 edm::LogVerbatim(
"IsoTrack") <<
"Seed " << seedCooAtEC.first << seedCooAtEC.second << std::endl;
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()));
266 if (
getDistInCM(VecSeedsatEC[
i].
eta, VecSeedsatEC[
i].
phi, VecSeedsatEC[j].eta, VecSeedsatEC[j].phi) <
268 sumP += pixelTrackRefs[iSurr]->p();
269 if (pixelTrackRefs[iSurr]->
p() > maxP)
270 maxP = pixelTrackRefs[iSurr]->p();
275 pixelTrackRefs[iSeed],
l1t::TauRef(l1eTauJets, selj - l1eTauJets->
begin()), maxP, sumP);
288 double theta1 = 2 * atan(
exp(-eta1));
289 double theta2 = 2 * atan(
exp(-eta2));
307 double etaIP,
double phiIP,
double pT,
int charge,
double vtxZ) {
312 double Rcurv = 9999999;
314 Rcurv = pT * 33.3 * 100 / (
bfVal_ * 10);
316 double ecDist =
zEE_;
318 double theta = 2 * atan(
exp(-etaIP));
323 if ((0.5 * ecRad / Rcurv) > 1) {
327 deltaPhi = -charge * asin(0.5 * ecRad / Rcurv);
328 double alpha1 = 2 * asin(0.5 * ecRad / Rcurv);
329 double z = ecRad /
tan(theta);
331 zNew = z * (Rcurv * alpha1) / ecRad + vtxZ;
333 zNew = -z * (Rcurv * alpha1) / ecRad + vtxZ;
336 etaEC = -
log(
tan(0.5 * atan(ecRad / zAbs)));
337 deltaPhi = -charge * asin(0.5 * ecRad / Rcurv);
340 zAbs = (
std::abs(etaIP) / etaIP) * ecDist;
341 double Zflight =
std::abs(zAbs - vtxZ);
342 double alpha = (Zflight * ecRad) / (z * Rcurv);
343 double Rec = 2 * Rcurv *
sin(alpha / 2);
344 deltaPhi = -charge * alpha / 2;
345 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
349 zNew = (
std::abs(etaIP) / etaIP) * ecDist;
350 double Zflight =
std::abs(zNew - vtxZ);
352 double Rec = 2 * Rcurv *
sin(Rvirt / (2 * Rcurv));
353 deltaPhi = -(
charge) * (Rvirt / (2 * Rcurv));
354 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
366 std::pair<double, double> retVal(etaEC, phiEC);
const_iterator end(int bx) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
void produce(edm::Event &evt, const edm::EventSetup &es) override
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
IsolatedPixelTrackCandidateL1TProducer(const edm::ParameterSet &ps)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void beginRun(const edm::Run &, const edm::EventSetup &) override
GlobalVector inTesla(const GlobalPoint &g) const override
Field value ad specified global point, in Tesla.
const double maxPForIsolationValue_
double getDistInCM(double eta1, double phi1, double eta2, double phi2)
const double pixelIsolationConeSizeAtEC_
Sin< T >::type sin(const T &t)
Global3DPoint GlobalPoint
Geom::Theta< T > theta() const
std::vector< Vertex > VertexCollection
collection of Vertex objects
const double minPTrackValue_
BXVector< Tau > TauBxCollection
const edm::EDGetTokenT< reco::VertexCollection > tok_vert_
const edm::EDGetTokenT< l1t::TauBxCollection > tok_l1_
Cos< T >::type cos(const T &t)
const std::vector< edm::EDGetTokenT< reco::TrackCollection > > toks_pix_
const double tauUnbiasCone_
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
std::pair< double, double > GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
const double tauAssocCone_
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 >
const double ebEtaBoundary_
~IsolatedPixelTrackCandidateL1TProducer() override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const_iterator begin(int bx) const
const std::string bfield_
std::vector< T >::const_iterator const_iterator
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_