test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
Phase2OTBarrelLayerBuilder Class Reference

#include <Phase2OTBarrelLayerBuilder.h>

Public Member Functions

Phase2OTBarrelLayerbuild (const GeometricDet *aPhase2OTBarrelLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
 
 Phase2OTBarrelLayerBuilder ()
 

Detailed Description

A concrete builder for Phase2OTBarrelLayer

Definition at line 15 of file Phase2OTBarrelLayerBuilder.h.

Constructor & Destructor Documentation

Phase2OTBarrelLayerBuilder::Phase2OTBarrelLayerBuilder ( )
inline

Definition at line 17 of file Phase2OTBarrelLayerBuilder.h.

17 {};

Member Function Documentation

Phase2OTBarrelLayer * Phase2OTBarrelLayerBuilder::build ( const GeometricDet aPhase2OTBarrelLayer,
const TrackerGeometry theGeomDetGeometry 
)

Definition at line 9 of file Phase2OTBarrelLayerBuilder.cc.

References Phase2OTBarrelRodBuilder::build(), Phase2EndcapRingBuilder::build(), GeometricDet::components(), cmsHarvester::index, GeometricDet::ladder, LogDebug, LogTrace, and GeometricDet::panel.

Referenced by GeometricSearchTrackerBuilder::build().

11 {
12  // This builder is very similar to TOBLayer one. Most of the code should be put in a
13  // common place.
14 
15  LogTrace("TkDetLayers") << "Phase2OTBarrelLayerBuilder::build";
16  vector<const GeometricDet*> theGeometricDets = aPhase2OTBarrelLayer->components();
17  LogDebug("TkDetLayers") << "Phase2OTBarrelLayerBuilder with #Components: " << theGeometricDets.size() << std::endl;
18  vector<const GeometricDet*> theGeometricDetRods;
19  vector<const GeometricDet*> theGeometricDetRings;
20 
21  for(vector<const GeometricDet*>::const_iterator it = theGeometricDets.begin();
22  it!=theGeometricDets.end(); it++){
23 
24  if( (*it)->type() == GeometricDet::ladder) {
25  theGeometricDetRods.push_back(*it);
26  } else if( (*it)->type() == GeometricDet::panel) {
27  theGeometricDetRings.push_back(*it);
28  } else {
29  LogDebug("TkDetLayers") << "Phase2OTBarrelLayerBuilder with no Rods and no Rings! ";
30  }
31  }
32 
33  LogDebug("TkDetLayers") << "Phase2OTBarrelLayerBuilder with #Rods: " << theGeometricDetRods.size() << std::endl;
34 
35  Phase2OTBarrelRodBuilder myPhase2OTBarrelRodBuilder;
36 
37  vector<const Phase2OTBarrelRod*> theInnerRods;
38  vector<const Phase2OTBarrelRod*> theOuterRods;
39 
40  // properly calculate the meanR value to separate rod in inner/outer.
41 
42  double meanR = 0;
43  for (unsigned int index=0; index!=theGeometricDetRods.size(); index++) meanR+=theGeometricDetRods[index]->positionBounds().perp();
44  if (theGeometricDetRods.size()!=0)
45  meanR/=(double) theGeometricDetRods.size();
46 
47  for(unsigned int index=0; index!=theGeometricDetRods.size(); index++){
48  if(theGeometricDetRods[index]->positionBounds().perp() < meanR)
49  theInnerRods.push_back(myPhase2OTBarrelRodBuilder.build(theGeometricDetRods[index],
50  theGeomDetGeometry) );
51 
52  if(theGeometricDetRods[index]->positionBounds().perp() > meanR)
53  theOuterRods.push_back(myPhase2OTBarrelRodBuilder.build(theGeometricDetRods[index],
54  theGeomDetGeometry) );
55 
56  }
57 
58  if(theGeometricDetRings.empty()) return new Phase2OTBarrelLayer(theInnerRods,theOuterRods);
59 
60  LogDebug("TkDetLayers") << "Phase2OTBarrelLayerBuilder with #Rings: " << theGeometricDetRings.size() << std::endl;
61 
62  Phase2EndcapRingBuilder myPhase2EndcapRingBuilder;
63 
64  vector<const Phase2EndcapRing*> theNegativeRings;
65  vector<const Phase2EndcapRing*> thePositiveRings;
66 
67  // properly calculate the meanR value to separate rod in inner/outer.
68  double centralZ = 0.0;
69 
70  for(vector<const GeometricDet*>::const_iterator it=theGeometricDetRings.begin();
71  it!=theGeometricDetRings.end();it++){
72  if((*it)->positionBounds().z() < centralZ)
73  theNegativeRings.push_back(myPhase2EndcapRingBuilder.build( *it,theGeomDetGeometry,true ));
74  if((*it)->positionBounds().z() > centralZ)
75  thePositiveRings.push_back(myPhase2EndcapRingBuilder.build( *it,theGeomDetGeometry,true ));
76  }
77 
78  return new Phase2OTtiltedBarrelLayer(theInnerRods,theOuterRods,theNegativeRings,thePositiveRings);
79 
80 }
#define LogDebug(id)
TBPLayer Phase2OTBarrelLayer
Phase2OTBarrelRod * build(const GeometricDet *thePhase2OTBarrelRod, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:175
Phase2EndcapRing * build(const GeometricDet *aPhase2EndcapRing, const TrackerGeometry *theGeomDetGeometry, const bool useBrothers=true) __attribute__((cold))
#define LogTrace(id)