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