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  const bool useBrothers) {
10  vector<const GeometricDet*> allGeometricDets = thePhase2OTBarrelRod->components();
11  LogDebug("TkDetLayers") << "Phase2OTBarrelRodBuilder with #Modules: " << allGeometricDets.size() << std::endl;
12  LogDebug("TkDetLayers") << " useBrothers: " << useBrothers << 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 
21  if (!useBrothers) {
22  for (auto const& compGeometricDets : allGeometricDets) {
23  meanR = meanR + compGeometricDets->positionBounds().perp();
24  }
25  meanR = meanR / allGeometricDets.size();
26  LogDebug("TkDetLayers") << " meanR Lower " << meanR << std::endl;
27  for (auto const& compGeometricDets : allGeometricDets) {
28  const GeomDet* theGeomDet = theGeomDetGeometry->idToDet(compGeometricDets->geographicalId());
29 
30  if (compGeometricDets->positionBounds().perp() < meanR)
31  innerGeomDets.push_back(theGeomDet);
32 
33  if (compGeometricDets->positionBounds().perp() > meanR)
34  outerGeomDets.push_back(theGeomDet);
35  }
36 
37  LogDebug("TkDetLayers") << "innerGeomDets.size(): " << innerGeomDets.size();
38  LogDebug("TkDetLayers") << "outerGeomDets.size(): " << outerGeomDets.size();
39 
40  } else {
41  vector<const GeometricDet*> compGeometricDets;
42 
43  double meanRBrothers = 0;
44  for (auto& it : allGeometricDets) {
45  compGeometricDets = it->components();
46  if (compGeometricDets.size() != 2) {
47  LogDebug("TkDetLayers") << " Stack not with two components but with " << compGeometricDets.size() << std::endl;
48  } else {
49  meanR = meanR + compGeometricDets[0]->positionBounds().perp();
50  meanRBrothers = meanRBrothers + compGeometricDets[1]->positionBounds().perp();
51  }
52  }
53  meanR = meanR / allGeometricDets.size();
54  meanRBrothers = meanRBrothers / allGeometricDets.size();
55  LogDebug("TkDetLayers") << " meanR Lower " << meanR << std::endl;
56  LogDebug("TkDetLayers") << " meanR Upper " << meanRBrothers << std::endl;
57 
58  for (auto& it : allGeometricDets) {
59  compGeometricDets = it->components();
60  const GeomDet* theGeomDet = theGeomDetGeometry->idToDet(compGeometricDets[0]->geographicalId());
61  LogTrace("TkDetLayers") << " inserting " << compGeometricDets[0]->geographicalId().rawId() << std::endl;
62 
63  if (compGeometricDets[0]->positionBounds().perp() < meanR)
64  innerGeomDets.push_back(theGeomDet);
65 
66  else
67  outerGeomDets.push_back(theGeomDet);
68 
69  const GeomDet* theGeomDetBrother = theGeomDetGeometry->idToDet(compGeometricDets[1]->geographicalId());
70  LogTrace("TkDetLayers") << " inserting " << compGeometricDets[1]->geographicalId().rawId() << std::endl;
71  if (compGeometricDets[1]->positionBounds().perp() < meanRBrothers)
72  innerGeomDetBrothers.push_back(theGeomDetBrother);
73 
74  else
75  outerGeomDetBrothers.push_back(theGeomDetBrother);
76  }
77 
78  LogDebug("TkDetLayers") << "innerGeomDets.size(): " << innerGeomDets.size();
79  LogDebug("TkDetLayers") << "outerGeomDets.size(): " << outerGeomDets.size();
80  LogDebug("TkDetLayers") << "innerGeomDetsBro.size(): " << innerGeomDetBrothers.size();
81  LogDebug("TkDetLayers") << "outerGeomDetsBro.size(): " << outerGeomDetBrothers.size();
82  }
83 
84  return new Phase2OTBarrelRod(innerGeomDets, outerGeomDets, innerGeomDetBrothers, outerGeomDetBrothers);
85 }
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
MessageLogger.h
GeomDet
Definition: GeomDet.h:27
edm
HLT enums.
Definition: AlignableModifier.h:19
GeometricDet::components
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:149
Phase2OTBarrelRodBuilder::build
Phase2OTBarrelRod * build(const GeometricDet *thePhase2OTBarrelRod, const TrackerGeometry *theGeomDetGeometry, const bool useBrothers=true) __attribute__((cold))
Definition: Phase2OTBarrelRodBuilder.cc:7
perp
T perp() const
Magnitude of transverse component.
Definition: Basic3DVectorLD.h:133
Phase2OTBarrelRod
Definition: Phase2OTBarrelRod.h:14
Phase2OTBarrelRodBuilder.h
GeometricDet
Definition: GeometricDet.h:31
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
std
Definition: JetResolutionObject.h:76
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
TrackerGeometry
Definition: TrackerGeometry.h:14