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
QuadrupletSeedMerger Class Reference

#include <QuadrupletSeedMerger.h>

Public Member Functions

std::pair< double, double > calculatePhiEta (SeedingHitSet const &) const
 
const OrderedSeedingHitsmergeTriplets (const OrderedSeedingHits &, const edm::EventSetup &)
 
const TrajectorySeedCollection mergeTriplets (const TrajectorySeedCollection &, const TrackingRegion &, const edm::EventSetup &, const edm::ParameterSet &)
 
void printHit (const TrackingRecHit *) const
 
void printHit (const TransientTrackingRecHit::ConstRecHitPointer &) const
 
void printNtuplet (const SeedingHitSet &) const
 
 QuadrupletSeedMerger (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
void setAddRemainingTriplets (bool)
 
void setMergeTriplets (bool)
 
void setTTRHBuilderLabel (std::string)
 
void update (const edm::EventSetup &)
 
 ~QuadrupletSeedMerger ()
 

Private Types

typedef std::array
< TransientTrackingRecHit::ConstRecHitPointer, 4 > 
QuadrupletHits
 

Private Member Functions

bool isValidQuadruplet (const QuadrupletHits &quadruplet, const std::vector< SeedMergerPixelLayer > &layers, const TrackerTopology *tTopo) const
 
void mySort (QuadrupletHits &unsortedHits)
 

Private Attributes

bool isAddRemainingTriplets_
 
bool isMergeTriplets_
 
OrderedHitSeeds quads_
 
SeedingLayerSetsBuilder theLayerBuilder_
 
ctfseeding::SeedingLayerSets theLayerSets_
 
edm::ESHandle< TrackerGeometrytheTrackerGeometry_
 
edm::ESHandle
< TransientTrackingRecHitBuilder
theTTRHBuilder_
 
std::string theTTRHBuilderLabel_
 

Detailed Description

merge triplets into quadruplets

Definition at line 78 of file QuadrupletSeedMerger.h.

Member Typedef Documentation

Definition at line 98 of file QuadrupletSeedMerger.h.

Constructor & Destructor Documentation

QuadrupletSeedMerger::QuadrupletSeedMerger ( const edm::ParameterSet iConfig,
edm::ConsumesCollector iC 
)
explicit

Definition at line 66 of file QuadrupletSeedMerger.cc.

References isAddRemainingTriplets_, and isMergeTriplets_.

66  :
67  theLayerBuilder_(iConfig, iC)
68  {
69 
70  // by default, do not..
71  // ..merge triplets
72  isMergeTriplets_ = false;
73  // ..add remaining triplets
75 }
SeedingLayerSetsBuilder theLayerBuilder_
QuadrupletSeedMerger::~QuadrupletSeedMerger ( )

Definition at line 85 of file QuadrupletSeedMerger.cc.

85  {
86 
87 }

Member Function Documentation

std::pair< double, double > QuadrupletSeedMerger::calculatePhiEta ( SeedingHitSet const &  nTuplet) const

Definition at line 479 of file QuadrupletSeedMerger.cc.

References eta(), p1, p2, phi, funct::sqr(), mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by mergeTriplets().

479  {
480 
481 // if( nTuplet.size() < 3 ) {
482 // std::cerr << " [QuadrupletSeedMerger::calculatePhiEta] ** ERROR: nTuplet has less than 3 hits" << std::endl;
483 // throw; // tbr.
484 // }
485 
486  GlobalPoint p1 = nTuplet[0]->globalPosition();
487  GlobalPoint p2 = nTuplet[1]->globalPosition();
488 
489  const double x1 = p1.x();
490  const double x2 = p2.x();
491  const double y1 = p1.y();
492  const double y2 = p2.y();
493  const double z1 = p1.z();
494  const double z2 = p2.z();
495 
496  const double phi = atan2( x2 - x1, y2 -y1 );
497  const double eta = acos( (z2 - z1) / sqrt( sqr( x2 - x1 ) + sqr( y2 - y1 ) + sqr( z2 - z1 ) ) ); // this is theta angle in reality
498 
499  std::pair<double,double> retVal;
500  retVal=std::make_pair (phi,eta);
501  return retVal;
502  //return std::make_pair<double,double>( phi, eta );
503 
504 }
T y() const
Definition: PV3DBase.h:63
T eta() const
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
Square< F >::type sqr(const F &f)
Definition: Square.h:13
T x() const
Definition: PV3DBase.h:62
Definition: DDAxes.h:10
bool QuadrupletSeedMerger::isValidQuadruplet ( const QuadrupletHits quadruplet,
const std::vector< SeedMergerPixelLayer > &  layers,
const TrackerTopology tTopo 
) const
private

check for validity of a (radius-) sorted quadruplet:

  1. after sorting, hits must be on layers according to the order given in PixelSeedMergerQuadruplets (from cfg)

Definition at line 610 of file QuadrupletSeedMerger.cc.

References gather_cfg::cout, and getHLTprescales::index.

Referenced by mergeTriplets().

610  {
611 
612  const unsigned int quadrupletSize = quadruplet.size();
613 
614  // basic size test..
615  if( quadrupletSize != layers.size() ) {
616  std::cout << " [QuadrupletSeedMerger::isValidQuadruplet] ** WARNING: size mismatch: "
617  << quadrupletSize << "/" << layers.size() << std::endl;
618  return false;
619  }
620 
621  // go along layers and check if all (parallel) quadruplet hits match
622  for( unsigned int index = 0; index < quadrupletSize; ++index ) {
623  if( ! layers[index].isContainsDetector( quadruplet[index]->geographicalId(), tTopo ) ) {
624  return false;
625  }
626  }
627 
628  return true;
629 
630 }
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
tuple cout
Definition: gather_cfg.py:121
const OrderedSeedingHits & QuadrupletSeedMerger::mergeTriplets ( const OrderedSeedingHits inputTriplets,
const edm::EventSetup es 
)

merge triplets into quadruplets INPUT: OrderedSeedingHits OUTPUT: SeedingHitSets

this method is used in RecoPixelVertexing/PixelTrackFitting/src/PixelTrackReconstruction.cc and contains the basic merger functionality

Definition at line 101 of file QuadrupletSeedMerger.cc.

References a, b, KDTreeLinkerAlgo< DATA >::build(), calculatePhiEta(), SeedingLayerSetsBuilder::check(), constexpr, gather_cfg::cout, eta(), edm::EventSetup::get(), i, isAddRemainingTriplets_, isMergeTriplets_, isValidQuadruplet(), j, SeedingLayerSetsBuilder::layers(), max(), maxEta, bookConverter::min, benchmark_cfg::minEta, mySort(), phi, edm::ESHandle< class >::product(), quads_, indexGen::s2, KDTreeLinkerAlgo< DATA >::search(), EgAmbiguityTools::sharedHits(), OrderedSeedingHits::size(), findQualityFiles::size, python.multivaluedict::sort(), reco::t2, theLayerBuilder_, theLayerSets_, and Geom::twoPi().

Referenced by mergeTriplets(), and SeedGeneratorFromRegionHitsEDProducer::produce().

101  {
102 
103  //Retrieve tracker topology from geometry
105  es.get<IdealGeometryRecord>().get(tTopoHand);
106  const TrackerTopology *tTopo=tTopoHand.product();
107 
108  // the list of layers on which quadruplets should be formed
109  if(theLayerBuilder_.check(es)) {
110  theLayerSets_ = theLayerBuilder_.layers( es ); // this is a vector<vector<SeedingLayer> >
111  }
112 
113 
114  // make a working copy of the input triplets
115  // to be able to remove merged triplets
116 
117  std::vector<std::pair<double,double> > phiEtaCache;
118  std::vector<SeedingHitSet> tripletCache; //somethings strange about OrderedSeedingHits?
119 
120  const unsigned int nInputTriplets = inputTriplets.size();
121  phiEtaCache.reserve(nInputTriplets);
122  tripletCache.reserve(nInputTriplets);
123 
124  for( unsigned int it = 0; it < nInputTriplets; ++it ) {
125  tripletCache.push_back((inputTriplets[it]));
126  phiEtaCache.push_back(calculatePhiEta( (tripletCache[it]) ));
127 
128  }
129 
130  // the output
131  quads_.clear();
132 
133  // check if the input is all triplets
134  // (code is also used for pairs..)
135  // if not, copy the input to the output & return
136  bool isAllTriplets = true;
137  for( unsigned int it = 0; it < nInputTriplets; ++it ) {
138  if( tripletCache[it].size() != 3 ) {
139  isAllTriplets = false;
140  break;
141  }
142  }
143 
144  if( !isAllTriplets && isMergeTriplets_ )
145  std::cout << "[QuadrupletSeedMerger::mergeTriplets] (in HLT) ** bailing out since non-triplets in input." << std::endl;
146 
147  if( !isAllTriplets || !isMergeTriplets_ ) {
148  quads_.reserve(nInputTriplets);
149  for( unsigned int it = 0; it < nInputTriplets; ++it ) {
150  quads_.push_back( (tripletCache[it]));
151  }
152 
153  return quads_;
154  }
155 
156 
157  quads_.reserve(0.2*nInputTriplets); //rough guess
158 
159  // loop all possible 4-layer combinations
160  // as specified in python/quadrupletseedmerging_cff.py
161 
162  std::vector<bool> usedTriplets(nInputTriplets,false);
163  std::pair<TransientTrackingRecHit::ConstRecHitPointer,TransientTrackingRecHit::ConstRecHitPointer> sharedHits;
164  std::pair<TransientTrackingRecHit::ConstRecHitPointer,TransientTrackingRecHit::ConstRecHitPointer> nonSharedHits;
165 
166  // k-d tree, indices are (th)eta, phi
167  // build the tree
168  std::vector<KDTreeNodeInfo<unsigned int> > nodes;
169  std::vector<unsigned int> foundNodes;
170  nodes.reserve(2*nInputTriplets);
171  foundNodes.reserve(100);
173  double minEta=1e10, maxEta=-1e10;
174  for(unsigned int it=0; it < nInputTriplets; ++it) {
175  double phi = phiEtaCache[it].first;
176  double eta = phiEtaCache[it].second;
177  nodes.push_back(KDTreeNodeInfo<unsigned int>(it, eta, phi));
178  minEta = std::min(minEta, eta);
179  maxEta = std::max(maxEta, eta);
180 
181  // to wrap all points in phi
182  // if(phi < 0) phi += twoPi(); else phi -= twoPi();
183  double twoPi = std::copysign(Geom::twoPi(), phi);
184  nodes.push_back(KDTreeNodeInfo<unsigned int>(it, eta, phi-twoPi));
185  }
186  KDTreeBox kdEtaPhi(minEta-0.01, maxEta+0.01, -1*Geom::twoPi(), Geom::twoPi());
187  kdtree.build(nodes, kdEtaPhi);
188  nodes.clear();
189 
190  // loop over triplets, search for close-by triplets by using the k-d tree
191  // also identify the hits which are shared by triplet pairs, and
192  // store indices to hits which are not shared
193  std::vector<unsigned int> t1List;
194  std::vector<unsigned int> t2List;
195  std::vector<short> t1NonSharedHitList;
196  std::vector<short> t2NonSharedHitList;
197  constexpr short sharedToNonShared[7] = {-1, -1, -1,
198  2, // 011=3 shared, not shared = 2
199  -1,
200  1, // 101=5 shared, not shared = 1
201  0}; // 110=6 shared, not shared = 0
202  constexpr short nonSharedToShared[3][2] = {
203  {1, 2},
204  {0, 2},
205  {0, 1}
206  };
207 
208  typedef std::tuple<unsigned int, short, short> T2NonSharedTuple;
209  std::vector<T2NonSharedTuple> t2Tmp; // temporary to sort t2's before insertion to t2List
210  for(unsigned int t1=0; t1<nInputTriplets; ++t1) {
211  double phi = phiEtaCache[t1].first;
212  double eta = phiEtaCache[t1].second;
213 
214  KDTreeBox box(eta-0.05, eta+0.05, phi-0.15, phi+0.15);
215  foundNodes.clear();
216  kdtree.search(box, foundNodes);
217  if(foundNodes.empty())
218  continue;
219 
220  const SeedingHitSet& tr1 = tripletCache[t1];
221 
222  for(unsigned int t2: foundNodes) {
223  if(t1 >= t2)
224  continue;
225 
226  // Ensure here that the triplet pairs share two hits.
227  const SeedingHitSet& tr2 = tripletCache[t2];
228 
229  // If neither of first two hits in tr1 are found from tr2, this
230  // pair can be skipped
231  int equalHits=0;
232  // Find the indices of shared hits in both t1 and t2, use them
233  // to obtain the index of non-shared hit for both. The index of
234  // non-shared hit is then stored for later use (the indices of
235  // shared hits can be easily obtained from them).
236  unsigned int t1Shared = 0;
237  unsigned int t2Shared = 0;
238  for(unsigned int i=0; i<2; ++i) {
239  for(unsigned int j=0; j<3; ++j) {
240  if(areHitsEqual(*tr1[i], *tr2[j])) {
241  t1Shared |= (1<<i);
242  t2Shared |= (1<<j);
243  ++equalHits;
244  break;
245  }
246  }
247  }
248  if(equalHits == 0)
249  continue;
250  // If, after including the third hit of tr1, number of equal
251  // hits is not 2, this pair can be skipped
252  if(equalHits != 2) {
253  for(unsigned int j=0; j<3; ++j) {
254  if(areHitsEqual(*tr1[2], *tr2[j])) {
255  t1Shared |= (1<<2);
256  t2Shared |= (1<<j);
257  ++equalHits;
258  break;
259  }
260  }
261  if(equalHits != 2)
262  continue;
263  }
264  // valid values for the bitfields are 011=3, 101=5, 110=6
265  assert(t1Shared <= 6 && t2Shared <= 6); // against out-of-bounds of sharedToNonShared[]
266  short t1NonShared = sharedToNonShared[t1Shared];
267  short t2NonShared = sharedToNonShared[t2Shared];
268  assert(t1NonShared >= 0 && t2NonShared >= 0); // against invalid value from sharedToNonShared[]
269 
270  t2Tmp.emplace_back(t2, t1NonShared, t2NonShared);
271  }
272 
273  // Sort to increasing order in t2 in order to get exactly same result as before
274  std::sort(t2Tmp.begin(), t2Tmp.end(), [](const T2NonSharedTuple& a, const T2NonSharedTuple& b){
275  return std::get<0>(a) < std::get<0>(b);
276  });
277  for(T2NonSharedTuple& t2tpl: t2Tmp) {
278  t1List.push_back(t1);
279  t2List.push_back(std::get<0>(t2tpl));
280  t1NonSharedHitList.push_back(std::get<1>(t2tpl));
281  t2NonSharedHitList.push_back(std::get<2>(t2tpl));
282  }
283  t2Tmp.clear();
284  }
285  nodes.clear();
286 
287  for( ctfseeding::SeedingLayerSets::const_iterator lsIt = theLayerSets_.begin(); lsIt < theLayerSets_.end(); ++lsIt ) {
288 
289  // fill a vector with the layers in this set
290  std::vector<SeedMergerPixelLayer> currentLayers;
291  currentLayers.reserve(lsIt->size());
292  for( ctfseeding::SeedingLayers::const_iterator layIt = lsIt->begin(); layIt < lsIt->end(); ++layIt ) {
293  currentLayers.push_back( SeedMergerPixelLayer( layIt->name() ) );
294  }
295  // loop all pair combinations of these 4 layers;
296  // strategy is to look for shared hits on such a pair and
297  // then merge the remaining hits in both triplets if feasible
298  // (SeedingLayers is a vector<SeedingLayer>)
299 
300  for( unsigned int s1=0; s1<currentLayers.size()-1; s1++) {
301 
302  for( unsigned int s2=s1+1; s2<currentLayers.size(); s2++) {
303 
304  std::vector<unsigned int> nonSharedLayerNums;
305  for ( unsigned int us1=0; us1<currentLayers.size(); us1++) {
306  if ( s1!=us1 && s2!=us1) nonSharedLayerNums.push_back(us1);
307  }
308 
309  // loop all possible triplet pairs (which come as input)
310  for (unsigned int t12=0; t12<t1List.size(); t12++) {
311  unsigned int t1=t1List[t12];
312  unsigned int t2=t2List[t12];
313 
314  if (usedTriplets[t1] || usedTriplets[t2] ) continue;
315 
316  const SeedingHitSet& firstTriplet = tripletCache[t1];
317 
318  short t1NonShared = t1NonSharedHitList[t12];
319  sharedHits.first = firstTriplet[nonSharedToShared[t1NonShared][0]];
320  sharedHits.second = firstTriplet[nonSharedToShared[t1NonShared][1]];
321 
322  // are the shared hits on these two layers?
323  if(areHitsOnLayers(currentLayers[s1], currentLayers[s2], sharedHits, tTopo)) {
324  short t2NonShared = t2NonSharedHitList[t12];
325  const SeedingHitSet& secondTriplet = tripletCache[t2];
326  nonSharedHits.first = firstTriplet[t1NonShared];
327  nonSharedHits.second = secondTriplet[t2NonShared];
328 
329  // are the remaining hits on different layers?
330  if(areHitsOnLayers(currentLayers[nonSharedLayerNums[0]], currentLayers[nonSharedLayerNums[1]], nonSharedHits, tTopo)) {
331  QuadrupletHits unsortedHits{ {sharedHits.first, sharedHits.second,
332  nonSharedHits.first, nonSharedHits.second} };
333 
334  mySort(unsortedHits);
335 
336  //start here with old addtoresult
337  if( isValidQuadruplet( unsortedHits, currentLayers, tTopo ) ) {
338  // and create the quadruplet
339  SeedingHitSet quadruplet(unsortedHits[0],unsortedHits[1],unsortedHits[2],unsortedHits[3]);
340 
341  // insert this quadruplet
342  quads_.push_back( quadruplet );
343  // remove both triplets from the list,
344  // needs this 4-permutation since we're in a double loop
345  usedTriplets[t1]=true;
346  usedTriplets[t2]=true;
347  }
348 
349  } // isMergeableHitsInTriplets
350  } // isTripletsShareHitsOnLayers
351  // } // triplet double loop
352  }
353  } // seeding layers double loop
354  }
355 
356  } // seeding layer sets
357 
358  // add the remaining triplets
360  for( unsigned int it = 0; it < nInputTriplets; ++it ) {
361  if ( !usedTriplets[it] )
362  quads_.push_back( tripletCache[it]);
363  }
364  }
365 
366  //calc for printout...
367 // unsigned int nLeft=0;
368 // for ( unsigned int i=0; i<nInputTriplets; i++)
369 // if ( !usedTriplets[i] ) nLeft++;
370  // some stats
371 // std::cout << " [QuadrupletSeedMerger::mergeTriplets] -- Created: " << theResult.size()
372 // << " quadruplets from: " << nInputTriplets << " input triplets (" << nLeft
373 // << " remaining ";
374 // std::cout << (isAddRemainingTriplets_?"added":"dropped");
375 // std::cout << ")." << std::endl;
376 
377  return quads_;
378 
379 }
int i
Definition: DBlmapReader.cc:9
ctfseeding::SeedingLayerSets layers(const edm::EventSetup &es)
void build(std::vector< KDTreeNodeInfo > &eltList, const KDTreeBox &region)
std::array< TransientTrackingRecHit::ConstRecHitPointer, 4 > QuadrupletHits
double maxEta
virtual unsigned int size() const =0
bool check(const edm::EventSetup &es)
T eta() const
ctfseeding::SeedingLayerSets theLayerSets_
void search(const KDTreeBox &searchBox, std::vector< KDTreeNodeInfo > &resRecHitList)
std::pair< double, double > calculatePhiEta(SeedingHitSet const &) const
void mySort(QuadrupletHits &unsortedHits)
int sharedHits(const reco::GsfTrackRef &, const reco::GsfTrackRef &)
tuple s2
Definition: indexGen.py:106
const T & max(const T &a, const T &b)
auto const T2 &decltype(t1.eta()) t2
Definition: deltaR.h:18
int j
Definition: DBlmapReader.cc:9
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
double twoPi()
Definition: Pi.h:32
bool isValidQuadruplet(const QuadrupletHits &quadruplet, const std::vector< SeedMergerPixelLayer > &layers, const TrackerTopology *tTopo) const
tuple cout
Definition: gather_cfg.py:121
SeedingLayerSetsBuilder theLayerBuilder_
tuple size
Write out results.
#define constexpr
Definition: DDAxes.h:10
const TrajectorySeedCollection QuadrupletSeedMerger::mergeTriplets ( const TrajectorySeedCollection seedCollection,
const TrackingRegion region,
const edm::EventSetup es,
const edm::ParameterSet cfg 
)

