CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
ConvBremSeedProducer Class Reference

#include <ConvBremSeedProducer.h>

Inheritance diagram for ConvBremSeedProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ConvBremSeedProducer (const edm::ParameterSet &)
 
 ~ConvBremSeedProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef GeometricSearchDet::DetWithState DetWithState
 
typedef SiStripMatchedRecHit2DCollection::const_iterator MatDetMatch
 
typedef SiStripMatchedRecHit2DCollection::DetSet MatDetSet
 
typedef SiPixelRecHitCollection::const_iterator PiDetMatch
 
typedef SiPixelRecHitCollection::DetSet PiDetSet
 
typedef SiStripRecHit2DCollection::const_iterator StDetMatch
 
typedef SiStripRecHit2DCollection::DetSet StDetSet
 

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...
 
edm::ParameterSet conf_
 
const MagneticFieldMapfieldMap_
 
const TrackerInteractionGeometrygeometry_
 
const GeometricSearchTrackergeomSearchTracker_
 
const TransientTrackingRecHitBuilderhitBuilder_
 
const KFUpdatorkfUpdator_
 
std::vector< const DetLayer * > layerMap_
 
const MagneticFieldmagfield_
 
int negLayerOffset_
 
const PropagatorWithMaterialpropagator_
 
std::vector< const DetLayer * > theLayerMap
 
const TrackerGeometrytracker_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 40 of file ConvBremSeedProducer.h.

Member Typedef Documentation

Definition at line 47 of file ConvBremSeedProducer.h.

Definition at line 43 of file ConvBremSeedProducer.h.

Definition at line 46 of file ConvBremSeedProducer.h.

Definition at line 42 of file ConvBremSeedProducer.h.

Definition at line 45 of file ConvBremSeedProducer.h.

Definition at line 41 of file ConvBremSeedProducer.h.

Definition at line 44 of file ConvBremSeedProducer.h.

Constructor & Destructor Documentation

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

Definition at line 53 of file ConvBremSeedProducer.cc.

53  :
54  conf_(iConfig),
55  fieldMap_(nullptr),
56  layerMap_(56, static_cast<const DetLayer*>(nullptr)),
57  negLayerOffset_(27)
58 {
59  produces<ConvBremSeedCollection>();
60 }
edm::ParameterSet conf_
const MagneticFieldMap * fieldMap_
std::vector< const DetLayer * > layerMap_
ConvBremSeedProducer::~ConvBremSeedProducer ( )
override

Definition at line 63 of file ConvBremSeedProducer.cc.

64 {
65 
66 
67 }

Member Function Documentation

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

Definition at line 389 of file ConvBremSeedProducer.cc.

References alongMomentum, B_, conf_, fieldMap_, geometry_, geomSearchTracker_, edm::EventSetup::get(), edm::ParameterSet::getParameter(), hitBuilder_, MagneticField::inTesla(), kfUpdator_, magfield_, edm::ESHandle< T >::product(), propagator_, HiIsolationCommonParameters_cff::track, trackingTruthProducer_cfi::tracker, and tracker_.

391 {
393  iSetup.get<TrackerRecoGeometryRecord>().get( track );
394  geomSearchTracker_ = track.product();
395 
396  ESHandle<TrackerInteractionGeometry> theTrackerInteractionGeometry;
397  iSetup.get<TrackerInteractionGeometryRecord>().get(theTrackerInteractionGeometry );
398  geometry_=theTrackerInteractionGeometry.product();
399 
401  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
402  tracker_=tracker.product();
403 
404  ESHandle<MagneticField> magfield;
405  iSetup.get<IdealMagneticFieldRecord>().get(magfield);
406  magfield_=magfield.product();
407  B_=magfield_->inTesla(GlobalPoint(0,0,0));
408 
410  iSetup.get<MagneticFieldMapRecord>().get(fieldMap);
411  fieldMap_ =fieldMap.product();
412 
413 
414 
416  iSetup.get<TransientRecHitRecord>().get(conf_.getParameter<string>("TTRHBuilder"),hitBuilder);
417  hitBuilder_= hitBuilder.product();
418 
419  propagator_ = new PropagatorWithMaterial(alongMomentum,0.0005,&(*magfield) );
420  kfUpdator_ = new KFUpdator();
421 }
const MagneticField * magfield_
T getParameter(std::string const &) const
const GeometricSearchTracker * geomSearchTracker_
const TransientTrackingRecHitBuilder * hitBuilder_
edm::ParameterSet conf_
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const PropagatorWithMaterial * propagator_
const KFUpdator * kfUpdator_
const TrackerInteractionGeometry * geometry_
const MagneticFieldMap * fieldMap_
math::XYZVector B_
B field.
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
T get() const
Definition: EventSetup.h:71
const TrackerGeometry * tracker_
T const * product() const
Definition: ESHandle.h:86
const DetLayer * ConvBremSeedProducer::detLayer ( const TrackerLayer layer,
float  zpos 
) const
private

