CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
TIDLayer Class Reference

#include <TIDLayer.h>

Inheritance diagram for TIDLayer:
RingedForwardLayer

Classes

struct  RingPar
 

Public Member Functions

virtual const std::vector
< const GeomDet * > & 
basicComponents () const
 
virtual const std::vector
< const GeometricSearchDet * > & 
components () const __attribute__((cold))
 
void groupedCompatibleDetsV (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const __attribute__((hot))
 
virtual SubDetector subDetector () const
 
 TIDLayer (std::vector< const TIDRing * > &rings) __attribute__((cold))
 
 ~TIDLayer () __attribute__((cold))
 

Private Member Functions

BoundDiskcomputeDisk (const std::vector< const TIDRing * > &rings) const __attribute__((cold))
 
float computeWindowSize (const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const __attribute__((hot))
 
void fillRingPars (int i) __attribute__((cold))
 
int findClosest (const GlobalPoint[3]) const __attribute__((hot))
 
int findNextIndex (const GlobalPoint[3], int) const __attribute__((hot))
 
bool overlapInR (const TrajectoryStateOnSurface &tsos, int i, double ymax) const __attribute__((hot))
 
std::array< int, 3 > ringIndicesByCrossingProximity (const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
 

Private Attributes

RingPar ringPars [3]
 
std::vector< GeomDet const * > theBasicComps
 
const TIDRingtheComps [3]
 

Detailed Description

A concrete implementation for TID layer built out of TIDRings

Definition at line 15 of file TIDLayer.h.

Constructor & Destructor Documentation

TIDLayer::TIDLayer ( std::vector< const TIDRing * > &  rings)

Definition at line 114 of file TIDLayer.cc.

References basicComponents(), computeDisk(), fillRingPars(), i, LogDebug, position, theBasicComps, and theComps.

114  :
115  RingedForwardLayer(true) {
116  //They should be already R-ordered. TO BE CHECKED!!
117  //sort( theRings.begin(), theRings.end(), DetLessR());
118 
119  if ( rings.size() != 3) throw DetLayerException("Number of rings in TID layer is not equal to 3 !!");
120  setSurface( computeDisk( rings ) );
121 
122  for(int i=0; i!=3; ++i) {
123  theComps[i]=rings[i];
124  fillRingPars(i);
125  theBasicComps.insert(theBasicComps.end(),
126  (*rings[i]).basicComponents().begin(),
127  (*rings[i]).basicComponents().end());
128  }
129 
130 
131  LogDebug("TkDetLayers") << "==== DEBUG TIDLayer =====" ;
132  LogDebug("TkDetLayers") << "r,zed pos , thickness, innerR, outerR: "
133  << this->position().perp() << " , "
134  << this->position().z() << " , "
135  << this->specificSurface().bounds().thickness() << " , "
136  << this->specificSurface().innerRadius() << " , "
137  << this->specificSurface().outerRadius() ;
138 }
#define LogDebug(id)
Common base class.
int i
Definition: DBlmapReader.cc:9
ForwardDetLayer RingedForwardLayer
std::vector< GeomDet const * > theBasicComps
Definition: TIDLayer.h:59
virtual const std::vector< const GeomDet * > & basicComponents() const
Definition: TIDLayer.h:22
void fillRingPars(int i) __attribute__((cold))
Definition: TIDLayer.cc:102
static int position[264][3]
Definition: ReadPGInfo.cc:509
BoundDisk * computeDisk(const std::vector< const TIDRing * > &rings) const __attribute__((cold))
Definition: TIDLayer.cc:142
const TIDRing * theComps[3]
Definition: TIDLayer.h:60
TIDLayer::~TIDLayer ( )

Definition at line 172 of file TIDLayer.cc.

References EnergyCorrector::c, and theComps.

172  {
173  for (auto c : theComps) delete c;
174 }
const TIDRing * theComps[3]
Definition: TIDLayer.h:60

Member Function Documentation

virtual const std::vector<const GeomDet*>& TIDLayer::basicComponents ( ) const
inlinevirtual

Definition at line 22 of file TIDLayer.h.

References theBasicComps.

Referenced by TIDLayer().

22 {return theBasicComps;}
std::vector< GeomDet const * > theBasicComps
Definition: TIDLayer.h:59
const std::vector< const GeometricSearchDet * > & TIDLayer::components ( ) const
virtual

Definition at line 94 of file TIDLayer.cc.

References EnergyCorrector::c.

94  {
95  static std::vector<const GeometricSearchDet*> crap;
96  for ( auto c: theComps) crap.push_back(c);
97  return crap;
98  }
const TIDRing * theComps[3]
Definition: TIDLayer.h:60
BoundDisk * TIDLayer::computeDisk ( const std::vector< const TIDRing * > &  rings) const
private

Definition at line 142 of file TIDLayer.cc.

References i, bookConverter::max, min(), makeMuonMisalignmentScenario::rot, SiStripMonitorClusterAlca_cfi::zmax, SiStripMonitorClusterAlca_cfi::zmin, and zPos.

Referenced by TIDLayer().

143 {
144  float theRmin = rings.front()->specificSurface().innerRadius();
145  float theRmax = rings.front()->specificSurface().outerRadius();
146  float theZmin = rings.front()->position().z() -
147  rings.front()->surface().bounds().thickness()/2;
148  float theZmax = rings.front()->position().z() +
149  rings.front()->surface().bounds().thickness()/2;
150 
151  for (vector<const TIDRing*>::const_iterator i = rings.begin(); i != rings.end(); i++) {
152  float rmin = (**i).specificSurface().innerRadius();
153  float rmax = (**i).specificSurface().outerRadius();
154  float zmin = (**i).position().z() - (**i).surface().bounds().thickness()/2.;
155  float zmax = (**i).position().z() + (**i).surface().bounds().thickness()/2.;
156  theRmin = min( theRmin, rmin);
157  theRmax = max( theRmax, rmax);
158  theZmin = min( theZmin, zmin);
159  theZmax = max( theZmax, zmax);
160  }
161 
162  float zPos = (theZmax+theZmin)/2.;
163  PositionType pos(0.,0.,zPos);
165 
166  return new BoundDisk( pos, rot, new SimpleDiskBounds(theRmin, theRmax,
167  theZmin-zPos, theZmax-zPos));
168 
169 }
TkRotation< Scalar > RotationType
Definition: Definitions.h:29
int i
Definition: DBlmapReader.cc:9
double zPos
Point3DBase< Scalar, GlobalTag > PositionType
Definition: Definitions.h:30
T min(T a, T b)
Definition: MathUtil.h:58
Disk BoundDisk
Definition: BoundDisk.h:62
float TIDLayer::computeWindowSize ( const GeomDet det,
const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
) const
private

Definition at line 291 of file TIDLayer.cc.

References MeasurementEstimator::maximalLocalDisplacement(), GeomDet::surface(), and PV2DBase< T, PVType, FrameType >::y().

Referenced by groupedCompatibleDetsV().

294 {
295  const Plane& startPlane = det->surface();
297  est.maximalLocalDisplacement( tsos, startPlane);
298  return maxDistance.y();
299 }
T y() const
Definition: PV2DBase.h:46
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
Definition: Plane.h:17
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const
void TIDLayer::fillRingPars ( int  i)
private

Definition at line 102 of file TIDLayer.cc.

References funct::abs(), and i.

Referenced by TIDLayer().

102  {
103  const BoundDisk& ringDisk = static_cast<const BoundDisk&>(theComps[i]->surface());
104  float ringMinZ = std::abs( ringDisk.position().z()) - ringDisk.bounds().thickness()/2.;
105  float ringMaxZ = std::abs( ringDisk.position().z()) + ringDisk.bounds().thickness()/2.;
106  ringPars[i].thetaRingMin = ringDisk.innerRadius()/ ringMaxZ;
107  ringPars[i].thetaRingMax = ringDisk.outerRadius()/ ringMinZ;
108  ringPars[i].theRingR=( ringDisk.innerRadius() +
109  ringDisk.outerRadius())/2.;
110 
111 }
int i
Definition: DBlmapReader.cc:9
float thetaRingMin
Definition: TIDLayer.h:61
float thetaRingMax
Definition: TIDLayer.h:61
RingPar ringPars[3]
Definition: TIDLayer.h:62
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual const BoundSurface & surface() const
The surface of the GeometricSearchDet.
Definition: TIDRing.h:21
const TIDRing * theComps[3]
Definition: TIDLayer.h:60
int TIDLayer::findClosest ( const GlobalPoint  ringCrossing[3]) const
private

Definition at line 303 of file TIDLayer.cc.

References funct::abs(), i, perp(), ringPars, and TIDLayer::RingPar::theRingR.

Referenced by ringIndicesByCrossingProximity().

304 {
305  int theBin = 0;
306  float initialR = ringPars[0].theRingR;
307  float rDiff = std::abs( ringCrossing[0].perp() - initialR);
308  for (int i = 1; i < 3 ; i++){
309  float ringR = ringPars[i].theRingR;
310  float testDiff = std::abs( ringCrossing[i].perp() - ringR);
311  if ( testDiff<rDiff ) {
312  rDiff = testDiff;
313  theBin = i;
314  }
315  }
316  return theBin;
317 }
int i
Definition: DBlmapReader.cc:9
RingPar ringPars[3]
Definition: TIDLayer.h:62
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T perp() const
Magnitude of transverse component.
int TIDLayer::findNextIndex ( const GlobalPoint  ringCrossing[3],
int  closest 
) const
private

Definition at line 320 of file TIDLayer.cc.

References funct::abs(), i, perp(), ringPars, and TIDLayer::RingPar::theRingR.

Referenced by ringIndicesByCrossingProximity().

321 {
322 
323  int firstIndexToCheck = (closest != 0)? 0 : 1;
324  float initialR = ringPars[firstIndexToCheck].theRingR;
325  float rDiff = std::abs( ringCrossing[firstIndexToCheck].perp() - initialR);
326  int theBin = firstIndexToCheck;
327  for (int i = firstIndexToCheck+1; i < 3 ; i++){
328  if ( i != closest) {
329  float ringR = ringPars[i].theRingR;
330  float testDiff = std::abs( ringCrossing[i].perp() - ringR);
331  if ( testDiff<rDiff ) {
332  rDiff = testDiff;
333  theBin = i;
334  }
335  }
336  }
337  return theBin;
338 }
int i
Definition: DBlmapReader.cc:9
RingPar ringPars[3]
Definition: TIDLayer.h:62
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T perp() const
Magnitude of transverse component.
void TIDLayer::groupedCompatibleDetsV ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const

Definition at line 179 of file TIDLayer.cc.

References computeWindowSize(), constexpr, TIDRing::groupedCompatibleDetsV(), i, cmsHarvester::index, overlapInR(), query::result, ringIndicesByCrossingProximity(), and theComps.

183 {
184  std::array<int,3> const & ringIndices = ringIndicesByCrossingProximity(startingState,prop);
185  if ( ringIndices[0]==-1 ) {
186  edm::LogError("TkDetLayers") << "TkRingedForwardLayer::groupedCompatibleDets : error in CrossingProximity";
187  return;
188  }
189 
190  std::array<vector<DetGroup>,3> groupsAtRingLevel;
191  //order is ring3,ring1,ring2 i.e. 2 0 1
192  // 0 1 2
193  constexpr int ringOrder[3]{1,2,0};
194  auto index = [&ringIndices,& ringOrder](int i) { return ringOrder[ringIndices[i]];};
195 
196  auto & closestResult = groupsAtRingLevel[index(0)];
197  theComps[ringIndices[0]]->groupedCompatibleDetsV( startingState, prop, est, closestResult);
198  if ( closestResult.empty() ){
199  theComps[ringIndices[1]]->groupedCompatibleDetsV( startingState, prop, est, result);
200  return;
201  }
202 
203  DetGroupElement closestGel( closestResult.front().front());
204  float rWindow = computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
205 
206  if(!overlapInR(closestGel.trajectoryState(),ringIndices[1],rWindow)) {
207  result.swap(closestResult);
208  return;
209  }
210 
211 
212  auto & nextResult = groupsAtRingLevel[index(1)];
213  theComps[ringIndices[1]]->groupedCompatibleDetsV( startingState, prop, est, nextResult);
214  if(nextResult.empty()) {
215  result.swap(closestResult);
216  return;
217  }
218 
219  if(!overlapInR(closestGel.trajectoryState(),ringIndices[2],rWindow) ) {
220  //then merge 2 levels & return
221  orderAndMergeLevels(closestGel.trajectoryState(),prop,groupsAtRingLevel,result);
222  return;
223  }
224 
225  auto & nextNextResult = groupsAtRingLevel[index(2)];
226  theComps[ringIndices[2]]->groupedCompatibleDetsV( startingState, prop, est, nextNextResult);
227  if(nextNextResult.empty()) {
228  // then merge 2 levels and return
229  orderAndMergeLevels(closestGel.trajectoryState(),prop,groupsAtRingLevel,result); //
230  return;
231  }
232 
233  // merge 3 level and return merged
234  orderAndMergeLevels(closestGel.trajectoryState(),prop,groupsAtRingLevel, result);
235 }
int i
Definition: DBlmapReader.cc:9
std::array< int, 3 > ringIndicesByCrossingProximity(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
Definition: TIDLayer.cc:239
#define constexpr
tuple result
Definition: query.py:137
bool overlapInR(const TrajectoryStateOnSurface &tsos, int i, double ymax) const __attribute__((hot))
Definition: TIDLayer.cc:343
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const __attribute__((hot))
Definition: TIDLayer.cc:291
const TIDRing * theComps[3]
Definition: TIDLayer.h:60
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const __attribute__((hot))
Definition: TIDRing.cc:92
bool TIDLayer::overlapInR ( const TrajectoryStateOnSurface tsos,
int  i,
double  ymax 
) const
private

Definition at line 343 of file TIDLayer.cc.

References funct::abs(), f, TrajectoryStateOnSurface::globalPosition(), cmsHarvester::index, bookConverter::max, PV3DBase< T, PVType, FrameType >::perp(), ringPars, TIDLayer::RingPar::thetaRingMax, TIDLayer::RingPar::thetaRingMin, SiStripMonitorClusterAlca_cfi::ymax, and PV3DBase< T, PVType, FrameType >::z().

Referenced by groupedCompatibleDetsV().

344 {
345  // assume "fixed theta window", i.e. margin in local y = r is changing linearly with z
346  float tsRadius = tsos.globalPosition().perp();
347  float thetamin = ( max(0.,tsRadius-ymax))/(std::abs(tsos.globalPosition().z())+10.f); // add 10 cm contingency
348  float thetamax = ( tsRadius + ymax)/(std::abs(tsos.globalPosition().z())-10.f);
349 
350  // do the theta regions overlap ?
351 
352  return !( thetamin > ringPars[index].thetaRingMax || ringPars[index].thetaRingMin > thetamax);
353 }
T perp() const
Definition: PV3DBase.h:72
GlobalPoint globalPosition() const
float thetaRingMin
Definition: TIDLayer.h:61
float thetaRingMax
Definition: TIDLayer.h:61
RingPar ringPars[3]
Definition: TIDLayer.h:62
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
std::array< int, 3 > TIDLayer::ringIndicesByCrossingProximity ( const TrajectoryStateOnSurface startingState,
const Propagator prop 
) const
private

Definition at line 239 of file TIDLayer.cc.

References findClosest(), findNextIndex(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), i, Propagator::propagationDirection(), rho, TIDRing::surface(), theComps, and TrajectoryStateOnSurface::transverseCurvature().

Referenced by groupedCompatibleDetsV().

241 {
242  typedef HelixForwardPlaneCrossing Crossing;
244 
245  HelixPlaneCrossing::PositionType startPos( startingState.globalPosition());
246  HelixPlaneCrossing::DirectionType startDir( startingState.globalMomentum());
248  float rho( startingState.transverseCurvature());
249 
250  // calculate the crossings with the ring surfaces
251  // rings are assumed to be sorted in R !
252 
253  Crossing myXing( startPos, startDir, rho, propDir );
254 
255  GlobalPoint ringCrossings[3];
256  // vector<GlobalVector> ringXDirections;
257 
258  for (int i = 0; i < 3 ; i++ ) {
259  const BoundDisk & theRing = static_cast<const BoundDisk &>(theComps[i]->surface());
260  pair<bool,double> pathlen = myXing.pathLength( theRing);
261  if ( pathlen.first ) {
262  ringCrossings[i] = GlobalPoint( myXing.position(pathlen.second ));
263  // ringXDirections.push_back( GlobalVector( myXing.direction(pathlen.second )));
264  } else {
265  // TO FIX.... perhaps there is something smarter to do
266  //throw DetLayerException("trajectory doesn't cross TID rings");
267  ringCrossings[i] = GlobalPoint( 0.,0.,0.);
268  // ringXDirections.push_back( GlobalVector( 0.,0.,0.));
269  }
270  }
271 
272  int closestIndex = findClosest(ringCrossings);
273  int nextIndex = findNextIndex(ringCrossings,closestIndex);
274  if ( closestIndex<0 || nextIndex<0 ) return std::array<int,3>{{-1,-1,-1}};
275  int nextNextIndex = -1;
276  for(int i=0; i<3 ; i++){
277  if(i!= closestIndex && i!=nextIndex) {
278  nextNextIndex = i;
279  break;
280  }
281  }
282 
283  std::array<int,3> indices{{closestIndex,nextIndex,nextNextIndex}};
284  return indices;
285 }
int i
Definition: DBlmapReader.cc:9
virtual PropagationDirection propagationDirection() const
Definition: Propagator.h:155
Definition: DDAxes.h:10
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint globalPosition() const
Vector2DBase< float, LocalTag > Local2DVector
PropagationDirection
virtual const BoundSurface & surface() const
The surface of the GeometricSearchDet.
Definition: TIDRing.h:21
GlobalVector globalMomentum() const
const TIDRing * theComps[3]
Definition: TIDLayer.h:60
int findClosest(const GlobalPoint[3]) const __attribute__((hot))
Definition: TIDLayer.cc:303
int findNextIndex(const GlobalPoint[3], int) const __attribute__((hot))
Definition: TIDLayer.cc:320
virtual SubDetector TIDLayer::subDetector ( ) const
inlinevirtual

Definition at line 32 of file TIDLayer.h.

References GeomDetEnumerators::TID.

Member Data Documentation

RingPar TIDLayer::ringPars[3]
private

Definition at line 62 of file TIDLayer.h.

Referenced by findClosest(), findNextIndex(), and overlapInR().

std::vector<GeomDet const*> TIDLayer::theBasicComps
private

Definition at line 59 of file TIDLayer.h.

Referenced by basicComponents(), and TIDLayer().

const TIDRing* TIDLayer::theComps[3]
private