ATLAS Offline Software
Loading...
Searching...
No Matches
ActsTrk::CaloBlueprintNodeBuilder Class Reference

Builds the Calo Blueprint Node. More...

#include <CaloBlueprintNodeBuilder.h>

Inheritance diagram for ActsTrk::CaloBlueprintNodeBuilder:
Collaboration diagram for ActsTrk::CaloBlueprintNodeBuilder:

Public Member Functions

StatusCode initialize () override
StatusCode finalize () override
std::shared_ptr< Acts::Experimental::BlueprintNode > buildBlueprintNode (const Acts::GeometryContext &gctx, std::shared_ptr< Acts::Experimental::BlueprintNode > &&childNode) override
 Build the Itk Blueprint Node.

Private Member Functions

void fillMaps (std::map< caloRegion, caloSampleSurfaceMap_t > &caloRegionSampleSurfaceMap, std::map< caloRegion, caloSampleDDEElementsMap_t > &caloRegionSampleDDEElementsMap) const
 fillMaps fills two maps.
void fillCaloDimensionsMap (caloDimensionMap_t &caloDimensionsMap, caloSampleDDEElementsMap_t &caloSampleDDEElementsMap) const
 fillCaloDimensionsMap fills a map of calorimeter dimensions for each sampling layer.
void generateCylinderSurfaces (caloSampleSurfaceMap_t &caloSampleSurfaceMap, caloSampleDDEElementsMap_t &caloSampleDDEElementsMap) const
 generateCylinderSurfaces generates cylindrical surfaces for each calo sampling.
std::shared_ptr< Acts::CylinderSurface > generateCylinderSurface (const double &maxLArBRadius, const double &minLArBRadius, const double &lowZLarB, const double &highZLarB) const
 generateCylinderSurface generates a cylindrical surface for a given set of parameters.
void addCylindricalTrackingVolumeToCaloNode (Acts::Experimental::CylinderContainerBlueprintNode &containerNode, const std::string &volumeName, const std::vector< std::shared_ptr< Acts::Surface > > &surfaces, int layerIndex, const bool &isDisc) const
 addCylindricalTrackingVolumeToCaloNode adds a cylindrical tracking volume to the calo node.
void generateDiscSurfaces (caloSampleSurfaceMap_t &caloSampleSurfaceMap, caloSampleDDEElementsMap_t &caloSampleDDEElementsMap) const
std::shared_ptr< Acts::DiscSurface > generateDiscSurface (const double &z, const double &maxLArBRadius, const double &minLArBRadius) const
std::string getSampleName (CaloCell_ID::CaloSample currentSample) const
CaloCell_ID::CaloSample getSampleEnum (const std::string &sampleName) const

Private Attributes

std::unique_ptr< CaloDetDescrManagerm_caloDetSecrMgr
std::vector< std::pair< std::string, CaloCell_ID::CaloSample > > m_caloDiscSampleList
std::vector< std::pair< std::string, CaloCell_ID::CaloSample > > m_caloCylinderSampleList
Gaudi::Property< double > m_radiusTolerance
Gaudi::Property< double > m_zTolerance

Detailed Description

Builds the Calo Blueprint Node.

Definition at line 33 of file CaloBlueprintNodeBuilder.h.

Member Function Documentation

◆ addCylindricalTrackingVolumeToCaloNode()

void ActsTrk::CaloBlueprintNodeBuilder::addCylindricalTrackingVolumeToCaloNode ( Acts::Experimental::CylinderContainerBlueprintNode & containerNode,
const std::string & volumeName,
const std::vector< std::shared_ptr< Acts::Surface > > & surfaces,
int layerIndex,
const bool & isDisc ) const
private

addCylindricalTrackingVolumeToCaloNode adds a cylindrical tracking volume to the calo node.

It takes as input the container node, the calo dimensions map, the name of the volume and the vector of surfaces to be added to the volume. It creates a new CylinderContainerBlueprintNode in the container node, then creates a new Acts::TrackingVolume with the appropriate dimensions. Finally it adds the Acts::CylinderSurface to that Acts::TrackingVolume, then adds the tracking volume to the container node.

Definition at line 446 of file CaloBlueprintNodeBuilder.cxx.

446 {
447
448 // Construct the container node with geometry identifier and layer, and add the surfaces to the layer.
449 Acts::Experimental::GeometryIdentifierBlueprintNode& geoIdNode = containerNode.withGeometryIdentifier();
450 geoIdNode.setAllVolumeIdsTo(s_caloBarrelId +
451 layerIndex);
452
453 AxisDirection axis = AxisDirection::AxisZ;
454 if (isDisc) axis = AxisDirection::AxisR;
455 CylinderContainerBlueprintNode& cylinder = geoIdNode.addCylinderContainer(volumeName,
456 axis);
457
458 cylinder.addLayer(volumeName + "_Layer", [&](auto& layer) {
459 layer.setSurfaces(surfaces);
460 layer.setEnvelope(Acts::ExtentEnvelope{{
461 .z = {0.1_mm, 0.1_mm},
462 .r = {2_mm, 2_mm},
463 }});
464 });
465
466}
@ layer
Definition HitInfo.h:79

