CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Public Attributes | Private Attributes
TrajectorySeedProducer Class Reference

#include <TrajectorySeedProducer.h>

Inheritance diagram for TrajectorySeedProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector
< std::unique_ptr
< TrackingRegion > > 
Regions
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

bool compatibleWithBeamSpot (const GlobalPoint &gpos1, const GlobalPoint &gpos2, double error, bool forward) const
 
bool compatibleWithPrimaryVertex (const GlobalPoint &gpos1, const GlobalPoint &gpos2, double error, bool forward) const
 
const SeedingNode
< TrackingLayer > * 
insertHit (const std::vector< TrajectorySeedHitCandidate > &trackerRecHits, std::vector< int > &hitIndicesInTree, const SeedingNode< TrackingLayer > *node, unsigned int trackerHit) const
 
bool isHitOnLayer (const TrajectorySeedHitCandidate &trackerRecHit, const TrackingLayer &layer) const
 
virtual std::vector< unsigned int > iterateHits (unsigned int start, const std::vector< TrajectorySeedHitCandidate > &trackerRecHits, std::vector< int > hitIndicesInTree, bool processSkippedHits) const
 method tries to insert all hits into the tree structure. More...
 
bool pass2HitsCuts (const TrajectorySeedHitCandidate &hit1, const TrajectorySeedHitCandidate &hit2) const
 
bool passHitTuplesCuts (const SeedingNode< TrackingLayer > &seedingNode, const std::vector< TrajectorySeedHitCandidate > &trackerRecHits, const std::vector< int > &hitIndicesInTree, const TrajectorySeedHitCandidate &currentTrackerHit) const
 method checks if a SimTrack fulfills the quality requirements. More...
 
virtual void produce (edm::Event &e, const edm::EventSetup &es)
 
bool testWithRegions (const TrajectorySeedHitCandidate &innerHit, const TrajectorySeedHitCandidate &outerHit) const
 method inserts hit into the tree structure at an empty position. More...
 
 TrajectorySeedProducer (const edm::ParameterSet &conf)
 
virtual ~TrajectorySeedProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 ()
 

Public Attributes

const edm::EventSetupes_
 
const MeasurementTrackerEventmeasurementTrackerEvent
 
edm::EDGetTokenT
< MeasurementTrackerEvent
measurementTrackerEventToken
 
Regions regions
 
std::unique_ptr
< TrackingRegionProducer
theRegionProducer
 

Private Attributes

SeedingTree< TrackingLayer_seedingTree
 
const reco::BeamSpotbeamSpot
 
bool hitMasks_exists
 
edm::EDGetTokenT< std::vector
< bool > > 
hitMasksToken
 
const MagneticFieldmagneticField
 
const MagneticFieldMapmagneticFieldMap
 
unsigned int minLayersCrossed
 
double nSigmaZ
 
double originHalfLength
 
double originRadius
 
const reco::VertexCollectionprimaryVertices
 
double ptMin
 
edm::EDGetTokenT
< FastTrackerRecHitCombinationCollection
recHitCombinationsToken
 
std::unique_ptr< SeedCreatorseedCreator
 
std::vector< std::vector
< TrackingLayer > > 
seedingLayers
 
double simTrack_maxD0
 
double simTrack_maxZ0
 
double simTrack_pTMin
 
bool testBeamspotCompatibility
 
bool testPrimaryVertexCompatibility
 
std::shared_ptr
< PropagatorWithMaterial
thePropagator
 
const TrackerGeometrytrackerGeometry
 
const TrackerTopologytrackerTopology
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 35 of file TrajectorySeedProducer.h.

Member Typedef Documentation

typedef std::vector<std::unique_ptr<TrackingRegion> > TrajectorySeedProducer::Regions

Definition at line 192 of file TrajectorySeedProducer.h.

Constructor & Destructor Documentation

TrajectorySeedProducer::TrajectorySeedProducer ( const edm::ParameterSet conf)

Definition at line 49 of file TrajectorySeedProducer.cc.

References _seedingTree, edm::EDConsumerBase::consumesCollector(), SurfaceDeformationFactory::create(), TrackingLayer::createFromString(), edm::ParameterSet::exists(), reco::get(), edm::ParameterSet::getParameter(), hitMasks_exists, hitMasksToken, SeedingTree< DATA >::insert(), geometryCSVtoXML::line, measurementTrackerEventToken, minLayersCrossed, eostools::move(), recHitCombinationsToken, seedCreator, seedingLayers, AlCaHLTBitMon_QueryRunRegistry::string, and theRegionProducer.

