CMS 3D CMS Logo

FastTrackingUtilities.h
Go to the documentation of this file.
1 
2 #ifndef FASTSIMULATION_TRACKING_FASTTRACKINGHELPER_H
3 #define FASTSIMULATION_TRACKING_FASTTRACKINGHELPER_H
4 
7 
9 
10  template <class T>
11  inline void setRecHitCombinationIndex(edm::OwnVector<T> &recHits, int32_t icomb) {
12  for (auto &recHit : recHits) {
14  throw cms::Exception("fastTrackingHelpers::setRecHitCombinationIndex: one of hits in OwnVector is non-fastsim");
15  }
16  static_cast<FastTrackerRecHit &>(recHit).setRecHitCombinationIndex(icomb);
17  }
18  }
19 
20  // get recHitCombination for TrackCandidate and TrajectorySeed
21  template <class T>
22  int32_t getRecHitCombinationIndex(const T &object) {
23  // seed must have at least one hit
24  if (object.recHits().first == object.recHits().second) {
25  throw cms::Exception("fastTrackingHelpers::getRecHitCombinationIndex")
26  << " given object has 0 hits" << std::endl;
27  }
28 
29  const TrackingRecHit &recHit = *object.recHits().first;
31  throw cms::Exception("fastTrackingHelpers::setRecHitCombinationIndex")
32  << " one of hits in OwnVector is non-fastsim" << std::endl;
33  }
34  // cast and return combination index
35  return static_cast<const FastTrackerRecHit &>(recHit).recHitCombinationIndex();
36  // return combination index of first hit
37  }
38 
39  inline bool hitIsMasked(const FastTrackerRecHit *hit, const std::vector<bool> &hitMasks) {
40  for (unsigned int i = 0; i < hit->nIds(); i++) {
41  if (!(hitMasks)[hit->id(i)]) {
42  return false;
43  }
44  }
45  return true;
46  }
47 
48  inline double hitLocalError(const TrackingRecHit *hit) {
49  double xx = hit->localPositionError().xx();
50  double yy = hit->localPositionError().yy();
51  double xy = hit->localPositionError().xy();
52  double delta = std::sqrt((xx - yy) * (xx - yy) + 4. * xy * xy);
53  return 0.5 * (xx + yy - delta);
54  }
55 } // namespace fastTrackingUtilities
56 
57 #endif
fastTrackingUtilities::hitLocalError
double hitLocalError(const TrackingRecHit *hit)
Definition: FastTrackingUtilities.h:48
mps_fire.i
i
Definition: mps_fire.py:355
hit::id
unsigned int id
Definition: SiStripHitEffFromCalibTree.cc:92
DetachedQuadStep_cff.hitMasks
hitMasks
Definition: DetachedQuadStep_cff.py:99
fastTrackingUtilities::setRecHitCombinationIndex
void setRecHitCombinationIndex(edm::OwnVector< T > &recHits, int32_t icomb)
Definition: FastTrackingUtilities.h:11
fastTrackingUtilities::hitIsMasked
bool hitIsMasked(const FastTrackerRecHit *hit, const std::vector< bool > &hitMasks)
Definition: FastTrackingUtilities.h:39
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
FastTrackerRecHit
Definition: FastTrackerRecHit.h:40
fastTrackingUtilities
Definition: FastTrackingUtilities.h:8
dqmdumpme.first
first
Definition: dqmdumpme.py:55
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
fastTrackingUtilities::getRecHitCombinationIndex
int32_t getRecHitCombinationIndex(const T &object)
Definition: FastTrackingUtilities.h:22
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
geometryCSVtoXML.xy
xy
Definition: geometryCSVtoXML.py:19
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
FastTrackerRecHitCollection.h
TrackingRecHit
Definition: TrackingRecHit.h:21
T
long double T
Definition: Basic3DVectorLD.h:48
Exception
Definition: hltDiff.cc:246
FastTrackerRecHit.h
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
hit
Definition: SiStripHitEffFromCalibTree.cc:88
edm::OwnVector
Definition: OwnVector.h:24
trackerHitRTTI::isFast
bool isFast(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:36