CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
ConvBremSeedProducer Class Reference
Inheritance diagram for ConvBremSeedProducer:
edm::stream::EDProducer<>

Public Member Functions

 ConvBremSeedProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
const DetLayerdetLayer (const TrackerLayer &layer, float zpos) const
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 
int GoodCluster (const BaseParticlePropagator &bpg, const reco::PFClusterCollection &pfc, float minep, bool sec=false)
 
void initializeLayerMap ()
 
bool isGsfTrack (const reco::Track &, const TrackingRecHit *)
 
TrajectoryStateOnSurface makeTrajectoryState (const DetLayer *layer, const ParticlePropagator &pp, const MagneticField *field) const
 
void produce (edm::Event &, const edm::EventSetup &) override
 
std::vector< bool > sharedHits (const std::vector< std::pair< TrajectorySeed, std::pair< GlobalVector, float > > > &)
 

Private Attributes

math::XYZVector B_
 B field. More...
 
const MagneticFieldMapfieldMap_
 
const TrackerInteractionGeometrygeometry_
 
const edm::ESGetToken< TrackerInteractionGeometry, TrackerInteractionGeometryRecordgeometryToken_
 
const GeometricSearchTrackergeomSearchTracker_
 
const edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecordgeomSearchTrackerToken_
 
const TransientTrackingRecHitBuilderhitBuilder_
 
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecordhitBuilderToken_
 
const KFUpdatorkfUpdator_
 
std::vector< const DetLayer * > layerMap_
 
const MagneticFieldmagfield_
 
const edm::ESGetToken< MagneticFieldMap, MagneticFieldMapRecordmagFieldMapToken_
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagFieldToken_
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagFieldToken_beginRun_
 
const edm::EDGetTokenT< SiStripMatchedRecHit2DCollectionmatchedrecHitsToken_
 
int negLayerOffset_
 
const edm::EDGetTokenT< reco::PFClusterCollectionpfToken_
 
const edm::EDGetTokenT< SiPixelRecHitCollectionpixelHitsToken_
 
const PropagatorWithMaterialpropagator_
 
const edm::EDGetTokenT< SiStripRecHit2DCollectionrphirecHitsToken_
 
std::vector< const DetLayer * > theLayerMap
 
const edm::EDGetTokenT< reco::GsfPFRecTrackCollectionthePfRecTrackToken_
 
const TrackerGeometrytracker_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtrackerToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 54 of file ConvBremSeedProducer.cc.

Constructor & Destructor Documentation

◆ ConvBremSeedProducer()

ConvBremSeedProducer::ConvBremSeedProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 127 of file ConvBremSeedProducer.cc.

128  : pfToken_(consumes<reco::PFClusterCollection>(iConfig.getParameter<InputTag>("PFClusters"))),
129  pixelHitsToken_(consumes<SiPixelRecHitCollection>(iConfig.getParameter<InputTag>("pixelRecHits"))),
130  rphirecHitsToken_(consumes<SiStripRecHit2DCollection>(iConfig.getParameter<InputTag>("rphirecHits"))),
132  consumes<SiStripMatchedRecHit2DCollection>(iConfig.getParameter<InputTag>("matchedrecHits"))),
133  thePfRecTrackToken_(consumes<reco::GsfPFRecTrackCollection>(iConfig.getParameter<InputTag>("PFRecTrackLabel"))),
134  fieldMap_(nullptr),
135  layerMap_(56, static_cast<const DetLayer*>(nullptr)),
136  negLayerOffset_(27),
138  geomSearchTrackerToken_(esConsumes<edm::Transition::BeginRun>()),
139  geometryToken_(esConsumes<edm::Transition::BeginRun>()),
140  trackerToken_(esConsumes<edm::Transition::BeginRun>()),
141  magFieldToken_beginRun_(esConsumes<edm::Transition::BeginRun>()),
142  magFieldMapToken_(esConsumes<edm::Transition::BeginRun>()),
144  esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", iConfig.getParameter<string>("TTRHBuilder")))) {
145  produces<ConvBremSeedCollection>();
146 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > hitBuilderToken_
const edm::ESGetToken< TrackerInteractionGeometry, TrackerInteractionGeometryRecord > geometryToken_
const edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedrecHitsToken_
const MagneticFieldMap * fieldMap_
const edm::EDGetTokenT< SiPixelRecHitCollection > pixelHitsToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_beginRun_
std::vector< const DetLayer * > layerMap_
const edm::EDGetTokenT< reco::PFClusterCollection > pfToken_
const edm::ESGetToken< MagneticFieldMap, MagneticFieldMapRecord > magFieldMapToken_
const edm::EDGetTokenT< SiStripRecHit2DCollection > rphirecHitsToken_
const edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecord > geomSearchTrackerToken_
const edm::EDGetTokenT< reco::GsfPFRecTrackCollection > thePfRecTrackToken_

Member Function Documentation

◆ beginRun()

void ConvBremSeedProducer::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 423 of file ConvBremSeedProducer.cc.

References alongMomentum, B_, fieldMap_, geometry_, geometryToken_, geomSearchTracker_, geomSearchTrackerToken_, edm::EventSetup::getData(), hitBuilder_, hitBuilderToken_, MagneticField::inTesla(), kfUpdator_, magfield_, magFieldMapToken_, magFieldToken_beginRun_, propagator_, tracker_, and trackerToken_.

