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 48 of file ActsStrawLayerBuilder.cxx.

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

◆ endcapLayers()

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

Definition at line 157 of file ActsStrawLayerBuilder.cxx.

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

◆ 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 34 of file ActsStrawLayerBuilder.cxx.

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

◆ positiveLayers()

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

Definition at line 40 of file ActsStrawLayerBuilder.cxx.

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

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
max
#define max(a, b)
Definition: cfImp.cxx:41
ActsStrawLayerBuilder::m_cfg
Config m_cfg
configruation object
Definition: ActsStrawLayerBuilder.h:77
Trk::binZ
@ binZ
Definition: BinningType.h:49
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:113
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:157
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:56
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 (?):
min
#define min(a, b)
Definition: cfImp.cxx:40
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:129
pmontree.code
code
Definition: pmontree.py:443
WriteCaloSwCorrections.cfg
cfg
Definition: WriteCaloSwCorrections.py:23
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
Trk::binR
@ binR
Definition: BinningType.h:50
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
Trk::binPhi
@ binPhi
Definition: BinningType.h:51