CMS 3D CMS Logo

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

#include <SeedFinderSelector.h>

Public Member Functions

void initEvent (const edm::Event &ev, const edm::EventSetup &es)
 
bool pass (const std::vector< const FastTrackerRecHit * > &hits) const
 
 SeedFinderSelector (const edm::ParameterSet &cfg, edm::ConsumesCollector &&consumesCollector)
 
void setTrackingRegion (const TrackingRegion *trackingRegion)
 
 ~SeedFinderSelector ()
 

Private Attributes

const edm::EventSetupeventSetup_
 
const MeasurementTrackermeasurementTracker_
 
const std::string measurementTrackerLabel_
 
std::unique_ptr< MultiHitGeneratorFromPairAndLayersmultiHitGenerator_
 
std::unique_ptr< HitTripletGeneratorFromPairAndLayerspixelTripletGenerator_
 
const TrackingRegiontrackingRegion_
 

Detailed Description

Definition at line 22 of file SeedFinderSelector.h.

Constructor & Destructor Documentation

SeedFinderSelector::SeedFinderSelector ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  consumesCollector 
)

Definition at line 21 of file SeedFinderSelector.cc.

References beamerCreator::create(), Exception, edm::ParameterSet::exists(), reco::get(), edm::ParameterSet::getParameter(), multiHitGenerator_, pixelTripletGenerator_, and AlCaHLTBitMon_QueryRunRegistry::string.

22  : trackingRegion_(0)
23  , eventSetup_(0)
25  , measurementTrackerLabel_(cfg.getParameter<std::string>("measurementTracker"))
26 {
27  if(cfg.exists("pixelTripletGeneratorFactory"))
28  {
29  const edm::ParameterSet & tripletConfig = cfg.getParameter<edm::ParameterSet>("pixelTripletGeneratorFactory");
30  pixelTripletGenerator_.reset(HitTripletGeneratorFromPairAndLayersFactory::get()->create(tripletConfig.getParameter<std::string>("ComponentName"),tripletConfig,consumesCollector));
31  }
32 
33  if(cfg.exists("MultiHitGeneratorFactory"))
34  {
35  const edm::ParameterSet & tripletConfig = cfg.getParameter<edm::ParameterSet>("MultiHitGeneratorFactory");
36  multiHitGenerator_.reset(MultiHitGeneratorFromPairAndLayersFactory::get()->create(tripletConfig.getParameter<std::string>("ComponentName"),tripletConfig));
37  }
38 
40  {
41  throw cms::Exception("FastSimTracking") << "It is forbidden to specify both 'pixelTripletGeneratorFactory' and 'MultiHitGeneratorFactory' in configuration of SeedFinderSelection";
42  }
43 }
T getParameter(std::string const &) const
const edm::EventSetup * eventSetup_
def create(alignables, pedeDump, additionalData, outputFile, config)
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::unique_ptr< HitTripletGeneratorFromPairAndLayers > pixelTripletGenerator_
const TrackingRegion * trackingRegion_
const MeasurementTracker * measurementTracker_
const std::string measurementTrackerLabel_
T get(const Candidate &c)
Definition: component.h:55
std::unique_ptr< MultiHitGeneratorFromPairAndLayers > multiHitGenerator_
SeedFinderSelector::~SeedFinderSelector ( )

Definition at line 46 of file SeedFinderSelector.cc.

46 {;}

Member Function Documentation

void SeedFinderSelector::initEvent ( const edm::Event ev,
const edm::EventSetup es 
)

Definition at line 48 of file SeedFinderSelector.cc.

References eventSetup_, edm::EventSetup::get(), measurementTracker_, measurementTrackerLabel_, and multiHitGenerator_.

49 {
50  eventSetup_ = &es;
51 
52  edm::ESHandle<MeasurementTracker> measurementTrackerHandle;
53  es.get<CkfComponentsRecord>().get(measurementTrackerLabel_, measurementTrackerHandle);
54  measurementTracker_ = &(*measurementTrackerHandle);
55 
57  {
58  multiHitGenerator_->initES(es);
59  }
60 }
const edm::EventSetup * eventSetup_
const T & get() const
Definition: EventSetup.h:56
const MeasurementTracker * measurementTracker_
const std::string measurementTrackerLabel_
std::unique_ptr< MultiHitGeneratorFromPairAndLayers > multiHitGenerator_
bool SeedFinderSelector::pass ( const std::vector< const FastTrackerRecHit * > &  hits) const

Definition at line 63 of file SeedFinderSelector.cc.

References GeometricSearchTracker::detLayer(), HitPairGeneratorFromLayerPair::doublets(), eventSetup_, Exception, MeasurementTracker::geometricSearchTracker(), measurementTracker_, multiHitGenerator_, TrackingRegion::origin(), pixelTripletGenerator_, mps_fire::result, OrderedMultiHits::size(), OrderedHitTriplets::size(), and trackingRegion_.