49  :
50  magneticField(nullptr),
51  magneticFieldMap(nullptr),
52  trackerGeometry(nullptr),
53  trackerTopology(nullptr),
54  theRegionProducer(nullptr)
55 {
56 
57  produces<TrajectorySeedCollection>();
58 
59  // tokens
60  recHitCombinationsToken = consumes<FastTrackerRecHitCombinationCollection>(conf.getParameter<edm::InputTag>("recHitCombinations"));
61  measurementTrackerEventToken = consumes<MeasurementTrackerEvent>(conf.getParameter<edm::InputTag>("MeasurementTrackerEvent"));
62  hitMasks_exists = conf.exists("hitMasks");
63  if (hitMasks_exists){
64  edm::InputTag hitMasksTag = conf.getParameter<edm::InputTag>("hitMasks");
65  hitMasksToken = consumes<std::vector<bool> >(hitMasksTag);
66  }
67 
68  // The smallest number of hits for a track candidate
69  minLayersCrossed = conf.getParameter<unsigned int>("minLayersCrossed");
70 
71  // read Layers
72  std::vector<std::string> layerStringList = conf.getParameter<std::vector<std::string>>("layerList");
73  for(auto it=layerStringList.cbegin(); it < layerStringList.cend(); ++it)
74  {
75  std::vector<TrackingLayer> trackingLayerList;
76  std::string line = *it;
78  while (pos != std::string::npos)
79  {
80  pos=line.find("+");
81  std::string layer = line.substr(0, pos);
83 
84  trackingLayerList.push_back(layerSpec);
85  line=line.substr(pos+1,std::string::npos);
86  }
87  _seedingTree.insert(trackingLayerList);
88  seedingLayers.push_back(std::move(trackingLayerList));
89  }
90 
91  // region producer
92  if(conf.exists("RegionFactoryPSet")){
93  edm::ParameterSet regfactoryPSet = conf.getParameter<edm::ParameterSet>("RegionFactoryPSet");
94  std::string regfactoryName = regfactoryPSet.getParameter<std::string>("ComponentName");
95  theRegionProducer.reset(TrackingRegionProducerFactory::get()->create(regfactoryName,regfactoryPSet, consumesCollector()));
96 
97  // seed creator
98  const edm::ParameterSet & seedCreatorPSet = conf.getParameter<edm::ParameterSet>("SeedCreatorPSet");
99  std::string seedCreatorName = seedCreatorPSet.getParameter<std::string>("ComponentName");
100  seedCreator.reset(SeedCreatorFactory::get()->create( seedCreatorName, seedCreatorPSet));
101  }
102 }
T getParameter(std::string const &) const
const MagneticField * magneticField
std::unique_ptr< TrackingRegionProducer > theRegionProducer
edm::EDGetTokenT< std::vector< bool > > hitMasksToken
bool exists(std::string const &parameterName) const
checks if a parameter exists
uint16_t size_type
bool insert(const std::vector< DATA > &dataList)
Definition: SeedingTree.h:179
const TrackerTopology * trackerTopology
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
def move
Definition: eostools.py:510
static TrackingLayer createFromString(std::string layerSpecification)
std::vector< std::vector< TrackingLayer > > seedingLayers
edm::EDGetTokenT< FastTrackerRecHitCombinationCollection > recHitCombinationsToken
edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerEventToken
const TrackerGeometry * trackerGeometry
SeedingTree< TrackingLayer > _seedingTree
std::unique_ptr< SeedCreator > seedCreator
SurfaceDeformation * create(int type, const std::vector< double > &params)
const MagneticFieldMap * magneticFieldMap
T get(const Candidate &c)
Definition: component.h:55
virtual TrajectorySeedProducer::~TrajectorySeedProducer ( )
inlinevirtual

Definition at line 70 of file TrajectorySeedProducer.h.

71  {
72  }

Member Function Documentation

bool TrajectorySeedProducer::compatibleWithBeamSpot ( const GlobalPoint gpos1,
const GlobalPoint gpos2,
double  error,
bool  forward 
) const

Check that the seed is compatible with a track coming from within a cylinder of radius originRadius, with a decent pT.

bool TrajectorySeedProducer::compatibleWithPrimaryVertex ( const GlobalPoint gpos1,
const GlobalPoint gpos2,
double  error,
bool  forward 
) const