◆ buildBlueprintNode()

std::shared_ptr< BlueprintNode > ActsTrk::CaloBlueprintNodeBuilder::buildBlueprintNode ( const Acts::GeometryContext & gctx,
std::shared_ptr< Acts::Experimental::BlueprintNode > && childNode )
override

Build the Itk Blueprint Node.

Parameters
gctxGeometry context
childThe child node which is added to the itk node.

Definition at line 49 of file CaloBlueprintNodeBuilder.cxx.

50 {
51
52
53 std::map<caloRegion, caloSampleSurfaceMap_t> caloRegionSampleSurfaceMap;
54 std::map<caloRegion, caloSampleDDEElementsMap_t> caloRegionSampleDDEElementsMap;
55
56 fillMaps(caloRegionSampleSurfaceMap, caloRegionSampleDDEElementsMap);
57
58 ATH_MSG_DEBUG("Have filled first two maps");
59
60 // TODO: it seems that only the CaloMaxR and CaloHalfLengthZ
61 // m_radiusTolerancesions are used later on... do we need the others?
62 caloDimensionMap_t caloDimensionMap;
63 fillCaloDimensionsMap(caloDimensionMap, caloRegionSampleDDEElementsMap[caloRegion::Global]);
64
65 ATH_MSG_DEBUG("Have filled calo dimensions map");
66
67 generateCylinderSurfaces(caloRegionSampleSurfaceMap[caloRegion::Global], caloRegionSampleDDEElementsMap[caloRegion::Global]);
68 generateDiscSurfaces(caloRegionSampleSurfaceMap[caloRegion::DiscNegativeZ], caloRegionSampleDDEElementsMap[caloRegion::DiscNegativeZ]);
69 generateDiscSurfaces(caloRegionSampleSurfaceMap[caloRegion::DiscPositiveZ], caloRegionSampleDDEElementsMap[caloRegion::DiscPositiveZ]);
70
71 ATH_MSG_DEBUG("Have generated calorimeter cylindrical surfaces");
72
73 // The calo node is a container node that will hold the itk and calo nodes as children.
74 // The calo cylinder is static in order to avoid merging issues with the itk portals
75 // that are supposed to carry material.
76 // Take the itk+calo cylinder dimensions based from the previously evaluated map adding some tolerance.
77 // Use 2.0 as a reasonable first guess at the tolerance needed.
78 auto itkCaloNode = std::make_shared<StaticBlueprintNode>(
79 std::make_unique<TrackingVolume>(Transform3::Identity(),
80 std::make_shared<CylinderVolumeBounds>(0.,
81 caloDimensionMap["CaloMaxR"] + 2.0,
82 caloDimensionMap["CaloHalfLengthZ"] + 2.0),"ITkCalo"));
83
84 if (childNode) itkCaloNode->addChild(std::move(childNode));
85
86 ATH_MSG_DEBUG("Top level calorimeter node created");
87
88 auto caloNode = std::make_shared<CylinderContainerBlueprintNode>("CaloNode", AxisDirection::AxisZ);
89 CylinderContainerBlueprintNode& caloBarrelCylinderNode = caloNode->addCylinderContainer("CaloBarrelCylinders", AxisDirection::AxisR);
90 caloBarrelCylinderNode.setAttachmentStrategy(VolumeAttachmentStrategy::Gap);
91 caloBarrelCylinderNode.setResizeStrategy(ResizeStrategy::Gap);
92
93 ATH_MSG_DEBUG("EM Barrel container node created");
94
95 //Barrel cylinders symmetric about z = 0
96 std::vector<std::string> caloBarrelCylindricalLayerNames = {"PreSamplerB", "EMB1", "EMB2", "EMB3", "TileBar0", "TileBar1", "TileBar2"};
97 for (unsigned int sampleIndex = 0; sampleIndex < caloBarrelCylindricalLayerNames.size(); ++sampleIndex) {
98 auto& sampleName = caloBarrelCylindricalLayerNames.at(sampleIndex);
99 addCylindricalTrackingVolumeToCaloNode(caloBarrelCylinderNode, sampleName, caloRegionSampleSurfaceMap[caloRegion::Global].at({sampleName, getSampleEnum(sampleName)}), sampleIndex, false);
100 }
101
102 CylinderContainerBlueprintNode& caloEndCapDiscNegativeZNode = caloNode->addCylinderContainer("CaloEndCapDiscNegativeZ", AxisDirection::AxisZ);
103 caloEndCapDiscNegativeZNode.setAttachmentStrategy(VolumeAttachmentStrategy::Gap);
104 caloEndCapDiscNegativeZNode.setResizeStrategy(ResizeStrategy::Gap);
105
106 CylinderContainerBlueprintNode& caloEndCapDiscPositiveZNode = caloNode->addCylinderContainer("CaloEndCapDiscPositiveZ", AxisDirection::AxisZ);
107 caloEndCapDiscPositiveZNode.setAttachmentStrategy(VolumeAttachmentStrategy::Gap);
108 caloEndCapDiscPositiveZNode.setResizeStrategy(ResizeStrategy::Gap);
109
110 for (unsigned int sampleIndex = 0; sampleIndex < m_caloDiscSampleList.size(); ++sampleIndex) {
111 auto& sampleName = m_caloDiscSampleList.at(sampleIndex).first;
112 addCylindricalTrackingVolumeToCaloNode(caloEndCapDiscNegativeZNode, sampleName+"NegZ", caloRegionSampleSurfaceMap[caloRegion::DiscNegativeZ].at({sampleName, getSampleEnum(sampleName)}), sampleIndex+caloBarrelCylindricalLayerNames.size(), true);
113 addCylindricalTrackingVolumeToCaloNode(caloEndCapDiscPositiveZNode, sampleName+"PosZ", caloRegionSampleSurfaceMap[caloRegion::DiscPositiveZ].at({sampleName, getSampleEnum(sampleName)}), sampleIndex+caloBarrelCylindricalLayerNames.size()+m_caloDiscSampleList.size(), true);
114 }
115
116 ATH_MSG_DEBUG("Have added all Barrel layers to caloBarrelCylinderNode");
117
118 // Add calo barrel node to the top level calo node.
119 itkCaloNode->addChild(caloNode);
120
121 //return the top level calo node
122 return itkCaloNode;
123}
#define ATH_MSG_DEBUG(x)
std::map< std::string, double > caloDimensionMap_t
void fillMaps(std::map< caloRegion, caloSampleSurfaceMap_t > &caloRegionSampleSurfaceMap, std::map< caloRegion, caloSampleDDEElementsMap_t > &caloRegionSampleDDEElementsMap) const
fillMaps fills two maps.
std::vector< std::pair< std::string, CaloCell_ID::CaloSample > > m_caloDiscSampleList
void fillCaloDimensionsMap(caloDimensionMap_t &caloDimensionsMap, caloSampleDDEElementsMap_t &caloSampleDDEElementsMap) const
fillCaloDimensionsMap fills a map of calorimeter dimensions for each sampling layer.
void generateCylinderSurfaces(caloSampleSurfaceMap_t &caloSampleSurfaceMap, caloSampleDDEElementsMap_t &caloSampleDDEElementsMap) const
generateCylinderSurfaces generates cylindrical surfaces for each calo sampling.
void addCylindricalTrackingVolumeToCaloNode(Acts::Experimental::CylinderContainerBlueprintNode &containerNode, const std::string &volumeName, const std::vector< std::shared_ptr< Acts::Surface > > &surfaces, int layerIndex, const bool &isDisc) const
addCylindricalTrackingVolumeToCaloNode adds a cylindrical tracking volume to the calo node.
CaloCell_ID::CaloSample getSampleEnum(const std::string &sampleName) const
void generateDiscSurfaces(caloSampleSurfaceMap_t &caloSampleSurfaceMap, caloSampleDDEElementsMap_t &caloSampleDDEElementsMap) const
mapped_type at(key_type key) const
Look up an element in the map.

