CMS 3D CMS Logo

CmsTrackerOTLayerBuilder.cc
Go to the documentation of this file.
10 
11 #include <vector>
12 #include <bitset>
13 
15 
16  LogTrace("DetConstruction") << " CmsTrackerOTLayerBuilder::buildComponent ";
17  CmsTrackerLadderBuilder theCmsTrackerLadderBuilder;
18  CmsTrackerOTRingBuilder theCmsTrackerOTRingBuilder;
19 
23  theCmsTrackerLadderBuilder.build(fv,subdet,s);
24  break;
26  theCmsTrackerOTRingBuilder.build( fv, subdet, s );
27  break;
28  default:
29  edm::LogError("CmsTrackerOTLayerBuilder")<<" ERROR - I was expecting a ladder or a panel, I got a "<<ExtractStringFromDDD::getString(s,&fv);
30  }
31  g->addComponent(subdet);
32 
33 }
34 
36 
38 
39  //order ladder and rings together
43  rods.clear();
44  ringsNeg.clear();
45  ringsPos.clear();
46 
47  for(uint32_t i=0; i<comp.size();i++){
48  auto component = det->component(i);
49  if(component->type()== GeometricDet::ladder){
50  rods.emplace_back(component);
51  } else if(component->type()== GeometricDet::panel){
52  if(component->translation().z() < 0.){
53  ringsNeg.emplace_back(component);
54  } else if (component->translation().z() > 0.) {
55  ringsPos.emplace_back(component);
56  }
57  } else {
58  edm::LogError("CmsTrackerOTLayerBuilder")<<"ERROR - wrong SubDet to sort..... "<<det->components().front()->type();
59  }
60  }
61 
62  // negative rings
63  if(!ringsNeg.empty()){
64  std::sort(ringsNeg.begin(),ringsNeg.end(),isLessZ);
65  uint32_t totalringsNeg = ringsNeg.size();
66 
67  LogTrace("DetConstruction") << " Neg rings ordered by z: ";
68  for ( uint32_t ring = 0; ring < totalringsNeg; ring++) {
69  uint32_t temp = ring+1;
70  temp|=(1<<8);
71  ringsNeg[ring]->setGeographicalID(temp);
72  LogTrace("BuildingTrackerDetId") << "\t\t\t DetId >> " << temp << "(r: " << sqrt(ringsNeg[ring]->translation().Perp2()) << ", phi: " << ringsNeg[ring]->phi() << ", z: " << ringsNeg[ring]->translation().z() << ")";
73  }
74  }
75 
76  // rods
77  if(!rods.empty()){
78  trackerStablePhiSort(rods.begin(), rods.end(), getPhi);
79  uint32_t totalrods = rods.size();
80 
81  LogTrace("DetConstruction") << " Rods ordered by phi: ";
82  for ( uint32_t rod = 0; rod < totalrods; rod++) {
83  uint32_t temp = rod+1;
84  temp|=(3<<8);
85  rods[rod]->setGeographicalID(DetId(temp));
86  LogTrace("BuildingTrackerDetId") << "\t\t\t DetId >> " << temp << "(r: " << sqrt(rods[rod]->translation().Perp2()) << ", phi: " << rods[rod]->phi() << ", z: " << rods[rod]->translation().z() << ")";
87  }
88  }
89 
90  // positive rings
91  if(!ringsPos.empty()){
92  std::sort(ringsPos.begin(),ringsPos.end(),isLessZ);
93  uint32_t totalringsPos = ringsPos.size();
94 
95 
96  LogTrace("DetConstruction") << " Pos rings ordered by z: ";
97  for ( uint32_t ring = 0; ring < totalringsPos; ring++) {
98  uint32_t temp = ring+1;
99  temp|=(2<<8);
100  ringsPos[ring]->setGeographicalID(temp);
101  LogTrace("BuildingTrackerDetId") << "\t\t\t DetId >> " << temp << "(r: " << sqrt(ringsPos[ring]->translation().Perp2()) << ", phi: " << ringsPos[ring]->phi() << ", z: " << ringsPos[ring]->translation().z() << ")";
102  }
103  }
104 
105  det->clearComponents();
106  det->addComponents(ringsNeg);
107  det->addComponents(rods);
108  det->addComponents(ringsPos);
109 
110 }
static bool isLessZ(const GeometricDet *a, const GeometricDet *b)
void addComponent(GeometricDet *)
void sortNS(DDFilteredView &, GeometricDet *) override
void build(DDFilteredView &, GeometricDet *, std::string) override
static double getPhi(const GeometricDet *a)
void clearComponents()
Definition: GeometricDet.h:98
std::vector< GeometricDet * > GeometricDetContainer
Definition: GeometricDet.h:37
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:176
static std::string getString(std::string const &, DDFilteredView *)
T sqrt(T t)
Definition: SSEVec.h:18
GeometricDet * component(size_t index)
Definition: GeometricDet.h:114
void trackerStablePhiSort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr)
#define LogTrace(id)
std::vector< GeometricDet const * > ConstGeometricDetContainer
Definition: GeometricDet.h:36
Definition: DetId.h:18
void buildComponent(DDFilteredView &, GeometricDet *, std::string) override
void addComponents(GeometricDetContainer const &cont)
GeometricDet::GeometricEnumType type(std::string const &) const
CmsTrackerStringToEnum theCmsTrackerStringToEnum