ATLAS Offline Software
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ActsStrawLayerBuilder Class Reference

#include <ActsStrawLayerBuilder.h>

Inheritance diagram for ActsStrawLayerBuilder:
Collaboration diagram for ActsStrawLayerBuilder:

Classes

struct  Config
 

Public Types

using ElementVector = ActsElementVector
 

Public Member Functions

 ActsStrawLayerBuilder (const Config &cfg, std::unique_ptr< const Acts::Logger > logger=Acts::getDefaultLogger("GMSLayBldr", Acts::Logging::INFO))
 Constructor. More...
 
 ~ActsStrawLayerBuilder ()
 
const Acts::LayerVector negativeLayers (const Acts::GeometryContext &gctx) const override
 
const Acts::LayerVector centralLayers (const Acts::GeometryContext &gctx) const override
 
const Acts::LayerVector positiveLayers (const Acts::GeometryContext &gctx) const override
 
const std::string & identification () const override
 
const Acts::LayerVector endcapLayers (const Acts::GeometryContext &gctx, int side) const
 

Private Member Functions

const Acts::Logger & logger () const
 Private access to the logger. More...
 

Private Attributes

Config m_cfg
 configruation object More...
 
std::unique_ptr< const Acts::Logger > m_logger
 logging instance More...
 

Detailed Description

Definition at line 29 of file ActsStrawLayerBuilder.h.

Member Typedef Documentation

◆ ElementVector

Definition at line 32 of file ActsStrawLayerBuilder.h.

Constructor & Destructor Documentation

◆ ActsStrawLayerBuilder()

ActsStrawLayerBuilder::ActsStrawLayerBuilder ( const Config cfg,
std::unique_ptr< const Acts::Logger >  logger = Acts::getDefaultLogger("GMSLayBldr", Acts::Logging::INFO) 
)
inline

Constructor.

Parameters
cfgis the configuration struct
loggerthe local logging instance

Definition at line 47 of file ActsStrawLayerBuilder.h.

50  : m_cfg (cfg),
51  m_logger(std::move(logger))
52  {
53  }

◆ ~ActsStrawLayerBuilder()

ActsStrawLayerBuilder::~ActsStrawLayerBuilder ( )
inline

Definition at line 55 of file ActsStrawLayerBuilder.h.

55 {}

Member Function Documentation

◆ centralLayers()

const Acts::LayerVector ActsStrawLayerBuilder::centralLayers ( const Acts::GeometryContext &  gctx) const
override

Definition at line 49 of file ActsStrawLayerBuilder.cxx.

