CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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

virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
const DetLayerdetLayer (const TrackerLayer &layer, float zpos) const
 
virtual 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
 
virtual 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
TransientTrackingRecHitBuilder
hitBuilder_
 
const KFUpdatorkfUpdator_
 
std::vector< const DetLayer * > layerMap_
 
const MagneticFieldmagfield_
 
int negLayerOffset_
 
const PropagatorWithMaterialpropagator_
 
std::vector< const DetLayer * > theLayerMap
 
const TrackerGeometrytracker_
 
const TrajectoryStateTransformtransformer_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 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 41 of file ConvBremSeedProducer.h.

Member Typedef Documentation

Definition at line 48 of file ConvBremSeedProducer.h.

Definition at line 44 of file ConvBremSeedProducer.h.

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.

Constructor & Destructor Documentation

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

Definition at line 51 of file ConvBremSeedProducer.cc.

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

Definition at line 61 of file ConvBremSeedProducer.cc.

62 {
63 
64 
65 }

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 391 of file ConvBremSeedProducer.cc.

References alongMomentum, B_, conf_, fieldMap_, geometry_, geomSearchTracker_, edm::EventSetup::get(), edm::ParameterSet::getParameter(), hitBuilder_, MagneticField::inTesla(), kfUpdator_, HLT_ES_cff::magfield, magfield_, edm::ESHandle< class >::product(), propagator_, patCandidatesForDimuonsSequences_cff::tracker, and tracker_.

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

Definition at line 532 of file ConvBremSeedProducer.cc.

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

Referenced by produce().

533 {
534  if (zpos > 0 || !layer.forward() ) return layerMap_[layer.layerNumber()];
535  else return layerMap_[layer.layerNumber()+negLayerOffset_];
536 }
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 
)
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 426 of file ConvBremSeedProducer.cc.

References kfUpdator_, and propagator_.

427  {
428  delete propagator_;
429  delete kfUpdator_;
430 }
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 615 of file ConvBremSeedProducer.cc.

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

Referenced by produce().

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

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

Referenced by produce().

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

References TrackingRecHit::all, cuy::ib, reco::Track::recHitsBegin(), and reco::Track::recHitsEnd().

Referenced by produce().

552  {
553  auto ib=tkv.recHitsBegin();
554  auto ie=tkv.recHitsEnd();
555  bool istaken=false;
556  // for (;ib!=ie-2;++ib){
557  for (;ib!=ie;++ib){
558  if (istaken) continue;
559  if (!((*ib)->isValid())) continue;
560 
561  istaken = (*ib)->sharesInput(h,TrackingRecHit::all);
562  }
563  return istaken;
564 }
int ib
Definition: cuy.py:660
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:104
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:109
TrajectoryStateOnSurface ConvBremSeedProducer::makeTrajectoryState ( const DetLayer layer,
const ParticlePropagator pp,
const MagneticField field 
) const
private

Definition at line 539 of file ConvBremSeedProducer.cc.

References RawParticle::charge(), GeometricSearchDet::surface(), Surface::tangentPlane(), RawParticle::X(), RawParticle::Y(), and RawParticle::Z().

Referenced by produce().

542 {
543 
544  GlobalPoint pos( pp.X(), pp.Y(), pp.Z());
545  GlobalVector mom( pp.Px(), pp.Py(), pp.Pz());
546 
547  auto plane = layer->surface().tangentPlane(pos);
548 
550  (GlobalTrajectoryParameters( pos, mom, TrackCharge( pp.charge()), field), *plane);
551 }
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
virtual ConstReferenceCountingPointer< TangentPlane > tangentPlane(const GlobalPoint &) const =0
int TrackCharge
Definition: TrackCharge.h:4
double Y() const
y of vertex
Definition: RawParticle.h:275
double Z() const
z of vertex
Definition: RawParticle.h:276
double charge() const
get the MEASURED charge
Definition: RawParticle.h:282
double X() const
x of vertex
Definition: RawParticle.h:274
void ConvBremSeedProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

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

Implements edm::EDProducer.

