CMS 3D CMS Logo

CompatibleDetToGroupAdder.cc

Go to the documentation of this file.
00001 #include "RecoTracker/TkDetLayers/interface/CompatibleDetToGroupAdder.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include "RecoTracker/TkDetLayers/interface/DetGroupMerger.h"
00004 
00005 
00006 using namespace std;
00007 
00008 
00009 bool CompatibleDetToGroupAdder::add( const GeometricSearchDet& det,
00010                                      const TrajectoryStateOnSurface& tsos, 
00011                                      const Propagator& prop,
00012                                      const MeasurementEstimator& est,
00013                                      vector<DetGroup>& result) {
00014   if (det.hasGroups()) {
00015     vector<DetGroup> tmp;
00016     det.groupedCompatibleDetsV(tsos, prop, est,tmp);
00017     if (tmp.empty()) return false;
00018     
00019     if (result.empty()) result.swap(tmp);
00020     else                DetGroupMerger::addSameLevel( tmp, result);
00021   }
00022   else {
00023     vector<GeometricSearchDet::DetWithState> compatDets;
00024     det.compatibleDetsV( tsos, prop, est, compatDets);
00025     if (compatDets.empty()) return false;
00026     
00027     if (result.empty())
00028       result.push_back( DetGroup( 0, 1)); // empty group for insertion
00029     
00030     if (result.size() != 1)
00031       edm::LogError("TkDetLayers") << "CompatibleDetToGroupAdder: det is not grouped but result has more than one group!" ;
00032     result.front().reserve(result.front().size()+compatDets.size());
00033     for (vector<GeometricSearchDet::DetWithState>::const_iterator i=compatDets.begin();
00034          i!=compatDets.end(); i++)
00035       result.front().push_back( *i);
00036   } 
00037     return true;
00038 }
00039 
00040 #include "TrackingTools/DetLayers/interface/GeomDetCompatibilityChecker.h"
00041 #include "RecoTracker/TkDetLayers/interface/TkGeomDetCompatibilityChecker.h"
00042 
00043 bool CompatibleDetToGroupAdder::add( const GeomDet& det,
00044                                      const TrajectoryStateOnSurface& tsos, 
00045                                      const Propagator& prop,
00046                                      const MeasurementEstimator& est,
00047                                      vector<DetGroup>& result) {
00048   //TkGeomDetCompatibilityChecker theCompatibilityChecker;
00049   GeomDetCompatibilityChecker theCompatibilityChecker;
00050   pair<bool, TrajectoryStateOnSurface> compat = theCompatibilityChecker.isCompatible( &det,tsos, prop, est);
00051 
00052   if (!compat.first) return false;
00053 
00054   DetGroupElement ge( &det, compat.second);
00055 
00056   if (result.empty())
00057     result.push_back( DetGroup( 0, 1)); // empty group for ge insertion
00058 
00059   if (result.size() != 1) 
00060       edm::LogError("TkDetLayers") << "CompatibleDetToGroupAdder: det is not grouped but result has more than one group!" ;
00061     
00062 
00063   result.front().push_back(ge); 
00064   return true;  
00065 }
00066 
00067 
00068 
00069 

Generated on Tue Jun 9 17:45:46 2009 for CMSSW by  doxygen 1.5.4