CMS 3D CMS Logo

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  vector<const DetLayer*> myLayers;
9 
10  FTS myFts(aFts.parameters());
11 
12  vector<const DetLayer*> nextLayers = theStartingLayerFinder(myFts, deltaR(), deltaZ());
13 
14  vector<const DetLayer*> dummy;
15 
16  bool inside = true;
17  while (inside) {
18  inside = false;
19  for (vector<const DetLayer*>::iterator ilay = nextLayers.begin(); ilay != nextLayers.end(); ilay++) {
20  TSOS pTsos = propagator()->propagate(myFts, (**ilay).surface());
21 
22  if (pTsos.isValid()) {
23  inside = true;
24 
25  if ((**ilay).location() == GeomDetEnumerators::barrel) {
26  Range barrZRange((**ilay).position().z() - 0.5 * ((**ilay).surface().bounds().length()),
27  (**ilay).position().z() + 0.5 * ((**ilay).surface().bounds().length()));
28  Range trajZRange(pTsos.globalPosition().z() - deltaZ(), pTsos.globalPosition().z() + deltaZ());
29 
30  if (rangesIntersect(trajZRange, barrZRange))
31  myLayers.push_back(*ilay);
32 
33  } else if ((**ilay).location() == GeomDetEnumerators::endcap) {
34  const ForwardDetLayer* fwd = dynamic_cast<const ForwardDetLayer*>(*ilay);
35  Range fwdRRange((*fwd).specificSurface().innerRadius(), (*fwd).specificSurface().outerRadius());
36  Range trajRRange(pTsos.globalPosition().perp() - deltaR(), pTsos.globalPosition().perp() + deltaR());
37 
38  if (rangesIntersect(trajRRange, fwdRRange))
39  myLayers.push_back(*ilay);
40  }
41 
42  myFts = FTS(pTsos.globalParameters());
43 
44  nextLayers = theSchool->nextLayers(**ilay, *pTsos.freeState(), propagator()->propagationDirection());
45 
46  break;
47  }
48  }
49  }
50 
51  return myLayers;
52 }
53 
54 vector<const BarrelDetLayer*> LayerCollector::barrelLayers(const FTS& aFts) const {
55  vector<const DetLayer*> all = allLayers(aFts);
56  vector<const BarrelDetLayer*> barrelLayers;
57 
58  for (vector<const DetLayer*>::iterator ilay = all.begin(); ilay != all.end(); ilay++) {
59  if (const BarrelDetLayer* myBarrel = dynamic_cast<const BarrelDetLayer*>(*ilay))
60  barrelLayers.push_back(myBarrel);
61  }
62 
63  return barrelLayers;
64 }
65 
66 vector<const ForwardDetLayer*> LayerCollector::forwardLayers(const FTS& aFts) const {
67  vector<const DetLayer*> all = allLayers(aFts);
68  vector<const ForwardDetLayer*> fwdLayers;
69 
70  for (vector<const DetLayer*>::iterator ilay = all.begin(); ilay != all.end(); ilay++) {
71  if (const ForwardDetLayer* myFwd = dynamic_cast<const ForwardDetLayer*>(*ilay))
72  fwdLayers.push_back(myFwd);
73  }
74 
75  return fwdLayers;
76 }
FreeTrajectoryState FTS
T perp() const
Definition: PV3DBase.h:69
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
T z() const
Definition: PV3DBase.h:61
std::vector< const ForwardDetLayer * > forwardLayers(const FTS &aFts) const
const GlobalTrajectoryParameters & globalParameters() const
std::vector< const DetLayer * > allLayers(const FTS &aFts) const
const GlobalTrajectoryParameters & parameters() const
GlobalPoint globalPosition() const
std::pair< float, float > Range
bool rangesIntersect(const Range &a, const Range &b)
FreeTrajectoryState const * freeState(bool withErrors=true) const
std::vector< const BarrelDetLayer * > barrelLayers(const FTS &aFts) const