45 #include "Math/GenVector/VectorUtil.h"
46 #include "Math/GenVector/PxPyPzE4D.h"
87 const std::vector<edm::EDGetTokenT<reco::TrackCollection> >
toks_pix_;
109 : tok_hlt_(consumes<trigger::TriggerFilterObjectWithRefs>(config.getParameter<edm::
InputTag>(
"L1GTSeedLabel"))),
115 tok_bFieldH_(esConsumes<MagneticField, IdealMagneticFieldRecord, edm::Transition::BeginRun>()),
116 tok_geom_(esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>()),
131 produces<reco::IsolatedPixelTrackCandidateCollection>();
138 std::vector<edm::InputTag> tracksrc = {
edm::InputTag(
"hltPixelTracks")};
140 desc.
add<
double>(
"tauAssociationCone", 0.0);
141 desc.
add<
double>(
"tauUnbiasCone", 1.2);
142 desc.
add<std::vector<edm::InputTag> >(
"PixelTracksSources", tracksrc);
143 desc.
add<
double>(
"ExtrapolationConeSize", 1.0);
144 desc.
add<
double>(
"PixelIsolationConeSizeAtEC", 40);
146 desc.
add<
double>(
"MaxVtxDXYSeed", 101.0);
147 desc.
add<
double>(
"MaxVtxDXYIsol", 101.0);
149 desc.
add<
std::string>(
"MagFieldRecordName",
"VolumeBasedMagneticField");
150 desc.
add<
double>(
"minPTrack", 5.0);
151 desc.
add<
double>(
"maxPTrackForIsolation", 3.0);
152 desc.
add<
double>(
"EBEtaBoundary", 1.479);
153 descriptions.
add(
"isolPixelTrackProd", desc);
160 ->avgRadiusXYFrontFaceCenter());
162 ->avgAbsZFrontFaceCenter());
174 auto trackCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
177 std::vector<reco::TrackRef> pixelTrackRefs;
180 <<
" candidates to start with\n";
182 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()));
199 std::vector<seedAtEC> VecSeedsatEC;
201 for (
unsigned iS = 0; iS < pixelTrackRefs.size(); iS++) {
202 bool vtxMatch =
false;
204 reco::VertexCollection::const_iterator vitSel;
207 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
208 if (
std::abs(pixelTrackRefs[iS]->
dz(vit->position())) < minDZ) {
209 minDZ =
std::abs(pixelTrackRefs[iS]->
dz(vit->position()));
224 l1extra::L1JetParticleCollection::const_iterator selj;
225 for (l1extra::L1JetParticleCollection::const_iterator tj = l1eTauJets->begin(); tj != l1eTauJets->end(); tj++) {
227 pixelTrackRefs[iS]->momentum().
phi(),
228 tj->momentum().eta(),
229 tj->momentum().phi()) > drMaxL1Track_)
236 std::pair<double, double> seedCooAtEC;
240 pixelTrackRefs[iS]->
phi(),
241 pixelTrackRefs[iS]->
pt(),
242 pixelTrackRefs[iS]->
charge(),
247 pixelTrackRefs[iS]->
phi(),
248 pixelTrackRefs[iS]->
pt(),
249 pixelTrackRefs[iS]->
charge(),
251 seedAtEC seed(iS, (tmatch || vtxMatch), seedCooAtEC.first, seedCooAtEC.second);
252 VecSeedsatEC.push_back(seed);
255 edm::LogVerbatim(
"HcalIsoTrack") <<
"IsolatedPixelTrakCandidate: " << VecSeedsatEC.size()
256 <<
" seeds after propagation\n";
259 for (
unsigned int i = 0;
i < VecSeedsatEC.size();
i++) {
260 unsigned int iSeed = VecSeedsatEC[
i].index;
261 if (!VecSeedsatEC[
i].
ok)
265 l1extra::L1JetParticleCollection::const_iterator selj;
266 for (l1extra::L1JetParticleCollection::const_iterator tj = l1eTauJets->begin(); tj != l1eTauJets->end(); tj++) {
268 pixelTrackRefs[iSeed]->momentum().
phi(),
269 tj->momentum().eta(),
270 tj->momentum().phi()) > drMaxL1Track_)
276 for (
unsigned int j = 0;
j < VecSeedsatEC.size();
j++) {
279 unsigned int iSurr = VecSeedsatEC[
j].index;
282 pixelTrackRefs[iSeed]->
phi(),
283 pixelTrackRefs[iSurr]->
eta(),
288 reco::VertexCollection::const_iterator vitSel2;
289 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
290 if (
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position())) < minDZ2) {
291 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()));
300 if (
getDistInCM(VecSeedsatEC[
i].
eta, VecSeedsatEC[
i].
phi, VecSeedsatEC[
j].eta, VecSeedsatEC[
j].phi) <
302 sumP += pixelTrackRefs[iSurr]->p();
303 if (pixelTrackRefs[iSurr]->
p() > maxP)
304 maxP = pixelTrackRefs[iSurr]->p();
318 edm::LogVerbatim(
"HcalIsoTrack") <<
"IsolatedPixelTrackCandidate: Final # of candiates " << ntr <<
"\n";
324 double theta1 = 2 * atan(
exp(-eta1));
325 double theta2 = 2 * atan(
exp(-eta2));
343 double etaIP,
double phiIP,
double pT,
int charge,
double vtxZ) {
348 double Rcurv = 9999999;
350 Rcurv = pT * 33.3 * 100 / (
bfVal_ * 10);
352 double ecDist =
zEE_;
354 double theta = 2 * atan(
exp(-etaIP));
359 if ((0.5 * ecRad / Rcurv) > 1) {
363 deltaPhi = -charge * asin(0.5 * ecRad / Rcurv);
364 double alpha1 = 2 * asin(0.5 * ecRad / Rcurv);
365 double z = ecRad /
tan(theta);
367 zNew = z * (Rcurv * alpha1) / ecRad + vtxZ;
369 zNew = -z * (Rcurv * alpha1) / ecRad + vtxZ;
372 etaEC = -
log(
tan(0.5 * atan(ecRad / zAbs)));
373 deltaPhi = -charge * asin(0.5 * ecRad / Rcurv);
376 zAbs = (
std::abs(etaIP) / etaIP) * ecDist;
377 double Zflight =
std::abs(zAbs - vtxZ);
378 double alpha = (Zflight * ecRad) / (z * Rcurv);
379 double Rec = 2 * Rcurv *
sin(alpha / 2);
380 deltaPhi = -charge * alpha / 2;
381 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
385 zNew = (
std::abs(etaIP) / etaIP) * ecDist;
386 double Zflight =
std::abs(zNew - vtxZ);
388 double Rec = 2 * Rcurv *
sin(Rvirt / (2 * Rcurv));
389 deltaPhi = -(
charge) * (Rvirt / (2 * Rcurv));
390 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
402 std::pair<double, double> retVal(etaEC, phiEC);
std::pair< double, double > GetEtaPhiAtEcal(double etaIP, double phiIP, double pT, int charge, double vtxZ)
Log< level::Info, true > LogVerbatim
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.
static std::vector< std::string > checklist log
const double ebEtaBoundary_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
tauAssocCone_(config.getParameter< double >("tauAssociationCone"))
void beginRun(const edm::Run &, const edm::EventSetup &) override
const double tauUnbiasCone_
GlobalVector inTesla(const GlobalPoint &g) const override
Field value ad specified global point, in Tesla.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_
const edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_l1_
#define DEFINE_FWK_MODULE(type)
tok_bFieldH_(esConsumes< MagneticField, IdealMagneticFieldRecord, edm::Transition::BeginRun >())
Sin< T >::type sin(const T &t)
IsolatedPixelTrackCandidateProducer(const edm::ParameterSet &ps)
Global3DPoint GlobalPoint
Geom::Theta< T > theta() const
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 >
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< Vertex > VertexCollection
const double tauAssocCone_
seedAtEC(unsigned int i, bool f, double et, double fi)
bool getData(T &iHolder) const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_bFieldH_
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
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 std::string bfield_
~IsolatedPixelTrackCandidateProducer() override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< reco::VertexCollection > tok_vert_
const double minPTrackValue_
const double pixelIsolationConeSizeAtEC_
tuple config
parse the configuration file
const double maxPForIsolationValue_
bfield_(config.getParameter< std::string >("MagFieldRecordName"))
double getDistInCM(double eta1, double phi1, double eta2, double phi2)
tauUnbiasCone_(config.getParameter< double >("tauUnbiasCone"))
pixelIsolationConeSizeAtEC_(config.getParameter< double >("PixelIsolationConeSizeAtEC"))
void produce(edm::Event &evt, const edm::EventSetup &es) override
maxPForIsolationValue_(config.getParameter< double >("maxPTrackForIsolation"))
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)