Check that the seed is compatible with a track coming from within a cylinder of radius originRadius, with a decent pT.

const SeedingNode< TrackingLayer > * TrajectorySeedProducer::insertHit ( const std::vector< TrajectorySeedHitCandidate > &  trackerRecHits,
std::vector< int > &  hitIndicesInTree,
const SeedingNode< TrackingLayer > *  node,
unsigned int  trackerHit 
) const

Definition at line 133 of file TrajectorySeedProducer.cc.

References SeedingNode< DATA >::getChild(), SeedingNode< DATA >::getChildrenSize(), SeedingNode< DATA >::getData(), SeedingNode< DATA >::getIndex(), SeedingNode< DATA >::getParent(), isHitOnLayer(), passHitTuplesCuts(), and fileCollector::seed.

Referenced by iterateHits().

138 {
139  if (!node->getParent() || hitIndicesInTree[node->getParent()->getIndex()]>=0)
140  {
141  if (hitIndicesInTree[node->getIndex()]<0)
142  {
143  const TrajectorySeedHitCandidate& currentTrackerHit = trackerRecHits[trackerHit];
144  if (!isHitOnLayer(currentTrackerHit,node->getData()))
145  {
146  return nullptr;
147  }
148  if (!passHitTuplesCuts(*node,trackerRecHits,hitIndicesInTree,currentTrackerHit))
149  {
150  return nullptr;
151  }
152  hitIndicesInTree[node->getIndex()]=trackerHit;
153  if (node->getChildrenSize()==0)
154  {
155  return node;
156  }
157  return nullptr;
158  }
159  else
160  {
161  for (unsigned int ichild = 0; ichild<node->getChildrenSize(); ++ichild)
162  {
163  const SeedingNode<TrackingLayer>* seed = insertHit(trackerRecHits,hitIndicesInTree,node->getChild(ichild),trackerHit);
164  if (seed)
165  {
166  return seed;
167  }
168  }
169  }
170  }
171  return nullptr;
172 }
bool passHitTuplesCuts(const SeedingNode< TrackingLayer > &seedingNode, const std::vector< TrajectorySeedHitCandidate > &trackerRecHits, const std::vector< int > &hitIndicesInTree, const TrajectorySeedHitCandidate &currentTrackerHit) const
method checks if a SimTrack fulfills the quality requirements.
const DATA & getData() const
Definition: SeedingTree.h:136
unsigned int getChildrenSize() const
Definition: SeedingTree.h:121
const SeedingNode * getParent() const
Definition: SeedingTree.h:112
bool isHitOnLayer(const TrajectorySeedHitCandidate &trackerRecHit, const TrackingLayer &layer) const
const SeedingNode< TrackingLayer > * insertHit(const std::vector< TrajectorySeedHitCandidate > &trackerRecHits, std::vector< int > &hitIndicesInTree, const SeedingNode< TrackingLayer > *node, unsigned int trackerHit) const
unsigned int getIndex() const
Definition: SeedingTree.h:107
const SeedingNode< DATA > * getChild(unsigned int ichild) const
Definition: SeedingTree.h:126
bool TrajectorySeedProducer::isHitOnLayer ( const TrajectorySeedHitCandidate trackerRecHit,
const TrackingLayer layer 
) const
inline

Definition at line 152 of file TrajectorySeedProducer.h.

References TrajectorySeedHitCandidate::getTrackingLayer().

Referenced by insertHit().

153  {
154  return layer==trackerRecHit.getTrackingLayer();
155  }
const TrackingLayer & getTrackingLayer() const
std::vector< unsigned int > TrajectorySeedProducer::iterateHits ( unsigned int  start,
const std::vector< TrajectorySeedHitCandidate > &  trackerRecHits,
std::vector< int >  hitIndicesInTree,
bool  processSkippedHits 
) const
virtual

method tries to insert all hits into the tree structure.

Parameters
startindex where to begin insertion. Important for recursion.
trackerRecHitslist of all TrackerRecHits.
hitIndicesInTreehit indices which translates the tree node to the hits in trackerRecHits.
currentTrackerHithit which is tested.
Returns
list of hit indices which form a found seed. Returns empty list if no seed was found.

Definition at line 175 of file TrajectorySeedProducer.cc.

