File indexing completed on 2024-04-06 12:28:48
0001 #include "TECWedgeBuilder.h"
0002 #include "CompositeTECWedge.h"
0003 #include "SimpleTECWedge.h"
0004
0005 using namespace edm;
0006 using namespace std;
0007
0008 TECWedge* TECWedgeBuilder::build(const GeometricDet* aTECWedge, const TrackerGeometry* theGeomDetGeometry) {
0009 vector<const GeometricDet*> theGeometricDets = aTECWedge->components();
0010
0011
0012 if (theGeometricDets.size() == 1) {
0013 const GeomDet* theGeomDet = theGeomDetGeometry->idToDet(theGeometricDets.front()->geographicalId());
0014 return new SimpleTECWedge(theGeomDet);
0015 }
0016
0017 vector<const GeomDet*> innerGeomDets;
0018 vector<const GeomDet*> outerGeomDets;
0019
0020
0021 double meanZ = 0;
0022 for (vector<const GeometricDet*>::const_iterator it = theGeometricDets.begin(); it != theGeometricDets.end(); it++) {
0023 meanZ = meanZ + (*it)->positionBounds().z();
0024 }
0025
0026 meanZ = meanZ / theGeometricDets.size();
0027
0028
0029
0030 for (vector<const GeometricDet*>::const_iterator it = theGeometricDets.begin(); it != theGeometricDets.end(); it++) {
0031
0032 const GeomDet* theGeomDet = theGeomDetGeometry->idToDet((*it)->geographicalId());
0033
0034
0035 if (std::abs((*it)->positionBounds().z()) < std::abs(meanZ))
0036 innerGeomDets.push_back(theGeomDet);
0037
0038 if (std::abs((*it)->positionBounds().z()) > std::abs(meanZ))
0039 outerGeomDets.push_back(theGeomDet);
0040 }
0041
0042
0043
0044
0045 return new CompositeTECWedge(innerGeomDets, outerGeomDets);
0046 }