◆ fillCaloDimensionsMap()

void ActsTrk::CaloBlueprintNodeBuilder::fillCaloDimensionsMap ( caloDimensionMap_t & caloDimensionsMap,
caloSampleDDEElementsMap_t & caloSampleDDEElementsMap ) const
private

fillCaloDimensionsMap fills a map of calorimeter dimensions for each sampling layer.

The map contains minR, maxR, minZ, maxZ and halfLengthZ for each sampling layer.

Definition at line 404 of file CaloBlueprintNodeBuilder.cxx.

404 {
405
406 //initialise parameters we will use to find the dimensions of the calorimeter
407 double minR = std::numeric_limits<double>::max();
408 double maxR = 0.0;
409 double minZ = std::numeric_limits<double>::max();
410 double maxZ = -std::numeric_limits<double>::max();
411
412 //define functions we will use
413 auto checkMinR = [&minR](const CaloDetDescrElement* theDDE){double r = theDDE->r();if (r < minR) minR = r;};
414 auto checkMaxR = [&maxR](const CaloDetDescrElement* theDDE){double r = theDDE->r();if (r > maxR) maxR = r;};
415 auto checkMinMaxZ = [&minZ,&maxZ](const CaloDetDescrElement* theDDE){double z = theDDE->z();if (z > maxZ) maxZ = z;if (z < minZ) minZ = z;};
416 auto calcHalfLengthZ = [&minZ, &maxZ](){return (maxZ - minZ) / 2.0;};
417
418 //find minR from PreSamplerB
419 for (const CaloDetDescrElement* theDDE : caloSampleDDEElementsMap.at({getSampleName(CaloCell_ID::PreSamplerB), CaloCell_ID::PreSamplerB})) checkMinR(theDDE);
420
421 //find maxR from TileBar2, TileGap2 and Tile Ext2
422 for (auto& currentSample : std::vector<std::pair<std::string, CaloCell_ID::CaloSample>>{{"TileBar2", CaloCell_ID::TileBar2}, {"TileGap2", CaloCell_ID::TileGap2}, {"TileExt2", CaloCell_ID::TileExt2}}) {
423 for (const CaloDetDescrElement* theDDE : caloSampleDDEElementsMap.at(currentSample)) checkMaxR(theDDE);
424 }
425
426 ATH_MSG_DEBUG("Min R in PreSamplerB is " << minR);
427 ATH_MSG_DEBUG("Max R in TileBar2, TileGap2 and TileExt2 is " << maxR);
428
429 caloDimensionsMap["CaloMinR"] = minR;
430 caloDimensionsMap["CaloMaxR"] = maxR;
431
432 //find minZ and maxZ from all barrel samplings
433 for (auto& currentSample : m_caloCylinderSampleList) {
434 for (const CaloDetDescrElement* theDDE : caloSampleDDEElementsMap.at(currentSample)) checkMinMaxZ(theDDE);
435 }
436
437 caloDimensionsMap["CaloMinZ"] = minZ;
438 caloDimensionsMap["CaloMaxZ"] = maxZ;
439
440 double halfLengthZ = calcHalfLengthZ();
441 ATH_MSG_DEBUG("Half length in Z for entire barrel is " << halfLengthZ);
442 caloDimensionsMap["CaloHalfLengthZ"] = halfLengthZ;
443
444}
#define z
std::vector< std::pair< std::string, CaloCell_ID::CaloSample > > m_caloCylinderSampleList
int r
Definition globals.cxx:22

