11 vector<const GeometricDet*> allGeometricDets = aPhase2EndcapRing->
components();
12 vector<const GeometricDet*> compGeometricDets;
13 LogDebug(
"TkDetLayers") <<
"Phase2EndcapRingBuilder with #Modules: " << allGeometricDets.size() << std::endl;
15 vector<const GeomDet*> frontGeomDets;
16 vector<const GeomDet*> backGeomDets;
21 for (vector<const GeometricDet*>::const_iterator compGeometricDets = allGeometricDets.begin();
22 compGeometricDets != allGeometricDets.end();
23 compGeometricDets++) {
24 LogTrace(
"TkDetLayers") <<
" compGeometricDets->positionBounds().perp() " 25 << (*compGeometricDets)->positionBounds().z() << std::endl;
26 meanZ =
meanZ + (*compGeometricDets)->positionBounds().z();
31 for (vector<const GeometricDet*>::const_iterator compGeometricDets = allGeometricDets.begin();
32 compGeometricDets != allGeometricDets.end();
33 compGeometricDets++) {
34 const GeomDet* theGeomDet = theGeomDetGeometry->
idToDet((*compGeometricDets)->geographicalId());
36 if (fabs((*compGeometricDets)->positionBounds().z()) < fabs(
meanZ))
37 frontGeomDets.push_back(theGeomDet);
39 if (fabs((*compGeometricDets)->positionBounds().z()) > fabs(
meanZ))
40 backGeomDets.push_back(theGeomDet);
42 if (fabs((*compGeometricDets)->positionBounds().z()) == fabs(
meanZ))
43 throw DetLayerException(
"Not possible to assiciate this GeometricDet in front or back");
46 LogDebug(
"TkDetLayers") <<
"frontGeomDets.size(): " << frontGeomDets.size();
47 LogDebug(
"TkDetLayers") <<
"backGeomDets.size(): " << backGeomDets.size();
52 vector<const GeomDet*> frontGeomDetBrothers;
53 vector<const GeomDet*> backGeomDetBrothers;
54 vector<const GeometricDet*> compGeometricDets;
58 double meanZBrothers = 0;
59 for (vector<const GeometricDet*>::const_iterator
it = allGeometricDets.begin();
it != allGeometricDets.end();
61 compGeometricDets = (*it)->components();
62 if (compGeometricDets.size() != 2) {
63 throw DetLayerException(
"Phase2OTEndcapRing is considered as a stack but does not have two components");
65 LogTrace(
"TkDetLayers") <<
" compGeometricDets[0]->positionBounds().perp() " 66 << compGeometricDets[0]->positionBounds().z() << std::endl;
67 LogTrace(
"TkDetLayers") <<
" compGeometricDets[1]->positionBounds().perp() " 68 << compGeometricDets[1]->positionBounds().z() << std::endl;
69 meanZ =
meanZ + compGeometricDets[0]->positionBounds().z();
70 meanZBrothers = meanZBrothers + compGeometricDets[1]->positionBounds().z();
74 meanZBrothers = meanZBrothers / allGeometricDets.size();
75 LogDebug(
"TkDetLayers") <<
" meanZ Lower " <<
meanZ << std::endl;
76 LogDebug(
"TkDetLayers") <<
" meanZ Upper " << meanZBrothers << std::endl;
78 for (vector<const GeometricDet*>::const_iterator
it = allGeometricDets.begin();
it != allGeometricDets.end();
80 compGeometricDets = (*it)->components();
81 const GeomDet* theGeomDet = theGeomDetGeometry->
idToDet(compGeometricDets[0]->geographicalId());
83 if (fabs(compGeometricDets[0]->positionBounds().
z()) < fabs(
meanZ))
84 frontGeomDets.push_back(theGeomDet);
86 if (fabs(compGeometricDets[0]->positionBounds().
z()) > fabs(
meanZ))
87 backGeomDets.push_back(theGeomDet);
89 const GeomDet* theGeomDetBrother = theGeomDetGeometry->
idToDet(compGeometricDets[1]->geographicalId());
91 if (fabs(compGeometricDets[1]->positionBounds().
z()) < fabs(meanZBrothers))
92 frontGeomDetBrothers.push_back(theGeomDetBrother);
94 if (fabs(compGeometricDets[1]->positionBounds().
z()) > fabs(meanZBrothers))
95 backGeomDetBrothers.push_back(theGeomDetBrother);
97 if (fabs(compGeometricDets[0]->positionBounds().
z()) == fabs(
meanZ) ||
98 fabs(compGeometricDets[1]->positionBounds().
z()) == fabs(meanZBrothers))
99 throw DetLayerException(
"Not possible to assiciate components of this GeometricDet in front or back");
102 LogDebug(
"TkDetLayers") <<
"frontGeomDets.size(): " << frontGeomDets.size();
103 LogDebug(
"TkDetLayers") <<
"backGeomDets.size(): " << backGeomDets.size();
104 LogDebug(
"TkDetLayers") <<
"frontGeomDetsBro.size(): " << frontGeomDetBrothers.size();
105 LogDebug(
"TkDetLayers") <<
"backGeomDetsBro.size(): " << backGeomDetBrothers.size();
107 return new Phase2EndcapRing(frontGeomDets, backGeomDets, frontGeomDetBrothers, backGeomDetBrothers);
ConstGeometricDetContainer & components()
const TrackerGeomDet * idToDet(DetId) const override