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 (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 ()
 

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 36 of file TrajectorySeedProducer.h.

Member Typedef Documentation

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

Definition at line 197 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, 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.
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 74 of file TrajectorySeedProducer.h.

75  {
76  }

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 139 of file TrajectorySeedProducer.cc.

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

Referenced by iterateHits().

144 {
145  if (!node->getParent() || hitIndicesInTree[node->getParent()->getIndex()]>=0)
146  {
147  if (hitIndicesInTree[node->getIndex()]<0)
148  {
149  const TrajectorySeedHitCandidate& currentTrackerHit = trackerRecHits[trackerHit];
150  if (!isHitOnLayer(currentTrackerHit,node->getData()))
151  {
152  return nullptr;
153  }
154  if (!passHitTuplesCuts(*node,trackerRecHits,hitIndicesInTree,currentTrackerHit))
155  {
156  return nullptr;
157  }
158  hitIndicesInTree[node->getIndex()]=trackerHit;
159  if (node->getChildrenSize()==0)
160  {
161  return node;
162  }
163  return nullptr;
164  }
165  else
166  {
167  for (unsigned int ichild = 0; ichild<node->getChildrenSize(); ++ichild)
168  {
169  const SeedingNode<TrackingLayer>* seed = insertHit(trackerRecHits,hitIndicesInTree,node->getChild(ichild),trackerHit);
170  if (seed)
171  {
172  return seed;
173  }
174  }
175  }
176  }
177  return nullptr;
178 }
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
tuple node
Definition: Node.py:50
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 157 of file TrajectorySeedProducer.h.

References TrajectorySeedHitCandidate::getTrackingLayer().

Referenced by insertHit().

158  {
159  return layer==trackerRecHit.getTrackingLayer();
160  }
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 181 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().

187 {
188  for (unsigned int irecHit = start; irecHit<trackerRecHits.size(); ++irecHit)
189  {
190  unsigned int currentHitIndex=irecHit;
191 
192  for (unsigned int inext=currentHitIndex+1; inext< trackerRecHits.size(); ++inext)
193  {
194  //if multiple hits are on the same layer -> follow all possibilities by recusion
195  if (trackerRecHits[currentHitIndex].getTrackingLayer()==trackerRecHits[inext].getTrackingLayer())
196  {
197  if (processSkippedHits)
198  {
199  //recusively call the method again with hit 'inext' but skip all following on the same layer though 'processSkippedHits=false'
200  std::vector<unsigned int> seedHits = iterateHits(
201  inext,
202  trackerRecHits,
203  hitIndicesInTree,
204  false
205  );
206  if (seedHits.size()>0)
207  {
208  return seedHits;
209  }
210  }
211  irecHit+=1;
212  }
213  else
214  {
215  break;
216  }
217  }
218 
219  processSkippedHits=true;
220 
221  const SeedingNode<TrackingLayer>* seedNode = nullptr;
222  for (unsigned int iroot=0; seedNode==nullptr && iroot<_seedingTree.numberOfRoots(); ++iroot)
223  {
224  seedNode=insertHit(trackerRecHits,hitIndicesInTree,_seedingTree.getRoot(iroot), currentHitIndex);
225  }
226  if (seedNode)
227  {
228  std::vector<unsigned int> seedIndices(seedNode->getDepth()+1);
229  while (seedNode)
230  {
231  seedIndices[seedNode->getDepth()]=hitIndicesInTree[seedNode->getIndex()];
232  seedNode=seedNode->getParent();
233  }
234  return seedIndices;
235  }
236 
237  }
238 
239  return std::vector<unsigned int>();
240 
241 }
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 constexpr, TrackingRecHit::det(), GeometricSearchTracker::detLayer(), es_, GeomDet::geographicalId(), MeasurementTracker::geometricSearchTracker(), BaseTrackerRecHit::globalState(), TrajectorySeedHitCandidate::hit(), DetLayer::isBarrel(), MeasurementTrackerEvent::measurementTracker(), measurementTrackerEvent, nSigmaRZ, TrackingRecHitGlobalState::position, GeometricSearchDet::position(), HitRZCompatibility::range(), regions, seedCreator, findQualityFiles::v, and PV3DBase< T, PVType, FrameType >::z().

Referenced by passHitTuplesCuts().

106 {
107 
108  const DetLayer * innerLayer =
109  measurementTrackerEvent->measurementTracker().geometricSearchTracker()->detLayer(innerHit.hit()->det()->geographicalId());
110  const DetLayer * outerLayer =
111  measurementTrackerEvent->measurementTracker().geometricSearchTracker()->detLayer(outerHit.hit()->det()->geographicalId());
112 
114 
115  for(Regions::const_iterator ir=regions.begin(); ir < regions.end(); ++ir){
116 
117  auto const & gs = outerHit.hit()->globalState();
118  auto loc = gs.position-(*ir)->origin().basicVector();
119  const HitRZCompatibility * checkRZ = (*ir)->checkRZ(innerLayer, outerHit.hit(), *es_, outerLayer,
120  loc.perp(),gs.position.z(),gs.errorR,gs.errorZ);
121 
122  float u = innerLayer->isBarrel() ? loc.perp() : gs.position.z();
123  float v = innerLayer->isBarrel() ? gs.position.z() : loc.perp();
124  float dv = innerLayer->isBarrel() ? gs.errorZ : gs.errorR;
125  constexpr float nSigmaRZ = 3.46410161514f;
126  Range allowed = checkRZ->range(u);
127  float vErr = nSigmaRZ * dv;
128  Range hitRZ(v-vErr, v+vErr);
129  Range crossRange = allowed.intersection(hitRZ);
130 
131  if( ! crossRange.empty()){
132  seedCreator->init(**ir,*es_,0);
133  return true;}
134 
135  }
136  return false;
137 }
virtual Range range(const float &rORz) const =0
#define constexpr
const edm::EventSetup * es_
T z() const
Definition: PV3DBase.h:64
const DetLayer * detLayer(const DetId &id) const
obsolete method. Use idToLayer() instead.
const MeasurementTracker & measurementTracker() const
bool isBarrel() const
Definition: DetLayer.h:32
PixelRecoRange< float > Range
virtual const Surface::PositionType & position() const
Returns position of the surface.
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 96 of file TrajectorySeedProducer.h.

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

Referenced by insertHit().

102  {
103  switch (seedingNode.getDepth())
104  {
105  case 0:
106  {
107  return true;
108  /* example for 1 hits
109  const TrajectorySeedHitCandidate& hit1 = currentTrackerHit;
110  return pass1HitsCuts(hit1,trackingAlgorithmId);
111  */
112  }
113 
114  case 1:
115  {
116  const SeedingNode<TrackingLayer>* parentNode = &seedingNode;
117  parentNode = parentNode->getParent();
118  const TrajectorySeedHitCandidate& hit1 = trackerRecHits[hitIndicesInTree[parentNode->getIndex()]];
119  const TrajectorySeedHitCandidate& hit2 = currentTrackerHit;
120 
121  return pass2HitsCuts(hit1,hit2);
122  }
123  case 2:
124  {
125  return true;
126  /* example for 3 hits
127  const SeedingNode<LayerSpec>* parentNode = &seedingNode;
128  parentNode = parentNode->getParent();
129  const TrajectorySeedHitCandidate& hit2 = trackerRecHits[hitIndicesInTree[parentNode->getIndex()]];
130  parentNode = parentNode->getParent();
131  const TrajectorySeedHitCandidate& hit1 = trackerRecHits[hitIndicesInTree[parentNode->getIndex()]];
132  const TrajectorySeedHitCandidate& hit3 = currentTrackerHit;
133  return pass3HitsCuts(hit1,hit2,hit3,trackingAlgorithmId);
134  */
135  }
136  }
137  return true;
138  }
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 244 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, 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().

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

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

const reco::BeamSpot* TrajectorySeedProducer::beamSpot
private

Definition at line 64 of file TrajectorySeedProducer.h.

const edm::EventSetup* TrajectorySeedProducer::es_

Definition at line 204 of file TrajectorySeedProducer.h.

Referenced by pass2HitsCuts(), and produce().

bool TrajectorySeedProducer::hitMasks_exists
private

Definition at line 62 of file TrajectorySeedProducer.h.

Referenced by produce(), and TrajectorySeedProducer().

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

Definition at line 69 of file TrajectorySeedProducer.h.

Referenced by produce(), and TrajectorySeedProducer().

const MagneticField* TrajectorySeedProducer::magneticField
private

Definition at line 42 of file TrajectorySeedProducer.h.

Referenced by produce().

const MagneticFieldMap* TrajectorySeedProducer::magneticFieldMap
private

Definition at line 43 of file TrajectorySeedProducer.h.

Referenced by produce().

const MeasurementTrackerEvent* TrajectorySeedProducer::measurementTrackerEvent

Definition at line 203 of file TrajectorySeedProducer.h.

Referenced by pass2HitsCuts(), and produce().

edm::EDGetTokenT<MeasurementTrackerEvent> TrajectorySeedProducer::measurementTrackerEventToken

Definition at line 202 of file TrajectorySeedProducer.h.

Referenced by produce(), and TrajectorySeedProducer().

unsigned int TrajectorySeedProducer::minLayersCrossed
private

Definition at line 53 of file TrajectorySeedProducer.h.

Referenced by produce(), and TrajectorySeedProducer().

double TrajectorySeedProducer::nSigmaZ
private

Definition at line 60 of file TrajectorySeedProducer.h.

double TrajectorySeedProducer::originHalfLength
private

Definition at line 59 of file TrajectorySeedProducer.h.

double TrajectorySeedProducer::originRadius
private

Definition at line 57 of file TrajectorySeedProducer.h.

const reco::VertexCollection* TrajectorySeedProducer::primaryVertices
private

Definition at line 66 of file TrajectorySeedProducer.h.

double TrajectorySeedProducer::ptMin
private

Definition at line 58 of file TrajectorySeedProducer.h.

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

Definition at line 68 of file TrajectorySeedProducer.h.

Referenced by produce(), and TrajectorySeedProducer().

Regions TrajectorySeedProducer::regions

Definition at line 198 of file TrajectorySeedProducer.h.

Referenced by pass2HitsCuts(), and produce().

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

Definition at line 52 of file TrajectorySeedProducer.h.

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

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

Definition at line 55 of file TrajectorySeedProducer.h.

Referenced by TrajectorySeedProducer().

double TrajectorySeedProducer::simTrack_maxD0
private

Definition at line 50 of file TrajectorySeedProducer.h.

double TrajectorySeedProducer::simTrack_maxZ0
private

Definition at line 51 of file TrajectorySeedProducer.h.

double TrajectorySeedProducer::simTrack_pTMin
private

Definition at line 49 of file TrajectorySeedProducer.h.

bool TrajectorySeedProducer::testBeamspotCompatibility
private

Definition at line 63 of file TrajectorySeedProducer.h.

bool TrajectorySeedProducer::testPrimaryVertexCompatibility
private

Definition at line 65 of file TrajectorySeedProducer.h.

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

Definition at line 47 of file TrajectorySeedProducer.h.

std::unique_ptr<TrackingRegionProducer> TrajectorySeedProducer::theRegionProducer

Definition at line 201 of file TrajectorySeedProducer.h.

Referenced by produce(), and TrajectorySeedProducer().

const TrackerGeometry* TrajectorySeedProducer::trackerGeometry
private

Definition at line 44 of file TrajectorySeedProducer.h.

Referenced by produce().

const TrackerTopology* TrajectorySeedProducer::trackerTopology
private

Definition at line 45 of file TrajectorySeedProducer.h.

Referenced by produce().