◆ fillMaps()

void ActsTrk::CaloBlueprintNodeBuilder::fillMaps ( std::map< caloRegion, caloSampleSurfaceMap_t > & caloRegionSampleSurfaceMap,
std::map< caloRegion, caloSampleDDEElementsMap_t > & caloRegionSampleDDEElementsMap ) const
private

fillMaps fills two maps.

The first maps each calo sampling to a vector of surfaces (initially empty) The second maps each calo sampling to a vector of CaloDetDescrElements The second map is filled by looping over all DDE in the CaloDetDescrManager and adding each DDE to the vector corresponding to its sampling in the map

Definition at line 130 of file CaloBlueprintNodeBuilder.cxx.

131 {
132
133
134 //loop over all possible calo sampling layers
135 //and create empty vectors of surfaces in the map
136
137 //Create map between each calorimeter sampling and a vector of
138 //cylinder surfaces. We can have N cylinders in a given sampling,
139 //and the value of N is determined by how often the average radius
140 //calculated for a given phi ring, at fixed Z, changes by more than
141 //a tolerance value
142
143 //Use the same loop to create map bwteeen sampling and vectors of DDE
144 for (const auto & currentSample : m_caloCylinderSampleList) {
145 caloRegionSampleSurfaceMap[caloRegion::Global][currentSample] = std::vector<std::shared_ptr<Surface> >();
146 caloRegionSampleDDEElementsMap[caloRegion::Global][currentSample] = std::vector<const CaloDetDescrElement*>();
147 }
148
149 for (const auto & currentSample : m_caloDiscSampleList) {
150 caloRegionSampleSurfaceMap[caloRegion::DiscNegativeZ][currentSample] = std::vector<std::shared_ptr<Surface> >();
151 caloRegionSampleDDEElementsMap[caloRegion::DiscNegativeZ][currentSample] = std::vector<const CaloDetDescrElement*>();
152 caloRegionSampleSurfaceMap[caloRegion::DiscPositiveZ][currentSample] = std::vector<std::shared_ptr<Surface> >();
153 caloRegionSampleDDEElementsMap[caloRegion::DiscPositiveZ][currentSample] = std::vector<const CaloDetDescrElement*>();
154 }
155
156 //for each calo sampling collect all the DDE in a vector
157 for (const CaloDetDescrElement* theDDE : m_caloDetSecrMgr->element_range()){
158 if (!theDDE){
159 ATH_MSG_ERROR("Null pointer to CaloDetDescrElement");
160 continue;
161 }
162 CaloCell_ID::CaloSample currentSample=theDDE->getSampling();
163 caloRegionSampleDDEElementsMap[caloRegion::Global][{getSampleName(currentSample), currentSample}].push_back(theDDE);
164 //check if sampling is in disc list
165 if (std::find(m_caloDiscSampleList.begin(), m_caloDiscSampleList.end(), std::make_pair(getSampleName(currentSample), currentSample)) != m_caloDiscSampleList.end()) {
166 //check if in negative or positive z
167 if (theDDE->z() < 0.0) {
168 caloRegionSampleDDEElementsMap[caloRegion::DiscNegativeZ][{getSampleName(currentSample), currentSample}].push_back(theDDE);
169 }
170 else {
171 caloRegionSampleDDEElementsMap[caloRegion::DiscPositiveZ][{getSampleName(currentSample), currentSample}].push_back(theDDE);
172 }
173 }
174
175 }
176
177 auto sortAllLayersInZ = [&caloRegionSampleDDEElementsMap](const std::vector<std::pair<std::string, CaloCell_ID::CaloSample>>& caloSampleList) {
178 for (const auto & currentSample : caloSampleList) {
179 std::vector<const CaloDetDescrElement*> currentElements = caloRegionSampleDDEElementsMap[caloRegion::Global][currentSample];
180 std::sort(currentElements.begin(), currentElements.end(), [](const CaloDetDescrElement* a, const CaloDetDescrElement* b) {return a->z() < b->z();});
181 caloRegionSampleDDEElementsMap[caloRegion::Global][currentSample] = std::move(currentElements);
182 }
183 };
184
185 //Sort the DDE, by Z, in all possible layers
186 sortAllLayersInZ(m_caloCylinderSampleList);
187
188 auto sortAllLayersInR = [&caloRegionSampleDDEElementsMap](const std::vector<std::pair<std::string, CaloCell_ID::CaloSample>>& caloSampleList, const caloRegion& region) {
189 for (const auto& currentSample : caloSampleList) {
190 std::vector<const CaloDetDescrElement*> currentElements = caloRegionSampleDDEElementsMap[region][currentSample];
191 std::sort(currentElements.begin(), currentElements.end(), [](const CaloDetDescrElement* a, const CaloDetDescrElement* b) {return a->r() < b->r();});
192 caloRegionSampleDDEElementsMap[region][currentSample] = std::move(currentElements);
193 }
194 };
195
196 //Sort the DDE, by R, in all possible layers
199
200}
#define ATH_MSG_ERROR(x)
static Double_t a
std::string getSampleName(CaloCell_ID::CaloSample currentSample) const
std::unique_ptr< CaloDetDescrManager > m_caloDetSecrMgr
CaloSampling::CaloSample CaloSample
Definition CaloCell_ID.h:53
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ finalize()

