45 #include "Math/GenVector/VectorUtil.h" 46 #include "Math/GenVector/PxPyPzE4D.h" 87 const std::vector<edm::EDGetTokenT<reco::TrackCollection> >
toks_pix_;
115 tok_bFieldH_(esConsumes<MagneticField, IdealMagneticFieldRecord, edm::Transition::BeginRun>()),
116 tok_geom_(esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>()),
118 prelimCone_(
config.getParameter<
double>(
"ExtrapolationConeSize")),
119 pixelIsolationConeSizeAtEC_(
config.getParameter<
double>(
"PixelIsolationConeSizeAtEC")),
120 vtxCutSeed_(
config.getParameter<
double>(
"MaxVtxDXYSeed")),
121 vtxCutIsol_(
config.getParameter<
double>(
"MaxVtxDXYIsol")),
122 tauAssocCone_(
config.getParameter<
double>(
"tauAssociationCone")),
123 tauUnbiasCone_(
config.getParameter<
double>(
"tauUnbiasCone")),
124 minPTrackValue_(
config.getParameter<
double>(
"minPTrack")),
125 maxPForIsolationValue_(
config.getParameter<
double>(
"maxPTrackForIsolation")),
126 ebEtaBoundary_(
config.getParameter<
double>(
"EBEtaBoundary")),
131 produces<reco::IsolatedPixelTrackCandidateCollection>();
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++) {
184 for (reco::TrackCollection::const_iterator pit = iPixCol->begin(); pit != iPixCol->end(); pit++) {
185 pixelTrackRefs.push_back(
reco::TrackRef(iPixCol, pit - iPixCol->begin()));
197 std::vector<seedAtEC> VecSeedsatEC;
199 for (
unsigned iS = 0; iS < pixelTrackRefs.size(); iS++) {
200 bool vtxMatch =
false;
202 reco::VertexCollection::const_iterator vitSel;
205 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
206 if (
std::abs(pixelTrackRefs[iS]->
dz(vit->position())) < minDZ) {
207 minDZ =
std::abs(pixelTrackRefs[iS]->
dz(vit->position()));
222 l1extra::L1JetParticleCollection::const_iterator selj;
223 for (l1extra::L1JetParticleCollection::const_iterator tj = l1eTauJets->begin(); tj != l1eTauJets->end(); tj++) {
225 pixelTrackRefs[iS]->momentum().
phi(),
226 tj->momentum().eta(),
227 tj->momentum().phi()) > drMaxL1Track_)
234 std::pair<double, double> seedCooAtEC;
238 pixelTrackRefs[iS]->
phi(),
239 pixelTrackRefs[iS]->
pt(),
240 pixelTrackRefs[iS]->
charge(),
245 pixelTrackRefs[iS]->
phi(),
246 pixelTrackRefs[iS]->
pt(),
247 pixelTrackRefs[iS]->
charge(),
249 seedAtEC seed(iS, (tmatch || vtxMatch), seedCooAtEC.first, seedCooAtEC.second);
250 VecSeedsatEC.push_back(
seed);
253 edm::LogVerbatim(
"HcalIsoTrack") <<
"IsolatedPixelTrakCandidate: " << VecSeedsatEC.size()
254 <<
" seeds after propagation\n";
257 for (
unsigned int i = 0;
i < VecSeedsatEC.size();
i++) {
258 unsigned int iSeed = VecSeedsatEC[
i].index;
259 if (!VecSeedsatEC[
i].
ok)
263 l1extra::L1JetParticleCollection::const_iterator selj;
264 for (l1extra::L1JetParticleCollection::const_iterator tj = l1eTauJets->begin(); tj != l1eTauJets->end(); tj++) {
266 pixelTrackRefs[iSeed]->momentum().
phi(),
267 tj->momentum().eta(),
268 tj->momentum().phi()) > drMaxL1Track_)
274 for (
unsigned int j = 0;
j < VecSeedsatEC.size();
j++) {
277 unsigned int iSurr = VecSeedsatEC[
j].index;
280 pixelTrackRefs[iSeed]->
phi(),
281 pixelTrackRefs[iSurr]->
eta(),
286 reco::VertexCollection::const_iterator vitSel2;
287 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
288 if (
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position())) < minDZ2) {
289 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()));
300 sumP += pixelTrackRefs[iSurr]->p();
301 if (pixelTrackRefs[iSurr]->
p() >
maxP)
302 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) {
364 double alpha1 = 2 * asin(0.5 * ecRad / Rcurv);
367 zNew =
z * (Rcurv * alpha1) / ecRad + vtxZ;
369 zNew = -
z * (Rcurv * alpha1) / ecRad + vtxZ;
372 etaEC = -
log(
tan(0.5 * atan(ecRad / zAbs)));
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);
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));
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 std::vector< edm::EDGetTokenT< reco::TrackCollection > > toks_pix_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const double ebEtaBoundary_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
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.
const edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hlt_
const edm::EDGetTokenT< l1extra::L1JetParticleCollection > tok_l1_
Sin< T >::type sin(const T &t)
IsolatedPixelTrackCandidateProducer(const edm::ParameterSet &ps)
Global3DPoint GlobalPoint
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)
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
#define DEFINE_FWK_MODULE(type)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
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_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
const double maxPForIsolationValue_
double getDistInCM(double eta1, double phi1, double eta2, double phi2)
void produce(edm::Event &evt, const edm::EventSetup &es) override
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
T angle(T x1, T y1, T z1, T x2, T y2, T z2)