merge triplets into quadruplets INPUT: TrajectorySeedCollection OUTPUT: TrajectorySeedCollection

this is a wrapper for: vector<SeedingHitSet> mergeTriplets( const OrderedSeedingHits& ) for use in RecoTracker/TkSeedGenerator/plugins/SeedGeneratorFromRegionHitsEDProducer.cc (iterative tracking)

Definition at line 393 of file QuadrupletSeedMerger.cc.

References gather_cfg::cout, edm::EventSetup::get(), reco::get(), edm::ParameterSet::getParameter(), i, isMergeTriplets_, mergeTriplets(), OrderedSeedingHits::size(), AlCaHLTBitMon_QueryRunRegistry::string, theTTRHBuilder_, and theTTRHBuilderLabel_.

396  {
397 
398  // ttrh builder for HitSet -> TrajectorySeed conversion;
399  // require this to be correctly configured, otherwise -> exception
401 
402  // output collection
403  TrajectorySeedCollection theResult;
404 
405  // loop to see if we have triplets ONLY
406  // if not, copy input -> output and return
407  bool isAllTriplets = true;
408  for( TrajectorySeedCollection::const_iterator aTrajectorySeed = seedCollection.begin();
409  aTrajectorySeed < seedCollection.end(); ++aTrajectorySeed ) {
410  if( 3 != aTrajectorySeed->nHits() ) isAllTriplets = false;
411  }
412 
413  if( !isAllTriplets && isMergeTriplets_ )
414  std::cout << " [QuadrupletSeedMerger::mergeTriplets] (in RECO) -- bailing out since non-triplets in input." << std::endl;
415 
416  if( !isAllTriplets || !isMergeTriplets_ ) {
417  for( TrajectorySeedCollection::const_iterator aTrajectorySeed = seedCollection.begin();
418  aTrajectorySeed < seedCollection.end(); ++aTrajectorySeed ) {
419  theResult.push_back( *aTrajectorySeed );
420  }
421 
422  return theResult;
423  }
424 
425 
426  // all this fiddling here is now about converting
427  // TrajectorySeedCollection <-> OrderedSeedingHits
428 
429  // create OrderedSeedingHits first;
430  OrderedHitTriplets inputTriplets;
431 
432  // loop seeds
433  for( TrajectorySeedCollection::const_iterator aTrajectorySeed = seedCollection.begin();
434  aTrajectorySeed < seedCollection.end(); ++aTrajectorySeed ) {
435 
436  std::vector<TransientTrackingRecHit::RecHitPointer> recHitPointers;
437 
438  // loop RecHits
439  const TrajectorySeed::range theHitsRange = aTrajectorySeed->recHits();
440  for( edm::OwnVector<TrackingRecHit>::const_iterator aHit = theHitsRange.first;
441  aHit < theHitsRange.second; ++aHit ) {
442 
443  // this is a collection of: ReferenceCountingPointer< TransientTrackingRecHit>
444  recHitPointers.push_back( theTTRHBuilder_->build( &(*aHit) ) );
445 
446  }
447 
448  // add to input collection
449  inputTriplets.push_back( OrderedHitTriplet( recHitPointers.at( 0 ), recHitPointers.at( 1 ), recHitPointers.at( 2 ) ) );
450 
451  }
452 
453  // do the real merging..
454  const OrderedSeedingHits &quadrupletHitSets = mergeTriplets( inputTriplets, es );
455 
456  // convert back to TrajectorySeedCollection
457 
458  // the idea here is to fetch the same SeedCreator and PSet
459  // as those used by the plugin which is calling the merger
460  // (at the moment that's SeedGeneratorFromRegionHitsEDProducer)
461  edm::ParameterSet creatorPSet = cfg.getParameter<edm::ParameterSet>("SeedCreatorPSet");
462  std::string const& creatorName = creatorPSet.getParameter<std::string>( "ComponentName" );
463  // leak????
464  SeedCreator* seedCreator = SeedCreatorFactory::get()->create( creatorName, creatorPSet );
465  seedCreator->init(region, es, 0);
466  for ( unsigned int i=0; i< quadrupletHitSets.size(); i++) {
467  // add trajectory seed to result collection
468  seedCreator->makeSeed( theResult, quadrupletHitSets[i]);
469  }
470 
471  return theResult;
472 
473 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
virtual unsigned int size() const =0
std::vector< TrajectorySeed > TrajectorySeedCollection
std::pair< const_iterator, const_iterator > range
const T & get() const
Definition: EventSetup.h:55
const OrderedSeedingHits & mergeTriplets(const OrderedSeedingHits &, const edm::EventSetup &)
edm::ESHandle< TransientTrackingRecHitBuilder > theTTRHBuilder_
tuple cout
Definition: gather_cfg.py:121
T get(const Candidate &c)
Definition: component.h:55
void QuadrupletSeedMerger::mySort ( QuadrupletHits unsortedHits)
private

Definition at line 730 of file QuadrupletSeedMerger.cc.

References p1, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by mergeTriplets().

730  {
731  float radiiSq[4];
732  for ( unsigned int iR=0; iR<4; iR++){
733  GlobalPoint p1 = unsortedHits[iR]->globalPosition();
734  radiiSq[iR]=( p1.x()*p1.x()+p1.y()*p1.y()); // no need to take the sqrt
735  }
737  float tempFloat=0.;
738  for ( unsigned int iR1=0; iR1<3; iR1++) {
739  for ( unsigned int iR2=iR1+1; iR2<4; iR2++) {
740  if (radiiSq[iR1]>radiiSq[iR2]) {
741  tempRHP=unsortedHits[iR1];
742  unsortedHits[iR1]=unsortedHits[iR2];
743  unsortedHits[iR2]=tempRHP;
744  tempFloat=radiiSq[iR1];
745  radiiSq[iR1]=radiiSq[iR2];
746  radiiSq[iR2]=tempFloat;
747  }
748  }
749  }
750 }
T y() const
Definition: PV3DBase.h:63
double p1[4]
Definition: TauolaWrapper.h:89
T x() const
Definition: PV3DBase.h:62
void QuadrupletSeedMerger::printHit ( const TrackingRecHit aHit) const

Definition at line 522 of file QuadrupletSeedMerger.cc.

References gather_cfg::cout, TrackingRecHit::geographicalId(), TrackingRecHit::localPosition(), PV3DBase< T, PVType, FrameType >::perp(), GloballyPositioned< T >::position(), alignCSCRings::r, GeomDet::surface(), theTrackerGeometry_, GeomDet::toGlobal(), x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

Referenced by printHit().

522  {
523 
524  const GeomDet* geomDet = theTrackerGeometry_->idToDet( aHit->geographicalId() );
525  const double r = geomDet->surface().position().perp();
526  const double x = geomDet->toGlobal( aHit->localPosition() ).x();
527  const double y = geomDet->toGlobal( aHit->localPosition() ).y();
528  const double z = geomDet->toGlobal( aHit->localPosition() ).z();
529  std::cout << "<RecHit> x: " << x << " y: " << y << " z: " << z << " r: " << r << std::endl;
530 
531 }
edm::ESHandle< TrackerGeometry > theTrackerGeometry_
T perp() const
Definition: PV3DBase.h:72
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
float float float z
tuple cout
Definition: gather_cfg.py:121
DetId geographicalId() const
Definition: DDAxes.h:10
virtual LocalPoint localPosition() const =0
const PositionType & position() const
void QuadrupletSeedMerger::printHit ( const TransientTrackingRecHit::ConstRecHitPointer aRecHitPointer) const

Definition at line 511 of file QuadrupletSeedMerger.cc.

References printHit().

511  {
512 
513  printHit( aRecHitPointer->hit() );
514 
515 }
void printHit(const TrackingRecHit *) const
void QuadrupletSeedMerger::printNtuplet ( const SeedingHitSet aNtuplet) const

Definition at line 536 of file QuadrupletSeedMerger.cc.

References gather_cfg::cout, PixelEndcapName::diskName(), TrackingRecHit::geographicalId(), PixelBarrelName::layerName(), TrackingRecHit::localPosition(), PixelSubdetector::PixelBarrel, alignCSCRings::r, SeedingHitSet::size(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, DetId::subdetId(), theTrackerGeometry_, GeomDet::toGlobal(), x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

536  {
537 
538  std::cout << "DUMPING NTUPLET OF SIZE:";
539  std::cout << aNtuplet.size() << std::endl;
540 
541  for( unsigned int aHit = 0; aHit < aNtuplet.size(); ++aHit ) {
542 
543  const TrackingRecHit* theHit = aNtuplet[aHit]->hit();
544  const GeomDet* geomDet = theTrackerGeometry_->idToDet( theHit->geographicalId() );
545  const double x = geomDet->toGlobal( theHit->localPosition() ).x();
546  const double y = geomDet->toGlobal( theHit->localPosition() ).y();
547  const double z = geomDet->toGlobal( theHit->localPosition() ).z();
548  const double r = sqrt( x*x + y*y );
549 
550  unsigned int layer;
551  std::string detName;
553  detName = "BPIX ";
554  PixelBarrelName pbn( aNtuplet[aHit]->hit()->geographicalId());
555  layer = pbn.layerName();
556  }
557  else {
558  detName = "FPIX";
559  if( z > 0 ) detName += "+";
560  else detName += "-";
561 
562  PixelEndcapName pen( theHit->geographicalId() );
563  layer = pen.diskName();
564  }
565 
566  std::cout << "<NtupletHit> D: " << detName << " L: " << layer << " x: " << x << " y: " << y << " z: " << z << " r: " << r << std::endl;
567 
568 }
569 
570  std::cout << "<<<<<<<<<<<<<<<<<<<<<<<<<<<" << std::endl;
571 
572 }
edm::ESHandle< TrackerGeometry > theTrackerGeometry_
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
float float float z
T sqrt(T t)
Definition: SSEVec.h:48
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
unsigned int size() const
Definition: SeedingHitSet.h:41
tuple cout
Definition: gather_cfg.py:121
int diskName() const
disk id
DetId geographicalId() const
Definition: DDAxes.h:10
virtual LocalPoint localPosition() const =0
void QuadrupletSeedMerger::setAddRemainingTriplets ( bool  isAddTriplets)

Definition at line 599 of file QuadrupletSeedMerger.cc.

References isAddRemainingTriplets_.

599  {
600  isAddRemainingTriplets_ = isAddTriplets;
601 }
void QuadrupletSeedMerger::setMergeTriplets ( bool  isMergeTriplets)

Definition at line 590 of file QuadrupletSeedMerger.cc.

References isMergeTriplets_.

590  {
591  isMergeTriplets_ = isMergeTriplets;
592 }
void QuadrupletSeedMerger::setTTRHBuilderLabel ( std::string  label)

Definition at line 579 of file QuadrupletSeedMerger.cc.

References diffTwoXMLs::label, and theTTRHBuilderLabel_.

579  {
580 
582 
583 }
void QuadrupletSeedMerger::update ( const edm::EventSetup es)

Definition at line 77 of file QuadrupletSeedMerger.cc.

References edm::EventSetup::get(), and theTrackerGeometry_.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), SeedGeneratorFromRegionHitsEDProducer::produce(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

77  {
78  // copy geometry
80 }
edm::ESHandle< TrackerGeometry > theTrackerGeometry_
const T & get() const
Definition: EventSetup.h:55

Member Data Documentation

bool QuadrupletSeedMerger::isAddRemainingTriplets_
private
bool QuadrupletSeedMerger::isMergeTriplets_
private

Definition at line 109 of file QuadrupletSeedMerger.h.

Referenced by mergeTriplets(), QuadrupletSeedMerger(), and setMergeTriplets().

OrderedHitSeeds QuadrupletSeedMerger::quads_
private

Definition at line 112 of file QuadrupletSeedMerger.h.

Referenced by mergeTriplets().

SeedingLayerSetsBuilder QuadrupletSeedMerger::theLayerBuilder_
private

Definition at line 105 of file QuadrupletSeedMerger.h.

Referenced by mergeTriplets().

ctfseeding::SeedingLayerSets QuadrupletSeedMerger::theLayerSets_
private

Definition at line 106 of file QuadrupletSeedMerger.h.

Referenced by mergeTriplets().

edm::ESHandle<TrackerGeometry> QuadrupletSeedMerger::theTrackerGeometry_
private

Definition at line 107 of file QuadrupletSeedMerger.h.

Referenced by printHit(), printNtuplet(), and update().

edm::ESHandle<TransientTrackingRecHitBuilder> QuadrupletSeedMerger::theTTRHBuilder_
private

Definition at line 108 of file QuadrupletSeedMerger.h.

Referenced by mergeTriplets().

std::string QuadrupletSeedMerger::theTTRHBuilderLabel_
private

Definition at line 111 of file QuadrupletSeedMerger.h.

Referenced by mergeTriplets(), and setTTRHBuilderLabel().