StatusCode ActsTrk::CaloBlueprintNodeBuilder::finalize ( )
override

Definition at line 125 of file CaloBlueprintNodeBuilder.cxx.

125 {
126 ATH_MSG_DEBUG("Finalizing CaloBlueprintNodeBuilder");
127 return StatusCode::SUCCESS;
128}

◆ generateCylinderSurface()

std::shared_ptr< CylinderSurface > ActsTrk::CaloBlueprintNodeBuilder::generateCylinderSurface ( const double & maxLArBRadius,
const double & minLArBRadius,
const double & lowZLarB,
const double & highZLarB ) const
private

generateCylinderSurface generates a cylindrical surface for a given set of parameters.

To do this it calculates the radius and length of the cylinder, then shifts it in Z to the midpoint of the Z values used to build it. It then creates the Acts::CylinderSurface and returns it via a shared pointer.

Definition at line 297 of file CaloBlueprintNodeBuilder.cxx.

297 {
298
299 //Characterise the dimensions of the cylinder
300 double LArBRadius = (maxLArBRadius + minLArBRadius) / 2.0;
301 double LArBLength = std::abs(highZLarB - lowZLarB);
302
303 ATH_MSG_DEBUG("Cylinder radius and length are " << LArBRadius << " and " << LArBLength);
304
305 auto surface = Surface::makeShared<CylinderSurface>(Transform3::Identity(), LArBRadius, LArBLength/2);
306
307 return surface;
308
309}

◆ generateCylinderSurfaces()

void ActsTrk::CaloBlueprintNodeBuilder::generateCylinderSurfaces ( caloSampleSurfaceMap_t & caloSampleSurfaceMap,
caloSampleDDEElementsMap_t & caloSampleDDEElementsMap ) const
private

generateCylinderSurfaces generates cylindrical surfaces for each calo sampling.

It does this for cylindrical layers by scanning in Z, for each Z finding the average radius of the cells in a phi ring If the average radius changes by more than a tolerance value (m_radiusTolerance), a new cylinder surface is created. The surfaces are added to the relevant vector of surfaces in the caloSampleSurfaceMap.

Definition at line 202 of file CaloBlueprintNodeBuilder.cxx.

