64 produces<reco::ElectronSeedCollection>();
65 produces<reco::PreIdCollection>();
66 produces<reco::PreIdCollection>(
"HCAL");
67 produces<edm::ValueMap<reco::PreIdRef> >();
84 auto seeds = std::make_unique<reco::ElectronSeedCollection>();
85 auto ecalPreIds = std::make_unique<reco::PreIdCollection>();
86 auto hcalPreIds = std::make_unique<reco::PreIdCollection>();
104 for (
auto& trk : *pfTracks) {
105 if (trk.trackRef().isNonnull()) {
106 if (trk.trackRef().id() != kfTracks.
id()) {
108 <<
"kfTracks is not the collection that pfTracks was built from, please fix this";
134 auto ecalPreIdsHandle =
event.put(
std::move(ecalPreIds));
135 event.put(
std::move(hcalPreIds),
"HCAL");
138 auto preIdVMOut = std::make_unique<edm::ValueMap<reco::PreIdRef> >();
159 template <
typename T>
170 event.getByToken(
rho_, rho);
201 std::vector<int> matchedEcalClusters;
202 std::vector<int> matchedHcalClusters;
205 seeds.reserve(
handle->size());
206 ecalPreIds.reserve(
handle->size());
207 hcalPreIds.reserve(
handle->size());
210 for (
unsigned int itrk = 0; itrk <
handle.product()->size(); itrk++) {
226 unsigned int nModels = globalCache()->modelNames().size();
236 templatedRef, ecalClusters, hcalClusters, matchedEcalClusters, matchedHcalClusters, ecalPreId, hcalPreId);
242 bool result =
decision(templatedRef, ecalPreId, hcalPreId, *rho, *spot, ecalTools);
250 ecalPreIds.push_back(ecalPreId);
251 hcalPreIds.push_back(hcalPreId);
252 trksToPreIdIndx[trackRef.
index()] = ecalPreIds.size() - 1;
255 seeds.push_back(seed);
286 std::vector<int>& matchedEcalClusters,
287 std::vector<int>& matchedHcalClusters,
313 point = pfTrackRef->extrapolatedPoint(reco::PFTrajectoryPoint::LayerType::ECALShowerMax);
315 point = pfTrackRef->extrapolatedPoint(reco::PFTrajectoryPoint::LayerType::HCALEntrance);
320 for (
unsigned int iclu = 0; iclu < clusters.
product()->size(); iclu++) {
321 if (
std::find(matched.begin(), matched.end(), iclu) == matched.end()) {
327 if (dr2 < info.dr2min) {
329 info.cluRef = cluRef;
330 info.deta = cluRef->positionREP().eta() - point.
positionREP().eta();
339 if (info.dr2min < 1.e5) {
340 float ep = info.cluRef->correctedEnergy() /
std::sqrt(pfTrackRef->trackRef()->innerMomentum().mag2());
348 pfTrackRef->trackRef()->normalizedChi2(),
361 std::vector<int>& matchedEcalClusters,
362 std::vector<int>& matchedHcalClusters,
377 kfTrackRef->outerMomentum().x(), kfTrackRef->outerMomentum().y(), kfTrackRef->outerMomentum().z(),
energy);
379 kfTrackRef->outerPosition().x(), kfTrackRef->outerPosition().y(), kfTrackRef->outerPosition().z(), 0.);
383 if (particle.getSuccess() == 0) {
389 particle.particle().vertex().x(), particle.particle().vertex().y(), particle.particle().vertex().z());
392 bool below_ps =
pow(ecal_pos.z(), 2.) >
boundary_ * ecal_pos.perp2();
395 for (
unsigned int iclu = 0; iclu < ecalClusters.
product()->size(); iclu++) {
401 particle.particle().momentum().y(),
402 particle.particle().momentum().z())
410 if (dr2 <
info.dr2min) {
412 info.cluRef = cluRef;
413 info.deta =
std::abs(cluRef->positionREP().eta() - showerPos.eta());
415 info.showerPos = showerPos;
431 kfTrackRef->normalizedChi2(),
432 info.cluRef->correctedEnergy() /
std::sqrt(kfTrackRef->innerMomentum().mag2()));
442 for (
unsigned int ihit = 0; ihit < trackRef->recHitsSize(); ++ihit) {
443 hits.push_back(trackRef->recHit(ihit)->cloneSH());
446 GlobalVector gv(trackRef->innerMomentum().x(), trackRef->innerMomentum().y(), trackRef->innerMomentum().z());
447 GlobalPoint gp(trackRef->innerPosition().x(), trackRef->innerPosition().y(), trackRef->innerPosition().z());
455 if (!traj1.isValid()) {
464 float chi2Ratio = trackRef->chi2() > 0. ? traj2.
chiSquared() / trackRef->chi2() : -1.;
465 float gsfReducedChi2 = chi2Ratio > -1. ? chi2Ratio * trackRef->normalizedChi2() : -1.;
468 float gsfDpt = (ptIn > 0) ? fabs(ptOut - ptIn) / ptIn : 0.;
483 for (
auto&
name : globalCache()->modelNames()) {
484 result |= globalCache()->eval(
name, ecalPreId, hcalPreId, rho, spot, ecalTools);
501 template <
typename CollType>
506 std::vector<reco::PreIdRef>
values;
508 unsigned ntracks = tracksHandle->size();
509 for (
unsigned itrack = 0; itrack < ntracks; ++itrack) {
511 auto preIdRefIt = trksToPreIdIndx.find(trackRef.
index());
512 if (preIdRefIt == trksToPreIdIndx.end()) {
516 values.push_back(preIdRef);
519 filler.
insert(tracksHandle, values.begin(), values.end());
535 desc.
add<
std::string>(
"Smoother",
"GsfTrajectorySmoother_forPreId");
537 desc.
add<std::vector<std::string> >(
"ModelNames", std::vector<std::string>());
538 desc.
add<std::vector<std::string> >(
"ModelWeights", std::vector<std::string>());
539 desc.
add<std::vector<double> >(
"ModelThresholds", std::vector<double>());
540 desc.
add<
bool>(
"PassThrough",
false);
541 desc.
add<
bool>(
"UsePfTracks",
true);
542 desc.
add<
double>(
"MinPtThreshold", 1.0);
543 desc.
add<
double>(
"MaxPtThreshold", 15.);
544 descriptions.
add(
"lowPtGsfElectronSeeds", desc);
const REPPoint & positionREP() const
trajectory position in (rho, eta, phi) base
constexpr double deltaPhi(double phi1, double phi2)
T getParameter(std::string const &) const
edm::ESHandle< MagneticField > field_
const std::string smoother_
std::unique_ptr< TrajectorySmoother > smootherPtr_
LowPtGsfElectronSeedProducer(const edm::ParameterSet &, const lowptgsfeleseed::HeavyObjectCache *)
void setECALMatchingProperties(PFClusterRef clusterRef, const math::XYZPoint &ecalpos, const math::XYZPoint &meanShower, float deta, float dphi, float chieta, float chiphi, float chi2, float eop)
std::vector< reco::PreId > PreIdCollection
void propagateTrackToCalo(const reco::PFRecTrackRef &pfTrackRef, const edm::Handle< reco::PFClusterCollection > &ecalClusters, const edm::Handle< reco::PFClusterCollection > &hcalClusters, std::vector< int > &matchedEcalClusters, std::vector< int > &matchedHcalClusters, reco::PreId &ecalPreId, reco::PreId &hcalPreId)
bool decision(const reco::PFRecTrackRef &pfTrackRef, reco::PreId &ecal, reco::PreId &hcal, double rho, const reco::BeamSpot &spot, noZS::EcalClusterLazyTools &ecalTools)
double z() const
z of vertex
const math::XYZPoint & position() const
cartesian position (x, y, z)
const edm::EDGetTokenT< reco::PFClusterCollection > ecalClusters_
~LowPtGsfElectronSeedProducer() override
edm::EDGetTokenT< reco::PFClusterCollection > hcalClusters_
void insert(const H &h, I begin, I end)
std::unordered_map< reco::TrackRef::key_type, size_t > TrackIndxMap
const edm::EDGetTokenT< reco::BeamSpot > beamSpot_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const std::string builder_
void setCtfTrack(const CtfTrackRef &)
Set additional info.
void loop(const edm::Handle< std::vector< T > > &handle, edm::Handle< reco::PFClusterCollection > &hcalClusters, reco::ElectronSeedCollection &seeds, reco::PreIdCollection &ecalPreIds, reco::PreIdCollection &hcalPreIds, TrackIndxMap &trksToPreIdIndx, edm::Event &, const edm::EventSetup &)
virtual TrajectorySmoother * clone() const =0
void setTrack(reco::TrackRef trackref)
void fillPreIdRefValueMap(edm::Handle< CollType > tracksHandle, const TrackIndxMap &trksToPreIdIndx, const edm::OrphanHandle< reco::PreIdCollection > &preIdHandle, edm::ValueMap< reco::PreIdRef >::Filler &filler)
const double minPtThreshold_
virtual std::unique_ptr< TrajectoryFitter > clone() const =0
edm::EDGetTokenT< reco::TrackCollection > kfTracks_
#define DEFINE_FWK_MODULE(type)
edm::Ref< PFClusterCollection > PFClusterRef
persistent reference to PFCluster objects
TrajectoryMeasurement const & lastMeasurement() const
bool lightGsfTracking(reco::PreId &, const reco::TrackRef &, const reco::ElectronSeed &, const edm::EventSetup &)
const edm::EDGetTokenT< EcalRecHitCollection > ebRecHits_
Abs< T >::type abs(const T &t)
edm::Ref< PFRecTrackCollection > PFRecTrackRef
persistent reference to PFRecTrack objects
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
const edm::EDGetTokenT< EcalRecHitCollection > eeRecHits_
const edm::EDGetTokenT< double > rho_
edm::EDGetTokenT< reco::PFRecTrackCollection > pfTracks_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
bool propagateToEcalEntrance(bool first=true)
static void fillDescriptions(edm::ConfigurationDescriptions &)
void produce(edm::Event &, const edm::EventSetup &) override
static double getDepthCorrection(double energy, bool isBelowPS=false, bool isHadron=false)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
TrajectoryMeasurement const & firstMeasurement() const
static TrackQuality qualityByName(const std::string &name)
bool isValid() const
is this point valid ?
T const * product() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
const std::string fitter_
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
void add(std::string const &label, ParameterSetDescription const &psetDescription)
TrackingRecHit::ConstRecHitContainer ConstRecHitContainer
void setTrackProperties(float newchi2, float chi2ratio, float dpt)
const double maxPtThreshold_
GlobalVector globalMomentum() const
TrajectoryStateOnSurface const & updatedState() const
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
T const * product() const
reco::TrackRef getBaseRef(edm::Handle< std::vector< reco::Track > > handle, int idx) const
Power< A, B >::type pow(const A &a, const B &b)
std::unique_ptr< TrajectoryFitter > fitterPtr_
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Global3DVector GlobalVector
math::XYZTLorentzVector XYZTLorentzVector
Basic3DVector unit() const