Definition at line 530 of file ConvBremSeedProducer.cc.

References TrackerLayer::forward(), layerMap_, TrackerLayer::layerNumber(), and negLayerOffset_.

Referenced by produce().

531 {
532  if (zpos > 0 || !layer.forward() ) return layerMap_[layer.layerNumber()];
533  else return layerMap_[layer.layerNumber()+negLayerOffset_];
534 }
unsigned int layerNumber() const
Returns the layer number.
Definition: TrackerLayer.h:82
bool forward() const
Is the layer forward ?
Definition: TrackerLayer.h:70
std::vector< const DetLayer * > layerMap_
void ConvBremSeedProducer::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 424 of file ConvBremSeedProducer.cc.

References kfUpdator_, and propagator_.

425  {
426  delete propagator_;
427  delete kfUpdator_;
428 }
const PropagatorWithMaterial * propagator_
const KFUpdator * kfUpdator_
int ConvBremSeedProducer::GoodCluster ( const BaseParticlePropagator bpg,
const reco::PFClusterCollection pfc,
float  minep,
bool  sec = false 
)
private

Definition at line 608 of file ConvBremSeedProducer.cc.

References runTauDisplay::dr, PVValHelper::eta, BaseParticlePropagator::getSuccess(), mps_fire::i, RawParticle::momentum(), BaseParticlePropagator::particle(), phi, position, funct::pow(), BaseParticlePropagator::propagateToEcalEntrance(), mathSSE::sqrt(), TwoPi, and RawParticle::vertex().

Referenced by produce().

608  {
609 
610  BaseParticlePropagator bpg = ubpg;
611  bpg.propagateToEcalEntrance(false);
612  float dr=1000;
613  float de=1000;
614  float df=1000;
615  int ibest=-1;
616 
617  if(bpg.getSuccess()!=0){
618 
619  for (unsigned int i =0; i<pfc.size();i++ ){
620  float tmp_ep=pfc[i].energy()/bpg.particle().momentum().e();
621  float tmp_phi=fabs(pfc[i].position().phi()-bpg.particle().vertex().phi());
622  if (tmp_phi>TMath::TwoPi()) tmp_phi-= TMath::TwoPi();
623  float tmp_eta=fabs(pfc[i].position().eta()-bpg.particle().vertex().eta());
624  float tmp_dr=sqrt(pow(tmp_phi,2)+pow(tmp_eta,2));
625  bool isBet=(tmp_dr<dr);
626  if (sec) isBet=(tmp_phi<df);
627  if ((isBet)&&(tmp_ep>minep)&&(tmp_ep<10)){
628  dr=tmp_dr;
629  de=tmp_eta;
630  df=tmp_phi;
631  ibest=i;
632  }
633  }
634  bool isBad=(dr>0.1);
635  if (sec) isBad= ((df>0.25) || (de>0.5));
636 
637  if (isBad) ibest=-1;
638 
639  }
640  return ibest;
641 }
const double TwoPi
int getSuccess() const
Has propagation been performed and was barrel or endcap reached ?
RawParticle const & particle() const
The particle being propagated.
const XYZTLorentzVector & momentum() const
the momentum fourvector
Definition: RawParticle.h:340
T sqrt(T t)
Definition: SSEVec.h:18
bool propagateToEcalEntrance(bool first=true)
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:339
static int position[264][3]
Definition: ReadPGInfo.cc:509
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
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 431 of file ConvBremSeedProducer.cc.

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

