CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FastTrackingHelper.h
Go to the documentation of this file.
1 #ifndef FASTSIMULATION_TRACKING_FASTTRACKINGHELPER_H
2 #define FASTSIMULATION_TRACKING_FASTTRACKINGHELPER_H
3 
6 
7 namespace fastTrackingHelper {
8 
9  template<class T> inline void setRecHitCombinationIndex(edm::OwnVector<T> & recHits,int32_t icomb){
10  for(auto & recHit : recHits){
11  if(!trackerHitRTTI::isFast(recHit)){
12  throw cms::Exception("fastTrackingHelpers::setRecHitCombinationIndex: one of hits in OwnVector is non-fastsim");
13  }
14  static_cast<FastTrackerRecHit &>(recHit).setRecHitCombinationIndex(icomb);
15  }
16  }
17 
18  // get recHitCombination for TrackCandidate and TrajectorySeed
19  template<class T> int32_t getRecHitCombinationIndex(const T & object){
20  // seed must have at least one hit
21  if(object.recHits().first == object.recHits().second){
22  throw cms::Exception("fastTrackingHelpers::getRecHitCombinationIndex") << " given object has 0 hits" << std::endl;
23  }
24 
25  const TrackingRecHit & recHit = *object.recHits().first;
26  if(!trackerHitRTTI::isFast(recHit)){
27  throw cms::Exception("fastTrackingHelpers::setRecHitCombinationIndex") << " one of hits in OwnVector is non-fastsim" << std::endl;
28  }
29  // cast and return combination index
30  return static_cast<const FastTrackerRecHit &>(recHit).recHitCombinationIndex();
31  // return combination index of first hit
32  }
33 
34 }
35 
36 #endif
U second(std::pair< T, U > const &p)
virtual std::vector< const TrackingRecHit * > recHits() const =0
Access to component RecHits (if any)
bool isFast(TrackingRecHit const &hit)
void setRecHitCombinationIndex(edm::OwnVector< T > &recHits, int32_t icomb)
int32_t getRecHitCombinationIndex(const T &object)
long double T