CMS 3D CMS Logo

CompatibleDetToGroupAdder.cc
Go to the documentation of this file.
3 #include "DetGroupMerger.h"
4 
5 
6 using namespace std;
7 
8 
10  const TrajectoryStateOnSurface& tsos,
11  const Propagator& prop,
12  const MeasurementEstimator& est,
13  vector<DetGroup>& result) {
14  if (det.hasGroups()) {
15  vector<DetGroup> tmp;
16  det.groupedCompatibleDetsV(tsos, prop, est,tmp);
17  if (tmp.empty()) return false;
18 
19  if (result.empty()) result.swap(tmp);
20  else DetGroupMerger::addSameLevel(std::move(tmp), result);
21  }
22  else {
23  vector<GeometricSearchDet::DetWithState> compatDets;
24  det.compatibleDetsV( tsos, prop, est, compatDets);
25  if (compatDets.empty()) return false;
26 
27  if (result.empty())
28  result.push_back( DetGroup( 0, 1)); // empty group for insertion
29 
30  if (result.size() != 1)
31  edm::LogError("TkDetLayers") << "CompatibleDetToGroupAdder: det is not grouped but result has more than one group!" ;
32  result.front().reserve(result.front().size()+compatDets.size());
33  for (vector<GeometricSearchDet::DetWithState>::const_iterator i=compatDets.begin();
34  i!=compatDets.end(); i++)
35  result.front().push_back(std::move( *i));
36  }
37  return true;
38 }
39 
41 // #include "TkGeomDetCompatibilityChecker.h"
42 
44  const TrajectoryStateOnSurface& tsos,
45  const Propagator& prop,
46  const MeasurementEstimator& est,
47  vector<DetGroup>& result) {
48  //TkGeomDetCompatibilityChecker theCompatibilityChecker;
49  GeomDetCompatibilityChecker theCompatibilityChecker;
50  auto && compat = theCompatibilityChecker.isCompatible( &det,tsos, prop, est);
51 
52  if (!compat.first) return false;
53 
54  if (result.empty())
55  result.push_back( DetGroup( 0, 1)); // empty group for ge insertion
56 
57  if (result.size() != 1)
58  edm::LogError("TkDetLayers") << "CompatibleDetToGroupAdder: det is not grouped but result has more than one group!" ;
59 
60 
61  result.front().emplace_back(&det, std::move(compat.second));
62  return true;
63 }
64 
65 
66 
67 
virtual void groupedCompatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const
static void addSameLevel(std::vector< DetGroup > &&gvec, std::vector< DetGroup > &result)
static std::pair< bool, TrajectoryStateOnSurface > isCompatible(const GeomDet *theDet, const TrajectoryStateOnSurface &ts, const Propagator &prop, const MeasurementEstimator &est)
static bool add(const GeometricSearchDet &det, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) __attribute__((hot))
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const
def move(src, dest)
Definition: eostools.py:510