CMS 3D CMS Logo

Phase2OTBarrelRodBuilder.cc
Go to the documentation of this file.
3 
4 using namespace edm;
5 using namespace std;
6 
8  const TrackerGeometry* theGeomDetGeometry)
9 {
10  vector<const GeometricDet*> allGeometricDets = thePhase2OTBarrelRod->components();
11  vector<const GeometricDet*> compGeometricDets;
12  LogDebug("TkDetLayers") << "Phase2OTBarrelRodBuilder with #Modules: " << allGeometricDets.size() << std::endl;
13 
14  vector<const GeomDet*> innerGeomDets;
15  vector<const GeomDet*> outerGeomDets;
16  vector<const GeomDet*> innerGeomDetBrothers;
17  vector<const GeomDet*> outerGeomDetBrothers;
18 
19  double meanR = 0;
20  double meanRBrothers = 0;
21  for(vector<const GeometricDet*>::const_iterator it=allGeometricDets.begin(); it!=allGeometricDets.end();it++){
22  compGeometricDets = (*it)->components();
23  if (compGeometricDets.size() != 2){
24  LogDebug("TkDetLayers") << " Stack not with two components but with " << compGeometricDets.size() << std::endl;
25  } else {
26  //LogTrace("TkDetLayers") << " compGeometricDets[0]->positionBounds().perp() " << compGeometricDets[0]->positionBounds().perp() << std::endl;
27  //LogTrace("TkDetLayers") << " compGeometricDets[1]->positionBounds().perp() " << compGeometricDets[1]->positionBounds().perp() << std::endl;
28  meanR = meanR + compGeometricDets[0]->positionBounds().perp();
29  meanRBrothers = meanRBrothers + compGeometricDets[1]->positionBounds().perp();
30  }
31 
32  }
33  meanR = meanR/allGeometricDets.size();
34  meanRBrothers = meanRBrothers/allGeometricDets.size();
35  LogDebug("TkDetLayers") << " meanR Lower " << meanR << std::endl;
36  LogDebug("TkDetLayers") << " meanR Upper " << meanRBrothers << std::endl;
37 
38  for(vector<const GeometricDet*>::iterator it=allGeometricDets.begin(); it!=allGeometricDets.end(); it++){
39  compGeometricDets = (*it)->components();
40  const GeomDet* theGeomDet = theGeomDetGeometry->idToDet( compGeometricDets[0]->geographicalID() );
41  LogTrace("TkDetLayers") << " inserisco " << compGeometricDets[0]->geographicalID().rawId() << std::endl;
42 
43  if( compGeometricDets[0]->positionBounds().perp() < meanR)
44  innerGeomDets.push_back(theGeomDet);
45 
46  if( compGeometricDets[0]->positionBounds().perp() > meanR)
47  outerGeomDets.push_back(theGeomDet);
48 
49  const GeomDet* theGeomDetBrother = theGeomDetGeometry->idToDet( compGeometricDets[1]->geographicalID() );
50  LogTrace("TkDetLayers") << " inserisco " << compGeometricDets[1]->geographicalID().rawId() << std::endl;
51  if( compGeometricDets[1]->positionBounds().perp() < meanRBrothers)
52  innerGeomDetBrothers.push_back(theGeomDetBrother);
53 
54  if( compGeometricDets[1]->positionBounds().perp() > meanRBrothers)
55  outerGeomDetBrothers.push_back(theGeomDetBrother);
56  }
57 
58  LogDebug("TkDetLayers") << "innerGeomDets.size(): " << innerGeomDets.size() ;
59  LogDebug("TkDetLayers") << "outerGeomDets.size(): " << outerGeomDets.size() ;
60  LogDebug("TkDetLayers") << "innerGeomDetsBro.size(): " << innerGeomDetBrothers.size() ;
61  LogDebug("TkDetLayers") << "outerGeomDetsBro.size(): " << outerGeomDetBrothers.size() ;
62 
63  return new Phase2OTBarrelRod(innerGeomDets,outerGeomDets,innerGeomDetBrothers,outerGeomDetBrothers);
64 
65 }
#define LogDebug(id)
Phase2OTBarrelRod * build(const GeometricDet *thePhase2OTBarrelRod, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:176
#define LogTrace(id)
T perp() const
Magnitude of transverse component.
HLT enums.
const TrackerGeomDet * idToDet(DetId) const