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