test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Phase2OTEndcapRingBuilder.cc
Go to the documentation of this file.
2 
3 using namespace edm;
4 using namespace std;
5 
7  const TrackerGeometry* theGeomDetGeometry)
8 {
9  vector<const GeometricDet*> allGeometricDets = aPhase2OTEndcapRing->components();
10  vector<const GeometricDet*> compGeometricDets;
11  LogDebug("TkDetLayers") << "Phase2OTEndcapRingBuilder with #Modules: " << allGeometricDets.size() << std::endl;
12 
13  vector<const GeomDet*> frontGeomDets;
14  vector<const GeomDet*> backGeomDets;
15  vector<const GeomDet*> frontGeomDetBrothers;
16  vector<const GeomDet*> backGeomDetBrothers;
17 
18  //---- to evaluate meanZ
19  double meanZ = 0;
20  double meanZBrothers = 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().z() << std::endl;
27  LogTrace("TkDetLayers") << " compGeometricDets[1]->positionBounds().perp() " << compGeometricDets[1]->positionBounds().z() << std::endl;
28  meanZ = meanZ + compGeometricDets[0]->positionBounds().z();
29  meanZBrothers = meanZBrothers + compGeometricDets[1]->positionBounds().z();
30  }
31 
32  }
33  meanZ = meanZ/allGeometricDets.size();
34  meanZBrothers = meanZBrothers/allGeometricDets.size();
35  LogDebug("TkDetLayers") << " meanZ Lower " << meanZ << std::endl;
36  LogDebug("TkDetLayers") << " meanZ Upper " << meanZBrothers << std::endl;
37 
38  for(vector<const GeometricDet*>::const_iterator it=allGeometricDets.begin();
39  it!=allGeometricDets.end();it++){
40  compGeometricDets = (*it)->components();
41  const GeomDet* theGeomDet = theGeomDetGeometry->idToDet( compGeometricDets[0]->geographicalID() );
42  LogTrace("TkDetLayers") << " inserisco " << compGeometricDets[0]->geographicalID().rawId() << std::endl;
43 
44  if( fabs( compGeometricDets[0]->positionBounds().z() ) < fabs(meanZ))
45  frontGeomDets.push_back(theGeomDet);
46 
47  if( fabs( compGeometricDets[0]->positionBounds().z() ) > fabs(meanZ))
48  backGeomDets.push_back(theGeomDet);
49 
50  const GeomDet* theGeomDetBrother = theGeomDetGeometry->idToDet( compGeometricDets[1]->geographicalID() );
51  LogTrace("TkDetLayers") << " inserisco " << compGeometricDets[1]->geographicalID().rawId() << std::endl;
52 
53  if( fabs( compGeometricDets[1]->positionBounds().z() ) < fabs(meanZ))
54  frontGeomDetBrothers.push_back(theGeomDetBrother);
55 
56  if( fabs( compGeometricDets[1]->positionBounds().z() ) > fabs(meanZ))
57  backGeomDetBrothers.push_back(theGeomDetBrother);
58  }
59 
60  LogDebug("TkDetLayers") << "frontGeomDets.size(): " << frontGeomDets.size() ;
61  LogDebug("TkDetLayers") << "backGeomDets.size(): " << backGeomDets.size() ;
62  LogDebug("TkDetLayers") << "frontGeomDetsBro.size(): " << frontGeomDetBrothers.size() ;
63  LogDebug("TkDetLayers") << "backGeomDetsBro.size(): " << backGeomDetBrothers.size() ;
64 
65  return new Phase2OTEndcapRing(frontGeomDets,backGeomDets,frontGeomDetBrothers,backGeomDetBrothers);
66 
67 }
#define LogDebug(id)
Phase2OTEndcapRing * build(const GeometricDet *aPhase2OTEndcapRing, const TrackerGeometry *theGeomDetGeometry) __attribute__((cold))
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:174
#define LogTrace(id)
const TrackerGeomDet * idToDet(DetId) const