25 const double toCloseToEachOther=1e-4;
26 if ( (middlePoint-initialPoint).
mag() < toCloseToEachOther){
27 LogDebug(
"SimpleNavigableLayer")<<
"initial state and PCA are identical. Things are bound to fail. Do not add the link.";
34 else dirS =
"anyDirection";
36 LogDebug(
"SimpleNavigableLayer")<<
"self propagating("<< dir <<
") from:\n"
39 <<
" and the direction is: "<<dir<<
" = "<<dirS;
43 propState =
propagator(dir).propagate( dest, detLayer()->surface());
48 LogDebug(
"SimpleNavigableLayer")<<
"second propagation("<< dir <<
") to: \n"
50 double finalDot = (middlePoint - initialPoint).basicVector().dot((finalPoint-middlePoint).basicVector());
52 LogDebug(
"SimpleNavigableLayer")<<
"switch side back: ABORT.";
66 propState = crossingState(fts,dir);
67 if (!propState.
isValid())
return false;
72 if ( !propState.
isValid())
return false;
75 if (theCheckCrossingSide){
79 if (backTobackTransverse || backToback ){
80 LogTrace(
"TkNavigation") <<
"Crossing over prevented!\nStaring from (x,y,z,r) ("
82 <<
") going to TSOS (x,y,z,r)"
102 float length = bounds.
length() / 2.f;
105 float deltaZ = bounds.thickness()/2. /
109 const float nSigma = theEpsilon;
117 if ( fabs( zpos) < length + deltaZ) result.push_back( bl);
119 if ( fabs( zpos) < length - deltaZ)
return true;
129 if ( !propState.
isValid())
return false;
132 LogDebug(
"SimpleNavigableLayer")<<
"self propagating from:\n"
138 if (theCheckCrossingSide){
142 if (backTobackTransverse || backToback ){
143 LogTrace(
"TkNavigation") <<
"Crossing over prevented!\nStaring from (x,y,z,r) ("
145 <<
") going to TSOS (x,y,z,r)"
162 const float nSigma = theEpsilon;
166 deltaR += nSigma *
sqrt(err.
xx() + err.
yy());
171 if ( innerR-deltaR < rpos && rpos < outerR+deltaR) result.push_back( fl);
173 if ( innerR+deltaR < rpos && rpos < outerR-deltaR)
return true;
185 for (DLC::const_iterator
i = layers.begin();
i != layers.end();
i++) {
188 if (wellInside( fts, dir, bl, result))
return true;
192 if ( fl == 0)
edm::LogError(
"TkNavigation") <<
"dynamic_cast<const ForwardDetLayer*> failed" ;
193 if (wellInside( fts, dir, fl, result))
return true;
205 if (wellInside( fts, dir, *
i, result))
return true;
216 if (wellInside( fts, dir, *
i, result))
return true;
223 #ifndef CMS_NO_MUTABLE
225 return thePropagator;
236 result.push_back(*
i);
243 result.push_back(*
i);
250 typedef std::vector<const DetLayer*> Lvect;
251 typedef std::set<const DetLayer *> Lset;
257 Lset layerToTry,nextLayerToTry;
259 Lvect someLayers(nextLayers(fts,timeDirection));
260 layerToTry.insert(someLayers.begin(),someLayers.end());
262 while (!layerToTry.empty() && (counter++)<=150){
264 <<counter<<
"] going to check on : "<<layerToTry.size()<<
" next layers.";
266 nextLayerToTry.clear();
267 for (Lset::iterator toTry=layerToTry.begin();toTry!=layerToTry.end();++toTry){
270 <<counter<<
"] adding layer with pointer: "<<(*toTry)
271 <<
" first detid: "<<
DetIdInfo::info((*toTry)->basicComponents().front()->geographicalId());
272 collect.insert( (*toTry) );
275 Lvect nextLayers( (*toTry)->nextLayers(fts,timeDirection) );
277 <<counter<<
"] this layer has : "<<nextLayers.size()<<
" next layers.";
278 for (Lvect::iterator next=nextLayers.begin();next!=nextLayers.end();++next){
280 bool alreadyTested=
false;
281 for (Lset::iterator testMe=collect.begin();testMe!=collect.end();++testMe){
282 if ((*testMe) == (*next))
283 {alreadyTested=
true;
break;}
287 nextLayerToTry.insert( *next );
289 <<counter<<
"] to try next, layer with pointer: "<<(*next)
290 <<
" first detid: "<<
DetIdInfo::info((*next)->basicComponents().front()->geographicalId());
294 <<counter<<
"] skipping for next tryout, layer with pointer: "<<(*next)
295 <<
" first detid: "<<
DetIdInfo::info((*next)->basicComponents().front()->geographicalId());
300 <<counter<<
"] "<<nextLayerToTry.size()<<
" layers to try next so far.";
303 layerToTry.swap(nextLayerToTry);
306 edm::LogWarning(
"SimpleNavigableLayer") <<
"WARNING: compatibleLayers() more than 150 iterations!!! Bailing out..";
307 counter = -1;
return empty;
310 result.insert(result.end(),collect.begin(),collect.end());
312 <<
"Number of compatible layers: "<<result.size();
virtual float length() const =0
void pushResult(DLC &result, const FDLC &tmp) const
std::vector< BarrelDetLayer * > BDLC
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
LocalVector localDirection() const
virtual const BoundSurface & surface() const
The surface of the GeometricSearchDet.
GlobalPoint globalPosition() const
LocalError positionError() const
Geom::Theta< T > theta() const
virtual float thickness() const =0
FreeTrajectoryState * freeState(bool withErrors=true) const
virtual std::vector< const DetLayer * > compatibleLayers(const FreeTrajectoryState &fts, PropagationDirection timeDirection, int &counter) const
virtual const BoundDisk & specificSurface() const
FDLC::const_iterator ConstFDLI
std::vector< const DetLayer * > DLC
Tan< T >::type tan(const T &t)
static std::string info(const DetId &)
const LocalTrajectoryError & localError() const
GlobalError position() const
Position error submatrix.
double deltaR(double eta1, double eta2, double phi1, double phi2)
GlobalPoint position() const
const Bounds & bounds() const
const CartesianTrajectoryError & cartesianError() const
virtual const BoundCylinder & specificSurface() const
Extension of the interface.
bool wellInside(const FreeTrajectoryState &fts, PropagationDirection dir, const BarrelDetLayer *bl, DLC &result) const
Propagator & propagator(PropagationDirection dir) const
std::vector< std::vector< double > > tmp
std::vector< ForwardDetLayer * > FDLC
AnalyticalPropagator thePropagator
float outerRadius() const
The outer radius of the disk.
virtual void setPropagationDirection(PropagationDirection dir) const
float innerRadius() const
The inner radius of the disk.
const BasicVectorType & basicVector() const
TSOS crossingState(const FreeTrajectoryState &fts, PropagationDirection dir) const
BDLC::const_iterator ConstBDLI
GlobalVector globalDirection() const
T dot(const Basic3DVector &rh) const
Scalar product, or "dot" product, with a vector of same type.