202 {
203
204 for (const auto & currentSample : m_caloCylinderSampleList) {
205
206 std::vector<const CaloDetDescrElement*> currentElements = caloSampleDDEElementsMap[currentSample];
207
208 double maxLArBRadius = 0.0, minLArBRadius = std::numeric_limits<double>::max();
209 double lowZLarB = 0.0, highZLarB = 0.0;
210
211 //loop over cells runs from -z to +z in a given sampling layer
212 //There are many cells with the same z value, but different phi values
213 //We will find the average radius of the cells in a given phi ring
214 double totalRadiusFixedPhi = 0.0;
215 bool firstCellInPhiRing = true;
216 unsigned int phiCounter = 0;
217
218 //Then we will also track changes in radius as we move in Z from
219 //each ring of cells in phi to the next ring of cells in phi
220 bool firstPhiRing = true;
221 double initialRadius = 0.0;
222 double initialZ = -std::numeric_limits<double>::max();
223
224 for (const CaloDetDescrElement* theDDE : currentElements){
225
226 double z = theDDE->z();
227 double radius = theDDE->r();
228
229 ATH_MSG_DEBUG(" Calo Sampling is " << currentSample.first);
230
231 if (firstCellInPhiRing) {
232 ATH_MSG_DEBUG("First Cell in phi ring " << currentSample.first << " has z = " << z << " and r = " << radius);
233 initialZ = z;
234 firstCellInPhiRing = false;
235 }
236
237 if (firstPhiRing) {
238 ATH_MSG_DEBUG("First Cell in layer " << currentSample.first << " has z = " << z << " and r = " << radius);
239 initialRadius = theDDE->r();
240 firstPhiRing = false;
241 lowZLarB = z;
242 }
243
244 ATH_MSG_DEBUG("Z and initialZ are " << z << " and " << initialZ);
245
246 //if z has not changed then we add the radius to the summed radius for this phi ring
247 //and increment the counter of cells in this phi ring
248 if (std::abs(z - initialZ) < 0.0001) {
249 ATH_MSG_DEBUG("phiCounter is " << phiCounter << " and radius is " << radius << " and totalRadiusFixedPhi is " << totalRadiusFixedPhi << " and hash is " << theDDE->calo_hash());
250 totalRadiusFixedPhi += radius;
251 phiCounter++;
252 continue;
253 }
254 else {
255 firstCellInPhiRing = true;
256 if (phiCounter > 0) {
257 double cellRingRadius = totalRadiusFixedPhi / phiCounter;
258 totalRadiusFixedPhi = 0.0;
259 phiCounter = 0;
260
261 if (cellRingRadius > maxLArBRadius) maxLArBRadius = radius;
262 if (cellRingRadius < minLArBRadius) minLArBRadius = radius;
263
264 //if radius changes by more than tolerance, then we will create a cylinder
265 //with the average cell radius and length from neg to pos z
266 highZLarB = z;
267 ATH_MSG_DEBUG("Values of cellRingRadius, initialRadius, highZLarB and lowZLarB are " << cellRingRadius << ", " << initialRadius << ", " << highZLarB << " and " << lowZLarB);
268 if (std::abs(cellRingRadius - initialRadius) > m_radiusTolerance && highZLarB - lowZLarB > 0.0) {
269 ATH_MSG_DEBUG("CYLINDER: Create cylinder for layer " << currentSample.first);
270 ATH_MSG_DEBUG("CYLINDER: Create Cylinder: Min and Max LAr B radius are " << minLArBRadius << " " << maxLArBRadius);
271 ATH_MSG_DEBUG("CYLINDER: Create Cylinder: Min and Max LAr B z are " << lowZLarB << " " << highZLarB);
272
273 caloSampleSurfaceMap[currentSample].push_back(generateCylinderSurface(maxLArBRadius, minLArBRadius, lowZLarB, highZLarB));
274
275 //reset the dimensions of the cylinder to the initial conditions, in
276 //preparation for the next cylinder
277 firstPhiRing = true;
278 minLArBRadius = std::numeric_limits<double>::max();
279 maxLArBRadius = 0.0;
280 lowZLarB = 0.0;
281 highZLarB = 0.0;
282 }//if radius changes by more than tolerance
283 }//if at least one cell in phi (should always be the case!)
284 else ATH_MSG_ERROR("phiCounter is zero!");
285 }//if z has changed
286 }//loop over calorimeter DDE
287
288 if (0 == caloSampleSurfaceMap[currentSample].size()){
289 ATH_MSG_DEBUG("CYLINDER: Zero size Vector: Create cylinder for layer " << currentSample.first);
290 ATH_MSG_DEBUG("CYLINDER: Create Cylinder: Min and Max LAr B radius are " << minLArBRadius << " " << maxLArBRadius);
291 ATH_MSG_DEBUG("CYLINDER: Create Cylinder: Min and Max LAr B z are " << lowZLarB << " " << highZLarB);
292 caloSampleSurfaceMap[currentSample].push_back(generateCylinderSurface(maxLArBRadius, minLArBRadius, lowZLarB, highZLarB));
293 }
294 }
295}
size_t size() const
Number of registered mappings.
std::shared_ptr< Acts::CylinderSurface > generateCylinderSurface(const double &maxLArBRadius, const double &minLArBRadius, const double &lowZLarB, const double &highZLarB) const
generateCylinderSurface generates a cylindrical surface for a given set of parameters.

◆ generateDiscSurface()

std::shared_ptr< Acts::DiscSurface > ActsTrk::CaloBlueprintNodeBuilder::generateDiscSurface ( const double & z,
const double & maxLArBRadius,
const double & minLArBRadius ) const
private

Definition at line 391 of file CaloBlueprintNodeBuilder.cxx.

391 {
392
393 ATH_MSG_DEBUG("DISC: Disc min and max radius are " << minLArBRadius << " and " << maxLArBRadius << " with z of " << z);
394
395 auto transform = Acts::Transform3(Acts::Translation3(0.0,0.0,z));
396 auto surface = Surface::makeShared<DiscSurface>(transform, minLArBRadius, maxLArBRadius);
397
398 return surface;
399
400}
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.

◆ generateDiscSurfaces()

void ActsTrk::CaloBlueprintNodeBuilder::generateDiscSurfaces ( caloSampleSurfaceMap_t & caloSampleSurfaceMap,
caloSampleDDEElementsMap_t & caloSampleDDEElementsMap ) const
private

Definition at line 311 of file CaloBlueprintNodeBuilder.cxx.

