Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:27:43

0001 #ifndef TkDetLayers_LayerCrossingSide_h
0002 #define TkDetLayers_LayerCrossingSide_h
0003 
0004 // temporary solution
0005 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
0006 
0007 /** Helper class to determine if a TrajectoryStateOnSurface would cross a layer from 
0008  *  the inside, or from the outside, if propagated with a propagator with a defined 
0009  *  direction. No propagations performed, the result is very fast but not correct in 
0010  *  case of a looping track that first goes outwards, then inwards, before crossing
0011  *  a layer.
0012  */
0013 
0014 #pragma GCC visibility push(hidden)
0015 class LayerCrossingSide {
0016 public:
0017   /// returns 0 if barrel layer crossed from inside, 1 if from outside
0018   static int barrelSide(const TrajectoryStateOnSurface& startingState, const Propagator& prop) {
0019     auto pos = startingState.globalPosition();
0020     auto dir = startingState.globalMomentum();
0021     bool outwards = (pos.x() * dir.x() + pos.y() * dir.y()) > 0;
0022 
0023     auto inout = outwards ? alongMomentum : oppositeToMomentum;
0024 
0025     return (prop.propagationDirection() == inout ? 0 : 1);
0026   }
0027 
0028   /** returns 0 if endcap layer crossed from inside, ie from the side of the 
0029    *  interation region, 1 if from outside
0030    */
0031   static int endcapSide(const TrajectoryStateOnSurface& startingState, const Propagator& prop) {
0032     auto zpos = startingState.globalPosition().z();
0033     bool outwards = (startingState.globalMomentum().z() * zpos) > 0;
0034 
0035     auto inout = outwards ? alongMomentum : oppositeToMomentum;
0036 
0037     return (prop.propagationDirection() == inout ? 0 : 1);
0038   }
0039 };
0040 
0041 #pragma GCC visibility pop
0042 #endif