File indexing completed on 2023-03-17 11:22:53
0001 #include "TIDRingBuilder.h"
0002
0003 using namespace edm;
0004 using namespace std;
0005
0006 TIDRing* TIDRingBuilder::build(const GeometricDet* aTIDRing, const TrackerGeometry* theGeomDetGeometry) {
0007 vector<const GeometricDet*> theGeometricDets = aTIDRing->components();
0008
0009
0010 vector<const GeomDet*> innerGeomDets;
0011 vector<const GeomDet*> outerGeomDets;
0012
0013
0014 double meanZ = 0;
0015 for (vector<const GeometricDet*>::const_iterator it = theGeometricDets.begin(); it != theGeometricDets.end(); it++) {
0016 meanZ = meanZ + (*it)->positionBounds().z();
0017 }
0018 meanZ = meanZ / theGeometricDets.size();
0019
0020
0021 for (vector<const GeometricDet*>::const_iterator it = theGeometricDets.begin(); it != theGeometricDets.end(); it++) {
0022 const GeomDet* theGeomDet = theGeomDetGeometry->idToDet((*it)->geographicalId());
0023
0024 if (std::abs((*it)->positionBounds().z()) < std::abs(meanZ))
0025 innerGeomDets.push_back(theGeomDet);
0026
0027 if (std::abs((*it)->positionBounds().z()) > std::abs(meanZ))
0028 outerGeomDets.push_back(theGeomDet);
0029 }
0030
0031
0032
0033
0034 return new TIDRing(innerGeomDets, outerGeomDets);
0035 }