CMS 3D CMS Logo

TECWedgeBuilder.cc
Go to the documentation of this file.
1 #include "TECWedgeBuilder.h"
2 #include "CompositeTECWedge.h"
3 #include "SimpleTECWedge.h"
4 
5 using namespace edm;
6 using namespace std;
7 
8 TECWedge* TECWedgeBuilder::build(const GeometricDet* aTECWedge, const TrackerGeometry* theGeomDetGeometry) {
9  vector<const GeometricDet*> theGeometricDets = aTECWedge->components();
10  //edm::LogInfo(TkDetLayers) << "theGeometricDets.size(): " << theGeometricDets.size() ;
11 
12  if (theGeometricDets.size() == 1) {
13  const GeomDet* theGeomDet = theGeomDetGeometry->idToDet(theGeometricDets.front()->geographicalId());
14  return new SimpleTECWedge(theGeomDet);
15  }
16 
17  vector<const GeomDet*> innerGeomDets;
18  vector<const GeomDet*> outerGeomDets;
19 
20  //---- to evaluate meanZ
21  double meanZ = 0;
22  for (vector<const GeometricDet*>::const_iterator it = theGeometricDets.begin(); it != theGeometricDets.end(); it++) {
23  meanZ = meanZ + (*it)->positionBounds().z();
24  }
25 
26  meanZ = meanZ / theGeometricDets.size();
27  //edm::LogInfo(TkDetLayers) << "meanZ: " << meanZ ;
28  //----
29 
30  for (vector<const GeometricDet*>::const_iterator it = theGeometricDets.begin(); it != theGeometricDets.end(); it++) {
31  //double theGeometricDetRposition = (*it)->positionBounds().perp();
32  const GeomDet* theGeomDet = theGeomDetGeometry->idToDet((*it)->geographicalId());
33  //double theGeomDetRposition = theGeomDet->surface().position().perp();
34 
35  if (std::abs((*it)->positionBounds().z()) < std::abs(meanZ))
36  innerGeomDets.push_back(theGeomDet);
37 
38  if (std::abs((*it)->positionBounds().z()) > std::abs(meanZ))
39  outerGeomDets.push_back(theGeomDet);
40  }
41 
42  //edm::LogInfo(TkDetLayers) << "innerGeomDets.size(): " << innerGeomDets.size() ;
43  //edm::LogInfo(TkDetLayers) << "outerGeomDets.size(): " << outerGeomDets.size() ;
44 
45  return new CompositeTECWedge(innerGeomDets, outerGeomDets);
46 }
TECWedge * build(const GeometricDet *aTECWedge, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:152
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const TrackerGeomDet * idToDet(DetId) const override
HLT enums.