311 {
312
313 for (const auto & currentSample : m_caloDiscSampleList) {
314
315 const std::vector<const CaloDetDescrElement*> & currentElements = caloSampleDDEElementsMap[currentSample];
316
317 double totalZFixedPhi = 0.0;
318 bool firstCellInPhiRing = true;
319 unsigned int phiCounter = 0;
320
321 bool firstPhiRing = true;
322 double initialRadius = 0.0;
323 double initialZ = -std::numeric_limits<double>::max();
324
325 //loop over cells runs from -z to +z in a given sampling layer
326 //There are many cells with the same z value, but different phi values
327 //We will find a min amd max radius in this phi ring.
328 double minDiscRadius = std::numeric_limits<double>::max(), maxDiscRadius = 0.0;
329
330 unsigned int currentElementsSize = currentElements.size();
331 unsigned int DDECounter = 0;
332
333 for (const CaloDetDescrElement* theDDE : currentElements){
334
335 bool isLastDDE = (DDECounter == (currentElementsSize-1));
336
337 ATH_MSG_DEBUG("Disc DDE with sampling, r and z of " << currentSample << ", " << theDDE->r() << ", " << theDDE->z());
338 ATH_MSG_DEBUG("isLastDDE is " << isLastDDE);
339
340 double z = theDDE->z();
341 double radius = theDDE->r();
342
343 if (firstCellInPhiRing) {
344 initialRadius = radius;
345 firstCellInPhiRing = false;
346 }
347
348 if (firstPhiRing) {
349 initialZ = z;
350 firstPhiRing = false;
351 minDiscRadius = radius;
352 }
353
354 //if radius is unchanged then we add the z to the summed z for this phi ring
355 //and increment the counter of cells in this phi ring
356 if (std::abs(radius - initialRadius) < 0.0001 && !isLastDDE) {
357 totalZFixedPhi += z;
358 phiCounter++;
359 DDECounter++;
360 continue;
361 }
362 else {
363 firstCellInPhiRing = true;
364 if (phiCounter > 0) {
365 double cellRingZ = totalZFixedPhi / phiCounter;
366 totalZFixedPhi = 0.0;
367 phiCounter = 0;
368
369 //if z changes by more than tolerance, then we will create a disc
370 //with the min and max radius found
371 //if we reach the last DDE and no new surface has been created, then we also create a disc surface
372 maxDiscRadius = radius;
373 ATH_MSG_DEBUG("cellRingZ, initialZ and z tolerance are " << cellRingZ << ", " << initialZ << " and " << m_zTolerance);
374 if (std::abs(cellRingZ - initialZ) > m_zTolerance || isLastDDE) {
375 ATH_MSG_DEBUG("DISC: About to create disc surface for sampling " << currentSample);
376 caloSampleSurfaceMap[currentSample].push_back(generateDiscSurface(cellRingZ,maxDiscRadius, minDiscRadius));
377 //reset the dimensions of the disc to the initial conditions, in
378 //preparation for the next disc
379 minDiscRadius = std::numeric_limits<double>::max();
380 maxDiscRadius = 0.0;
381 firstPhiRing = true;
382 }//if z changes by more than tolerance
383 }//if at least one cell in phi (should always be the case!)
384 else ATH_MSG_ERROR("phiCounter is zero!");
385 }//if radius has changed
386 DDECounter++;
387 }//loop over calorimeter DDE
388 }//loop over calo samplings
389}
std::shared_ptr< Acts::DiscSurface > generateDiscSurface(const double &z, const double &maxLArBRadius, const double &minLArBRadius) const

◆ getSampleEnum()

CaloCell_ID::CaloSample ActsTrk::CaloBlueprintNodeBuilder::getSampleEnum ( const std::string & sampleName) const
inlineprivate

Definition at line 142 of file CaloBlueprintNodeBuilder.h.

142 {
143 CaloCell_ID::CaloSample sampleEnum = CaloCell_ID::Unknown;
144 for (auto& [name, sample] : m_caloCylinderSampleList) {
145 if (sampleName == name) {
146 sampleEnum = sample;
147 break;
148 }
149 }
150 if (sampleEnum == CaloCell_ID::Unknown) {
151 for (auto& [name, sample] : m_caloDiscSampleList) {
152 if (sampleName == name) {
153 sampleEnum = sample;
154 break;
155 }
156 }
157 }
158 return sampleEnum;
159 }

◆ getSampleName()

std::string ActsTrk::CaloBlueprintNodeBuilder::getSampleName ( CaloCell_ID::CaloSample currentSample) const
inlineprivate

Definition at line 123 of file CaloBlueprintNodeBuilder.h.

123 {
124 std::string sampleName = "";
125 for ( auto& [name, sample] : m_caloCylinderSampleList) {
126 if (currentSample == sample) {
128 break;
129 }
130 }
131 if (sampleName == "") {
132 for ( auto& [name, sample] : m_caloDiscSampleList) {
133 if (currentSample == sample) {
135 break;
136 }
137 }
138 }
139 return sampleName;
140 }

◆ initialize()

StatusCode ActsTrk::CaloBlueprintNodeBuilder::initialize ( )
override

