CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Phase2OTBarrelLayerBuilder.cc
Go to the documentation of this file.
3 
4 using namespace std;
5 using namespace edm;
6 
8  const TrackerGeometry* theGeomDetGeometry)
9 {
10  // This builder is very similar to TOBLayer one. Most of the code should be put in a
11  // common place.
12 
13  vector<const GeometricDet*> theGeometricDetRods = aPhase2OTBarrelLayer->components();
14  //edm::LogInfo(TkDetLayers) << "theGeometricDetRods has size: " << theGeometricDetRods.size() ;
15 
16 
17  Phase2OTBarrelRodBuilder myPhase2OTBarrelRodBuilder;
18 
19  vector<const Phase2OTBarrelRod*> theInnerRods;
20  vector<const Phase2OTBarrelRod*> theOuterRods;
21 
22  // properly calculate the meanR value to separate rod in inner/outer.
23 
24  double meanR = 0;
25  for (unsigned int index=0; index!=theGeometricDetRods.size(); index++) meanR+=theGeometricDetRods[index]->positionBounds().perp();
26  if (theGeometricDetRods.size()!=0)
27  meanR/=(double) theGeometricDetRods.size();
28 
29  for(unsigned int index=0; index!=theGeometricDetRods.size(); index++){
30  if(theGeometricDetRods[index]->positionBounds().perp() < meanR)
31  theInnerRods.push_back(myPhase2OTBarrelRodBuilder.build(theGeometricDetRods[index],
32  theGeomDetGeometry) );
33 
34  if(theGeometricDetRods[index]->positionBounds().perp() > meanR)
35  theOuterRods.push_back(myPhase2OTBarrelRodBuilder.build(theGeometricDetRods[index],
36  theGeomDetGeometry) );
37 
38  }
39 
40  return new Phase2OTBarrelLayer(theInnerRods,theOuterRods);
41 
42 }
43 
TBPLayer Phase2OTBarrelLayer
Phase2OTBarrelRod * build(const GeometricDet *thePhase2OTBarrelRod, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
Phase2OTBarrelLayer * build(const GeometricDet *aPhase2OTBarrelLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:174