References _seedingTree, SeedingNode< DATA >::getDepth(), SeedingNode< DATA >::getIndex(), SeedingNode< DATA >::getParent(), SeedingTree< DATA >::getRoot(), insertHit(), and SeedingTree< DATA >::numberOfRoots().

Referenced by produce().

181 {
182  for (unsigned int irecHit = start; irecHit<trackerRecHits.size(); ++irecHit)
183  {
184  unsigned int currentHitIndex=irecHit;
185 
186  for (unsigned int inext=currentHitIndex+1; inext< trackerRecHits.size(); ++inext)
187  {
188  //if multiple hits are on the same layer -> follow all possibilities by recusion
189  if (trackerRecHits[currentHitIndex].getTrackingLayer()==trackerRecHits[inext].getTrackingLayer())
190  {
191  if (processSkippedHits)
192  {
193  //recusively call the method again with hit 'inext' but skip all following on the same layer though 'processSkippedHits=false'
194  std::vector<unsigned int> seedHits = iterateHits(
195  inext,
196  trackerRecHits,
197  hitIndicesInTree,
198  false
199  );
200  if (seedHits.size()>0)
201  {
202  return seedHits;
203  }
204  }
205  irecHit+=1;
206  }
207  else
208  {
209  break;
210  }
211  }
212 
213  processSkippedHits=true;
214 
215  const SeedingNode<TrackingLayer>* seedNode = nullptr;
216  for (unsigned int iroot=0; seedNode==nullptr && iroot<_seedingTree.numberOfRoots(); ++iroot)
217  {
218  seedNode=insertHit(trackerRecHits,hitIndicesInTree,_seedingTree.getRoot(iroot), currentHitIndex);
219  }
220  if (seedNode)
221  {
222  std::vector<unsigned int> seedIndices(seedNode->getDepth()+1);
223  while (seedNode)
224  {
225  seedIndices[seedNode->getDepth()]=hitIndicesInTree[seedNode->getIndex()];
226  seedNode=seedNode->getParent();
227  }
228  return seedIndices;
229  }
230 
231  }
232 
233  return std::vector<unsigned int>();
234 
235 }
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
unsigned int getDepth() const
Definition: SeedingTree.h:84
const SeedingNode * getParent() const
Definition: SeedingTree.h:112
unsigned int numberOfRoots() const
Definition: SeedingTree.h:222
virtual std::vector< unsigned int > iterateHits(unsigned int start, const std::vector< TrajectorySeedHitCandidate > &trackerRecHits, std::vector< int > hitIndicesInTree, bool processSkippedHits) const
method tries to insert all hits into the tree structure.
const SeedingNode< DATA > * getRoot(unsigned int i) const
Definition: SeedingTree.h:232
const SeedingNode< TrackingLayer > * insertHit(const std::vector< TrajectorySeedHitCandidate > &trackerRecHits, std::vector< int > &hitIndicesInTree, const SeedingNode< TrackingLayer > *node, unsigned int trackerHit) const
unsigned int getIndex() const
Definition: SeedingTree.h:107
SeedingTree< TrackingLayer > _seedingTree
bool TrajectorySeedProducer::pass2HitsCuts ( const TrajectorySeedHitCandidate hit1,
const TrajectorySeedHitCandidate hit2 
) const

Definition at line 105 of file TrajectorySeedProducer.cc.

References TrackingRecHit::det(), GeometricSearchTracker::detLayer(), HitPairGeneratorFromLayerPair::doublets(), es_, GeomDet::geographicalId(), MeasurementTracker::geometricSearchTracker(), TrajectorySeedHitCandidate::hit(), MeasurementTrackerEvent::measurementTracker(), measurementTrackerEvent, regions, query::result, and seedCreator.

Referenced by passHitTuplesCuts().

