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;
228 std::vector<seedAtEC> VecSeedsatEC;
230 for (
unsigned iS = 0; iS < pixelTrackRefs.size(); iS++) {
231 bool vtxMatch =
false;
233 reco::VertexCollection::const_iterator vitSel;
236 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
237 if (
std::abs(pixelTrackRefs[iS]->
dz(vit->position())) < minDZ) {
238 minDZ =
std::abs(pixelTrackRefs[iS]->
dz(vit->position()));
254 double R =
reco::deltaR(etaTriggered, phiTriggered, pixelTrackRefs[iS]->
eta(), pixelTrackRefs[iS]->
phi());
267 pixelTrackRefs[iS]->momentum().
phi(),
268 tj->momentum().eta(),
269 tj->momentum().phi()) > drMaxL1Track_)
278 std::pair<double, double> seedCooAtEC;
282 pixelTrackRefs[iS]->
phi(),
283 pixelTrackRefs[iS]->
pt(),
284 pixelTrackRefs[iS]->
charge(),
289 pixelTrackRefs[iS]->
phi(),
290 pixelTrackRefs[iS]->
pt(),
291 pixelTrackRefs[iS]->
charge(),
293 seedAtEC seed(iS, (tmatch || vtxMatch), seedCooAtEC.first, seedCooAtEC.second);
294 VecSeedsatEC.push_back(
seed);
296 edm::LogVerbatim(
"IsoTrack") <<
"Seed " << seedCooAtEC.first << seedCooAtEC.second;
299 for (
unsigned int i = 0;
i < VecSeedsatEC.size();
i++) {
300 unsigned int iSeed = VecSeedsatEC[
i].index;
301 if (!VecSeedsatEC[
i].
ok)
308 pixelTrackRefs[iSeed]->momentum().
phi(),
309 tj->momentum().eta(),
310 tj->momentum().phi()) > drMaxL1Track_)
316 for (
unsigned int j = 0;
j < VecSeedsatEC.size();
j++) {
319 unsigned int iSurr = VecSeedsatEC[
j].index;
322 pixelTrackRefs[iSeed]->
phi(),
323 pixelTrackRefs[iSurr]->
eta(),
328 reco::VertexCollection::const_iterator vitSel2;
329 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
330 if (
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position())) < minDZ2) {
331 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()));
342 sumP += pixelTrackRefs[iSurr]->p();
343 if (pixelTrackRefs[iSurr]->
p() >
maxP)
344 maxP = pixelTrackRefs[iSurr]->p();
364 double theta1 = 2 * atan(
exp(-
eta1));
365 double theta2 = 2 * atan(
exp(-
eta2));
383 double etaIP,
double phiIP,
double pT,
int charge,
double vtxZ) {
388 double Rcurv = 9999999;
390 Rcurv =
pT * 33.3 * 100 / (
bfVal_ * 10);
392 double ecDist =
zEE_;
394 double theta = 2 * atan(
exp(-etaIP));
399 if ((0.5 * ecRad / Rcurv) > 1) {
404 double alpha1 = 2 * asin(0.5 * ecRad / Rcurv);
407 zNew =
z * (Rcurv * alpha1) / ecRad + vtxZ;
409 zNew = -
z * (Rcurv * alpha1) / ecRad + vtxZ;
412 etaEC = -
log(
tan(0.5 * atan(ecRad / zAbs)));
416 zAbs = (
std::abs(etaIP) / etaIP) * ecDist;
417 double Zflight =
std::abs(zAbs - vtxZ);
418 double alpha = (Zflight * ecRad) / (
z * Rcurv);
419 double Rec = 2 * Rcurv *
sin(
alpha / 2);
421 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
425 zNew = (
std::abs(etaIP) / etaIP) * ecDist;
426 double Zflight =
std::abs(zNew - vtxZ);
428 double Rec = 2 * Rcurv *
sin(Rvirt / (2 * Rcurv));
430 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
442 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_