46 #include "Math/GenVector/VectorUtil.h"
47 #include "Math/GenVector/PxPyPzE4D.h"
88 const std::vector<edm::EDGetTokenT<reco::TrackCollection> >
toks_pix_;
110 : tok_hlt_(consumes<trigger::TriggerFilterObjectWithRefs>(config.getParameter<edm::
InputTag>(
"L1GTSeedLabel"))),
116 tok_bFieldH_(esConsumes<MagneticField, IdealMagneticFieldRecord, edm::Transition::BeginRun>()),
117 tok_geom_(esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>()),
132 produces<reco::IsolatedPixelTrackCandidateCollection>();
139 std::vector<edm::InputTag> tracksrc = {
edm::InputTag(
"hltPixelTracks")};
141 desc.
add<
double>(
"tauAssociationCone", 0.0);
142 desc.
add<
double>(
"tauUnbiasCone", 1.2);
143 desc.
add<std::vector<edm::InputTag> >(
"PixelTracksSources", tracksrc);
144 desc.
add<
double>(
"ExtrapolationConeSize", 1.0);
145 desc.
add<
double>(
"PixelIsolationConeSizeAtEC", 40);
147 desc.
add<
double>(
"MaxVtxDXYSeed", 101.0);
148 desc.
add<
double>(
"MaxVtxDXYIsol", 101.0);
150 desc.
add<
std::string>(
"MagFieldRecordName",
"VolumeBasedMagneticField");
151 desc.
add<
double>(
"minPTrack", 5.0);
152 desc.
add<
double>(
"maxPTrackForIsolation", 3.0);
153 desc.
add<
double>(
"EBEtaBoundary", 1.479);
154 descriptions.
add(
"isolPixelTrackProdL1T", desc);
161 ->avgRadiusXYFrontFaceCenter());
163 ->avgAbsZFrontFaceCenter());
178 auto trackCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
181 std::vector<reco::TrackRef> pixelTrackRefs;
183 for (
unsigned int iPix = 0; iPix <
toks_pix_.size(); iPix++) {
186 for (reco::TrackCollection::const_iterator pit = iPixCol->begin(); pit != iPixCol->end(); pit++) {
187 pixelTrackRefs.push_back(
reco::TrackRef(iPixCol, pit - iPixCol->begin()));
197 double ptTriggered = -10;
198 double etaTriggered = -100;
199 double phiTriggered = -100;
204 std::vector<edm::Ref<l1t::TauBxCollection> > l1tauobjref;
205 std::vector<edm::Ref<l1t::JetBxCollection> > l1jetobjref;
212 for (
const auto&
p : l1tauobjref) {
213 if (
p->pt() > ptTriggered) {
214 ptTriggered =
p->pt();
215 phiTriggered =
p->phi();
216 etaTriggered =
p->eta();
219 for (
const auto&
p : l1jetobjref) {
220 if (
p->pt() > ptTriggered) {
221 ptTriggered =
p->pt();
222 phiTriggered =
p->phi();
223 etaTriggered =
p->eta();
227 edm::LogVerbatim(
"IsoTrack") <<
"Sizes " << l1tauobjref.size() <<
":" << l1jetobjref.size() <<
" Trig " << ptTriggered
228 <<
":" << etaTriggered <<
":" << phiTriggered;
232 std::vector<seedAtEC> VecSeedsatEC;
234 for (
unsigned iS = 0; iS < pixelTrackRefs.size(); iS++) {
235 bool vtxMatch =
false;
237 reco::VertexCollection::const_iterator vitSel;
240 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
241 if (
std::abs(pixelTrackRefs[iS]->
dz(vit->position())) < minDZ) {
242 minDZ =
std::abs(pixelTrackRefs[iS]->
dz(vit->position()));
255 edm::LogVerbatim(
"IsoTrack") <<
"minZD " << minDZ <<
" Found " << found <<
":" << vtxMatch;
258 double R =
reco::deltaR(etaTriggered, phiTriggered, pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi());
271 pixelTrackRefs[iS]->momentum().
phi(),
272 tj->momentum().eta(),
273 tj->momentum().phi()) > drMaxL1Track_)
282 std::pair<double, double> seedCooAtEC;
286 pixelTrackRefs[iS]->
phi(),
287 pixelTrackRefs[iS]->
pt(),
288 pixelTrackRefs[iS]->
charge(),
293 pixelTrackRefs[iS]->
phi(),
294 pixelTrackRefs[iS]->
pt(),
295 pixelTrackRefs[iS]->
charge(),
297 seedAtEC seed(iS, (tmatch || vtxMatch), seedCooAtEC.first, seedCooAtEC.second);
298 VecSeedsatEC.push_back(seed);
300 edm::LogVerbatim(
"IsoTrack") <<
"Seed " << seedCooAtEC.first << seedCooAtEC.second;
303 for (
unsigned int i = 0;
i < VecSeedsatEC.size();
i++) {
304 unsigned int iSeed = VecSeedsatEC[
i].index;
305 if (!VecSeedsatEC[
i].
ok)
312 pixelTrackRefs[iSeed]->momentum().
phi(),
313 tj->momentum().eta(),
314 tj->momentum().phi()) > drMaxL1Track_)
320 for (
unsigned int j = 0;
j < VecSeedsatEC.size();
j++) {
323 unsigned int iSurr = VecSeedsatEC[
j].index;
326 pixelTrackRefs[iSeed]->
phi(),
327 pixelTrackRefs[iSurr]->
eta(),
332 reco::VertexCollection::const_iterator vitSel2;
333 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
334 if (
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position())) < minDZ2) {
335 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()));
344 if (
getDistInCM(VecSeedsatEC[
i].
eta, VecSeedsatEC[
i].
phi, VecSeedsatEC[
j].eta, VecSeedsatEC[
j].phi) <
346 sumP += pixelTrackRefs[iSurr]->p();
347 if (pixelTrackRefs[iSurr]->
p() > maxP)
348 maxP = pixelTrackRefs[iSurr]->p();
353 pixelTrackRefs[iSeed],
l1t::TauRef(l1eTauJets, selj - l1eTauJets->begin()), maxP, sumP);
368 double theta1 = 2 * atan(
exp(-eta1));
369 double theta2 = 2 * atan(
exp(-eta2));
387 double etaIP,
double phiIP,
double pT,
int charge,
double vtxZ) {
392 double Rcurv = 9999999;
394 Rcurv = pT * 33.3 * 100 / (
bfVal_ * 10);
396 double ecDist =
zEE_;
398 double theta = 2 * atan(
exp(-etaIP));
403 if ((0.5 * ecRad / Rcurv) > 1) {
407 deltaPhi = -charge * asin(0.5 * ecRad / Rcurv);
408 double alpha1 = 2 * asin(0.5 * ecRad / Rcurv);
409 double z = ecRad /
tan(theta);
411 zNew = z * (Rcurv * alpha1) / ecRad + vtxZ;
413 zNew = -z * (Rcurv * alpha1) / ecRad + vtxZ;
416 etaEC = -
log(
tan(0.5 * atan(ecRad / zAbs)));
417 deltaPhi = -charge * asin(0.5 * ecRad / Rcurv);
420 zAbs = (
std::abs(etaIP) / etaIP) * ecDist;
421 double Zflight =
std::abs(zAbs - vtxZ);
422 double alpha = (Zflight * ecRad) / (z * Rcurv);
423 double Rec = 2 * Rcurv *
sin(alpha / 2);
424 deltaPhi = -charge * alpha / 2;
425 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
429 zNew = (
std::abs(etaIP) / etaIP) * ecDist;
430 double Zflight =
std::abs(zNew - vtxZ);
432 double Rec = 2 * Rcurv *
sin(Rvirt / (2 * Rcurv));
433 deltaPhi = -(
charge) * (Rvirt / (2 * Rcurv));
434 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
446 std::pair<double, double> retVal(etaEC, phiEC);
Log< level::Info, true > LogVerbatim
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.
static std::vector< std::string > checklist log
seedAtEC(unsigned int i, bool f, double et, double fi)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
tauAssocCone_(config.getParameter< double >("tauAssociationCone"))
GlobalVector inTesla(const GlobalPoint &g) const override
Field value ad specified global point, in Tesla.
IsolatedPixelTrackCandidateL1TProducer(const edm::ParameterSet &ps)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void beginRun(const edm::Run &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
const double maxPForIsolationValue_
tok_bFieldH_(esConsumes< MagneticField, IdealMagneticFieldRecord, edm::Transition::BeginRun >())
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
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
vtxCutIsol_(config.getParameter< double >("MaxVtxDXYIsol"))
Exp< T >::type exp(const T &t)
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 minPTrackValue_
std::vector< Vertex > VertexCollection
BXVector< Tau > TauBxCollection
const edm::EDGetTokenT< reco::VertexCollection > tok_vert_
bool getData(T &iHolder) const
std::vector< T >::const_iterator const_iterator
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)
minPTrackValue_(config.getParameter< double >("minPTrack"))
vtxCutSeed_(config.getParameter< double >("MaxVtxDXYSeed"))
ParameterDescriptionBase * add(U const &iLabel, T const &value)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
prelimCone_(config.getParameter< double >("ExtrapolationConeSize"))
const double tauAssocCone_
const double ebEtaBoundary_
~IsolatedPixelTrackCandidateL1TProducer() override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
tuple config
parse the configuration file
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_bFieldH_
bfield_(config.getParameter< std::string >("MagFieldRecordName"))
tauUnbiasCone_(config.getParameter< double >("tauUnbiasCone"))
pixelIsolationConeSizeAtEC_(config.getParameter< double >("PixelIsolationConeSizeAtEC"))
maxPForIsolationValue_(config.getParameter< double >("maxPTrackForIsolation"))
const std::string bfield_
ebEtaBoundary_(config.getParameter< double >("EBEtaBoundary"))
tok_geom_(esConsumes< CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun >())
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_