ATLAS Offline Software
Loading...
Searching...
No Matches
ServicesTracker.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "ServicesTracker.h"
6#include "ServicesLayer.h"
7#include "Routing2.h"
8#include "ServicesStave.h"
11#include <iostream> // for DEBUG only
12using namespace std;
13
15 AthMessaging("ServicesTracker"),
16 m_geoMgr(nullptr)
17{
18 m_barrelLayers.clear();
19 m_barrelPixelLayers.clear();
20 m_endcapPixelLayers.clear();
21 m_barrelStripLayers.clear();
22 m_endcapStripLayers.clear();
23}
24
26{
27
28 for (std::vector<ServiceVolume *>::iterator iter = m_volumes.begin(); iter != m_volumes.end(); ++iter) delete *iter;
29
30 for (LayerContainer::const_iterator iter=m_barrelLayers.begin(); iter!=m_barrelLayers.end(); ++iter) delete *iter;
31 for (LayerContainer::const_iterator iter=m_endcapPixelLayers.begin(); iter!=m_endcapPixelLayers.end(); ++iter) delete *iter;
32 for (LayerContainer::const_iterator iter=m_endcapStripLayers.begin(); iter!=m_endcapStripLayers.end(); ++iter) delete *iter;
33
34}
35
36void ServicesTracker::constructBarrelLayer( double radius, double zHalfLength,
37 DetType::Type type, int layerNum,
38 int nstaves, const std::string& suffix,
39 int nModulesPerStave, int nChipsPerModule)
40{
41 ServicesLayer* nl = new ServicesLayer( radius, zHalfLength, nstaves,
42 type, DetType::Barrel, layerNum, suffix,
43 nModulesPerStave, nChipsPerModule);
44
45 m_barrelLayers.push_back(nl);
46 if (type == DetType::Pixel) m_barrelPixelLayers.push_back(nl);
47 else m_barrelStripLayers.push_back(nl);
48}
49
50void ServicesTracker::constructEndcapLayer( double zpos, double rmin, double rmax,
51 DetType::Type type, int layerNum,
52 int nstaves, const std::string& suffix,
53 int nModulesPerStave, int nChipsPerModule)
54{
55 ServicesLayer* nl = new ServicesLayer( zpos, rmin, rmax, nstaves,
56 type, DetType::Endcap, layerNum,
57 suffix,
58 nModulesPerStave, nChipsPerModule);
59
60 if (type == DetType::Pixel) m_endcapPixelLayers.push_back(nl);
61 else m_endcapStripLayers.push_back(nl);
62}
63
65{
66 Routing2 routing;
67 routing.createRoutingVolumes(*this);
68}
69
70
72{
73 msg(MSG::INFO) << "ServicesTracker::finaliseServices called for " << m_volumes.size() << " volumes" << endmsg;
74
75 ComputeStaveServices staveComputer;
76 ConvertStaveServices staveConverter;
77
78 std::map<const ServicesLayer*, ServiceMaterial> layerMaterial; // cache the layer services
79
80 using VolumeIter = std::vector<ServiceVolume *>::iterator;
81 for (VolumeIter iv=m_volumes.begin(); iv!=m_volumes.end(); ++iv) {
82 std::vector<ServiceMaterial> result; // = (**iv).materials(); // preserve already present mat. (EOS)
83 if ((**iv).isEOS()) addEosMaterial(**iv, result);
84
85 ServiceVolume::LayerContainer layers = (**iv).layers();
86 for (ServiceVolume::LayerContainer::const_iterator il=layers.begin(); il!=layers.end(); ++il) {
87 const ServicesLayer& layer( **il);
88 ServiceMaterial layerMat;
89
90 std::map<const ServicesLayer*, ServiceMaterial>::iterator iMat = layerMaterial.find(*il);
91 if (iMat != layerMaterial.end()) layerMat = iMat->second;
92 else {
93 StaveServices sserv = staveComputer.compute( layer.type(), layer.part(), layer.number(),
94 layer.modulesPerStave(), layer.chipsPerModule(), msg());
95 layerMat = staveConverter.convertStaveServices( sserv);
96
97 layerMat.multiply( layer.nStaves()); // scale from one stave to full layer
98
99 // add cooling, with possibility for manifilding
100 staveConverter.addCooling( layer.type(), layer.part(), layer.number(), layer.nStaves(), layerMat);
101
102 if(msgLvl(MSG::DEBUG)){
103 msg(MSG::DEBUG) <<"Dumping services for layer " << layer.number()<< endmsg;
104 layerMat.dump(cout);
105 }
106 layerMaterial[*il] = layerMat;
107 }
108 result.push_back( std::move(layerMat));
109 }
110
111 (**iv).setMaterials( result);
112 }
113}
114
115void ServicesTracker::addEosMaterial( const ServiceVolume& vol, std::vector<ServiceMaterial>& result)
116{
117 string name;
118 if (vol.name().find("Pixel") != string::npos) {
119 name = "pix::PixelEOS";
120 }
121 else {
122 name = "pix::StripEOS";
123 }
124
125 const ServicesLayer* layer = vol.layers().front();
126
127 ServiceMaterial::Entry eos( name, layer->nStaves(), 0);
129 result.emplace_back( name, entries);
130 // msg(MSG::INFO) << "Added EOS material to volume " << vol.name() << endmsg;
131}
132
133/*
134From the DB:
135name of cable linear material for each cable type, for each part
136e.g. pixel low voltage cable -> CoaxialHVCable (Or TwistedPair_awg36 etc.)
137The table holding this information must have the format
138 SUBDETECOR SERVICETYPE
139['Pixel','SCT'] ['HV','DCS','Data','LV','InletPipe','OutletPipe']
140
141For all services except LV the material name in this table is used directly, in combination with the
142computed length of the service in the volume, to define te volume material.
143For the LV, the "material name" is a switch between different conductor materials (Al, CCAW, ...), but the
144actual linear material weight is computed using the information about the stave power, voltage, etc.
145
146The powering scheme for each part is defined in another table, the structure of which is
147 SUBDETECTOR POWERING
148['Pixel','SCT'] ['Serial','DCDC']
149
150In addition we need the following information:
151For each module type: current, voltage
152for each stave type: number and type of modules, module grouping for HV, LV, Data
153
154 */
#define endmsg
MsgStream & msg() const
The standard message stream.
bool msgLvl(const MSG::Level lvl) const
Test the output level.
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
StaveServices compute(DetType::Type, DetType::Part, int layerNumber, int nModulesPerStave, int nChipsPerModule, MsgStream &msg) const
ServiceMaterial convertStaveServices(const StaveServices &stServ) const
void addCooling(DetType::Type type, DetType::Part part, int layerNumber, int nStaves, ServiceMaterial &mat)
void createRoutingVolumes(ServicesTracker &tracker)
Definition Routing2.cxx:36
void dump(std::ostream &os) const
void multiply(int factor)
std::vector< Entry > EntryContainer
std::vector< const ServicesLayer * > LayerContainer
const LayerContainer & layers() const
const std::string & name() const
void constructEndcapLayer(double zpos, double rmin, double rmax, DetType::Type type, int num, int nstaves, const std::string &suffix, int nModulesPerStave, int nChipsPerModule)
LayerContainer m_barrelStripLayers
LayerContainer m_barrelLayers
LayerContainer m_endcapPixelLayers
std::vector< ServiceVolume * > m_volumes
LayerContainer m_barrelPixelLayers
ServicesTracker()
Construct an empty tracker, to be filled by Builder.
const InDetServMatGeometryManager * m_geoMgr
void addEosMaterial(const ServiceVolume &vol, std::vector< ServiceMaterial > &result)
LayerContainer m_endcapStripLayers
void constructBarrelLayer(double radius, double zHalfLength, DetType::Type type, int num, int nstaves, const std::string &suffix, int nModulesPerStave, int nChipsPerModule)
Class storing all the services of a stave (or a petal, etc...) classifying them by function and by nu...
double entries
Definition listroot.cxx:49
@ Pixel
Definition DetType.h:13
@ Endcap
Definition DetType.h:14
@ Barrel
Definition DetType.h:14
STL namespace.
Structure holding one service material.