64 {
66  {
67  throw cms::Exception("FastSimTracking") << "ERROR: event not initialized";
68  }
69  if(!trackingRegion_)
70  {
71  throw cms::Exception("FastSimTracking") << "ERROR: trackingRegion not set";
72  }
73 
74 
75  // check the inner 2 hits
76  if(hits.size() < 2)
77  {
78  throw cms::Exception("FastSimTracking") << "SeedFinderSelector::pass requires at least 2 hits";
79  }
80  const DetLayer * firstLayer = measurementTracker_->geometricSearchTracker()->detLayer(hits[0]->det()->geographicalId());
81  const DetLayer * secondLayer = measurementTracker_->geometricSearchTracker()->detLayer(hits[1]->det()->geographicalId());
82 
83  std::vector<BaseTrackerRecHit const *> firstHits(1,static_cast<const BaseTrackerRecHit*>(hits[0]));
84  std::vector<BaseTrackerRecHit const *> secondHits(1,static_cast<const BaseTrackerRecHit*>(hits[1]));
85 
86  const RecHitsSortedInPhi fhm(firstHits, trackingRegion_->origin(), firstLayer);
87  const RecHitsSortedInPhi shm(secondHits, trackingRegion_->origin(), secondLayer);
88 
89  HitDoublets result(fhm,shm);
90  HitPairGeneratorFromLayerPair::doublets(*trackingRegion_,*firstLayer,*secondLayer,fhm,shm,*eventSetup_,0,result);
91 
92  if(result.size()==0)
93  {
94  return false;
95  }
96 
97  // check the inner 3 hits
99  {
100  if(hits.size() < 3)
101  {
102  throw cms::Exception("FastSimTracking") << "For the given configuration, SeedFinderSelector::pass requires at least 3 hits";
103  }
104  const DetLayer * thirdLayer = measurementTracker_->geometricSearchTracker()->detLayer(hits[2]->det()->geographicalId());
105  std::vector<const DetLayer *> thirdLayerDetLayer(1,thirdLayer);
106  std::vector<BaseTrackerRecHit const *> thirdHits(1,static_cast<const BaseTrackerRecHit*>(hits[2]));
107  const RecHitsSortedInPhi thm(thirdHits,trackingRegion_->origin(), thirdLayer);
108  const RecHitsSortedInPhi * thmp =&thm;
109 
111  {
112  OrderedHitTriplets tripletresult;
113  pixelTripletGenerator_->hitTriplets(*trackingRegion_,tripletresult,*eventSetup_,result,&thmp,thirdLayerDetLayer,1);
114  return tripletresult.size()!=0;
115  }
116  else if(multiHitGenerator_)
117  {
118  OrderedMultiHits tripletresult;
119  multiHitGenerator_->hitTriplets(*trackingRegion_,tripletresult,*eventSetup_,result,&thmp,thirdLayerDetLayer,1);
120  return tripletresult.size()!=0;
121  }
122 
123  }
124  return true;
125 
126 }
const edm::EventSetup * eventSetup_
GlobalPoint const & origin() const
std::unique_ptr< HitTripletGeneratorFromPairAndLayers > pixelTripletGenerator_
virtual unsigned int size() const
const TrackingRegion * trackingRegion_
const DetLayer * detLayer(const DetId &id) const
obsolete method. Use idToLayer() instead.
HitDoublets doublets(const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es, Layers layers)
const MeasurementTracker * measurementTracker_
virtual unsigned int size() const
const GeometricSearchTracker * geometricSearchTracker() const
std::unique_ptr< MultiHitGeneratorFromPairAndLayers > multiHitGenerator_
void SeedFinderSelector::setTrackingRegion ( const TrackingRegion trackingRegion)
inline

Definition at line 32 of file SeedFinderSelector.h.

References hfClusterShapes_cfi::hits.

32 {trackingRegion_ = trackingRegion;}
const TrackingRegion * trackingRegion_

Member Data Documentation

const edm::EventSetup* SeedFinderSelector::eventSetup_
private

Definition at line 41 of file SeedFinderSelector.h.

Referenced by initEvent(), and pass().

const MeasurementTracker* SeedFinderSelector::measurementTracker_
private

Definition at line 42 of file SeedFinderSelector.h.

Referenced by initEvent(), and pass().

const std::string SeedFinderSelector::measurementTrackerLabel_
private

Definition at line 43 of file SeedFinderSelector.h.

Referenced by initEvent().

std::unique_ptr<MultiHitGeneratorFromPairAndLayers> SeedFinderSelector::multiHitGenerator_
private

Definition at line 39 of file SeedFinderSelector.h.

Referenced by initEvent(), pass(), and SeedFinderSelector().

std::unique_ptr<HitTripletGeneratorFromPairAndLayers> SeedFinderSelector::pixelTripletGenerator_
private

Definition at line 38 of file SeedFinderSelector.h.

Referenced by pass(), and SeedFinderSelector().

const TrackingRegion* SeedFinderSelector::trackingRegion_
private

Definition at line 40 of file SeedFinderSelector.h.

Referenced by pass().