65 produces<reco::ElectronSeedCollection>();
66 produces<reco::PreIdCollection>();
67 produces<reco::PreIdCollection>(
"HCAL");
68 produces< edm::ValueMap<reco::PreIdRef> >();
90 auto seeds = std::make_unique<reco::ElectronSeedCollection>();
91 auto ecalPreIds = std::make_unique<reco::PreIdCollection>();
92 auto hcalPreIds = std::make_unique<reco::PreIdCollection>();
112 for(
auto& trk : *pfTracks){
113 if(trk.trackRef().isNonnull()){
114 if(trk.trackRef().id() != kfTracks.
id()){
115 throw cms::Exception(
"ConfigError") <<
"kfTracks is not the collection that pfTracks was built from, please fix this";
143 auto ecalPreIdsHandle =
event.put(
std::move(ecalPreIds));
147 auto preIdVMOut = std::make_unique< edm::ValueMap<reco::PreIdRef> >();
170 template <
typename T>
183 event.getByToken(
rho_,rho);
214 std::vector<int> matchedEcalClusters;
215 std::vector<int> matchedHcalClusters;
218 seeds.reserve(
handle->size());
219 ecalPreIds.reserve(
handle->size());
220 hcalPreIds.reserve(
handle->size());
223 for (
unsigned int itrk = 0; itrk <
handle.product()->size(); itrk++ ) {
236 unsigned int nModels = globalCache()->modelNames().size();
257 bool result =
decision(templatedRef,ecalPreId,hcalPreId,*rho,*spot,ecalTools);
260 if ( !result ) {
continue; }
263 ecalPreIds.push_back(ecalPreId);
264 hcalPreIds.push_back(hcalPreId);
265 trksToPreIdIndx[trackRef.
index()] = ecalPreIds.size()-1;
268 seeds.push_back(seed);
303 std::vector<int>& matchedEcalClusters,
304 std::vector<int>& matchedHcalClusters,
332 if ( ecal ) { point = pfTrackRef->extrapolatedPoint(reco::PFTrajectoryPoint::LayerType::ECALShowerMax); }
333 else { point = pfTrackRef->extrapolatedPoint(reco::PFTrajectoryPoint::LayerType::HCALEntrance); }
338 for (
unsigned int iclu = 0; iclu < clusters.
product()->size(); iclu++ ) {
340 if (
std::find( matched.begin(), matched.end(), iclu ) == matched.end() ) {
347 if ( dr2 < info.dr2min ) {
349 info.cluRef = cluRef;
350 info.deta = cluRef->positionREP().eta() - point.
positionREP().eta();
353 pfTrackRef->trackRef()->charge();
361 if ( info.dr2min < 1.e5 ) {
362 float ep = info.cluRef->correctedEnergy() /
std::sqrt( pfTrackRef->trackRef()->innerMomentum().mag2() );
370 pfTrackRef->trackRef()->normalizedChi2(),
383 std::vector<int>& matchedEcalClusters,
384 std::vector<int>& matchedHcalClusters,
399 float energy =
sqrt(
mass_ + kfTrackRef->outerMomentum().Mag2() );
401 kfTrackRef->outerMomentum().y(),
402 kfTrackRef->outerMomentum().z(),
405 kfTrackRef->outerPosition().y(),
406 kfTrackRef->outerPosition().z(),
410 particle.
setCharge(kfTrackRef->charge());
411 particle.propagateToEcalEntrance(
false);
412 if ( particle.getSuccess() == 0 ) {
return; }
416 particle.vertex().y(),
417 particle.vertex().z());
420 bool below_ps =
pow(ecal_pos.z(),2.) >
boundary_*ecal_pos.perp2();
423 for (
unsigned int iclu = 0; iclu < ecalClusters.
product()->size(); iclu++ ) {
432 particle.momentum().y(),
433 particle.momentum().z()).
unit() * shower_depth;
436 float dr2 =
reco::deltaR2( cluRef->positionREP(), showerPos );
439 if ( dr2 <
info.dr2min ) {
441 info.cluRef = cluRef;
442 info.deta =
std::abs( cluRef->positionREP().eta() - showerPos.eta() );
445 kfTrackRef->charge();
446 info.showerPos = showerPos;
464 kfTrackRef->normalizedChi2(),
465 info.cluRef->correctedEnergy() /
std::sqrt( kfTrackRef->innerMomentum().mag2() ) );
478 for (
unsigned int ihit = 0; ihit < trackRef->recHitsSize(); ++ihit ) {
479 hits.push_back( trackRef->recHit(ihit)->cloneSH() );
483 trackRef->innerMomentum().y(),
484 trackRef->innerMomentum().z() );
486 trackRef->innerPosition().y(),
487 trackRef->innerPosition().z() );
495 trackRef->innerStateCovariance(),
496 *hits[0]->surface() );
500 if ( !traj1.isValid() ) {
return false; }
502 if ( !traj2.
isValid() ) {
return false; }
505 float chi2Ratio = trackRef->chi2() > 0. ? traj2.
chiSquared() / trackRef->chi2() : -1.;
506 float gsfReducedChi2 = chi2Ratio > -1. ? chi2Ratio * trackRef->normalizedChi2() : -1.;
509 float gsfDpt = ( ptIn > 0 ) ? fabs( ptOut - ptIn ) / ptIn : 0.;
526 for (
auto&
name: globalCache()->modelNames() ) {
527 result |= globalCache()->eval(
name,
550 template<
typename CollType>
556 std::vector<reco::PreIdRef>
values;
558 unsigned ntracks=tracksHandle->size();
559 for(
unsigned itrack=0;itrack<ntracks;++itrack){
561 auto preIdRefIt = trksToPreIdIndx.find(trackRef.
index());
562 if(preIdRefIt==trksToPreIdIndx.end()){
566 values.push_back(preIdRef);
569 filler.
insert(tracksHandle,values.begin(),values.end());
586 desc.
add<
std::string>(
"Smoother",
"GsfTrajectorySmoother_forPreId");
588 desc.
add< std::vector<std::string> >(
"ModelNames",std::vector<std::string>());
589 desc.
add< std::vector<std::string> >(
"ModelWeights",std::vector<std::string>());
590 desc.
add< std::vector<double> >(
"ModelThresholds",std::vector<double>());
591 desc.
add<
bool>(
"PassThrough",
false);
592 desc.
add<
bool>(
"UsePfTracks",
true);
593 desc.
add<
double>(
"MinPtThreshold",1.0);
594 desc.
add<
double>(
"MaxPtThreshold",15.);
595 descriptions.
add(
"lowPtGsfElectronSeeds",desc);
const REPPoint & positionREP() const
trajectory position in (rho, eta, phi) base
constexpr double deltaPhi(double phi1, double phi2)
void setCharge(float q)
set the MEASURED charge
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)
#define DEFINE_FWK_MODULE(type)
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)
def setup(process, global_tag, zero_tesla=False)
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)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
const double minPtThreshold_
virtual std::unique_ptr< TrajectoryFitter > clone() const =0
edm::EDGetTokenT< reco::TrackCollection > kfTracks_
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.
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
std::unordered_map< reco::TrackRef::key_type, size_t > TrackIndxMap
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