106 {
107  const DetLayer * innerLayer =
108  measurementTrackerEvent->measurementTracker().geometricSearchTracker()->detLayer(innerHit.hit()->det()->geographicalId());
109  const DetLayer * outerLayer =
110  measurementTrackerEvent->measurementTracker().geometricSearchTracker()->detLayer(outerHit.hit()->det()->geographicalId());
111  std::vector<BaseTrackerRecHit const *> innerHits(1,(const BaseTrackerRecHit*) innerHit.hit());
112  std::vector<BaseTrackerRecHit const *> outerHits(1,(const BaseTrackerRecHit*) outerHit.hit());
113  for(Regions::const_iterator ir=regions.begin(); ir < regions.end(); ++ir){
114 
115  const RecHitsSortedInPhi* ihm=new RecHitsSortedInPhi (innerHits, (**ir).origin(), innerLayer);
116 
117  const RecHitsSortedInPhi* ohm=new RecHitsSortedInPhi (outerHits, (**ir).origin(), outerLayer);
118 
119  HitDoublets result(*ihm,*ohm);
120 
121  HitPairGeneratorFromLayerPair::doublets(**ir,*innerLayer,*outerLayer,*ihm,*ohm,*es_,0,result);
122 
123  if(result.size()!=0){
124  seedCreator->init(**ir,*es_,0);
125  return true; }
126 
127  }
128 
129  return false;
130 }
const edm::EventSetup * es_
tuple result
Definition: query.py:137
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() const
const MeasurementTrackerEvent * measurementTrackerEvent
const GeometricSearchTracker * geometricSearchTracker() const
std::unique_ptr< SeedCreator > seedCreator
bool TrajectorySeedProducer::passHitTuplesCuts ( const SeedingNode< TrackingLayer > &  seedingNode,
const std::vector< TrajectorySeedHitCandidate > &  trackerRecHits,
const std::vector< int > &  hitIndicesInTree,
const TrajectorySeedHitCandidate currentTrackerHit 
) const
inline

method checks if a SimTrack fulfills the quality requirements.

Parameters
theSimTrackthe SimTrack to be tested.
theSimVertexthe associated SimVertex of the SimTrack.
Returns
true if a track fulfills the requirements.method checks if a TrajectorySeedHitCandidate fulfills the quality requirements.
Parameters
seedingNodetree node at which the hit will be inserted.
trackerRecHitslist of all TrackerRecHits.
hitIndicesInTreehit indices which translates the tree node to the hits in trackerRecHits.
currentTrackerHithit which is tested.
Returns
true if a hit fulfills the requirements.

Definition at line 91 of file TrajectorySeedProducer.h.

References SeedingNode< DATA >::getDepth(), SeedingNode< DATA >::getIndex(), SeedingNode< DATA >::getParent(), and pass2HitsCuts().

Referenced by insertHit().

