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()));
196 std::vector<seedAtEC> VecSeedsatEC;
198 for (
unsigned iS = 0; iS < pixelTrackRefs.size(); iS++) {
199 bool vtxMatch =
false;
201 reco::VertexCollection::const_iterator vitSel;
204 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
205 if (
std::abs(pixelTrackRefs[iS]->
dz(vit->position())) < minDZ) {
206 minDZ =
std::abs(pixelTrackRefs[iS]->
dz(vit->position()));
221 l1extra::L1JetParticleCollection::const_iterator selj;
222 for (l1extra::L1JetParticleCollection::const_iterator tj = l1eTauJets->begin(); tj != l1eTauJets->end(); tj++) {
224 pixelTrackRefs[iS]->momentum().
phi(),
225 tj->momentum().eta(),
226 tj->momentum().phi()) > drMaxL1Track_)
233 std::pair<double, double> seedCooAtEC;
237 pixelTrackRefs[iS]->
phi(),
238 pixelTrackRefs[iS]->
pt(),
239 pixelTrackRefs[iS]->
charge(),
244 pixelTrackRefs[iS]->
phi(),
245 pixelTrackRefs[iS]->
pt(),
246 pixelTrackRefs[iS]->
charge(),
248 seedAtEC seed(iS, (tmatch || vtxMatch), seedCooAtEC.first, seedCooAtEC.second);
249 VecSeedsatEC.push_back(
seed);
252 edm::LogVerbatim(
"HcalIsoTrack") <<
"IsolatedPixelTrakCandidate: " << VecSeedsatEC.size()
253 <<
" seeds after propagation\n";
256 for (
unsigned int i = 0;
i < VecSeedsatEC.size();
i++) {
257 unsigned int iSeed = VecSeedsatEC[
i].index;
258 if (!VecSeedsatEC[
i].
ok)
262 l1extra::L1JetParticleCollection::const_iterator selj;
263 for (l1extra::L1JetParticleCollection::const_iterator tj = l1eTauJets->begin(); tj != l1eTauJets->end(); tj++) {
265 pixelTrackRefs[iSeed]->momentum().
phi(),
266 tj->momentum().eta(),
267 tj->momentum().phi()) > drMaxL1Track_)
273 for (
unsigned int j = 0;
j < VecSeedsatEC.size();
j++) {
276 unsigned int iSurr = VecSeedsatEC[
j].index;
279 pixelTrackRefs[iSeed]->
phi(),
280 pixelTrackRefs[iSurr]->
eta(),
285 reco::VertexCollection::const_iterator vitSel2;
286 for (reco::VertexCollection::const_iterator vit = pVert->begin(); vit != pVert->end(); vit++) {
287 if (
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position())) < minDZ2) {
288 minDZ2 =
std::abs(pixelTrackRefs[iSurr]->
dz(vit->position()));
299 sumP += pixelTrackRefs[iSurr]->p();
300 if (pixelTrackRefs[iSurr]->
p() >
maxP)
301 maxP = pixelTrackRefs[iSurr]->p();
315 edm::LogVerbatim(
"HcalIsoTrack") <<
"IsolatedPixelTrackCandidate: Final # of candiates " << ntr <<
"\n";
321 double theta1 = 2 * atan(
exp(-
eta1));
322 double theta2 = 2 * atan(
exp(-
eta2));
340 double etaIP,
double phiIP,
double pT,
int charge,
double vtxZ) {
345 double Rcurv = 9999999;
347 Rcurv =
pT * 33.3 * 100 / (
bfVal_ * 10);
349 double ecDist =
zEE_;
351 double theta = 2 * atan(
exp(-etaIP));
356 if ((0.5 * ecRad / Rcurv) > 1) {
361 double alpha1 = 2 * asin(0.5 * ecRad / Rcurv);
364 zNew =
z * (Rcurv * alpha1) / ecRad + vtxZ;
366 zNew = -
z * (Rcurv * alpha1) / ecRad + vtxZ;
369 etaEC = -
log(
tan(0.5 * atan(ecRad / zAbs)));
373 zAbs = (
std::abs(etaIP) / etaIP) * ecDist;
374 double Zflight =
std::abs(zAbs - vtxZ);
375 double alpha = (Zflight * ecRad) / (
z * Rcurv);
376 double Rec = 2 * Rcurv *
sin(
alpha / 2);
378 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
382 zNew = (
std::abs(etaIP) / etaIP) * ecDist;
383 double Zflight =
std::abs(zNew - vtxZ);
385 double Rec = 2 * Rcurv *
sin(Rvirt / (2 * Rcurv));
387 etaEC = -
log(
tan(0.5 * atan(Rec / ecDist)));
399 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.
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_
#define DEFINE_FWK_MODULE(type)
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
bool getData(T &iHolder) const
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
Geom::Theta< T > theta() const
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)