50 {
51  ACTS_VERBOSE("Building central Straw layers");
52 
53  using LBBV = Acts::LineBounds::BoundValues;
54  using enum Acts::AxisDirection;
55 
56  const InDetDD::TRT_Numerology* trtNums = m_cfg.mng->getNumerology();
57  size_t nBarrelRings = trtNums->getNBarrelRings();
58  size_t nBarrelPhiSectors = trtNums->getNBarrelPhi();
59 
60 
61  ACTS_VERBOSE("- Numerology reports: - " << nBarrelRings << " barrel rings");
62  ACTS_VERBOSE(" - " << nBarrelPhiSectors << " barrel phi sectors");
63 
64  Acts::LayerVector layers;
65 
66  std::vector<Acts::ProtoLayer> protoLayers;
67 
68  for(size_t iring=0; iring < nBarrelRings;iring++) {
69  ACTS_VERBOSE("- Collecting elements for ring " << iring);
70 
71  // were calculating min/max radius while were at it.
72  Acts::ProtoLayer pl;
73  auto& ext = pl.extent;
74  ext.range(AxisR).setMin( std::numeric_limits<double>::max() );
75  ext.range(AxisR).setMax( std::numeric_limits<double>::lowest() );
76  ext.range(AxisZ).setMin( std::numeric_limits<double>::max() );
77  ext.range(AxisZ).setMax( std::numeric_limits<double>::lowest() );
78  ext.range(AxisPhi).setMin( -M_PI );
79  ext.range(AxisPhi).setMax( M_PI );
80 
81  pl.envelope[AxisZ] = {1_mm, 1_mm};
82  pl.envelope[AxisR] = {0_mm, 0_mm};
83 
84  double fudge = 0_mm;
85  // RING in TRT speak is translated to Layer in ACTS speak
86  std::vector<std::shared_ptr<const Acts::Surface>> layerSurfaces;
87 
88  size_t nBarrelLayers = trtNums->getNBarrelLayers(iring);
89  ACTS_VERBOSE(" - Numerology reports: " << nBarrelLayers << " layers in ring " << iring);
90  for (size_t ilayer=0;ilayer < nBarrelLayers;ilayer++) {
91  for (size_t iphisec=0;iphisec < nBarrelPhiSectors;iphisec++) {
92  // what is this?
93  for (size_t iposneg=0;iposneg<2;iposneg++) {
94 
95  const InDetDD::TRT_BarrelElement* brlElem
96  = m_cfg.mng->getBarrelElement(iposneg, iring, iphisec, ilayer);
97 
98  unsigned int nStraws = brlElem->nStraws();
99 
100  for(unsigned int istraw=0;istraw<nStraws;istraw++) {
101 
102  Acts::Transform3 trf = brlElem->strawTransform(istraw);
103  // need to convert translation to length unit
104  trf.translation() *= 1_mm;
105  auto code = brlElem->getCode();
106  Identifier straw_id = m_cfg.idHelper->straw_id(code.isPosZ() == 1 ? 1 : -1,
107  code.getPhiIndex(),
108  code.getModuleIndex(),
109  code.getStrawLayerIndex(),
110  istraw);
111 
112  auto elem = std::make_shared<const ActsDetectorElement>(
113  trf, *brlElem, straw_id);
114 
115  m_cfg.elementStore->push_back(elem);
116 
117  auto straw = dynamic_cast<const Acts::StrawSurface*>(&elem->surface());
118  if (not straw) continue;
119  auto strawBounds = dynamic_cast<const Acts::LineBounds*>(&straw->bounds());
120  if (not strawBounds) continue;
121  // units should be fine since they're already converted in det elem construction
122  double radius = strawBounds->get(LBBV::eR);
123  double length = strawBounds->get(LBBV::eHalfLengthZ);
124  fudge = radius / 4.;
125 
126  // calculate min/max R and Z
127  Acts::Vector3 ctr = straw->center(gctx);
128  ext.range(AxisR).setMax( std::max(ext.max(AxisR), ctr.perp() + radius) );
129  ext.range(AxisR).setMin( std::min(ext.min(AxisR), ctr.perp() - radius) );
130  ext.range(AxisZ).setMax( std::max(ext.max(AxisZ), ctr.z() + length) );
131  ext.range(AxisZ).setMin( std::min(ext.min(AxisZ), ctr.z() - length) );
132 
133  layerSurfaces.push_back(straw->getSharedPtr());
134  }
135  }
136  }
137  }
138 
139  ACTS_VERBOSE(" - Collected " << layerSurfaces.size() << " straws");
140 
141  if(iring > 0) {
142  // match outer radius of previous ring
143  const Acts::ProtoLayer &prev = protoLayers.at(iring-1);
144  ext.range(AxisR).setMin( prev.extent.max(AxisR) + prev.envelope[AxisR][1] + pl.envelope[AxisR][0] + fudge );
145  }
146 
147  std::shared_ptr<Acts::Layer> layer
148  = m_cfg.layerCreator->cylinderLayer(gctx, std::move(layerSurfaces), 100, 1, pl);
149  layers.push_back(layer);
150 
151  protoLayers.push_back(pl);
152 
153  }
154 
155  return layers;
156 }

◆ endcapLayers()

const Acts::LayerVector ActsStrawLayerBuilder::endcapLayers ( const Acts::GeometryContext &  gctx,
int  side 
) const

Definition at line 159 of file ActsStrawLayerBuilder.cxx.