Definition at line 40 of file CaloBlueprintNodeBuilder.cxx.

40 {
41 ATH_MSG_DEBUG("Initializing CaloBlueprintNodeBuilder");
42
45
46 return StatusCode::SUCCESS;
47}
std::unique_ptr< CaloDetDescrManager > buildCaloDetDescrNoAlign(ISvcLocator *svcLocator, IMessageSvc *msgSvc)
IMessageSvc * getMessageSvc(bool quiet=false)

Member Data Documentation

◆ m_caloCylinderSampleList

std::vector<std::pair<std::string, CaloCell_ID::CaloSample> > ActsTrk::CaloBlueprintNodeBuilder::m_caloCylinderSampleList
private
Initial value:
{ { "PreSamplerB", CaloCell_ID::PreSamplerB},
{"EMB1", CaloCell_ID::EMB1},
{"EMB2", CaloCell_ID::EMB2},
{"EMB3", CaloCell_ID::EMB3},
{"TileBar0", CaloCell_ID::TileBar0},
{"TileBar1", CaloCell_ID::TileBar1},
{"TileBar2", CaloCell_ID::TileBar2},
{"TileGap1", CaloCell_ID::TileGap1},
{"TileGap2", CaloCell_ID::TileGap2},
{"TileExt0", CaloCell_ID::TileExt0},
{"TileExt1", CaloCell_ID::TileExt1},
{"TileExt2", CaloCell_ID::TileExt2}}

Definition at line 99 of file CaloBlueprintNodeBuilder.h.

99 { { "PreSamplerB", CaloCell_ID::PreSamplerB},
100 {"EMB1", CaloCell_ID::EMB1},
101 {"EMB2", CaloCell_ID::EMB2},
102 {"EMB3", CaloCell_ID::EMB3},
103 {"TileBar0", CaloCell_ID::TileBar0},
104 {"TileBar1", CaloCell_ID::TileBar1},
105 {"TileBar2", CaloCell_ID::TileBar2},
106 {"TileGap1", CaloCell_ID::TileGap1},
107 {"TileGap2", CaloCell_ID::TileGap2},
108 {"TileExt0", CaloCell_ID::TileExt0},
109 {"TileExt1", CaloCell_ID::TileExt1},
110 {"TileExt2", CaloCell_ID::TileExt2}};

◆ m_caloDetSecrMgr

std::unique_ptr<CaloDetDescrManager> ActsTrk::CaloBlueprintNodeBuilder::m_caloDetSecrMgr
private

Definition at line 84 of file CaloBlueprintNodeBuilder.h.

◆ m_caloDiscSampleList

std::vector<std::pair<std::string, CaloCell_ID::CaloSample> > ActsTrk::CaloBlueprintNodeBuilder::m_caloDiscSampleList
private
Initial value:
{{"PreSamplerE", CaloCell_ID::PreSamplerE},
{"EME1",CaloCell_ID::EME1},
{"EME2",CaloCell_ID::EME2},
{"EME3",CaloCell_ID::EME3},
{"HEC0",CaloCell_ID::HEC0},
{"HEC1",CaloCell_ID::HEC1},
{"HEC2",CaloCell_ID::HEC2},
{"HEC3",CaloCell_ID::HEC3},
{"TileGap3",CaloCell_ID::TileGap3}}

Definition at line 89 of file CaloBlueprintNodeBuilder.h.

89 {{"PreSamplerE", CaloCell_ID::PreSamplerE},
90 {"EME1",CaloCell_ID::EME1},
91 {"EME2",CaloCell_ID::EME2},
92 {"EME3",CaloCell_ID::EME3},
93 {"HEC0",CaloCell_ID::HEC0},
94 {"HEC1",CaloCell_ID::HEC1},
95 {"HEC2",CaloCell_ID::HEC2},
96 {"HEC3",CaloCell_ID::HEC3},
97 {"TileGap3",CaloCell_ID::TileGap3}};

◆ m_radiusTolerance

Gaudi::Property<double> ActsTrk::CaloBlueprintNodeBuilder::m_radiusTolerance
private
Initial value:
{ this
, "RadiusTolerance"
, 2.0
, "Tolerance for determining if a ring of cells in phi has changed the radius w.r.t to the previous ring in phi" }

Definition at line 112 of file CaloBlueprintNodeBuilder.h.

112 { this
113 , "RadiusTolerance"
114 , 2.0
115 , "Tolerance for determining if a ring of cells in phi has changed the radius w.r.t to the previous ring in phi" };

◆ m_zTolerance

Gaudi::Property<double> ActsTrk::CaloBlueprintNodeBuilder::m_zTolerance
private
Initial value:
{ this
, "ZTolerance"
, 2.0
, "Tolerance for determining if a ring of cells in phi has changed the z w.r.t to the previous ring in phi" }

Definition at line 117 of file CaloBlueprintNodeBuilder.h.

117 { this
118 , "ZTolerance"
119 , 2.0
120 , "Tolerance for determining if a ring of cells in phi has changed the z w.r.t to the previous ring in phi" };

The documentation for this class was generated from the following files: