CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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( 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( *i);
36  }
37  return true;
38 }
39 
42 
44  const TrajectoryStateOnSurface& tsos,
45  const Propagator& prop,
46  const MeasurementEstimator& est,
47  vector<DetGroup>& result) {
48  //TkGeomDetCompatibilityChecker theCompatibilityChecker;
49  GeomDetCompatibilityChecker theCompatibilityChecker;
50  pair<bool, TrajectoryStateOnSurface> compat = theCompatibilityChecker.isCompatible( &det,tsos, prop, est);
51 
52  if (!compat.first) return false;
53 
54  DetGroupElement ge( &det, compat.second);
55 
56  if (result.empty())
57  result.push_back( DetGroup( 0, 1)); // empty group for ge insertion
58 
59  if (result.size() != 1)
60  edm::LogError("TkDetLayers") << "CompatibleDetToGroupAdder: det is not grouped but result has more than one group!" ;
61 
62 
63  result.front().push_back(ge);
64  return true;
65 }
66 
67 
68 
69 
int i
Definition: DBlmapReader.cc:9
virtual void groupedCompatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const
static std::pair< bool, TrajectoryStateOnSurface > isCompatible(const GeomDet *theDet, const TrajectoryStateOnSurface &ts, const Propagator &prop, const MeasurementEstimator &est)
tuple result
Definition: query.py:137
virtual bool hasGroups() const =0
static bool add(const GeometricSearchDet &det, const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
static void addSameLevel(const std::vector< DetGroup > &gvec, std::vector< DetGroup > &result)
virtual void compatibleDetsV(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetWithState > &result) const