160 {
161  ACTS_VERBOSE("Building endcap Straw layers");
162  using LBBV = Acts::LineBounds::BoundValues;
163  using enum Acts::AxisDirection;
164 
165  const InDetDD::TRT_Numerology* trtNums = m_cfg.mng->getNumerology();
166  size_t nEndcapWheels = trtNums->getNEndcapWheels();
167  size_t nEndcapPhiSectors = trtNums->getNEndcapPhi();
168 
169  ACTS_VERBOSE("- Numerology reports: - " << nEndcapWheels<< " endcap wheels");
170  ACTS_VERBOSE(" - " << nEndcapPhiSectors << " endcap phi sectors");
171 
172  Acts::LayerVector layers;
173 
174  for(size_t iwheel=0;iwheel<nEndcapWheels;++iwheel) {
175  ACTS_VERBOSE("- Collecting elements for wheel " << iwheel);
176 
177 
178  size_t nEndcapLayers = trtNums->getNEndcapLayers(iwheel);
179  ACTS_VERBOSE(" - Numerology reports: " << nEndcapLayers << " layers in wheel " << iwheel);
180  for(size_t ilayer=0;ilayer<nEndcapLayers;++ilayer) {
181  std::vector<std::shared_ptr<const Acts::Surface>> wheelSurfaces;
182 
183 
184  Acts::ProtoLayer pl;
185  auto& ext = pl.extent;;
186  ext.range(AxisR).setMin( std::numeric_limits<double>::max() );
187  ext.range(AxisR).setMax( std::numeric_limits<double>::lowest() );
188  ext.range(AxisZ).setMin( std::numeric_limits<double>::max() );
189  ext.range(AxisZ).setMax( std::numeric_limits<double>::lowest() );
190  ext.range(AxisPhi).setMin( -M_PI );
191  ext.range(AxisPhi).setMax( M_PI );
192  pl.envelope[AxisR] = {0_mm, 0_mm};
193 
194  for (unsigned int iphisec=0; iphisec<nEndcapPhiSectors; ++iphisec) {
195 
196  size_t iposneg = side < 0 ? 0 : 1;
197  const InDetDD::TRT_EndcapElement* ecElem = m_cfg.mng->getEndcapElement(iposneg, iwheel, ilayer, iphisec);
198  unsigned int nStraws = ecElem->nStraws();
199 
200  for(unsigned int istraw=0;istraw<nStraws;istraw++) {
201 
202  Acts::Transform3 trf = (ecElem->strawTransform(istraw));
203  // need to convert translation to length unit
204  trf.translation() *= 1_mm;
205 
206  auto code = ecElem->getCode();
207  Identifier straw_id = m_cfg.idHelper->straw_id(code.isPosZ() == 1 ? 2 : -2,
208  code.getPhiIndex(),
209  code.getWheelIndex(),
210  code.getStrawLayerIndex(),
211  istraw);
212 
213 
214  auto elem = std::make_shared<const ActsDetectorElement>(
215  trf, *ecElem, straw_id);
216 
217  m_cfg.elementStore->push_back(elem);
218 
219  auto straw = dynamic_cast<const Acts::StrawSurface*>(&elem->surface());
220  if (straw){
221  auto strawBounds = dynamic_cast<const Acts::LineBounds*>(&straw->bounds());
222  if (strawBounds){
223  double radius = strawBounds->get(LBBV::eR);
224  double length = strawBounds->get(LBBV::eHalfLengthZ);
225 
226  Acts::Vector3 ctr = straw->center(gctx);
227  ext.range(AxisZ).setMax( std::max(ext.max(AxisZ), ctr.z() + radius) );
228  ext.range(AxisZ).setMin( std::min(ext.min(AxisZ), ctr.z() - radius) );
229  ext.range(AxisR).setMax( std::max(ext.max(AxisR), ctr.perp() + length) );
230  ext.range(AxisR).setMin( std::min(ext.min(AxisR), ctr.perp() - length) );
231  pl.envelope[AxisZ] = {radius/2., radius/2.};
232 
233  wheelSurfaces.push_back(straw->getSharedPtr());
234  }
235  }
236  }
237  }
238 
239  std::shared_ptr<Acts::Layer> layer
240  = m_cfg.layerCreator->discLayer(gctx, std::move(wheelSurfaces), 1, 100, pl);
241  layers.push_back(layer);
242  ACTS_VERBOSE(" - Collected " << wheelSurfaces.size() << " straws");
243  }
244 
245  }
246 
247  ACTS_VERBOSE(" - Built " << layers.size() << " straw endcap layers");
248  return layers;
249 }

◆ identification()

const std::string& ActsStrawLayerBuilder::identification ( ) const
inlineoverride

Definition at line 67 of file ActsStrawLayerBuilder.h.

68  {
69  return m_cfg.configurationName;
70  }

◆ logger()

const Acts::Logger& ActsStrawLayerBuilder::logger ( ) const
inlineprivate

Private access to the logger.

Definition at line 81 of file ActsStrawLayerBuilder.h.

82  {
83  return *m_logger;
84  }

◆ negativeLayers()

const Acts::LayerVector ActsStrawLayerBuilder::negativeLayers ( const Acts::GeometryContext &  gctx) const
override

Definition at line 35 of file ActsStrawLayerBuilder.cxx.

36 {
37  return endcapLayers(gctx, -1);
38 }

◆ positiveLayers()

const Acts::LayerVector ActsStrawLayerBuilder::positiveLayers ( const Acts::GeometryContext &  gctx) const
override

Definition at line 41 of file ActsStrawLayerBuilder.cxx.

42 {
43  return endcapLayers(gctx, 1);
44 
45 }

Member Data Documentation

◆ m_cfg

Config ActsStrawLayerBuilder::m_cfg
private

configruation object

Definition at line 77 of file ActsStrawLayerBuilder.h.

◆ m_logger

std::unique_ptr<const Acts::Logger> ActsStrawLayerBuilder::m_logger
private

logging instance

Definition at line 87 of file ActsStrawLayerBuilder.h.


