CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LayerCollector.cc
Go to the documentation of this file.
3 
4 using namespace std;
5 
6 vector<const DetLayer*> LayerCollector::allLayers(const FTS& aFts) const {
7 
8 
9  vector<const DetLayer*> myLayers;
10 
11 
12 
13  FTS myFts(aFts.parameters());
14 
15  vector<const DetLayer*> nextLayers = finder()->startingLayers(myFts, deltaR(), deltaZ());
16 
17  vector<const DetLayer*> dummy;
18 
19 
20 
21 
22  bool inside = true;
23  while(inside) {
24 
25  inside = false;
26  for(vector<const DetLayer*>::iterator ilay = nextLayers.begin(); ilay != nextLayers.end(); ilay++) {
27 
28 
29  TSOS pTsos = propagator()->propagate(myFts, (**ilay).surface());
30 
31 
32  if(pTsos.isValid()) {
33 
34  inside = true;
35 
36 
37 
38  if((**ilay).location() == GeomDetEnumerators::barrel) {
39 
40  Range barrZRange((**ilay).position().z() -
41  0.5*((**ilay).surface().bounds().length()),
42  (**ilay).position().z() +
43  0.5*((**ilay).surface().bounds().length()));
44  Range trajZRange(pTsos.globalPosition().z() - deltaZ(),
45  pTsos.globalPosition().z() + deltaZ());
46 
47  if(rangesIntersect(trajZRange, barrZRange))
48  myLayers.push_back(*ilay);
49 
50  } else if((**ilay).location() == GeomDetEnumerators::endcap) {
51 
52  const ForwardDetLayer* fwd =
53  dynamic_cast<const ForwardDetLayer*>(*ilay);
54  Range fwdRRange((*fwd).specificSurface().innerRadius(),
55  (*fwd).specificSurface().outerRadius());
56  Range trajRRange(pTsos.globalPosition().perp() - deltaR(),
57  pTsos.globalPosition().perp() + deltaR());
58 
59  if(rangesIntersect(trajRRange, fwdRRange))
60  myLayers.push_back(*ilay);
61 
62  }
63 
64  myFts = FTS(pTsos.globalParameters());
65 
66 
67  nextLayers = (**ilay).nextLayers(*pTsos.freeState(),
68  propagator()->propagationDirection());
69 
70 
71  break;
72 
73 
74  }
75 
76 
77 
78  }
79  }
80 
81 
82 
83 
84  return myLayers;
85 }
86 
87 vector<const BarrelDetLayer*> LayerCollector::barrelLayers(const FTS& aFts) const {
88 
89  vector<const DetLayer*> all = allLayers(aFts);
90  vector<const BarrelDetLayer*> barrelLayers;
91 
92 
93  for(vector<const DetLayer*>::iterator ilay = all.begin();
94  ilay != all.end(); ilay++) {
95 
96  if(const BarrelDetLayer* myBarrel =
97  dynamic_cast<const BarrelDetLayer*>(*ilay))
98  barrelLayers.push_back(myBarrel);
99  }
100 
101 
102  return barrelLayers;
103 }
104 
105 vector<const ForwardDetLayer*> LayerCollector::forwardLayers(const FTS& aFts) const {
106 
107  vector<const DetLayer*> all = allLayers(aFts);
108  vector<const ForwardDetLayer*> fwdLayers;
109 
110 
111  for(vector<const DetLayer*>::iterator ilay = all.begin();
112  ilay != all.end(); ilay++) {
113 
114  if(const ForwardDetLayer* myFwd =
115  dynamic_cast<const ForwardDetLayer*>(*ilay))
116  fwdLayers.push_back(myFwd);
117  }
118 
119 
120  return fwdLayers;
121 }
122 
123 
124 
125 
126 
127 
128 
129 
T perp() const
Definition: PV3DBase.h:72
const GlobalTrajectoryParameters & parameters() const
GlobalPoint globalPosition() const
std::vector< const ForwardDetLayer * > forwardLayers(const FTS &aFts) const
FreeTrajectoryState FTS
std::vector< const BarrelDetLayer * > barrelLayers(const FTS &aFts) const
std::pair< float, float > Range
bool rangesIntersect(const Range &a, const Range &b)
FreeTrajectoryState const * freeState(bool withErrors=true) const
T z() const
Definition: PV3DBase.h:64
std::vector< const DetLayer * > allLayers(const FTS &aFts) const
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
const GlobalTrajectoryParameters & globalParameters() const