9 const bool useBrothers)
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;
22 for(vector<const GeometricDet*>::const_iterator compGeometricDets=allGeometricDets.begin(); compGeometricDets!=allGeometricDets.end();compGeometricDets++){
23 LogTrace(
"TkDetLayers") <<
" compGeometricDets->positionBounds().perp() " << (*compGeometricDets)->positionBounds().z() << std::endl;
24 meanZ = meanZ + (*compGeometricDets)->positionBounds().z();
26 meanZ = meanZ/allGeometricDets.size();
27 LogDebug(
"TkDetLayers") <<
" meanZ " << meanZ << std::endl;
29 for(vector<const GeometricDet*>::const_iterator compGeometricDets=allGeometricDets.begin();
30 compGeometricDets!=allGeometricDets.end();compGeometricDets++){
31 const GeomDet* theGeomDet = theGeomDetGeometry->
idToDet( (*compGeometricDets)->geographicalID() );
33 if( fabs( (*compGeometricDets)->positionBounds().z() ) < fabs(meanZ) )
34 frontGeomDets.push_back(theGeomDet);
36 if( fabs( (*compGeometricDets)->positionBounds().z() ) > fabs(meanZ) )
37 backGeomDets.push_back(theGeomDet);
39 if( fabs( (*compGeometricDets)->positionBounds().z() ) == fabs(meanZ) )
40 throw DetLayerException(
"Not possible to assiciate this GeometricDet in front or back");
44 LogDebug(
"TkDetLayers") <<
"frontGeomDets.size(): " << frontGeomDets.size() ;
45 LogDebug(
"TkDetLayers") <<
"backGeomDets.size(): " << backGeomDets.size() ;
51 vector<const GeomDet*> frontGeomDetBrothers;
52 vector<const GeomDet*> backGeomDetBrothers;
53 vector<const GeometricDet*> compGeometricDets;
57 double meanZBrothers = 0;
58 for(vector<const GeometricDet*>::const_iterator it=allGeometricDets.begin(); it!=allGeometricDets.end();it++){
59 compGeometricDets = (*it)->components();
60 if (compGeometricDets.size() != 2){
61 throw DetLayerException(
"Phase2OTEndcapRing is considered as a stack but does not have two components");
63 LogTrace(
"TkDetLayers") <<
" compGeometricDets[0]->positionBounds().perp() " << compGeometricDets[0]->positionBounds().z() << std::endl;
64 LogTrace(
"TkDetLayers") <<
" compGeometricDets[1]->positionBounds().perp() " << compGeometricDets[1]->positionBounds().z() << std::endl;
65 meanZ = meanZ + compGeometricDets[0]->positionBounds().z();
66 meanZBrothers = meanZBrothers + compGeometricDets[1]->positionBounds().z();
70 meanZ = meanZ/allGeometricDets.size();
71 meanZBrothers = meanZBrothers/allGeometricDets.size();
72 LogDebug(
"TkDetLayers") <<
" meanZ Lower " << meanZ << std::endl;
73 LogDebug(
"TkDetLayers") <<
" meanZ Upper " << meanZBrothers << std::endl;
75 for(vector<const GeometricDet*>::const_iterator it=allGeometricDets.begin();
76 it!=allGeometricDets.end();it++){
77 compGeometricDets = (*it)->components();
78 const GeomDet* theGeomDet = theGeomDetGeometry->
idToDet( compGeometricDets[0]->geographicalID() );
80 if( fabs( compGeometricDets[0]->positionBounds().z() ) < fabs(meanZ) )
81 frontGeomDets.push_back(theGeomDet);
83 if( fabs( compGeometricDets[0]->positionBounds().z() ) > fabs(meanZ) )
84 backGeomDets.push_back(theGeomDet);
86 const GeomDet* theGeomDetBrother = theGeomDetGeometry->
idToDet( compGeometricDets[1]->geographicalID() );
88 if( fabs( compGeometricDets[1]->positionBounds().z() ) < fabs(meanZBrothers) )
89 frontGeomDetBrothers.push_back(theGeomDetBrother);
91 if( fabs( compGeometricDets[1]->positionBounds().z() ) > fabs(meanZBrothers) )
92 backGeomDetBrothers.push_back(theGeomDetBrother);
94 if( fabs( compGeometricDets[0]->positionBounds().z() ) == fabs(meanZ) || fabs( compGeometricDets[1]->positionBounds().z() ) == fabs(meanZBrothers) )
95 throw DetLayerException(
"Not possible to assiciate components of this GeometricDet in front or back");
98 LogDebug(
"TkDetLayers") <<
"frontGeomDets.size(): " << frontGeomDets.size() ;
99 LogDebug(
"TkDetLayers") <<
"backGeomDets.size(): " << backGeomDets.size() ;
100 LogDebug(
"TkDetLayers") <<
"frontGeomDetsBro.size(): " << frontGeomDetBrothers.size() ;
101 LogDebug(
"TkDetLayers") <<
"backGeomDetsBro.size(): " << backGeomDetBrothers.size() ;
103 return new Phase2EndcapRing(frontGeomDets,backGeomDets,frontGeomDetBrothers,backGeomDetBrothers);
ConstGeometricDetContainer & components()
Phase2EndcapRing * build(const GeometricDet *aPhase2EndcapRing, const TrackerGeometry *theGeomDetGeometry, const bool useBrothers=true) __attribute__((cold))
const TrackerGeomDet * idToDet(DetId) const override