97  {
98  switch (seedingNode.getDepth())
99  {
100  case 0:
101  {
102  return true;
103  /* example for 1 hits
104  const TrajectorySeedHitCandidate& hit1 = currentTrackerHit;
105  return pass1HitsCuts(hit1,trackingAlgorithmId);
106  */
107  }
108 
109  case 1:
110  {
111  const SeedingNode<TrackingLayer>* parentNode = &seedingNode;
112  parentNode = parentNode->getParent();
113  const TrajectorySeedHitCandidate& hit1 = trackerRecHits[hitIndicesInTree[parentNode->getIndex()]];
114  const TrajectorySeedHitCandidate& hit2 = currentTrackerHit;
115 
116  return pass2HitsCuts(hit1,hit2);
117  }
118  case 2:
119  {
120  return true;
121  /* example for 3 hits
122  const SeedingNode<LayerSpec>* parentNode = &seedingNode;
123  parentNode = parentNode->getParent();
124  const TrajectorySeedHitCandidate& hit2 = trackerRecHits[hitIndicesInTree[parentNode->getIndex()]];
125  parentNode = parentNode->getParent();
126  const TrajectorySeedHitCandidate& hit1 = trackerRecHits[hitIndicesInTree[parentNode->getIndex()]];
127  const TrajectorySeedHitCandidate& hit3 = currentTrackerHit;
128  return pass3HitsCuts(hit1,hit2,hit3,trackingAlgorithmId);
129  */
130  }
131  }
132  return true;
133  }
unsigned int getDepth() const
Definition: SeedingTree.h:84
const SeedingNode * getParent() const
Definition: SeedingTree.h:112
bool pass2HitsCuts(const TrajectorySeedHitCandidate &hit1, const TrajectorySeedHitCandidate &hit2) const
unsigned int getIndex() const
Definition: SeedingTree.h:107
void TrajectorySeedProducer::produce ( edm::Event e,
const edm::EventSetup es 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 238 of file TrajectorySeedProducer.cc.

References _seedingTree, clone(), es_, edm::EventSetup::get(), edm::Event::getByToken(), SeedingTree< DATA >::getSingleSet(), TrajectorySeedHitCandidate::getTrackingLayer(), hitMasks_exists, hitMasksToken, TrajectorySeedHitCandidate::isOnTheSameLayer(), iterateHits(), magneticField, magneticFieldMap, measurementTrackerEvent, measurementTrackerEventToken, minLayersCrossed, eostools::move(), SeedingTree< DATA >::numberOfNodes(), convertSQLitetoXML_cfg::output, edm::Handle< T >::product(), edm::OwnVector< T, P >::push_back(), edm::Event::put(), recHitCombinationsToken, regions, seedCreator, fastTrackingHelper::setRecHitCombinationIndex(), edm::OwnVector< T, P >::size(), theRegionProducer, trackerGeometry, and trackerTopology.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

239 {
240 
241  // services
242  edm::ESHandle<MagneticField> magneticFieldHandle;
243  edm::ESHandle<TrackerGeometry> trackerGeometryHandle;
244  edm::ESHandle<MagneticFieldMap> magneticFieldMapHandle;
245  edm::ESHandle<TrackerTopology> trackerTopologyHandle;
246 
247  es.get<IdealMagneticFieldRecord>().get(magneticFieldHandle);
248  es.get<TrackerDigiGeometryRecord>().get(trackerGeometryHandle);
249  es.get<MagneticFieldMapRecord>().get(magneticFieldMapHandle);
250  es.get<TrackerTopologyRcd>().get(trackerTopologyHandle);
251 
252  magneticField = &(*magneticFieldHandle);
253  trackerGeometry = &(*trackerGeometryHandle);
254  magneticFieldMap = &(*magneticFieldMapHandle);
255  trackerTopology = &(*trackerTopologyHandle);
256 
257  es_ = &es;
258 
259  // hit masks
260  std::unique_ptr<HitMaskHelper> hitMaskHelper;
261  if (hitMasks_exists){
263  e.getByToken(hitMasksToken,hitMasks);
264  hitMaskHelper.reset(new HitMaskHelper(hitMasks.product()));
265  }
266 
267  // hit combinations
269  e.getByToken(recHitCombinationsToken, recHitCombinations);
270 
271  // measurement tracker event (only used to access services)
272  edm::Handle<MeasurementTrackerEvent> measurementTrackerEventHandle;
273  e.getByToken(measurementTrackerEventToken,measurementTrackerEventHandle);
274  measurementTrackerEvent = measurementTrackerEventHandle.product();
275 
276  // output
277  std::unique_ptr<TrajectorySeedCollection> output(new TrajectorySeedCollection());
278 
279  // produce the regions;
280  if(!theRegionProducer){
281  edm::LogWarning("TrajectorySeedProducer") << " RegionFactory is not initialised properly, please check your configuration. Producing empty seed collection" << std::endl;
282  e.put(std::move(output));
283  return;
284  }
285 
286  regions = theRegionProducer->regions(e,es);
287 
288 
289  for ( unsigned icomb=0; icomb<recHitCombinations->size(); ++icomb)
290  {
291 
292 
293  FastTrackerRecHitCombination recHitCombination = (*recHitCombinations)[icomb];
294 
295  TrajectorySeedHitCandidate previousTrackerHit;
296  TrajectorySeedHitCandidate currentTrackerHit;
297  unsigned int layersCrossed=0;
298 
299 
300  std::vector<TrajectorySeedHitCandidate> trackerRecHits;
301  for (const auto & _hit : recHitCombination )
302  {
303  // skip masked hits
304  if(hitMaskHelper && hitMaskHelper->mask(_hit.get()))
305  continue;
306 
307  previousTrackerHit=currentTrackerHit;
308 
309  currentTrackerHit = TrajectorySeedHitCandidate(_hit.get(),trackerGeometry,trackerTopology);
310 
311  if (!currentTrackerHit.isOnTheSameLayer(previousTrackerHit))
312  {
313  ++layersCrossed;
314  }
315  if (_seedingTree.getSingleSet().find(currentTrackerHit.getTrackingLayer())!=_seedingTree.getSingleSet().end())
316  {
317  //add only the hits which are actually on the requested layers
318  trackerRecHits.push_back(std::move(currentTrackerHit));
319  }
320  }
321 
322  if ( layersCrossed < minLayersCrossed)
323  {
324  continue;
325  }
326 
327  // set the combination index
328 
329  //A SeedingNode is associated by its index to this list. The list stores the indices of the hits in 'trackerRecHits'
330  /* example
331  SeedingNode | hit index | hit
332  -------------------------------------------------------------------------------
333  index= 0: [BPix1] | hitIndicesInTree[0] (=1) | trackerRecHits[1]
334  index= 1: -- [BPix2] | hitIndicesInTree[1] (=3) | trackerRecHits[3]
335  index= 2: -- -- [BPix3] | hitIndicesInTree[2] (=4) | trackerRecHits[4]
336  index= 3: -- -- [FPix1_pos] | hitIndicesInTree[3] (=6) | trackerRecHits[6]
337  index= 4: -- -- [FPix1_neg] | hitIndicesInTree[4] (=7) | trackerRecHits[7]
338 
339  The implementation has been chosen such that the tree only needs to be build once upon construction.
340  */
341 
342  // find the first combination of hits,
343  // compatible with the seedinglayer,
344  // and with one of the tracking regions
345  std::vector<int> hitIndicesInTree(_seedingTree.numberOfNodes(),-1);
346  std::vector<unsigned int> seedHitNumbers = iterateHits(0,trackerRecHits,hitIndicesInTree,true);
347 
348  // create a seed from those hits
349  if (seedHitNumbers.size()>1){
350  // temporary hit copies to allow setting the recHitCombinationIndex
352  for(unsigned iIndex = 0;iIndex < seedHitNumbers.size();++iIndex){
353  seedHits.push_back(trackerRecHits[seedHitNumbers[iIndex]].hit()->clone());
354  }
356 
357  // the actual seed creation
358  seedCreator->makeSeed(*output,SeedingHitSet(&seedHits[0],&seedHits[1],
359  seedHits.size() >=3 ? &seedHits[2] : nullptr,
360  seedHits.size() >=4 ? &seedHits[3] : nullptr));
361  }
362  }
363  e.put(std::move(output));
364 
365 }
const MagneticField * magneticField
std::unique_ptr< TrackingRegionProducer > theRegionProducer
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
edm::EDGetTokenT< std::vector< bool > > hitMasksToken
const SingleSet & getSingleSet() const
Definition: SeedingTree.h:204
size_type size() const
Definition: OwnVector.h:264
unsigned int numberOfNodes() const
Definition: SeedingTree.h:227
void push_back(D *&d)
Definition: OwnVector.h:290
const TrackerTopology * trackerTopology
std::vector< TrajectorySeed > TrajectorySeedCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
const edm::EventSetup * es_
def move
Definition: eostools.py:510
virtual std::vector< unsigned int > iterateHits(unsigned int start, const std::vector< TrajectorySeedHitCandidate > &trackerRecHits, std::vector< int > hitIndicesInTree, bool processSkippedHits) const
method tries to insert all hits into the tree structure.
std::vector< FastTrackerRecHitRef > FastTrackerRecHitCombination
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:56
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
edm::EDGetTokenT< FastTrackerRecHitCombinationCollection > recHitCombinationsToken
const MeasurementTrackerEvent * measurementTrackerEvent
void setRecHitCombinationIndex(edm::OwnVector< T > &recHits, int32_t icomb)
edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrackerEventToken
const TrackerGeometry * trackerGeometry
const TrackingLayer & getTrackingLayer() const
SeedingTree< TrackingLayer > _seedingTree
bool isOnTheSameLayer(const TrajectorySeedHitCandidate &other) const
Check if two hits are on the same layer of the same subdetector.
std::unique_ptr< SeedCreator > seedCreator
const MagneticFieldMap * magneticFieldMap
bool TrajectorySeedProducer::testWithRegions ( const TrajectorySeedHitCandidate innerHit,
const TrajectorySeedHitCandidate outerHit 
) const

method inserts hit into the tree structure at an empty position.

Parameters
trackerRecHitslist of all TrackerRecHits.
hitIndicesInTreehit indices which translates the tree node to the hits in trackerRecHits. Empty positions are identified with '-1'.
nodewhere to look for an empty position. Important for recursive tree traversing (Breadth-first). Starts with the root.
trackerHithit which is tested.
Returns
pointer if this hit is inserted at a leaf which means that a seed has been found. Returns 'nullptr' otherwise.

Member Data Documentation

SeedingTree<TrackingLayer> TrajectorySeedProducer::_seedingTree
private

Definition at line 39 of file TrajectorySeedProducer.h.

Referenced by iterateHits(), produce(), and TrajectorySeedProducer().

const reco::BeamSpot* TrajectorySeedProducer::beamSpot
private

Definition at line 61 of file TrajectorySeedProducer.h.

const edm::EventSetup* TrajectorySeedProducer::es_

Definition at line 199 of file TrajectorySeedProducer.h.

Referenced by pass2HitsCuts(), and produce().

bool TrajectorySeedProducer::hitMasks_exists
private

Definition at line 59 of file TrajectorySeedProducer.h.

Referenced by produce(), and TrajectorySeedProducer().

edm::EDGetTokenT<std::vector<bool> > TrajectorySeedProducer::hitMasksToken
private

Definition at line 66 of file TrajectorySeedProducer.h.

Referenced by produce(), and TrajectorySeedProducer().

const MagneticField* TrajectorySeedProducer::magneticField
private

Definition at line 41 of file TrajectorySeedProducer.h.

Referenced by produce().

const MagneticFieldMap* TrajectorySeedProducer::magneticFieldMap
private

Definition at line 42 of file TrajectorySeedProducer.h.

Referenced by produce().

const MeasurementTrackerEvent* TrajectorySeedProducer::measurementTrackerEvent

Definition at line 198 of file TrajectorySeedProducer.h.

Referenced by pass2HitsCuts(), and produce().

edm::EDGetTokenT<MeasurementTrackerEvent> TrajectorySeedProducer::measurementTrackerEventToken

Definition at line 197 of file TrajectorySeedProducer.h.

Referenced by produce(), and TrajectorySeedProducer().

unsigned int TrajectorySeedProducer::minLayersCrossed
private

Definition at line 51 of file TrajectorySeedProducer.h.

Referenced by produce(), and TrajectorySeedProducer().

double TrajectorySeedProducer::nSigmaZ
private

Definition at line 57 of file TrajectorySeedProducer.h.

double TrajectorySeedProducer::originHalfLength
private

Definition at line 56 of file TrajectorySeedProducer.h.

double TrajectorySeedProducer::originRadius
private

Definition at line 54 of file TrajectorySeedProducer.h.

const reco::VertexCollection* TrajectorySeedProducer::primaryVertices
private

Definition at line 63 of file TrajectorySeedProducer.h.

double TrajectorySeedProducer::ptMin
private

Definition at line 55 of file TrajectorySeedProducer.h.

edm::EDGetTokenT<FastTrackerRecHitCombinationCollection> TrajectorySeedProducer::recHitCombinationsToken
private

Definition at line 65 of file TrajectorySeedProducer.h.

Referenced by produce(), and TrajectorySeedProducer().

Regions TrajectorySeedProducer::regions

Definition at line 193 of file TrajectorySeedProducer.h.

Referenced by pass2HitsCuts(), and produce().

std::unique_ptr<SeedCreator> TrajectorySeedProducer::seedCreator
private

Definition at line 50 of file TrajectorySeedProducer.h.

Referenced by pass2HitsCuts(), produce(), and TrajectorySeedProducer().

std::vector<std::vector<TrackingLayer> > TrajectorySeedProducer::seedingLayers
private

Definition at line 53 of file TrajectorySeedProducer.h.

Referenced by TrajectorySeedProducer().

double TrajectorySeedProducer::simTrack_maxD0
private

Definition at line 48 of file TrajectorySeedProducer.h.

double TrajectorySeedProducer::simTrack_maxZ0
private

Definition at line 49 of file TrajectorySeedProducer.h.

double TrajectorySeedProducer::simTrack_pTMin
private

Definition at line 47 of file TrajectorySeedProducer.h.

bool TrajectorySeedProducer::testBeamspotCompatibility
private

Definition at line 60 of file TrajectorySeedProducer.h.

bool TrajectorySeedProducer::testPrimaryVertexCompatibility
private

Definition at line 62 of file TrajectorySeedProducer.h.

std::shared_ptr<PropagatorWithMaterial> TrajectorySeedProducer::thePropagator
private

Definition at line 45 of file TrajectorySeedProducer.h.

std::unique_ptr<TrackingRegionProducer> TrajectorySeedProducer::theRegionProducer

Definition at line 196 of file TrajectorySeedProducer.h.

Referenced by produce(), and TrajectorySeedProducer().

const TrackerGeometry* TrajectorySeedProducer::trackerGeometry
private

Definition at line 43 of file TrajectorySeedProducer.h.

Referenced by produce().

const TrackerTopology* TrajectorySeedProducer::trackerTopology
private

Definition at line 44 of file TrajectorySeedProducer.h.

Referenced by produce().