423  {
425 
426  geometry_ = &iSetup.getData(geometryToken_);
427 
428  tracker_ = &iSetup.getData(trackerToken_);
429 
431  B_ = magfield_->inTesla(GlobalPoint(0, 0, 0));
432 
434 
436 
438  kfUpdator_ = new KFUpdator();
439 }
const MagneticField * magfield_
const GeometricSearchTracker * geomSearchTracker_
const TransientTrackingRecHitBuilder * hitBuilder_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > hitBuilderToken_
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
const edm::ESGetToken< TrackerInteractionGeometry, TrackerInteractionGeometryRecord > geometryToken_
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const PropagatorWithMaterial * propagator_
const KFUpdator * kfUpdator_
const TrackerInteractionGeometry * geometry_
const MagneticFieldMap * fieldMap_
math::XYZVector B_
B field.
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_beginRun_
const edm::ESGetToken< MagneticFieldMap, MagneticFieldMapRecord > magFieldMapToken_
const TrackerGeometry * tracker_
const edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecord > geomSearchTrackerToken_

◆ detLayer()

const DetLayer * ConvBremSeedProducer::detLayer ( const TrackerLayer layer,
float  zpos 
) const
private

Definition at line 521 of file ConvBremSeedProducer.cc.

References nano_mu_digi_cff::layer, layerMap_, and negLayerOffset_.

Referenced by produce().

521  {
522  if (zpos > 0 || !layer.forward())
523  return layerMap_[layer.layerNumber()];
524  else
525  return layerMap_[layer.layerNumber() + negLayerOffset_];
526 }
std::vector< const DetLayer * > layerMap_

◆ endRun()

void ConvBremSeedProducer::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 441 of file ConvBremSeedProducer.cc.

References kfUpdator_, and propagator_.

441  {
442  delete propagator_;
443  delete kfUpdator_;
444 }
const PropagatorWithMaterial * propagator_
const KFUpdator * kfUpdator_

◆ fillDescriptions()

void ConvBremSeedProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 112 of file ConvBremSeedProducer.cc.

References submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

112  {
113  // convBremSeeds
115  desc.add<edm::InputTag>("pixelRecHits", edm::InputTag("gsPixelRecHits"));
116  desc.add<edm::InputTag>("matchedrecHits", edm::InputTag("gsStripRecHits", "matchedRecHit"));
117  desc.add<std::string>("TTRHBuilder", "WithTrackAngle");
118  desc.add<edm::InputTag>("rphirecHits", edm::InputTag("gsStripRecHits", "rphiRecHit"));
119  desc.add<edm::InputTag>("PFClusters", edm::InputTag("particleFlowClusterECAL"));
120  desc.add<edm::InputTag>("PFRecTrackLabel", edm::InputTag("pfTrackElec"));
121 }

◆ GoodCluster()

int ConvBremSeedProducer::GoodCluster ( const BaseParticlePropagator bpg,
const reco::PFClusterCollection pfc,
float  minep,
bool  sec = false 
)
private

Definition at line 588 of file ConvBremSeedProducer.cc.

References das-up-to-nevents::df, l1ctLayer1_cff::dr, PVValHelper::eta, BaseParticlePropagator::getSuccess(), mps_fire::i, RawParticle::momentum(), BaseParticlePropagator::particle(), phi, position, funct::pow(), BaseParticlePropagator::propagateToEcalEntrance(), fileinputsource_cfi::sec, mathSSE::sqrt(), TwoPi, and RawParticle::vertex().

Referenced by produce().

591  {
592  BaseParticlePropagator bpg = ubpg;
593  bpg.propagateToEcalEntrance(false);
594  float dr = 1000;
595  float de = 1000;
596  float df = 1000;
597  int ibest = -1;
598 
599  if (bpg.getSuccess() != 0) {
600  for (unsigned int i = 0; i < pfc.size(); i++) {
601  float tmp_ep = pfc[i].energy() / bpg.particle().momentum().e();
602  float tmp_phi = fabs(pfc[i].position().phi() - bpg.particle().vertex().phi());
603  if (tmp_phi > TMath::TwoPi())
604  tmp_phi -= TMath::TwoPi();
605  float tmp_eta = fabs(pfc[i].position().eta() - bpg.particle().vertex().eta());
606  float tmp_dr = sqrt(pow(tmp_phi, 2) + pow(tmp_eta, 2));
607  bool isBet = (tmp_dr < dr);
608  if (sec)
609  isBet = (tmp_phi < df);
610  if ((isBet) && (tmp_ep > minep) && (tmp_ep < 10)) {
611  dr = tmp_dr;
612  de = tmp_eta;
613  df = tmp_phi;
614  ibest = i;
615  }
616  }
617  bool isBad = (dr > 0.1);
618  if (sec)
619  isBad = ((df > 0.25) || (de > 0.5));
620 
621  if (isBad)
622  ibest = -1;
623  }
624  return ibest;
625 }
const double TwoPi
const XYZTLorentzVector & momentum() const
the momentum fourvector
Definition: RawParticle.h:321
T sqrt(T t)
Definition: SSEVec.h:23
RawParticle const & particle() const
The particle being propagated.
bool propagateToEcalEntrance(bool first=true)
int getSuccess() const
Has propagation been performed and was barrel or endcap reached ?
static int position[264][3]
Definition: ReadPGInfo.cc:289
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:320

