CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
Phase2EndcapLayerDoubleDisk Class Referencefinal

#include <Phase2EndcapLayerDoubleDisk.h>

Inheritance diagram for Phase2EndcapLayerDoubleDisk:
RingedForwardLayer

Classes

struct  SubDiskPar
 

Public Member Functions

const std::vector< const GeomDet * > & basicComponents () const override
 
const std::vector< const GeometricSearchDet * > & components () const override
 
void groupedCompatibleDetsV (const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override
 
Phase2EndcapLayerDoubleDiskoperator= (const Phase2EndcapLayerDoubleDisk &)=delete
 
 Phase2EndcapLayerDoubleDisk (std::vector< const Phase2EndcapSubDisk *> &subDisks)
 
 Phase2EndcapLayerDoubleDisk (const Phase2EndcapLayerDoubleDisk &)=delete
 
SubDetector subDetector () const override
 
 ~Phase2EndcapLayerDoubleDisk () override
 

Private Member Functions

BoundDiskcomputeDisk (const std::vector< const Phase2EndcapSubDisk *> &subDisks) const
 
void fillSubDiskPars (int i)
 
std::array< int, 2 > findTwoClosest (std::vector< GlobalPoint >) const
 
std::array< int, 2 > subDiskIndicesByCrossingProximity (const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
 

Private Attributes

std::vector< SubDiskParsubDiskPars
 
std::vector< GeomDet const * > theBasicComps
 
std::atomic< std::vector< const GeometricSearchDet * > * > theComponents
 
std::vector< const Phase2EndcapSubDisk * > theComps
 
int theSubDisksSize
 

Detailed Description

A concrete implementation for Phase 2 Endcap/Forward layer built out of Phase2EndcapRings

Definition at line 14 of file Phase2EndcapLayerDoubleDisk.h.

Constructor & Destructor Documentation

◆ Phase2EndcapLayerDoubleDisk() [1/2]

Phase2EndcapLayerDoubleDisk::Phase2EndcapLayerDoubleDisk ( std::vector< const Phase2EndcapSubDisk *> &  subDisks)

Definition at line 26 of file Phase2EndcapLayerDoubleDisk.cc.

27  : RingedForwardLayer(true), theComponents{nullptr} {
28  theSubDisksSize = subDisks.size();
29  LogDebug("TkDetLayers") << "Number of subdisks in Phase2 IT EC layer is " << theSubDisksSize << std::endl;
30  setSurface(computeDisk(subDisks));
31 
32  for (unsigned int i = 0; i != subDisks.size(); ++i) {
33  theComps.push_back(subDisks[i]);
35  theBasicComps.insert(
36  theBasicComps.end(), (*subDisks[i]).basicComponents().begin(), (*subDisks[i]).basicComponents().end());
37  }
38 
39  LogDebug("TkDetLayers") << "==== DEBUG Phase2EndcapLayer =====";
40  LogDebug("TkDetLayers") << "r,zed pos , thickness, innerR, outerR: " << this->position().perp() << " , "
41  << this->position().z() << " , " << this->specificSurface().bounds().thickness() << " , "
42  << this->specificSurface().innerRadius() << " , " << this->specificSurface().outerRadius();
43 }
std::vector< const Phase2EndcapSubDisk * > theComps
BoundDisk * computeDisk(const std::vector< const Phase2EndcapSubDisk *> &subDisks) const
ForwardDetLayer RingedForwardLayer
const std::vector< const GeomDet * > & basicComponents() const override
std::vector< GeomDet const * > theBasicComps
std::atomic< std::vector< const GeometricSearchDet * > * > theComponents
static int position[264][3]
Definition: ReadPGInfo.cc:289
#define LogDebug(id)

◆ ~Phase2EndcapLayerDoubleDisk()

Phase2EndcapLayerDoubleDisk::~Phase2EndcapLayerDoubleDisk ( )
override

Definition at line 49 of file Phase2EndcapLayerDoubleDisk.cc.

References DummyCfis::c, theComponents, and theComps.

49  {
50  for (auto c : theComps)
51  delete c;
52 
53  delete theComponents.load();
54 }
std::vector< const Phase2EndcapSubDisk * > theComps
std::atomic< std::vector< const GeometricSearchDet * > * > theComponents

◆ Phase2EndcapLayerDoubleDisk() [2/2]

Phase2EndcapLayerDoubleDisk::Phase2EndcapLayerDoubleDisk ( const Phase2EndcapLayerDoubleDisk )
delete

Member Function Documentation

◆ basicComponents()

const std::vector<const GeomDet*>& Phase2EndcapLayerDoubleDisk::basicComponents ( ) const
inlineoverride

Definition at line 25 of file Phase2EndcapLayerDoubleDisk.h.

References theBasicComps.

25 { return theBasicComps; }
std::vector< GeomDet const * > theBasicComps

◆ components()

const std::vector< const GeometricSearchDet * > & Phase2EndcapLayerDoubleDisk::components ( ) const
override

Definition at line 15 of file Phase2EndcapLayerDoubleDisk.cc.

References Exception.

15  {
16  throw cms::Exception("Phase2EndcapLayerDoubleDisk::components() is not implemented");
17 }

◆ computeDisk()

BoundDisk * Phase2EndcapLayerDoubleDisk::computeDisk ( const std::vector< const Phase2EndcapSubDisk *> &  subDisks) const
private

Definition at line 45 of file Phase2EndcapLayerDoubleDisk.cc.

References tkDetUtil::computeDisk().

45  {
46  return tkDetUtil::computeDisk(subDisks);
47 }
BoundDisk * computeDisk(const std::vector< const T *> &structures)
Definition: TkDetUtil.h:236

◆ fillSubDiskPars()

void Phase2EndcapLayerDoubleDisk::fillSubDiskPars ( int  i)
private

Definition at line 19 of file Phase2EndcapLayerDoubleDisk.cc.

References funct::abs(), mps_fire::i, and Phase2EndcapLayerDoubleDisk::SubDiskPar::theSubDiskZ.

19  {
20  const BoundDisk& subDiskDisk = static_cast<const BoundDisk&>(theComps[i]->surface());
21  SubDiskPar tempPar;
22  tempPar.theSubDiskZ = std::abs(subDiskDisk.position().z());
23  subDiskPars.push_back(tempPar);
24 }
std::vector< const Phase2EndcapSubDisk * > theComps
std::vector< SubDiskPar > subDiskPars
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ findTwoClosest()

std::array< int, 2 > Phase2EndcapLayerDoubleDisk::findTwoClosest ( std::vector< GlobalPoint subDiskCrossing) const
private

Definition at line 169 of file Phase2EndcapLayerDoubleDisk.cc.

References funct::abs(), mps_fire::i, subDiskPars, theSubDisksSize, and z.

Referenced by subDiskIndicesByCrossingProximity().

169  {
170  std::array<int, 2> theBins = {{-1, -1}};
171  theBins[0] = 0;
172  float initialZ = subDiskPars[0].theSubDiskZ;
173  float zDiff0 = std::abs(subDiskCrossing[0].z() - initialZ);
174  float zDiff1 = -1.;
175  for (int i = 1; i < theSubDisksSize; i++) {
176  float subDiskZ = subDiskPars[i].theSubDiskZ;
177  float testDiff = std::abs(subDiskCrossing[i].z() - subDiskZ);
178  if (testDiff < zDiff0) {
179  zDiff1 = zDiff0;
180  zDiff0 = testDiff;
181  theBins[1] = theBins[0];
182  theBins[0] = i;
183  } else if (zDiff1 < 0 || testDiff < zDiff1) {
184  zDiff1 = testDiff;
185  theBins[1] = i;
186  }
187  }
188 
189  return theBins;
190 }
std::vector< SubDiskPar > subDiskPars
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ groupedCompatibleDetsV()

void Phase2EndcapLayerDoubleDisk::groupedCompatibleDetsV ( const TrajectoryStateOnSurface tsos,
const Propagator prop,
const MeasurementEstimator est,
std::vector< DetGroup > &  result 
) const
override

Definition at line 56 of file Phase2EndcapLayerDoubleDisk.cc.

References funct::abs(), DetGroupMerger::addSameLevel(), alongMomentum, EcalPhiSymFlatTableProducers_cfi::fill, TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), mps_fire::i, eostools::move(), DetGroupMerger::orderAndMergeTwoLevels(), position, Propagator::propagationDirection(), mps_fire::result, subDiskIndicesByCrossingProximity(), theComps, theSubDisksSize, z, and PV3DBase< T, PVType, FrameType >::z().

59  {
60  std::array<int, 2> const& subDiskIndices = subDiskIndicesByCrossingProximity(startingState, prop);
61 
62  //order subdisks in z
63  //Subdisk near in z: 0, Subdisk far in z: 1
64  std::vector<int> subDiskOrder(theSubDisksSize);
65  std::fill(subDiskOrder.begin(), subDiskOrder.end(), 1);
66  if (theSubDisksSize > 1) {
67  if (std::abs(theComps[0]->position().z()) < std::abs(theComps[1]->position().z())) {
68  for (int i = 0; i < theSubDisksSize; i++) {
69  if (i % 2 == 0)
70  subDiskOrder[i] = 0;
71  }
72  } else if (std::abs(theComps[0]->position().z()) > std::abs(theComps[1]->position().z())) {
73  std::fill(subDiskOrder.begin(), subDiskOrder.end(), 0);
74  for (int i = 0; i < theSubDisksSize; i++) {
75  if (i % 2 == 0)
76  subDiskOrder[i] = 1;
77  }
78  } else {
79  throw DetLayerException("SubDisks in Endcap Layer have same z position, no idea how to order them!");
80  }
81  }
82 
83  auto index = [&subDiskIndices, &subDiskOrder](int i) { return subDiskOrder[subDiskIndices[i]]; };
84 
85  std::vector<DetGroup> closestResult;
86  theComps[subDiskIndices[0]]->groupedCompatibleDetsV(startingState, prop, est, closestResult);
87  // if the closest is empty, use the next one and exit: inherited from TID !
88  if (closestResult.empty()) {
89  theComps[subDiskIndices[1]]->groupedCompatibleDetsV(startingState, prop, est, result);
90  return;
91  }
92 
93  // check if next subdisk is found
94 
95  bool subdisk1ok = subDiskIndices[1] != -1;
96 
97  // determine if we are propagating from in to out (0) or from out to in (1)
98 
99  int direction = 0;
100  if (startingState.globalPosition().z() * startingState.globalMomentum().z() > 0) {
101  if (prop.propagationDirection() == alongMomentum)
102  direction = 0;
103  else
104  direction = 1;
105  } else {
106  if (prop.propagationDirection() == alongMomentum)
107  direction = 1;
108  else
109  direction = 0;
110  }
111 
112  if (index(0) == index(1)) {
113  if (subdisk1ok) {
114  std::vector<DetGroup> subdisk1res;
115  theComps[subDiskIndices[1]]->groupedCompatibleDetsV(startingState, prop, est, subdisk1res);
116  DetGroupMerger::addSameLevel(std::move(subdisk1res), closestResult);
117  result.swap(closestResult);
118  return;
119  }
120  } else {
121  std::vector<DetGroup> subdisk1res;
122  if (subdisk1ok) {
123  theComps[subDiskIndices[1]]->groupedCompatibleDetsV(startingState, prop, est, subdisk1res);
124  }
125  if (!subdisk1res.empty()) {
127  std::move(closestResult), std::move(subdisk1res), result, index(0), direction);
128  return;
129  } else {
130  result.swap(closestResult);
131  return;
132  }
133  }
134 }
std::vector< const Phase2EndcapSubDisk * > theComps
Common base class.
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
static void addSameLevel(std::vector< DetGroup > &&gvec, std::vector< DetGroup > &result)
std::array< int, 2 > subDiskIndicesByCrossingProximity(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static int position[264][3]
Definition: ReadPGInfo.cc:289
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
def move(src, dest)
Definition: eostools.py:511

◆ operator=()

Phase2EndcapLayerDoubleDisk& Phase2EndcapLayerDoubleDisk::operator= ( const Phase2EndcapLayerDoubleDisk )
delete

◆ subDetector()

SubDetector Phase2EndcapLayerDoubleDisk::subDetector ( ) const
inlineoverride

◆ subDiskIndicesByCrossingProximity()

std::array< int, 2 > Phase2EndcapLayerDoubleDisk::subDiskIndicesByCrossingProximity ( const TrajectoryStateOnSurface startingState,
const Propagator prop 
) const
private

Definition at line 136 of file Phase2EndcapLayerDoubleDisk.cc.

References findTwoClosest(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), mps_fire::i, Propagator::propagationDirection(), rho, theComps, theSubDisksSize, and TrajectoryStateOnSurface::transverseCurvature().

Referenced by groupedCompatibleDetsV().

137  {
138  typedef HelixForwardPlaneCrossing Crossing;
140 
141  HelixPlaneCrossing::PositionType startPos(startingState.globalPosition());
142  HelixPlaneCrossing::DirectionType startDir(startingState.globalMomentum());
144  float rho(startingState.transverseCurvature());
145 
146  // calculate the crossings with the subdisk surfaces
147 
148  Crossing myXing(startPos, startDir, rho, propDir);
149 
150  std::vector<GlobalPoint> subDiskCrossings;
151  subDiskCrossings.reserve(theSubDisksSize);
152 
153  for (int i = 0; i < theSubDisksSize; i++) {
154  const BoundDisk& theSubDisk = static_cast<const BoundDisk&>(theComps[i]->surface());
155  pair<bool, double> pathlen = myXing.pathLength(theSubDisk);
156  if (pathlen.first) {
157  subDiskCrossings.push_back(GlobalPoint(myXing.position(pathlen.second)));
158  } else {
159  // TO FIX.... perhaps there is something smarter to do
160  subDiskCrossings.push_back(GlobalPoint(0., 0., 0.));
161  }
162  }
163 
164  //find two closest subdisks to the crossing
165 
166  return findTwoClosest(subDiskCrossings);
167 }
std::vector< const Phase2EndcapSubDisk * > theComps
std::array< int, 2 > findTwoClosest(std::vector< GlobalPoint >) const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
PropagationDirection
GlobalPoint globalPosition() const
GlobalVector globalMomentum() const
Vector2DBase< float, LocalTag > Local2DVector

Member Data Documentation

◆ subDiskPars

std::vector<SubDiskPar> Phase2EndcapLayerDoubleDisk::subDiskPars
private

Definition at line 55 of file Phase2EndcapLayerDoubleDisk.h.

Referenced by findTwoClosest().

◆ theBasicComps

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

Definition at line 49 of file Phase2EndcapLayerDoubleDisk.h.

Referenced by basicComponents().

◆ theComponents

std::atomic<std::vector<const GeometricSearchDet*>*> Phase2EndcapLayerDoubleDisk::theComponents
mutableprivate

Definition at line 50 of file Phase2EndcapLayerDoubleDisk.h.

Referenced by ~Phase2EndcapLayerDoubleDisk().

◆ theComps

std::vector<const Phase2EndcapSubDisk*> Phase2EndcapLayerDoubleDisk::theComps
private

◆ theSubDisksSize

int Phase2EndcapLayerDoubleDisk::theSubDisksSize
private