Referenced by produce().

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

Definition at line 550 of file ConvBremSeedProducer.cc.

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

Referenced by produce().

550  {
551  bool istaken=false;
552  for(auto const& hit : tkv.recHits()) {
553  if (istaken || !hit->isValid()) continue;
554  istaken = hit->sharesInput(h,TrackingRecHit::all);
555  }
556  return istaken;
557 }
auto recHits() const
Access to reconstructed hits on the track.
Definition: Track.h:106
TrajectoryStateOnSurface ConvBremSeedProducer::makeTrajectoryState ( const DetLayer layer,
const ParticlePropagator pp,
const MagneticField field 
) const
private

Definition at line 537 of file ConvBremSeedProducer.cc.

References RawParticle::charge(), BaseParticlePropagator::particle(), RawParticle::Px(), RawParticle::Py(), RawParticle::Pz(), GeometricSearchDet::surface(), Surface::tangentPlane(), RawParticle::X(), RawParticle::Y(), and RawParticle::Z().

Referenced by produce().

540 {
541 
542  GlobalPoint pos( pp.particle().X(), pp.particle().Y(), pp.particle().Z());
543  GlobalVector mom( pp.particle().Px(), pp.particle().Py(), pp.particle().Pz());
544 
545  auto plane = layer->surface().tangentPlane(pos);
546 
548  (GlobalTrajectoryParameters( pos, mom, TrackCharge( pp.particle().charge()), field), *plane);
549 }
virtual ConstReferenceCountingPointer< TangentPlane > tangentPlane(const GlobalPoint &) const =0
RawParticle const & particle() const
The particle being propagated.
int TrackCharge
Definition: TrackCharge.h:4
double Y() const
y of vertex
Definition: RawParticle.h:306
double Py() const
y of the momentum
Definition: RawParticle.h:319
double Z() const
z of vertex
Definition: RawParticle.h:307
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
double Pz() const
z of the momentum
Definition: RawParticle.h:322
double charge() const
get the MEASURED charge
Definition: RawParticle.h:313
double X() const
x of vertex
Definition: RawParticle.h:305
double Px() const
x of the momentum
Definition: RawParticle.h:316
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 71 of file ConvBremSeedProducer.cc.

References alongMomentum, AnalyticalPropagator_cfi::AnalyticalPropagator, anyDirection, B_, edmNew::DetSet< T >::begin(), TransientTrackingRecHitBuilder::build(), GlobalTrajectoryParameters::charge(), edm::OwnVector< T, P >::clear(), clone(), GeometricSearchDet::compatibleDets(), conf_, TrackerInteractionGeometry::cylinderBegin(), TrackerInteractionGeometry::cylinderEnd(), detLayer(), edmNew::DetSet< T >::end(), edmNew::DetSetVector< T >::end(), edm::EventID::event(), fieldMap_, spr::find(), plotBeamSpotDB::first, geometry_, edm::EventSetup::get(), edm::Event::getByLabel(), BaseParticlePropagator::getMagneticField(), edm::ParameterSet::getParameter(), BaseParticlePropagator::getSuccess(), GoodCluster(), runTauDisplay::gp, hitBuilder_, mps_fire::i, cuy::ib, edm::EventBase::id(), TrackerGeometry::idToDet(), initializeLayerMap(), isGsfTrack(), GeomDetEnumerators::isTrackerPixel(), TrajectoryStateOnSurface::isValid(), kfUpdator_, LogDebug, magfield_, makeTrajectoryState(), AlignmentTrackSelector_cfi::matchedrecHits, GlobalTrajectoryParameters::momentum(), eostools::move(), MagneticField::nominalValue(), convertSQLitetoXML_cfg::output, AlCaHLTBitMon_ParallelJobs::p, BaseParticlePropagator::particle(), PV3DBase< T, PVType, FrameType >::perp(), trajectoryStateTransform::persistentState(), NuclearInteractionSecond_cff::pixelHits, GlobalTrajectoryParameters::position(), position, edm::Handle< T >::product(), Propagator::propagate(), BaseParticlePropagator::propagate(), propagator_, edm::OwnVector< T, P >::push_back(), edm::Event::put(), AlignmentTrackSelector_cfi::rphirecHits, edm::EventID::run(), ParticlePropagator::setPropagationConditions(), sharedHits(), mathSSE::sqrt(), FastHelix::stateAtVertex(), convBremSeeds_cfi::stereorecHits, DetLayer::subDetector(), GeomDet::surface(), groupFilesInBlocks::temp, tmp, tracker_, KFUpdator::update(), TrackInfoProducer_cfi::updatedState, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and RawParticle::Z().