◆ initializeLayerMap()

void ConvBremSeedProducer::initializeLayerMap ( )
private

ATTENTION: HARD CODED LOGIC! If Famos layer numbering changes this logic needs to be adapted to the new numbering!

Definition at line 446 of file ConvBremSeedProducer.cc.

References GeometricSearchTracker::barrelLayers(), TrackerInteractionGeometry::cylinderBegin(), TrackerInteractionGeometry::cylinderEnd(), newFWLiteAna::found, geometry_, geomSearchTracker_, mps_fire::i, layerMap_, LogDebug, and GeometricSearchTracker::posForwardLayers().

Referenced by produce().

446  {
447  // These are the BoundSurface&, the BoundDisk* and the BoundCylinder* for that layer
448  // const BoundSurface& theSurface = layer.surface();
449  // BoundDisk* theDisk = layer.disk(); // non zero for endcaps
450  // BoundCylinder* theCylinder = layer.cylinder(); // non zero for barrel
451  // int theLayer = layer.layerNumber(); // 1->3 PixB, 4->5 PixD,
452  // // 6->9 TIB, 10->12 TID,
453  // // 13->18 TOB, 19->27 TEC
454 
457 
458  const std::vector<const BarrelDetLayer*>& barrelLayers = geomSearchTracker_->barrelLayers();
459  LogDebug("FastTracker") << "Barrel DetLayer dump: ";
460  for (auto bl = barrelLayers.begin(); bl != barrelLayers.end(); ++bl) {
461  LogDebug("FastTracker") << "radius " << (**bl).specificSurface().radius();
462  }
463 
464  const std::vector<const ForwardDetLayer*>& posForwardLayers = geomSearchTracker_->posForwardLayers();
465  LogDebug("FastTracker") << "Positive Forward DetLayer dump: ";
466  for (auto fl = posForwardLayers.begin(); fl != posForwardLayers.end(); ++fl) {
467  LogDebug("FastTracker") << "Z pos " << (**fl).surface().position().z() << " radii "
468  << (**fl).specificSurface().innerRadius() << ", " << (**fl).specificSurface().outerRadius();
469  }
470 
471  const float rTolerance = 1.5;
472  const float zTolerance = 3.;
473 
474  LogDebug("FastTracker") << "Dump of TrackerInteractionGeometry cylinders:";
475  for (std::list<TrackerLayer>::const_iterator i = geometry_->cylinderBegin(); i != geometry_->cylinderEnd(); ++i) {
476  const BoundCylinder* cyl = i->cylinder();
477  const BoundDisk* disk = i->disk();
478 
479  LogDebug("FastTracker") << "Famos Layer no " << i->layerNumber() << " is sensitive? " << i->sensitive() << " pos "
480  << i->surface().position();
481  if (!i->sensitive())
482  continue;
483 
484  if (cyl != nullptr) {
485  LogDebug("FastTracker") << " cylinder radius " << cyl->radius();
486  bool found = false;
487 
488  for (auto bl = barrelLayers.begin(); bl != barrelLayers.end(); ++bl) {
489  if (fabs(cyl->radius() - (**bl).specificSurface().radius()) < rTolerance) {
490  layerMap_[i->layerNumber()] = *bl;
491  found = true;
492  LogDebug("FastTracker") << "Corresponding DetLayer found with radius " << (**bl).specificSurface().radius();
493 
494  break;
495  }
496  }
497  if (!found) {
498  LogError("FastTracker") << "FAILED to find a corresponding DetLayer!";
499  }
500  } else {
501  LogDebug("FastTracker") << " disk radii " << disk->innerRadius() << ", " << disk->outerRadius();
502 
503  bool found = false;
504 
505  for (auto fl = posForwardLayers.begin(); fl != posForwardLayers.end(); ++fl) {
506  if (fabs(disk->position().z() - (**fl).surface().position().z()) < zTolerance) {
507  layerMap_[i->layerNumber()] = *fl;
508  found = true;
509  LogDebug("FastTracker") << "Corresponding DetLayer found with Z pos " << (**fl).surface().position().z()
510  << " and radii " << (**fl).specificSurface().innerRadius() << ", "
511  << (**fl).specificSurface().outerRadius();
512  break;
513  }
514  }
515  if (!found) {
516  LogError("FastTracker") << "FAILED to find a corresponding DetLayer!";
517  }
518  }
519  }
520 }
const GeometricSearchTracker * geomSearchTracker_
Log< level::Error, false > LogError
const TrackerInteractionGeometry * geometry_
std::list< TrackerLayer >::const_iterator cylinderEnd() const
Returns the last pointer in the cylinder list.
std::vector< ForwardDetLayer const * > const & posForwardLayers() const
std::vector< const DetLayer * > layerMap_
std::list< TrackerLayer >::const_iterator cylinderBegin() const
Returns the first pointer in the cylinder list.
std::vector< BarrelDetLayer const * > const & barrelLayers() const
#define LogDebug(id)

