CMS 3D CMS Logo

List of all members | Public Member Functions
Phase2OTBarrelRodBuilder Class Reference

#include <Phase2OTBarrelRodBuilder.h>

Public Member Functions

Phase2OTBarrelRodbuild (const GeometricDet *thePhase2OTBarrelRod, const TrackerGeometry *theGeomDetGeometry, const bool useBrothers=true) __attribute__((cold))
 
 Phase2OTBarrelRodBuilder ()
 

Detailed Description

A concrete builder for Phase2OTBarrelRod

Definition at line 14 of file Phase2OTBarrelRodBuilder.h.

Constructor & Destructor Documentation

◆ Phase2OTBarrelRodBuilder()

Phase2OTBarrelRodBuilder::Phase2OTBarrelRodBuilder ( )
inline

Definition at line 16 of file Phase2OTBarrelRodBuilder.h.

16 {};

Member Function Documentation

◆ build()

Phase2OTBarrelRod * Phase2OTBarrelRodBuilder::build ( const GeometricDet thePhase2OTBarrelRod,
const TrackerGeometry theGeomDetGeometry,
const bool  useBrothers = true 
)

Definition at line 7 of file Phase2OTBarrelRodBuilder.cc.

9  {
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 }

References GeometricDet::components(), TrackerGeometry::idToDet(), LogDebug, LogTrace, and perp().

Referenced by Phase2OTBarrelLayerBuilder::build().

TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
GeomDet
Definition: GeomDet.h:27
GeometricDet::components
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:149
perp
T perp() const
Magnitude of transverse component.
Definition: Basic3DVectorLD.h:133
Phase2OTBarrelRod
Definition: Phase2OTBarrelRod.h:14
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234