72 {
73 
74  LogDebug("ConvBremSeedProducerProducer")<<"START event: "<<iEvent.id().event()
75  <<" in run "<<iEvent.id().run();
76 
77  float pfmass= 0.0005;
78 
80 
83  iEvent.getByLabel(conf_.getParameter<InputTag>("PFClusters") ,PfC);
84  const PFClusterCollection& PPP= *(PfC.product());
85 
88  iEvent.getByLabel(conf_.getParameter<InputTag>("pixelRecHits") , pixelHits);
89 
92  iEvent.getByLabel(conf_.getParameter<InputTag>("rphirecHits"),rphirecHits);
94  iEvent.getByLabel(conf_.getParameter<InputTag>("stereorecHits"), stereorecHits);
96  iEvent.getByLabel(conf_.getParameter<InputTag>("matchedrecHits"), matchedrecHits);
97 
98  //GSFPFRECTRACKS
99  Handle<GsfPFRecTrackCollection> thePfRecTrackCollection;
100  iEvent.getByLabel(conf_.getParameter<InputTag>("PFRecTrackLabel"),
101  thePfRecTrackCollection);
102  const GsfPFRecTrackCollection PfRTkColl = *(thePfRecTrackCollection.product());
103 
104 
106  auto output = std::make_unique<ConvBremSeedCollection>();
107 
108 
110  vector<pair< TrajectorySeed , pair<GlobalVector,float> > > unclean;
111  //TRIPLET OF MODULES TO BE USED FOR SEEDING
112  vector< vector< long int > > tripl;
113  //LAYER MAP
115 
116 
117 
119 
120  for(unsigned int ipft=0;ipft<PfRTkColl.size();ipft++){
121  GsfPFRecTrackRef pft(thePfRecTrackCollection,ipft);
122  LogDebug("ConvBremSeedProducerProducer")<<"NEW GsfPFRecTRACK ";
123  float eta_br=0;
124  unclean.clear();
125  tripl.clear();
126  vector<int> gc;
127  auto const & gsfRecHits = *pft->gsfTrackRef();
128  float pfoutenergy=sqrt((pfmass*pfmass)+pft->gsfTrackRef()->outerMomentum().Mag2());
129  XYZTLorentzVector mom =XYZTLorentzVector(pft->gsfTrackRef()->outerMomentum().x(),
130  pft->gsfTrackRef()->outerMomentum().y(),
131  pft->gsfTrackRef()->outerMomentum().z(),
132  pfoutenergy);
133  XYZTLorentzVector pos = XYZTLorentzVector(pft->gsfTrackRef()->outerPosition().x(),
134  pft->gsfTrackRef()->outerPosition().y(),
135  pft->gsfTrackRef()->outerPosition().z(),
136  0.);
137  BaseParticlePropagator theOutParticle=BaseParticlePropagator( RawParticle(mom,pos, pft->gsfTrackRef()->charge()),
138  0,0,B_.z());
139 
141  gc.push_back(GoodCluster(theOutParticle,PPP,0.5));
142 
143 
144  vector<PFBrem> brem =(*pft).PFRecBrem();
145  vector<PFBrem>::iterator ib=brem.begin();
146  vector<PFBrem>::iterator ib_end=brem.end();
147  LogDebug("ConvBremSeedProducerProducer")<<"NUMBER OF BREMS "<<brem.size();
148 
150  for (;ib!=ib_end;++ib){
151 
152  XYZTLorentzVector mom=pft->trajectoryPoint(ib->indTrajPoint()).momentum();
153  XYZTLorentzVector pos=
155  pft->trajectoryPoint(ib->indTrajPoint()).position().x(),
156  pft->trajectoryPoint(ib->indTrajPoint()).position().y(),
157  pft->trajectoryPoint(ib->indTrajPoint()).position().z(),
158  0);
159 
161  if (pos.Rho()>80) continue;
162  if ((pos.Rho()>5)&&(fabs(ib->SigmaDeltaP()/ib->DeltaP())>3)) continue;
163  if (fabs(ib->DeltaP())<3) continue;
164  eta_br=mom.eta();
165  vector< vector< long int > >Idd;
166 
167 
168 
169  BaseParticlePropagator p( RawParticle(mom,pos,0.),
170  0,0,B_.z());
171  gc.push_back(GoodCluster(p,PPP,0.2));
172 
173  ParticlePropagator PP(p,fieldMap_, nullptr);
174 
176  list<TrackerLayer>::const_iterator cyliter= geometry_->cylinderBegin();
177  for ( ; cyliter != geometry_->cylinderEnd() ; ++cyliter ) {
178 
180  if (!(cyliter->sensitive())) continue;
181  PP.setPropagationConditions(*cyliter);
182  PP.propagate();
183  if (PP.getSuccess()==0) continue;
184 
186  LocalMagneticField mf(PP.getMagneticField());
187  AnalyticalPropagator alongProp(&mf, anyDirection);
189  const DetLayer* tkLayer = detLayer(*cyliter,PP.particle().Z());
190  if (&(*tkLayer)==nullptr) continue;
191  TrajectoryStateOnSurface trajState = makeTrajectoryState( tkLayer, PP, &mf);
192 
193  std::vector<DetWithState> compat
194  = tkLayer->compatibleDets( trajState, alongProp, est);
195  vector <long int> temp;
196  if (compat.empty()) continue;
197 
198  for (std::vector<DetWithState>::const_iterator i=compat.begin(); i!=compat.end(); i++) {
199 
200  long int detid=i->first->geographicalId().rawId();
201 
203 
204 
205  StDetMatch DetMatch = (rphirecHits.product())->find((detid));
206  MatDetMatch MDetMatch =(matchedrecHits.product())->find((detid));
207 
208 
209  long int DetID=(DetMatch != rphirecHits->end())? detid:0;
210 
211  if ((MDetMatch != matchedrecHits->end()) && !MDetMatch->empty()) {
212  long int pii = MDetMatch->begin()->monoId();
213  StDetMatch CDetMatch = (rphirecHits.product())->find((pii));
214  DetID=(CDetMatch != rphirecHits->end())? pii:0;
215 
216  }
217 
218  temp.push_back(DetID);
219 
220  }
221  else{
222  PiDetMatch DetMatch = (pixelHits.product())->find((detid));
223  long int DetID=(DetMatch != pixelHits->end())? detid:0;
224  temp.push_back(DetID);
225 
226 
227  }
228  }
229 
230  Idd.push_back(temp);
231 
232  }//END TRACKER LAYER LOOP
233  if(Idd.size()<2)continue;
234 
236  for (unsigned int i=0;i<Idd.size()-2;i++){
237  for (unsigned int i1=0;i1<Idd[i].size();i1++){
238  for (unsigned int i2=0;i2<Idd[i+1].size();i2++){
239  for (unsigned int i3=0;i3<Idd[i+2].size();i3++){
240  if ((Idd[i][i1]!=0) &&(Idd[i+1][i2]!=0) &&(Idd[i+2][i3]!=0) ){
241  vector<long int >tmp;
242  tmp.push_back(Idd[i][i1]); tmp.push_back(Idd[i+1][i2]); tmp.push_back(Idd[i+2][i3]);
243 
244  bool newTrip=true;
245  for (unsigned int iv=0;iv<tripl.size();iv++){
246  if((tripl[iv][0]==tmp[0])&&(tripl[iv][1]==tmp[1])&&(tripl[iv][2]==tmp[2])) newTrip=false;
247 
248  }
249  if (newTrip){
250 
251  tripl.push_back(tmp);
252  }
253  }
254  }
255  }
256  }
257  }
258  }//END BREM LOOP
259 
260  float sineta_brem =sinh(eta_br);
261 
262 
263  //OUTPUT COLLECTION
265  iSetup.get<IdealMagneticFieldRecord>().get(bfield);
266  float nomField = bfield->nominalValue();
267 
268 
270  OwnVector<TrackingRecHit> loc_hits;
271  for (unsigned int i=0;i<tripl.size();i++){
272  StDetMatch DetMatch1 = (rphirecHits.product())->find(tripl[i][0]);
273  StDetMatch DetMatch2 = (rphirecHits.product())->find(tripl[i][1]);
274  StDetMatch DetMatch3 = (rphirecHits.product())->find(tripl[i][2]);
275  if ((DetMatch1 == rphirecHits->end()) ||
276  (DetMatch2 == rphirecHits->end()) ||
277  (DetMatch3 == rphirecHits->end()) ) continue;
278  StDetSet DetSet1 = *DetMatch1;
279  StDetSet DetSet2 = *DetMatch2;
280  StDetSet DetSet3 = *DetMatch3;
281 
282  for (StDetSet::const_iterator it1=DetSet1.begin();it1!=DetSet1.end();++it1){
283  GlobalPoint gp1=tracker_->idToDet(tripl[i][0])->surface().
284  toGlobal(it1->localPosition());
285 
286  bool tak1=isGsfTrack(gsfRecHits,&(*it1));
287 
288  for (StDetSet::const_iterator it2=DetSet2.begin();it2!=DetSet2.end();++it2){
289  GlobalPoint gp2=tracker_->idToDet(tripl[i][1])->surface().
290  toGlobal(it2->localPosition());
291  bool tak2=isGsfTrack(gsfRecHits,&(*it2));
292 
293  for (StDetSet::const_iterator it3=DetSet3.begin();it3!=DetSet3.end();++it3){
294  // ips++;
295  GlobalPoint gp3=tracker_->idToDet(tripl[i][2])->surface().
296  toGlobal(it3->localPosition());
297  bool tak3=isGsfTrack(gsfRecHits,&(*it3));
298 
299 
300  FastHelix helix(gp3, gp2, gp1,nomField,&*bfield);
301  GlobalVector gv=helix.stateAtVertex().momentum();
302  GlobalVector gv_corr(gv.x(),gv.y(),gv.perp()*sineta_brem);
303  float ene= sqrt(gv_corr.mag2()+(pfmass*pfmass));
304 
305  GlobalPoint gp=helix.stateAtVertex().position();
306  float ch=helix.stateAtVertex().charge();
307 
308 
309 
310 
311  XYZTLorentzVector mom = XYZTLorentzVector(gv.x(),gv.y(),gv_corr.z(),ene);
312  XYZTLorentzVector pos = XYZTLorentzVector(gp.x(),gp.y(),gp.z(),0.);
313  BaseParticlePropagator theOutParticle(RawParticle(mom,pos,ch),0,0,B_.z());
314  int bgc=GoodCluster(theOutParticle,PPP,0.3,true);
315 
316  if (gv.perp()<0.5) continue;
317 
318  if (tak1+tak2+tak3>2) continue;
319 
320  if (bgc==-1) continue;
321  bool clTak=false;
322  for (unsigned int igcc=0; igcc<gc.size(); igcc++){
323  if (clTak) continue;
324  if (bgc==gc[igcc]) clTak=true;
325  }
326  if (clTak) continue;
327 
328 
329 
330 
332  gv,int(ch),
333  &(*magfield_));
334  glob_hits.clear(); loc_hits.clear();
335  glob_hits.push_back(hitBuilder_->build(it1->clone()));
336  glob_hits.push_back(hitBuilder_->build(it2->clone()));
337  glob_hits.push_back(hitBuilder_->build(it3->clone()));
338 
340 
341  FreeTrajectoryState CSeed(Gtp,
344 
345  for (int ih=0;ih<3;ih++){
346 
347  TrajectoryStateOnSurface state = (ih==0)?
348  propagator_->propagate(CSeed,
349  tracker_->idToDet(tripl[i][ih])->surface()):
350  propagator_->propagate(updatedState,
351  tracker_->idToDet(tripl[i][ih])->surface());
352 
353  if (!state.isValid()){
354  ih=3;
355  continue;}
356 
357  updatedState = kfUpdator_->update(state, *glob_hits[ih]);
358  loc_hits.push_back(glob_hits[ih]->hit()->clone());
359  if (ih==2){
360  PTrajectoryStateOnDet const & PTraj=
361  trajectoryStateTransform::persistentState(updatedState,tripl[i][2]);
362  // output->push_back(Trajectoryseed(PTraj,loc_hits,alongMomentum));
363  unclean.push_back(make_pair(TrajectorySeed(PTraj,loc_hits,alongMomentum),
364  make_pair(gv_corr,ch)));
365  }
366  // }
367 
368  }
369  }
370  }
371  }
372  }
373  vector<bool> inPhot = sharedHits(unclean);
374  for (unsigned int iu=0; iu<unclean.size();iu++){
375 
376  if (inPhot[iu])
377  output->push_back(ConvBremSeed(unclean[iu].first,pft));
378 
379  }
380 
381  } //END GSF TRACK COLLECTION LOOP
382  LogDebug("ConvBremSeedProducerProducer")<<"END";
383  iEvent.put(std::move(output));
384 
385 }
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:39
const MagneticField * magfield_
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
const TransientTrackingRecHitBuilder * hitBuilder_
const_iterator end(bool update=false) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
T perp() const
Definition: PV3DBase.h:72
SiStripMatchedRecHit2DCollection::const_iterator MatDetMatch
int nominalValue() const
The nominal field value for this map in kGauss.
Definition: MagneticField.h:58
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
edm::ParameterSet conf_
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
const PropagatorWithMaterial * propagator_
T y() const
Definition: PV3DBase.h:63
std::list< TrackerLayer >::const_iterator cylinderEnd() const
Returns the last pointer in the cylinder list.
TrajectoryStateOnSurface makeTrajectoryState(const DetLayer *layer, const ParticlePropagator &pp, const MagneticField *field) const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
data_type const * const_iterator
Definition: DetSetNew.h:30
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
SiPixelRecHitCollection::const_iterator PiDetMatch
const KFUpdator * kfUpdator_
const TrackerInteractionGeometry * geometry_
const MagneticFieldMap * fieldMap_
bool isGsfTrack(const reco::Track &, const TrackingRecHit *)
void push_back(D *&d)
Definition: OwnVector.h:290
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
Definition: KFUpdator.cc:169
math::XYZVector B_
B field.
std::vector< GsfPFRecTrack > GsfPFRecTrackCollection
collection of GsfPFRecTrack objects
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
void clear()
Definition: OwnVector.h:445
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
SiStripRecHit2DCollection::DetSet StDetSet
std::vector< ConstRecHitPointer > ConstRecHitContainer
std::vector< bool > sharedHits(const std::vector< std::pair< TrajectorySeed, std::pair< GlobalVector, float > > > &)
T const * product() const
Definition: Handle.h:74
const DetLayer * detLayer(const TrackerLayer &layer, float zpos) const
std::list< TrackerLayer >::const_iterator cylinderBegin() const
Returns the first pointer in the cylinder list.
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
edm::EventID id() const
Definition: EventBase.h:59
static int position[264][3]
Definition: ReadPGInfo.cc:509
T get() const
Definition: EventSetup.h:71
SiStripRecHit2DCollection::const_iterator StDetMatch
const TrackerGeomDet * idToDet(DetId) const override
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
Definition: PFClusterFwd.h:9
int GoodCluster(const BaseParticlePropagator &bpg, const reco::PFClusterCollection &pfc, float minep, bool sec=false)
const TrackerGeometry * tracker_
T x() const
Definition: PV3DBase.h:62
def move(src, dest)
Definition: eostools.py:511
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:27
ib
Definition: cuy.py:662
vector< bool > ConvBremSeedProducer::sharedHits ( const std::vector< std::pair< TrajectorySeed, std::pair< GlobalVector, float > > > &  unclean)
private