The documentation for this class was generated from the following files:
InDetDD::TRT_BarrelElement
Definition: TRT_BarrelElement.h:44
TRT::Hit::straw
@ straw
Definition: HitInfo.h:82
ActsStrawLayerBuilder::Config::idHelper
const TRT_ID * idHelper
Definition: ActsStrawLayerBuilder.h:41
ActsStrawLayerBuilder::m_cfg
Config m_cfg
configruation object
Definition: ActsStrawLayerBuilder.h:77
InDetDD::TRT_DetectorManager::getBarrelElement
const TRT_BarrelElement * getBarrelElement(unsigned int positive, unsigned int moduleIndex, unsigned int phiIndex, unsigned int strawLayerIndex) const
Access Barrel Elements:---------------—(Fast)-------------------------—.
Definition: TRT_DetectorManager.cxx:103
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
InDetDD::TRT_BaseElement::nStraws
unsigned int nStraws() const
Number of straws in the element.
ActsStrawLayerBuilder::endcapLayers
const Acts::LayerVector endcapLayers(const Acts::GeometryContext &gctx, int side) const
Definition: ActsStrawLayerBuilder.cxx:159
module_driven_slicing.layers
layers
Definition: module_driven_slicing.py:114
M_PI
#define M_PI
Definition: ActiveFraction.h:11
InDetDD::TRT_EndcapElement
Definition: TRT_EndcapElement.h:44
ActsStrawLayerBuilder::Config::mng
const InDetDD::TRT_DetectorManager * mng
Definition: ActsStrawLayerBuilder.h:38
TRT::Hit::side
@ side
Definition: HitInfo.h:83
InDetDD::TRT_Numerology::getNEndcapWheels
unsigned int getNEndcapWheels() const
InDetDD::TRT_DetectorManager::getNumerology
TRT_Numerology * getNumerology()
Access Numerological information:---------------------------------------—.
Definition: TRT_DetectorManager.cxx:46
histSizes.code
code
Definition: histSizes.py:129
InDetDD::TRT_Numerology
Definition: TRT_Numerology.h:22
InDetDD::TRT_EndcapElement::getCode
const TRT_EndcapCode & getCode() const
Doomed (??)
ActsStrawLayerBuilder::Config::configurationName
std::string configurationName
string based identification
Definition: ActsStrawLayerBuilder.h:37
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
ActsStrawLayerBuilder::m_logger
std::unique_ptr< const Acts::Logger > m_logger
logging instance
Definition: ActsStrawLayerBuilder.h:87
InDetDD::TRT_Numerology::getNBarrelPhi
unsigned int getNBarrelPhi() const
InDetDD::TRT_Numerology::getNBarrelLayers
unsigned int getNBarrelLayers(unsigned int iMod) const
MakeFileForMJB.ext
string ext
Definition: Moriond2016/MakeFileForMJB.py:41
InDetDD::TRT_BarrelElement::getCode
const TRT_BarrelCode & getCode() const
Doomed (?):
InDetDD::TRT_DetectorManager::getEndcapElement
const TRT_EndcapElement * getEndcapElement(unsigned int positive, unsigned int wheelIndex, unsigned int strawLayerIndex, unsigned int phiIndex) const
Access Endcap Elements:---------------—(Fast)--------------------------—.
Definition: TRT_DetectorManager.cxx:119
WriteCaloSwCorrections.cfg
cfg
Definition: WriteCaloSwCorrections.py:23
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
ActsStrawLayerBuilder::Config::layerCreator
std::shared_ptr< const Acts::LayerCreator > layerCreator
Definition: ActsStrawLayerBuilder.h:39
InDetDD::TRT_BaseElement::strawTransform
const Amg::Transform3D & strawTransform(unsigned int straw) const
Straw transform - fast access in array, in Tracking frame: Amg.
Definition: TRT_BaseElement.cxx:89
InDetDD::TRT_Numerology::getNEndcapPhi
unsigned int getNEndcapPhi() const
InDetDD::TRT_Numerology::getNEndcapLayers
unsigned int getNEndcapLayers(unsigned int iWheel) const
InDetDD::TRT_Numerology::getNBarrelRings
unsigned int getNBarrelRings() const
CaloLCW_tf.trf
trf
Definition: CaloLCW_tf.py:20
dqt_zlumi_alleff_HIST.ctr
ctr
Definition: dqt_zlumi_alleff_HIST.py:193
ActsStrawLayerBuilder::logger
const Acts::Logger & logger() const
Private access to the logger.
Definition: ActsStrawLayerBuilder.h:81
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
ActsStrawLayerBuilder::Config::elementStore
std::shared_ptr< ElementVector > elementStore
Definition: ActsStrawLayerBuilder.h:40
TRT_ID::straw_id
Identifier straw_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer, int straw) const
Three ways of getting id for a single straw:
Definition: TRT_ID.h:581
Identifier
Definition: IdentifierFieldParser.cxx:14