Definition at line 69 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(), cond::rpcobgas::detid, detLayer(), edmNew::DetSet< 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(), hitBuilder_, i, cuy::ib, edm::EventBase::id(), TrackerGeometry::idToDet(), initializeLayerMap(), isGsfTrack(), TrajectoryStateOnSurface::isValid(), kfUpdator_, LogDebug, magfield_, makeTrajectoryState(), GlobalTrajectoryParameters::momentum(), convertSQLitetoXML_cfg::output, AlCaHLTBitMon_ParallelJobs::p, PV3DBase< T, PVType, FrameType >::perp(), trajectoryStateTransform::persistentState(), GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, GlobalTrajectoryParameters::position(), position, edm::Handle< T >::product(), BaseParticlePropagator::propagate(), Propagator::propagate(), propagator_, edm::OwnVector< T, P >::push_back(), edm::Event::put(), edm::EventID::run(), RawParticle::setCharge(), ParticlePropagator::setPropagationConditions(), sharedHits(), mathSSE::sqrt(), FastHelix::stateAtVertex(), DetLayer::subDetector(), GeomDet::surface(), groupFilesInBlocks::temp, tmp, tracker_, KFUpdator::update(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and RawParticle::Z().

70 {
71 
72  LogDebug("ConvBremSeedProducerProducer")<<"START event: "<<iEvent.id().event()
73  <<" in run "<<iEvent.id().run();
74 
75  float pfmass= 0.0005;
76 
78 
81  iEvent.getByLabel(conf_.getParameter<InputTag>("PFClusters") ,PfC);
82  const PFClusterCollection& PPP= *(PfC.product());
83 
86  iEvent.getByLabel(conf_.getParameter<InputTag>("pixelRecHits") , pixelHits);
87 
90  iEvent.getByLabel(conf_.getParameter<InputTag>("rphirecHits"),rphirecHits);
92  iEvent.getByLabel(conf_.getParameter<InputTag>("stereorecHits"), stereorecHits);
94  iEvent.getByLabel(conf_.getParameter<InputTag>("matchedrecHits"), matchedrecHits);
95 
96  //GSFPFRECTRACKS
97  Handle<GsfPFRecTrackCollection> thePfRecTrackCollection;
98  iEvent.getByLabel(conf_.getParameter<InputTag>("PFRecTrackLabel"),
99  thePfRecTrackCollection);
100  const GsfPFRecTrackCollection PfRTkColl = *(thePfRecTrackCollection.product());
101 
102 
104  std::auto_ptr<ConvBremSeedCollection> output(new ConvBremSeedCollection);
105 
106 
108  vector<pair< TrajectorySeed , pair<GlobalVector,float> > > unclean;
109  //TRIPLET OF MODULES TO BE USED FOR SEEDING
110  vector< vector< long int > > tripl;
111  //LAYER MAP
113 
114 
115 
117 
118  for(unsigned int ipft=0;ipft<PfRTkColl.size();ipft++){
119  GsfPFRecTrackRef pft(thePfRecTrackCollection,ipft);
120  LogDebug("ConvBremSeedProducerProducer")<<"NEW GsfPFRecTRACK ";
121  float eta_br=0;
122  unclean.clear();
123  tripl.clear();
124  vector<int> gc;
125  auto const & gsfRecHits = *pft->gsfTrackRef();
126  float pfoutenergy=sqrt((pfmass*pfmass)+pft->gsfTrackRef()->outerMomentum().Mag2());
127  XYZTLorentzVector mom =XYZTLorentzVector(pft->gsfTrackRef()->outerMomentum().x(),
128  pft->gsfTrackRef()->outerMomentum().y(),
129  pft->gsfTrackRef()->outerMomentum().z(),
130  pfoutenergy);
131  XYZTLorentzVector pos = XYZTLorentzVector(pft->gsfTrackRef()->outerPosition().x(),
132  pft->gsfTrackRef()->outerPosition().y(),
133  pft->gsfTrackRef()->outerPosition().z(),
134  0.);
136  0,0,B_.z());
137  theOutParticle.setCharge(pft->gsfTrackRef()->charge());
138 
140  gc.push_back(GoodCluster(theOutParticle,PPP,0.5));
141 
142 
143  vector<PFBrem> brem =(*pft).PFRecBrem();
144  vector<PFBrem>::iterator ib=brem.begin();
145  vector<PFBrem>::iterator ib_end=brem.end();
146  LogDebug("ConvBremSeedProducerProducer")<<"NUMBER OF BREMS "<<brem.size();
147 
149  for (;ib!=ib_end;++ib){
150 
151  XYZTLorentzVector mom=pft->trajectoryPoint(ib->indTrajPoint()).momentum();
152  XYZTLorentzVector pos=
154  pft->trajectoryPoint(ib->indTrajPoint()).position().x(),
155  pft->trajectoryPoint(ib->indTrajPoint()).position().y(),
156  pft->trajectoryPoint(ib->indTrajPoint()).position().z(),
157  0);
158 
160  if (pos.Rho()>80) continue;
161  if ((pos.Rho()>5)&&(fabs(ib->SigmaDeltaP()/ib->DeltaP())>3)) continue;
162  if (fabs(ib->DeltaP())<3) continue;
163  eta_br=mom.eta();
164  vector< vector< long int > >Idd;
165 
166 
167 
169  0,0,B_.z());
170  p.setCharge(0);
171  gc.push_back(GoodCluster(p,PPP,0.2));
172 
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.Z());
190  if (&(*tkLayer)==0) 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.size()==0) 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 
202  if ((tkLayer->subDetector()!=GeomDetEnumerators::PixelBarrel)&&
204 
205 
206  StDetMatch DetMatch = (rphirecHits.product())->find((detid));
207  MatDetMatch MDetMatch =(matchedrecHits.product())->find((detid));
208 
209 
210  long int DetID=(DetMatch != rphirecHits->end())? detid:0;
211 
212  if ((MDetMatch != matchedrecHits->end()) && !MDetMatch->empty()) {
213  long int pii = MDetMatch->begin()->monoId();
214  StDetMatch CDetMatch = (rphirecHits.product())->find((pii));
215  DetID=(CDetMatch != rphirecHits->end())? pii:0;
216 
217  }
218 
219  temp.push_back(DetID);
220 
221  }
222  else{
223  PiDetMatch DetMatch = (pixelHits.product())->find((detid));
224  long int DetID=(DetMatch != pixelHits->end())? detid:0;
225  temp.push_back(DetID);
226 
227 
228  }
229  }
230 
231  Idd.push_back(temp);
232 
233  }//END TRACKER LAYER LOOP
234  if(Idd.size()<2)continue;
235 
237  for (unsigned int i=0;i<Idd.size()-2;i++){
238  for (unsigned int i1=0;i1<Idd[i].size();i1++){
239  for (unsigned int i2=0;i2<Idd[i+1].size();i2++){
240  for (unsigned int i3=0;i3<Idd[i+2].size();i3++){
241  if ((Idd[i][i1]!=0) &&(Idd[i+1][i2]!=0) &&(Idd[i+2][i3]!=0) ){
242  vector<long int >tmp;
243  tmp.push_back(Idd[i][i1]); tmp.push_back(Idd[i+1][i2]); tmp.push_back(Idd[i+2][i3]);
244 
245  bool newTrip=true;
246  for (unsigned int iv=0;iv<tripl.size();iv++){
247  if((tripl[iv][0]==tmp[0])&&(tripl[iv][1]==tmp[1])&&(tripl[iv][2]==tmp[2])) newTrip=false;
248 
249  }
250  if (newTrip){
251 
252  tripl.push_back(tmp);
253  }
254  }
255  }
256  }
257  }
258  }
259  }//END BREM LOOP
260 
261  float sineta_brem =sinh(eta_br);
262 
263 
264  //OUTPUT COLLECTION
266  iSetup.get<IdealMagneticFieldRecord>().get(bfield);
267  float nomField = bfield->nominalValue();
268 
269 
271  OwnVector<TrackingRecHit> loc_hits;
272  for (unsigned int i=0;i<tripl.size();i++){
273  StDetMatch DetMatch1 = (rphirecHits.product())->find(tripl[i][0]);
274  StDetMatch DetMatch2 = (rphirecHits.product())->find(tripl[i][1]);
275  StDetMatch DetMatch3 = (rphirecHits.product())->find(tripl[i][2]);
276  if ((DetMatch1 == rphirecHits->end()) ||
277  (DetMatch2 == rphirecHits->end()) ||
278  (DetMatch3 == rphirecHits->end()) ) continue;
279  StDetSet DetSet1 = *DetMatch1;
280  StDetSet DetSet2 = *DetMatch2;
281  StDetSet DetSet3 = *DetMatch3;
282 
283  for (StDetSet::const_iterator it1=DetSet1.begin();it1!=DetSet1.end();++it1){
284  GlobalPoint gp1=tracker_->idToDet(tripl[i][0])->surface().
285  toGlobal(it1->localPosition());
286 
287  bool tak1=isGsfTrack(gsfRecHits,&(*it1));
288 
289  for (StDetSet::const_iterator it2=DetSet2.begin();it2!=DetSet2.end();++it2){
290  GlobalPoint gp2=tracker_->idToDet(tripl[i][1])->surface().
291  toGlobal(it2->localPosition());
292  bool tak2=isGsfTrack(gsfRecHits,&(*it2));
293 
294  for (StDetSet::const_iterator it3=DetSet3.begin();it3!=DetSet3.end();++it3){
295  // ips++;
296  GlobalPoint gp3=tracker_->idToDet(tripl[i][2])->surface().
297  toGlobal(it3->localPosition());
298  bool tak3=isGsfTrack(gsfRecHits,&(*it3));
299 
300 
301  FastHelix helix(gp3, gp2, gp1,nomField,&*bfield);
302  GlobalVector gv=helix.stateAtVertex().momentum();
303  GlobalVector gv_corr(gv.x(),gv.y(),gv.perp()*sineta_brem);
304  float ene= sqrt(gv_corr.mag2()+(pfmass*pfmass));
305 
306  GlobalPoint gp=helix.stateAtVertex().position();
307  float ch=helix.stateAtVertex().charge();
308 
309 
310 
311 
312  XYZTLorentzVector mom = XYZTLorentzVector(gv.x(),gv.y(),gv_corr.z(),ene);
313  XYZTLorentzVector pos = XYZTLorentzVector(gp.x(),gp.y(),gp.z(),0.);
314  BaseParticlePropagator theOutParticle(RawParticle(mom,pos),0,0,B_.z());
315  theOutParticle.setCharge(ch);
316  int bgc=GoodCluster(theOutParticle,PPP,0.3,true);
317 
318  if (gv.perp()<0.5) continue;
319 
320  if (tak1+tak2+tak3>2) continue;
321 
322  if (bgc==-1) continue;
323  bool clTak=false;
324  for (unsigned int igcc=0; igcc<gc.size(); igcc++){
325  if (clTak) continue;
326  if (bgc==gc[igcc]) clTak=true;
327  }
328  if (clTak) continue;
329 
330 
331 
332 
334  gv,int(ch),
335  &(*magfield_));
336  glob_hits.clear(); loc_hits.clear();
337  glob_hits.push_back(hitBuilder_->build(it1->clone()));
338  glob_hits.push_back(hitBuilder_->build(it2->clone()));
339  glob_hits.push_back(hitBuilder_->build(it3->clone()));
340 
342 
343  FreeTrajectoryState CSeed(Gtp,
345  TrajectoryStateOnSurface updatedState;
346 
347  for (int ih=0;ih<3;ih++){
348 
349  TrajectoryStateOnSurface state = (ih==0)?
350  propagator_->propagate(CSeed,
351  tracker_->idToDet(tripl[i][ih])->surface()):
352  propagator_->propagate(updatedState,
353  tracker_->idToDet(tripl[i][ih])->surface());
354 
355  if (!state.isValid()){
356  ih=3;
357  continue;}
358 
359  updatedState = kfUpdator_->update(state, *glob_hits[ih]);
360  loc_hits.push_back(glob_hits[ih]->hit()->clone());
361  if (ih==2){
362  PTrajectoryStateOnDet const & PTraj=
363  trajectoryStateTransform::persistentState(updatedState,tripl[i][2]);
364  // output->push_back(Trajectoryseed(PTraj,loc_hits,alongMomentum));
365  unclean.push_back(make_pair(TrajectorySeed(PTraj,loc_hits,alongMomentum),
366  make_pair(gv_corr,ch)));
367  }
368  // }
369 
370  }
371  }
372  }
373  }
374  }
375  vector<bool> inPhot = sharedHits(unclean);
376  for (unsigned int iu=0; iu<unclean.size();iu++){
377 
378  if (inPhot[iu])
379  output->push_back(ConvBremSeed(unclean[iu].first,pft));
380 
381  }
382 
383  } //END GSF TRACK COLLECTION LOOP
384  LogDebug("ConvBremSeedProducerProducer")<<"END";
385  iEvent.put(output);
386 
387 }
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:39
const MagneticField * magfield_
void setCharge(float q)
set the MEASURED charge
Definition: RawParticle.cc:139
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
Definition: Propagator.h:119
int i
Definition: DBlmapReader.cc:9
const TransientTrackingRecHitBuilder * hitBuilder_
int ib
Definition: cuy.py:660
T perp() const
Definition: PV3DBase.h:72
SiStripMatchedRecHit2DCollection::const_iterator MatDetMatch
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
edm::ParameterSet conf_
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
const PropagatorWithMaterial * propagator_
T y() const
Definition: PV3DBase.h:63
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
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
std::vector< ConvBremSeed > ConvBremSeedCollection
collectin of ConvBremSeed objects
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
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_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
bool isGsfTrack(const reco::Track &, const TrackingRecHit *)
void push_back(D *&d)
Definition: OwnVector.h:280
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
Definition: KFUpdator.cc:75
math::XYZVector B_
B field.
std::vector< GsfPFRecTrack > GsfPFRecTrackCollection
collection of GsfPFRecTrack objects
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
T sqrt(T t)
Definition: SSEVec.h:48
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
T z() const
Definition: PV3DBase.h:64
void clear()
Definition: OwnVector.h:377
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
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:81
const DetLayer * detLayer(const TrackerLayer &layer, float zpos) const
const T & get() const
Definition: EventSetup.h:55
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
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
edm::EventID id() const
Definition: EventBase.h:60
static int position[264][3]
Definition: ReadPGInfo.cc:509
SiStripRecHit2DCollection::const_iterator StDetMatch
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
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:15
virtual const TrackerGeomDet * idToDet(DetId) const
vector< bool > ConvBremSeedProducer::sharedHits ( const std::vector< std::pair< TrajectorySeed, std::pair< GlobalVector, float > > > &  unclean)
private