Definition at line 558 of file ConvBremSeedProducer.cc.

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

Referenced by produce().

559  {
560 
561  vector<bool> goodseed;
562  goodseed.clear();
563  if (unclean.size()<2){
564  for (unsigned int i=0;i<unclean.size();i++)
565  goodseed.push_back(true);
566  }else{
567 
568  for (unsigned int i=0;i<unclean.size();i++)
569  goodseed.push_back(true);
570 
571  for (unsigned int iu=0; iu<unclean.size()-1;iu++){
572  if (!goodseed[iu]) continue;
573  for (unsigned int iu2=iu+1; iu2<unclean.size();iu2++){
574  if (!goodseed[iu]) continue;
575  if (!goodseed[iu2]) continue;
576  // if (unclean[iu].second.second *unclean[iu2].second.second >0)continue;
577 
578  TrajectorySeed::const_iterator sh = unclean[iu].first.recHits().first;
579  TrajectorySeed::const_iterator sh_end = unclean[iu].first.recHits().second;
580 
581  unsigned int shar =0;
582  for (;sh!=sh_end;++sh){
583 
584  TrajectorySeed::const_iterator sh2 = unclean[iu2].first.recHits().first;
585  TrajectorySeed::const_iterator sh2_end = unclean[iu2].first.recHits().second;
586  for (;sh2!=sh2_end;++sh2){
587 
588  if ((*sh).sharesInput(&(*sh2),TrackingRecHit::all))
589 
590  shar++;
591 
592  }
593  }
594  if (shar>=2){
595  if (unclean[iu].second.first.perp()<unclean[iu2].second.first.perp()) goodseed[iu]=false;
596  else goodseed[iu2]=false;
597  }
598 
599  }
600 
601  }
602  }
603  return goodseed;
604 }
U second(std::pair< T, U > const &p)
recHitContainer::const_iterator const_iterator

