CMS 3D CMS Logo

List of all members | Public Member Functions
TOBLayerBuilder Class Reference

#include <TOBLayerBuilder.h>

Public Member Functions

TOBLayerbuild (const GeometricDet *aTOBLayer, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
 
 TOBLayerBuilder ()
 

Detailed Description

A concrete builder for TOBLayer

Definition at line 15 of file TOBLayerBuilder.h.

Constructor & Destructor Documentation

TOBLayerBuilder::TOBLayerBuilder ( )
inline

Definition at line 17 of file TOBLayerBuilder.h.

References build().

17 {};

Member Function Documentation

TOBLayer * TOBLayerBuilder::build ( const GeometricDet aTOBLayer,
const TrackerGeometry theGeomDetGeometry 
)

Definition at line 10 of file TOBLayerBuilder.cc.

References TOBRodBuilder::build(), GeometricDet::components(), and perp().

Referenced by GeometricSearchTrackerBuilder::build(), and TOBLayerBuilder().

11  {
12 
13  vector<const GeometricDet*> theGeometricDetRods = aTOBLayer->components();
14  vector<const GeometricDet*> negativeZrods;
15  vector<const GeometricDet*> positiveZrods;
16 
17  for(vector<const GeometricDet*>::const_iterator it=theGeometricDetRods.begin();
18  it!=theGeometricDetRods.end(); it++){
19  if( (*it)->positionBounds().z() < 0) negativeZrods.push_back(*it);
20  if( (*it)->positionBounds().z() >= 0) positiveZrods.push_back(*it);
21  }
22 
23  TOBRodBuilder myTOBRodBuilder;
24 
25  vector<const TOBRod*> theInnerRods;
26  vector<const TOBRod*> theOuterRods;
27 
28  //LogDebug("TkDetLayers") << "positiveZrods[0]->positionBounds().perp(): "
29  // << positiveZrods[0]->positionBounds().perp() ;
30  //LogDebug("TkDetLayers") << "positiveZrods[1]->positionBounds().perp(): "
31  // << positiveZrods[1]->positionBounds().perp() ;
32 
33  double positiveMeanR = 0;
34  if(!positiveZrods.empty()){
35  for(unsigned int index=0; index!=positiveZrods.size(); index++){
36  positiveMeanR += positiveZrods[index]->positionBounds().perp();
37  }
38  positiveMeanR = positiveMeanR/positiveZrods.size();
39  }
40 
41 
42  double negativeMeanR = 0;
43  if(!negativeZrods.empty()){
44  for(unsigned int index=0; index!=negativeZrods.size(); index++){
45  negativeMeanR += negativeZrods[index]->positionBounds().perp();
46  }
47  negativeMeanR = negativeMeanR/negativeZrods.size();
48  }
49 
50  if(!positiveZrods.empty() && !negativeZrods.empty()){
51  for(unsigned int index=0; index!=positiveZrods.size(); index++){
52  if( positiveZrods[index]->positionBounds().phi() != negativeZrods[index]->positionBounds().phi()){
53  edm::LogError("TkDetLayers") << "ERROR:rods don't have the same phi. exit!";
54  break;
55  }
56 
57  if(positiveZrods[index]->positionBounds().perp() < positiveMeanR)
58  theInnerRods.push_back(myTOBRodBuilder.build(negativeZrods[index],
59  positiveZrods[index],
60  theGeomDetGeometry) );
61  if(positiveZrods[index]->positionBounds().perp() >= positiveMeanR)
62  theOuterRods.push_back(myTOBRodBuilder.build(negativeZrods[index],
63  positiveZrods[index],
64  theGeomDetGeometry) );
65  }
66  } else{
67  if(!positiveZrods.empty()){
68  for(unsigned int index=0; index!=positiveZrods.size(); index++){
69  if(positiveZrods[index]->positionBounds().perp() < positiveMeanR)
70  theInnerRods.push_back(myTOBRodBuilder.build(nullptr,
71  positiveZrods[index],
72  theGeomDetGeometry) );
73  if(positiveZrods[index]->positionBounds().perp() >= positiveMeanR)
74  theOuterRods.push_back(myTOBRodBuilder.build(nullptr,
75  positiveZrods[index],
76  theGeomDetGeometry) );
77  }
78  }
79  if(!negativeZrods.empty()){
80  for(unsigned int index=0; index!=negativeZrods.size(); index++){
81  if(negativeZrods[index]->positionBounds().perp() < negativeMeanR)
82  theInnerRods.push_back(myTOBRodBuilder.build(negativeZrods[index],
83  nullptr,
84  theGeomDetGeometry) );
85  if(negativeZrods[index]->positionBounds().perp() >= negativeMeanR)
86  theOuterRods.push_back(myTOBRodBuilder.build(negativeZrods[index],
87  nullptr,
88  theGeomDetGeometry) );
89  }
90  }
91  }
92 
93  //LogDebug("TkDetLayers") << "theInnerRods.size(): " << theInnerRods.size() ;
94  //LogDebug("TkDetLayers") << "theOuterRods.size(): " << theOuterRods.size() ;
95 
96 
97  return new TOBLayer(theInnerRods,theOuterRods);
98 }
TBPLayer TOBLayer
Definition: TOBLayer.h:12
TOBRod * build(const GeometricDet *negTOBRod, const GeometricDet *posTOBRod, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
Definition: TOBRodBuilder.cc:7
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:176
T perp() const
Magnitude of transverse component.