46 #include "Math/GenVector/VectorUtil.h" 47 #include "Math/GenVector/PxPyPzE4D.h" 88 const std::vector<edm::EDGetTokenT<reco::TrackCollection> >
toks_pix_;
116 tok_bFieldH_(esConsumes<MagneticField, IdealMagneticFieldRecord, edm::Transition::BeginRun>()),
117 tok_geom_(esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>()),
119 prelimCone_(
config.getParameter<
double>(
"ExtrapolationConeSize")),
120 pixelIsolationConeSizeAtEC_(
config.getParameter<
double>(
"PixelIsolationConeSizeAtEC")),
121 vtxCutSeed_(
config.getParameter<
double>(
"MaxVtxDXYSeed")),
122 vtxCutIsol_(
config.getParameter<
double>(
"MaxVtxDXYIsol")),
123 tauAssocCone_(
config.getParameter<
double>(
"tauAssociationCone")),
124 tauUnbiasCone_(
config.getParameter<
double>(
"tauUnbiasCone")),
125 minPTrackValue_(
config.getParameter<
double>(
"minPTrack")),
126 maxPForIsolationValue_(
config.getParameter<
double>(
"maxPTrackForIsolation")),
127 ebEtaBoundary_(
config.getParameter<
double>(
"EBEtaBoundary")),
132 produces<reco::IsolatedPixelTrackCandidateCollection>();
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++) {
185 for (reco::TrackCollection::const_iterator pit = iPixCol->begin(); pit != iPixCol->end(); pit++) {
186 pixelTrackRefs.push_back(
reco::TrackRef(iPixCol, pit - iPixCol->begin()));
194 double ptTriggered = -10;
195 double etaTriggered = -100;
196 double phiTriggered = -100;
200 std::vector<edm::Ref<l1t::TauBxCollection> > l1tauobjref;
201 std::vector<edm::Ref<l1t::JetBxCollection> > l1jetobjref;
208 for (
const auto&
p : l1tauobjref) {
209 if (
p->pt() > ptTriggered) {
210 ptTriggered =
p->pt();
211 phiTriggered =
p->phi();
212 etaTriggered =
p->eta();
215 for (
const auto&
p : l1jetobjref) {
216 if (
p->pt() > ptTriggered) {
217 ptTriggered =
p->pt();
218 phiTriggered =
p->phi();
219 etaTriggered =
p->eta();
223 edm::LogVerbatim(
"IsoTrack") <<
"Sizes " << l1tauobjref.size() <<
":" << l1jetobjref.size() <<
" Trig " << ptTriggered
224 <<
":" << etaTriggered <<
":" << phiTriggered;
230 std::vector<seedAtEC> VecSeedsatEC;
232 for (
unsigned iS = 0; iS < pixelTrackRefs.size(); iS++) {
233 bool vtxMatch =
false;
235 reco::VertexCollection::const_iterator vitSel;
238 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
239 if (
std::abs(pixelTrackRefs[iS]->
dz(vit->position())) < minDZ) {
240 minDZ =
std::abs(pixelTrackRefs[iS]->
dz(vit->position()));
256 double R =
reco::deltaR(etaTriggered, phiTriggered, pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi());
269 pixelTrackRefs[iS]->momentum().
phi(),
270 tj->momentum().eta(),
271 tj->momentum().phi()) > drMaxL1Track_)
280 std::pair<double, double> seedCooAtEC;
284 pixelTrackRefs[iS]->
phi(),
285 pixelTrackRefs[iS]->
pt(),
286 pixelTrackRefs[iS]->
charge(),
291 pixelTrackRefs[iS]->
phi(),
292 pixelTrackRefs[iS]->
pt(),
293 pixelTrackRefs[iS]->
charge(),
295 seedAtEC seed(iS, (tmatch || vtxMatch), seedCooAtEC.first, seedCooAtEC.second);
296 VecSeedsatEC.push_back(
seed);
298 edm::LogVerbatim(
"IsoTrack") <<
"Seed " << seedCooAtEC.first << seedCooAtEC.second;
301 for (
unsigned int i = 0;
i < VecSeedsatEC.size();
i++) {
302 unsigned int iSeed = VecSeedsatEC[
i].index;
303 if (!VecSeedsatEC[
i].
ok)
310 pixelTrackRefs[iSeed]->momentum().
phi(),
311 tj->momentum().eta(),
312 tj->momentum().phi()) > drMaxL1Track_)
318 for (
unsigned int j = 0;
j < VecSeedsatEC.size();
j++) {
321 unsigned int iSurr = VecSeedsatEC[
j].index;
324 pixelTrackRefs[iSeed]->
phi(),
325 pixelTrackRefs[iSurr]->
eta(),
330 reco::VertexCollection::const_iterator vitSel2;
331 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
332 if (
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position())) < minDZ2) {
333 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()));
344 sumP += pixelTrackRefs[iSurr]->p();
345 if (pixelTrackRefs[iSurr]->
p() >
maxP)
346 maxP = pixelTrackRefs[iSurr]->p();
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) {
408 double alpha1 = 2 * asin(0.5 * ecRad / Rcurv);
411 zNew =
z * (Rcurv * alpha1) / ecRad + vtxZ;
413 zNew = -
z * (Rcurv * alpha1) / ecRad + vtxZ;
416 etaEC = -
log(
tan(0.5 * atan(ecRad / zAbs)));
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);
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));
434 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
446 std::pair<double, double> retVal(etaEC, phiEC);
Log< level::Info, true > LogVerbatim
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
void produce(edm::Event &evt, const edm::EventSetup &es) override
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
seedAtEC(unsigned int i, bool f, double et, double fi)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
GlobalVector inTesla(const GlobalPoint &g) const override
Field value ad specified global point, in Tesla.
IsolatedPixelTrackCandidateL1TProducer(const edm::ParameterSet &ps)
void beginRun(const edm::Run &, const edm::EventSetup &) override
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
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
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_
const_iterator begin(int bx) 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
#define DEFINE_FWK_MODULE(type)
std::pair< double, double > GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
const double tauAssocCone_
const double ebEtaBoundary_
~IsolatedPixelTrackCandidateL1TProducer() override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const_iterator end(int bx) const
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_bFieldH_
Geom::Theta< T > theta() const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
const std::string bfield_
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_