Member Data Documentation

math::XYZVector ConvBremSeedProducer::B_
private

B field.

Definition at line 84 of file ConvBremSeedProducer.h.

Referenced by beginRun(), and produce().

edm::ParameterSet ConvBremSeedProducer::conf_
private

Definition at line 72 of file ConvBremSeedProducer.h.

Referenced by beginRun(), and produce().

const MagneticFieldMap* ConvBremSeedProducer::fieldMap_
private

Definition at line 77 of file ConvBremSeedProducer.h.

Referenced by beginRun(), and produce().

const TrackerInteractionGeometry* ConvBremSeedProducer::geometry_
private

Definition at line 74 of file ConvBremSeedProducer.h.

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

const GeometricSearchTracker* ConvBremSeedProducer::geomSearchTracker_
private

Definition at line 73 of file ConvBremSeedProducer.h.

Referenced by beginRun(), and initializeLayerMap().

const TransientTrackingRecHitBuilder* ConvBremSeedProducer::hitBuilder_
private

Definition at line 80 of file ConvBremSeedProducer.h.

Referenced by beginRun(), and produce().

const KFUpdator* ConvBremSeedProducer::kfUpdator_
private

Definition at line 79 of file ConvBremSeedProducer.h.

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

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

Definition at line 81 of file ConvBremSeedProducer.h.

Referenced by detLayer(), and initializeLayerMap().

const MagneticField* ConvBremSeedProducer::magfield_
private

Definition at line 76 of file ConvBremSeedProducer.h.

Referenced by beginRun(), and produce().

int ConvBremSeedProducer::negLayerOffset_
private

Definition at line 82 of file ConvBremSeedProducer.h.

Referenced by detLayer().

const PropagatorWithMaterial* ConvBremSeedProducer::propagator_
private

Definition at line 78 of file ConvBremSeedProducer.h.

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

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

Definition at line 58 of file ConvBremSeedProducer.h.

const TrackerGeometry* ConvBremSeedProducer::tracker_
private

Definition at line 75 of file ConvBremSeedProducer.h.

Referenced by beginRun(), and produce().