Definition at line 565 of file ConvBremSeedProducer.cc.

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

Referenced by produce().

566  {
567 
568  vector<bool> goodseed;
569  goodseed.clear();
570  if (unclean.size()<2){
571  for (unsigned int i=0;i<unclean.size();i++)
572  goodseed.push_back(true);
573  }else{
574 
575  for (unsigned int i=0;i<unclean.size();i++)
576  goodseed.push_back(true);
577 
578  for (unsigned int iu=0; iu<unclean.size()-1;iu++){
579  if (!goodseed[iu]) continue;
580  for (unsigned int iu2=iu+1; iu2<unclean.size();iu2++){
581  if (!goodseed[iu]) continue;
582  if (!goodseed[iu2]) continue;
583  // if (unclean[iu].second.second *unclean[iu2].second.second >0)continue;
584 
585  TrajectorySeed::const_iterator sh = unclean[iu].first.recHits().first;
586  TrajectorySeed::const_iterator sh_end = unclean[iu].first.recHits().second;
587 
588  unsigned int shar =0;
589  for (;sh!=sh_end;++sh){
590 
591  TrajectorySeed::const_iterator sh2 = unclean[iu2].first.recHits().first;
592  TrajectorySeed::const_iterator sh2_end = unclean[iu2].first.recHits().second;
593  for (;sh2!=sh2_end;++sh2){
594 
595  if ((*sh).sharesInput(&(*sh2),TrackingRecHit::all))
596 
597  shar++;
598 
599  }
600  }
601  if (shar>=2){
602  if (unclean[iu].second.first.perp()<unclean[iu2].second.first.perp()) goodseed[iu]=false;
603  else goodseed[iu2]=false;
604  }
605 
606  }
607 
608  }
609  }
610  return goodseed;
611 }
int i
Definition: DBlmapReader.cc:9
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 86 of file ConvBremSeedProducer.h.

Referenced by beginRun(), and produce().

edm::ParameterSet ConvBremSeedProducer::conf_
private

Definition at line 73 of file ConvBremSeedProducer.h.

Referenced by beginRun(), and produce().

const MagneticFieldMap* ConvBremSeedProducer::fieldMap_
private

Definition at line 78 of file ConvBremSeedProducer.h.

Referenced by beginRun(), and produce().

const TrackerInteractionGeometry* ConvBremSeedProducer::geometry_
private

Definition at line 75 of file ConvBremSeedProducer.h.

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

const GeometricSearchTracker* ConvBremSeedProducer::geomSearchTracker_
private

Definition at line 74 of file ConvBremSeedProducer.h.

Referenced by beginRun(), and initializeLayerMap().

const TransientTrackingRecHitBuilder* ConvBremSeedProducer::hitBuilder_
private

Definition at line 81 of file ConvBremSeedProducer.h.

Referenced by beginRun(), and produce().

const KFUpdator* ConvBremSeedProducer::kfUpdator_
private

Definition at line 80 of file ConvBremSeedProducer.h.

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

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

Definition at line 83 of file ConvBremSeedProducer.h.

Referenced by detLayer(), and initializeLayerMap().

const MagneticField* ConvBremSeedProducer::magfield_
private

Definition at line 77 of file ConvBremSeedProducer.h.

Referenced by beginRun(), and produce().

int ConvBremSeedProducer::negLayerOffset_
private

Definition at line 84 of file ConvBremSeedProducer.h.

Referenced by detLayer().

const PropagatorWithMaterial* ConvBremSeedProducer::propagator_
private

Definition at line 79 of file ConvBremSeedProducer.h.

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

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

Definition at line 59 of file ConvBremSeedProducer.h.

const TrackerGeometry* ConvBremSeedProducer::tracker_
private

Definition at line 76 of file ConvBremSeedProducer.h.

Referenced by beginRun(), and produce().

const TrajectoryStateTransform* ConvBremSeedProducer::transformer_
private

Definition at line 82 of file ConvBremSeedProducer.h.