File indexing completed on 2024-04-06 12:28:49
0001 #include "TOBRodBuilder.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003
0004 using namespace edm;
0005 using namespace std;
0006
0007 TOBRod* TOBRodBuilder::build(const GeometricDet* negTOBRod,
0008 const GeometricDet* posTOBRod,
0009 const TrackerGeometry* theGeomDetGeometry) {
0010 vector<const GeometricDet*> theNegativeGeometricDets;
0011 if (negTOBRod != nullptr)
0012 theNegativeGeometricDets = negTOBRod->components();
0013 vector<const GeometricDet*> thePositiveGeometricDets;
0014 if (posTOBRod != nullptr)
0015 thePositiveGeometricDets = posTOBRod->components();
0016
0017 vector<const GeometricDet*> allGeometricDets = theNegativeGeometricDets;
0018 allGeometricDets.insert(allGeometricDets.end(), thePositiveGeometricDets.begin(), thePositiveGeometricDets.end());
0019
0020 vector<const GeomDet*> innerGeomDets;
0021 vector<const GeomDet*> outerGeomDets;
0022
0023 double meanR = (allGeometricDets[0]->positionBounds().perp() + allGeometricDets[1]->positionBounds().perp()) / 2;
0024 for (vector<const GeometricDet*>::iterator it = allGeometricDets.begin(); it != allGeometricDets.end(); it++) {
0025 const GeomDet* theGeomDet = theGeomDetGeometry->idToDet((*it)->geographicalId());
0026
0027 if ((*it)->positionBounds().perp() < meanR)
0028 innerGeomDets.push_back(theGeomDet);
0029
0030 if ((*it)->positionBounds().perp() > meanR)
0031 outerGeomDets.push_back(theGeomDet);
0032 }
0033
0034
0035
0036 return new TOBRod(innerGeomDets, outerGeomDets);
0037 }