◆ isGsfTrack()

bool ConvBremSeedProducer::isGsfTrack ( const reco::Track tkv,
const TrackingRecHit h 
)
private

Definition at line 539 of file ConvBremSeedProducer.cc.

References TrackingRecHit::all, h, and reco::Track::recHits().

Referenced by produce().

539  {
540  bool istaken = false;
541  for (auto const& hit : tkv.recHits()) {
542  if (istaken || !hit->isValid())
543  continue;
544  istaken = hit->sharesInput(h, TrackingRecHit::all);
545  }
546  return istaken;
547 }
auto recHits() const
Access to reconstructed hits on the track.
Definition: Track.h:85
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ makeTrajectoryState()

TrajectoryStateOnSurface ConvBremSeedProducer::makeTrajectoryState ( const DetLayer layer,
const ParticlePropagator pp,
const MagneticField field 
) const
private

Definition at line 528 of file ConvBremSeedProducer.cc.

References nano_mu_digi_cff::layer, and createTree::pp.

Referenced by produce().

530  {
531  GlobalPoint pos(pp.particle().X(), pp.particle().Y(), pp.particle().Z());
532  GlobalVector mom(pp.particle().Px(), pp.particle().Py(), pp.particle().Pz());
533 
534  auto plane = layer->surface().tangentPlane(pos);
535 
536  return TrajectoryStateOnSurface(GlobalTrajectoryParameters(pos, mom, TrackCharge(pp.particle().charge()), field),
537  *plane);
538 }
int TrackCharge
Definition: TrackCharge.h:4

◆ produce()

void ConvBremSeedProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

INPUT COLLECTIONS

PF CLUSTERS

PIXEL

STRIP

OUTPUT COLLECTION

INITIALIZE

LOOP OVER GSF TRACK COLLECTION

FIND THE CLUSTER ASSOCIATED TO THE GSF TRACK

LOOP OVER BREM PHOTONS

BREM SELECTION

LOOP OVER TRACKER LAYER

TRACKER LAYER SELECTION

FIND COMPATIBLE MODULES

MODULE TRIPLETS SELECTION

SEED CREATION

Definition at line 148 of file ConvBremSeedProducer.cc.

References alongMomentum, AnalyticalPropagator_cfi::AnalyticalPropagator, anyDirection, B_, TransientTrackingRecHitBuilder::build(), GlobalTrajectoryParameters::charge(), edm::OwnVector< T, P >::clear(), clone(), GeometricSearchDet::compatibleDets(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), TrackerInteractionGeometry::cylinderBegin(), TrackerInteractionGeometry::cylinderEnd(), detLayer(), fieldMap_, spr::find(), dqmdumpme::first, geometry_, edm::EventSetup::getHandle(), BaseParticlePropagator::getMagneticField(), BaseParticlePropagator::getSuccess(), GoodCluster(), runTauDisplay::gp, hitBuilder_, mps_fire::i, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, testProducerWithPsetDescEmpty_cfi::i3, cuy::ib, TrackerGeometry::idToDet(), iEvent, initializeLayerMap(), isGsfTrack(), GeomDetEnumerators::isTrackerPixel(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::iv, kfUpdator_, LogDebug, magfield_, magFieldToken_, makeTrajectoryState(), AlignmentTrackSelector_cfi::matchedrecHits, matchedrecHitsToken_, GlobalTrajectoryParameters::momentum(), eostools::move(), AlCaHLTBitMon_ParallelJobs::p, BaseParticlePropagator::particle(), PV3DBase< T, PVType, FrameType >::perp(), trajectoryStateTransform::persistentState(), pfToken_, InitialStepPreSplitting_cff::pixelHits, pixelHitsToken_, GlobalTrajectoryParameters::position(), position, PropagatorWithMaterial::propagate(), BaseParticlePropagator::propagate(), propagator_, edm::OwnVector< T, P >::push_back(), AlignmentTrackSelector_cfi::rphirecHits, rphirecHitsToken_, ParticlePropagator::setPropagationConditions(), sharedHits(), mathSSE::sqrt(), FastHelix::stateAtVertex(), DetLayer::subDetector(), GeomDet::surface(), groupFilesInBlocks::temp, thePfRecTrackToken_, createJobs::tmp, Surface::toGlobal(), tracker_, KFUpdator::update(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and RawParticle::Z().

148  {
149  LogDebug("ConvBremSeedProducerProducer") << "START event: " << iEvent.id().event() << " in run " << iEvent.id().run();
150 
151  constexpr float pfmass = 0.0005;
152 
154 
156  const auto& PPP = iEvent.get(pfToken_);
157 
159  const auto& pixelHits = iEvent.getHandle(pixelHitsToken_);
160 
162  const auto& rphirecHits = iEvent.getHandle(rphirecHitsToken_);
163  const auto& matchedrecHits = iEvent.getHandle(matchedrecHitsToken_);
164 
165  //GSFPFRECTRACKS
166  const auto& thePfRecTrackCollection = iEvent.getHandle(thePfRecTrackToken_);
167  const auto& PfRTkColl = *thePfRecTrackCollection;
168 
170  auto output = std::make_unique<ConvBremSeedCollection>();
171 
173  vector<pair<TrajectorySeed, pair<GlobalVector, float> > > unclean;
174  //TRIPLET OF MODULES TO BE USED FOR SEEDING
175  vector<vector<long int> > tripl;
176  //LAYER MAP
178 
180 
181  for (unsigned int ipft = 0; ipft < PfRTkColl.size(); ipft++) {
182  GsfPFRecTrackRef pft(thePfRecTrackCollection, ipft);
183  LogDebug("ConvBremSeedProducerProducer") << "NEW GsfPFRecTRACK ";
184  float eta_br = 0;
185  unclean.clear();
186  tripl.clear();
187  vector<int> gc;
188  auto const& gsfRecHits = *pft->gsfTrackRef();
189  float pfoutenergy = sqrt((pfmass * pfmass) + pft->gsfTrackRef()->outerMomentum().Mag2());
190  XYZTLorentzVector mom = XYZTLorentzVector(pft->gsfTrackRef()->outerMomentum().x(),
191  pft->gsfTrackRef()->outerMomentum().y(),
192  pft->gsfTrackRef()->outerMomentum().z(),
193  pfoutenergy);
194  XYZTLorentzVector pos = XYZTLorentzVector(pft->gsfTrackRef()->outerPosition().x(),
195  pft->gsfTrackRef()->outerPosition().y(),
196  pft->gsfTrackRef()->outerPosition().z(),
197  0.);
198  BaseParticlePropagator theOutParticle =
199  BaseParticlePropagator(RawParticle(mom, pos, pft->gsfTrackRef()->charge()), 0, 0, B_.z());
200 
202  gc.push_back(GoodCluster(theOutParticle, PPP, 0.5));
203 
204  vector<PFBrem> brem = (*pft).PFRecBrem();
205  vector<PFBrem>::iterator ib = brem.begin();
206  vector<PFBrem>::iterator ib_end = brem.end();
207  LogDebug("ConvBremSeedProducerProducer") << "NUMBER OF BREMS " << brem.size();
208 
210  for (; ib != ib_end; ++ib) {
211  XYZTLorentzVector mom = pft->trajectoryPoint(ib->indTrajPoint()).momentum();
212  XYZTLorentzVector pos = XYZTLorentzVector(pft->trajectoryPoint(ib->indTrajPoint()).position().x(),
213  pft->trajectoryPoint(ib->indTrajPoint()).position().y(),
214  pft->trajectoryPoint(ib->indTrajPoint()).position().z(),
215  0);
216 
218  if (pos.Rho() > 80)
219  continue;
220  if ((pos.Rho() > 5) && (fabs(ib->SigmaDeltaP() / ib->DeltaP()) > 3))
221  continue;
222  if (fabs(ib->DeltaP()) < 3)
223  continue;
224  eta_br = mom.eta();
225  vector<vector<long int> > Idd;
226 
227  BaseParticlePropagator p(RawParticle(mom, pos, 0.), 0, 0, B_.z());
228  gc.push_back(GoodCluster(p, PPP, 0.2));
229 
230  ParticlePropagator PP(p, fieldMap_, nullptr);
231 
233  list<TrackerLayer>::const_iterator cyliter = geometry_->cylinderBegin();
234  for (; cyliter != geometry_->cylinderEnd(); ++cyliter) {
236  if (!(cyliter->sensitive()))
237  continue;
238  PP.setPropagationConditions(*cyliter);
239  PP.propagate();
240  if (PP.getSuccess() == 0)
241  continue;
242 
244  LocalMagneticField mf(PP.getMagneticField());
245  AnalyticalPropagator alongProp(&mf, anyDirection);
247  const DetLayer* tkLayer = detLayer(*cyliter, PP.particle().Z());
248  if (&(*tkLayer) == nullptr)
249  continue;
250  TrajectoryStateOnSurface trajState = makeTrajectoryState(tkLayer, PP, &mf);
251 
252  auto compat = tkLayer->compatibleDets(trajState, alongProp, est);
253  vector<long int> temp;
254  if (compat.empty())
255  continue;
256 
257  for (auto i = compat.begin(); i != compat.end(); i++) {
258  long int detid = i->first->geographicalId().rawId();
259 
261  auto DetMatch = (rphirecHits.product())->find((detid));
262  auto MDetMatch = (matchedrecHits.product())->find((detid));
263 
264  long int DetID = (DetMatch != rphirecHits->end()) ? detid : 0;
265 
266  if ((MDetMatch != matchedrecHits->end()) && !MDetMatch->empty()) {
267  long int pii = MDetMatch->begin()->monoId();
268  auto CDetMatch = (rphirecHits.product())->find((pii));
269  DetID = (CDetMatch != rphirecHits->end()) ? pii : 0;
270  }
271 
272  temp.push_back(DetID);
273 
274  } else {
275  auto DetMatch = (pixelHits.product())->find((detid));
276  long int DetID = (DetMatch != pixelHits->end()) ? detid : 0;
277  temp.push_back(DetID);
278  }
279  }
280 
281  Idd.push_back(temp);
282 
283  } //END TRACKER LAYER LOOP
284  if (Idd.size() < 2)
285  continue;
286 
288  for (unsigned int i = 0; i < Idd.size() - 2; i++) {
289  for (unsigned int i1 = 0; i1 < Idd[i].size(); i1++) {
290  for (unsigned int i2 = 0; i2 < Idd[i + 1].size(); i2++) {
291  for (unsigned int i3 = 0; i3 < Idd[i + 2].size(); i3++) {
292  if ((Idd[i][i1] != 0) && (Idd[i + 1][i2] != 0) && (Idd[i + 2][i3] != 0)) {
293  vector<long int> tmp;
294  tmp.push_back(Idd[i][i1]);
295  tmp.push_back(Idd[i + 1][i2]);
296  tmp.push_back(Idd[i + 2][i3]);
297 
298  bool newTrip = true;
299  for (unsigned int iv = 0; iv < tripl.size(); iv++) {
300  if ((tripl[iv][0] == tmp[0]) && (tripl[iv][1] == tmp[1]) && (tripl[iv][2] == tmp[2]))
301  newTrip = false;
302  }
303  if (newTrip) {
304  tripl.push_back(tmp);
305  }
306  }
307  }
308  }
309  }
310  }
311  } //END BREM LOOP
312 
313  float sineta_brem = sinh(eta_br);
314 
315  //OUTPUT COLLECTION
316  auto bfield = iSetup.getHandle(magFieldToken_);
317  float nomField = bfield->nominalValue();
318 
320  OwnVector<TrackingRecHit> loc_hits;
321  for (unsigned int i = 0; i < tripl.size(); i++) {
322  auto DetMatch1 = (rphirecHits.product())->find(tripl[i][0]);
323  auto DetMatch2 = (rphirecHits.product())->find(tripl[i][1]);
324  auto DetMatch3 = (rphirecHits.product())->find(tripl[i][2]);
325  if ((DetMatch1 == rphirecHits->end()) || (DetMatch2 == rphirecHits->end()) || (DetMatch3 == rphirecHits->end()))
326  continue;
327  auto DetSet1 = *DetMatch1;
328  auto DetSet2 = *DetMatch2;
329  auto DetSet3 = *DetMatch3;
330 
331  for (auto it1 = DetSet1.begin(); it1 != DetSet1.end(); ++it1) {
332  GlobalPoint gp1 = tracker_->idToDet(tripl[i][0])->surface().toGlobal(it1->localPosition());
333 
334  bool tak1 = isGsfTrack(gsfRecHits, &(*it1));
335 
336  for (auto it2 = DetSet2.begin(); it2 != DetSet2.end(); ++it2) {
337  GlobalPoint gp2 = tracker_->idToDet(tripl[i][1])->surface().toGlobal(it2->localPosition());
338  bool tak2 = isGsfTrack(gsfRecHits, &(*it2));
339 
340  for (auto it3 = DetSet3.begin(); it3 != DetSet3.end(); ++it3) {
341  // ips++;
342  GlobalPoint gp3 = tracker_->idToDet(tripl[i][2])->surface().toGlobal(it3->localPosition());
343  bool tak3 = isGsfTrack(gsfRecHits, &(*it3));
344 
345  FastHelix helix(gp3, gp2, gp1, nomField, &*bfield);
346  GlobalVector gv = helix.stateAtVertex().momentum();
347  GlobalVector gv_corr(gv.x(), gv.y(), gv.perp() * sineta_brem);
348  float ene = sqrt(gv_corr.mag2() + (pfmass * pfmass));
349 
350  GlobalPoint gp = helix.stateAtVertex().position();
351  float ch = helix.stateAtVertex().charge();
352 
353  XYZTLorentzVector mom = XYZTLorentzVector(gv.x(), gv.y(), gv_corr.z(), ene);
354  XYZTLorentzVector pos = XYZTLorentzVector(gp.x(), gp.y(), gp.z(), 0.);
355  BaseParticlePropagator theOutParticle(RawParticle(mom, pos, ch), 0, 0, B_.z());
356  int bgc = GoodCluster(theOutParticle, PPP, 0.3, true);
357 
358  if (gv.perp() < 0.5)
359  continue;
360 
361  if (tak1 + tak2 + tak3 > 2)
362  continue;
363 
364  if (bgc == -1)
365  continue;
366  bool clTak = false;
367  for (unsigned int igcc = 0; igcc < gc.size(); igcc++) {
368  if (clTak)
369  continue;
370  if (bgc == gc[igcc])
371  clTak = true;
372  }
373  if (clTak)
374  continue;
375 
376  GlobalTrajectoryParameters Gtp(gp1, gv, int(ch), &(*magfield_));
377  glob_hits.clear();
378  loc_hits.clear();
379  glob_hits.push_back(hitBuilder_->build(it1->clone()));
380  glob_hits.push_back(hitBuilder_->build(it2->clone()));
381  glob_hits.push_back(hitBuilder_->build(it3->clone()));
382 
384 
386  TrajectoryStateOnSurface updatedState;
387 
388  for (int ih = 0; ih < 3; ih++) {
390  (ih == 0) ? propagator_->propagate(CSeed, tracker_->idToDet(tripl[i][ih])->surface())
391  : propagator_->propagate(updatedState, tracker_->idToDet(tripl[i][ih])->surface());
392 
393  if (!state.isValid()) {
394  ih = 3;
395  continue;
396  }
397 
398  updatedState = kfUpdator_->update(state, *glob_hits[ih]);
399  loc_hits.push_back(glob_hits[ih]->hit()->clone());
400  if (ih == 2) {
401  PTrajectoryStateOnDet const& PTraj =
402  trajectoryStateTransform::persistentState(updatedState, tripl[i][2]);
403  // output->push_back(Trajectoryseed(PTraj,loc_hits,alongMomentum));
404  unclean.push_back(make_pair(TrajectorySeed(PTraj, loc_hits, alongMomentum), make_pair(gv_corr, ch)));
405  }
406  // }
407  }
408  }
409  }
410  }
411  }
412  vector<bool> inPhot = sharedHits(unclean);
413  for (unsigned int iu = 0; iu < unclean.size(); iu++) {
414  if (inPhot[iu])
415  output->push_back(ConvBremSeed(unclean[iu].first, pft));
416  }
417 
418  } //END GSF TRACK COLLECTION LOOP
419  LogDebug("ConvBremSeedProducerProducer") << "END";
420  iEvent.put(std::move(output));
421 }
const MagneticField * magfield_
const TransientTrackingRecHitBuilder * hitBuilder_
T perp() const
Definition: PV3DBase.h:69
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
TrajectoryStateOnSurface makeTrajectoryState(const DetLayer *layer, const ParticlePropagator &pp, const MagneticField *field) const
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
const PropagatorWithMaterial * propagator_
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
const edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedrecHitsToken_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const KFUpdator * kfUpdator_
const TrackerInteractionGeometry * geometry_
const MagneticFieldMap * fieldMap_
bool isGsfTrack(const reco::Track &, const TrackingRecHit *)
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
void push_back(D *&d)
Definition: OwnVector.h:326
int iEvent
Definition: GenABIO.cc:224
math::XYZVector B_
B field.
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
Definition: KFUpdator.cc:177
T sqrt(T t)
Definition: SSEVec.h:23
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
void clear()
Definition: OwnVector.h:481
const edm::EDGetTokenT< SiPixelRecHitCollection > pixelHitsToken_
std::list< TrackerLayer >::const_iterator cylinderEnd() const
Returns the last pointer in the cylinder list.
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const TrackerGeomDet * idToDet(DetId) const override
std::vector< ConstRecHitPointer > ConstRecHitContainer
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
std::vector< bool > sharedHits(const std::vector< std::pair< TrajectorySeed, std::pair< GlobalVector, float > > > &)
const edm::EDGetTokenT< reco::PFClusterCollection > pfToken_
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
std::list< TrackerLayer >::const_iterator cylinderBegin() const
Returns the first pointer in the cylinder list.
const edm::EDGetTokenT< SiStripRecHit2DCollection > rphirecHitsToken_
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
const DetLayer * detLayer(const TrackerLayer &layer, float zpos) const
static int position[264][3]
Definition: ReadPGInfo.cc:289
Definition: output.py:1
int GoodCluster(const BaseParticlePropagator &bpg, const reco::PFClusterCollection &pfc, float minep, bool sec=false)
const TrackerGeometry * tracker_
tmp
align.sh
Definition: createJobs.py:716
def move(src, dest)
Definition: eostools.py:511
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
const edm::EDGetTokenT< reco::GsfPFRecTrackCollection > thePfRecTrackToken_
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25
ib
Definition: cuy.py:661
#define LogDebug(id)

◆ sharedHits()

vector< bool > ConvBremSeedProducer::sharedHits ( const std::vector< std::pair< TrajectorySeed, std::pair< GlobalVector, float > > > &  unclean)
private

Definition at line 548 of file ConvBremSeedProducer.cc.

References TrackingRecHit::all, dqmdumpme::first, mps_fire::i, and edm::second().

Referenced by produce().

548  {
549  vector<bool> goodseed;
550  goodseed.clear();
551  if (unclean.size() < 2) {
552  for (unsigned int i = 0; i < unclean.size(); i++)
553  goodseed.push_back(true);
554  } else {
555  for (unsigned int i = 0; i < unclean.size(); i++)
556  goodseed.push_back(true);
557 
558  for (unsigned int iu = 0; iu < unclean.size() - 1; iu++) {
559  if (!goodseed[iu])
560  continue;
561  for (unsigned int iu2 = iu + 1; iu2 < unclean.size(); iu2++) {
562  if (!goodseed[iu])
563  continue;
564  if (!goodseed[iu2])
565  continue;
566  // if (unclean[iu].second.second *unclean[iu2].second.second >0)continue;
567 
568  unsigned int shar = 0;
569  for (auto const& sh : unclean[iu].first.recHits()) {
570  for (auto const& sh2 : unclean[iu2].first.recHits()) {
571  if (sh.sharesInput(&sh2, TrackingRecHit::all))
572 
573  shar++;
574  }
575  }
576  if (shar >= 2) {
577  if (unclean[iu].second.first.perp() < unclean[iu2].second.first.perp())
578  goodseed[iu] = false;
579  else
580  goodseed[iu2] = false;
581  }
582  }
583  }
584  }
585  return goodseed;
586 }
U second(std::pair< T, U > const &p)

Member Data Documentation

◆ B_

math::XYZVector ConvBremSeedProducer::B_
private

B field.

Definition at line 97 of file ConvBremSeedProducer.cc.

Referenced by beginRun(), and produce().

◆ fieldMap_

const MagneticFieldMap* ConvBremSeedProducer::fieldMap_
private

Definition at line 90 of file ConvBremSeedProducer.cc.

Referenced by beginRun(), and produce().

◆ geometry_

const TrackerInteractionGeometry* ConvBremSeedProducer::geometry_
private

Definition at line 87 of file ConvBremSeedProducer.cc.

Referenced by beginRun(), initializeLayerMap(), and produce().

◆ geometryToken_

const edm::ESGetToken<TrackerInteractionGeometry, TrackerInteractionGeometryRecord> ConvBremSeedProducer::geometryToken_
private

Definition at line 102 of file ConvBremSeedProducer.cc.

Referenced by beginRun().

◆ geomSearchTracker_

const GeometricSearchTracker* ConvBremSeedProducer::geomSearchTracker_
private

Definition at line 86 of file ConvBremSeedProducer.cc.

Referenced by beginRun(), and initializeLayerMap().

◆ geomSearchTrackerToken_

const edm::ESGetToken<GeometricSearchTracker, TrackerRecoGeometryRecord> ConvBremSeedProducer::geomSearchTrackerToken_
private

Definition at line 101 of file ConvBremSeedProducer.cc.

Referenced by beginRun().

◆ hitBuilder_

const TransientTrackingRecHitBuilder* ConvBremSeedProducer::hitBuilder_
private

Definition at line 93 of file ConvBremSeedProducer.cc.

Referenced by beginRun(), and produce().

◆ hitBuilderToken_

const edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> ConvBremSeedProducer::hitBuilderToken_
private

Definition at line 106 of file ConvBremSeedProducer.cc.

Referenced by beginRun().

◆ kfUpdator_

const KFUpdator* ConvBremSeedProducer::kfUpdator_
private

Definition at line 92 of file ConvBremSeedProducer.cc.

Referenced by beginRun(), endRun(), and produce().

◆ layerMap_

std::vector<const DetLayer*> ConvBremSeedProducer::layerMap_
private

Definition at line 94 of file ConvBremSeedProducer.cc.

Referenced by detLayer(), and initializeLayerMap().

◆ magfield_

const MagneticField* ConvBremSeedProducer::magfield_
private

Definition at line 89 of file ConvBremSeedProducer.cc.

Referenced by beginRun(), and produce().

◆ magFieldMapToken_

const edm::ESGetToken<MagneticFieldMap, MagneticFieldMapRecord> ConvBremSeedProducer::magFieldMapToken_
private

Definition at line 105 of file ConvBremSeedProducer.cc.

Referenced by beginRun().

◆ magFieldToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> ConvBremSeedProducer::magFieldToken_
private

Definition at line 100 of file ConvBremSeedProducer.cc.

Referenced by produce().

◆ magFieldToken_beginRun_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> ConvBremSeedProducer::magFieldToken_beginRun_
private

Definition at line 104 of file ConvBremSeedProducer.cc.

Referenced by beginRun().

◆ matchedrecHitsToken_

const edm::EDGetTokenT<SiStripMatchedRecHit2DCollection> ConvBremSeedProducer::matchedrecHitsToken_
private

Definition at line 83 of file ConvBremSeedProducer.cc.

Referenced by produce().

◆ negLayerOffset_

int ConvBremSeedProducer::negLayerOffset_
private

Definition at line 95 of file ConvBremSeedProducer.cc.

Referenced by detLayer().

◆ pfToken_

const edm::EDGetTokenT<reco::PFClusterCollection> ConvBremSeedProducer::pfToken_
private

Definition at line 80 of file ConvBremSeedProducer.cc.

Referenced by produce().

◆ pixelHitsToken_

const edm::EDGetTokenT<SiPixelRecHitCollection> ConvBremSeedProducer::pixelHitsToken_
private

Definition at line 81 of file ConvBremSeedProducer.cc.

Referenced by produce().

◆ propagator_

const PropagatorWithMaterial* ConvBremSeedProducer::propagator_
private

Definition at line 91 of file ConvBremSeedProducer.cc.

Referenced by beginRun(), endRun(), and produce().

◆ rphirecHitsToken_

const edm::EDGetTokenT<SiStripRecHit2DCollection> ConvBremSeedProducer::rphirecHitsToken_
private

Definition at line 82 of file ConvBremSeedProducer.cc.

Referenced by produce().

◆ theLayerMap

std::vector<const DetLayer*> ConvBremSeedProducer::theLayerMap
private

Definition at line 65 of file ConvBremSeedProducer.cc.

◆ thePfRecTrackToken_

const edm::EDGetTokenT<reco::GsfPFRecTrackCollection> ConvBremSeedProducer::thePfRecTrackToken_
private

Definition at line 84 of file ConvBremSeedProducer.cc.

Referenced by produce().

◆ tracker_

const TrackerGeometry* ConvBremSeedProducer::tracker_
private

Definition at line 88 of file ConvBremSeedProducer.cc.

Referenced by beginRun(), and produce().

◆ trackerToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> ConvBremSeedProducer::trackerToken_
private

Definition at line 103 of file ConvBremSeedProducer.cc.

Referenced by beginRun().