ATLAS Offline Software
Loading...
Searching...
No Matches
PixelDetectorFactoryLite Class Reference

#include <PixelDetectorFactoryLite.h>

Inheritance diagram for PixelDetectorFactoryLite:
Collaboration diagram for PixelDetectorFactoryLite:

Public Member Functions

 PixelDetectorFactoryLite (GeoModelIO::ReadGeoModel *sqliteReader, PixelGeoModelAthenaComps *athenaComps, const PixelSwitches &switches)
 PixelDetectorFactoryLite ()=delete
 PixelDetectorFactoryLite (const PixelDetectorFactoryLite &right)=delete
const PixelDetectorFactoryLiteoperator= (const PixelDetectorFactoryLite &right)=delete
virtual void create (GeoPhysVol *world) override
virtual const InDetDD::PixelDetectorManagergetDetectorManager () const override
StoreGateSvcdetStore ()
const StoreGateSvcdetStore () const
const IGeoDbTagSvcgeoDbTagSvc () const
IRDBAccessSvcrdbAccessSvc ()
const IGeometryDBSvcgeomDB () const
MsgStream & msg (MSG::Level lvl) const
bool msgLvl (MSG::Level lvl)
InDetDD::AthenaCompsgetAthenaComps ()

Private Member Functions

void doChecks ()

Private Attributes

GeoModelIO::ReadGeoModel * m_sqliteReader {nullptr}
InDetDD::PixelDetectorManagerm_detectorManager {nullptr}
std::unique_ptr< PixelGeometryManagerm_geometryManager
bool m_useDynamicAlignFolders {false}
std::shared_ptr< std::map< std::string, GeoFullPhysVol * > > m_mapFPV
std::shared_ptr< std::map< std::string, GeoAlignableTransform * > > m_mapAX
InDetDD::AthenaCompsm_athenaComps

Detailed Description

Definition at line 28 of file PixelDetectorFactoryLite.h.

Constructor & Destructor Documentation

◆ PixelDetectorFactoryLite() [1/3]

PixelDetectorFactoryLite::PixelDetectorFactoryLite ( GeoModelIO::ReadGeoModel * sqliteReader,
PixelGeoModelAthenaComps * athenaComps,
const PixelSwitches & switches )

Definition at line 36 of file PixelDetectorFactoryLite.cxx.

39 : InDetDD::DetectorFactoryBase(athenaComps)
40 , m_sqliteReader (sqliteReader)
41{
42 // Create the detector manager
43 m_detectorManager = new PixelDetectorManager(detStore());
44
45 // Create the geometry manager.
46 m_geometryManager = std::make_unique<DBPixelGeoManager>(athenaComps);
47
48 // Pass the switches
49 m_geometryManager->SetServices(switches.services());
50 m_geometryManager->SetServicesOnLadder(switches.servicesOnLadder());
51 m_geometryManager->SetDC1Geometry(switches.dc1Geometry());
52 m_geometryManager->SetAlignable(switches.alignable());
53 m_geometryManager->SetInitialLayout(switches.initialLayout());
54 m_geometryManager->SetIBL(switches.ibl());
55
56 // get switch for DBM
57 m_geometryManager->SetDBMFlag(switches.dbm());
58 msg(MSG::INFO) << "DBM switch = SetDBMFlag: "<< m_geometryManager->dbm() << endmsg;
59
60 // Create SiCommonItems ans store it in geometry manager.
61 // These are items that are shared by all elements
62 std::unique_ptr<SiCommonItems> commonItems{std::make_unique<SiCommonItems>(athenaComps->getIdHelper())};
63 m_geometryManager->setCommonItems(commonItems.get());
64
65 // Add SiCommonItems to PixelDetectorManager to hold and delete it.
66 m_detectorManager->setCommonItems(std::move(commonItems));
67
68 // Determine if initial layer and tag from the id dict are consistent
69 bool initialLayoutIdDict = (m_detectorManager->tag() == "initial_layout");
70 if (m_geometryManager->InitialLayout() != initialLayoutIdDict ) {
71 msg(MSG::WARNING) << "IdDict tag is \"" << m_detectorManager->tag()
72 << "\" which is inconsistent with the layout choosen!" << endmsg;
73 }
74
75 //
76 // Set Version information
77 //
78 std::string versionTag = m_geometryManager->versionTag();
79 std::string versionName = m_geometryManager->versionName();
80 std::string layout = m_geometryManager->versionLayout();
81 std::string description = m_geometryManager->versionDescription() ;
82 int versionMajorNumber = 5;
83 int versionMinorNumber = 1;
84 int versionPatchNumber = 0;
85
86 if (m_geometryManager->InitialLayout()) {
87 layout = "Initial";
88 }
89
90 InDetDD::Version version(versionTag,
91 versionName,
92 layout,
94 versionMajorNumber,
95 versionMinorNumber,
96 versionPatchNumber);
97 m_detectorManager->setVersion(version);
98
100
101 if (sqliteReader) {
102 m_mapFPV = std::shared_ptr<std::map<std::string, GeoFullPhysVol*>> (new std::map<std::string, GeoFullPhysVol*> (m_sqliteReader->getPublishedNodes<std::string, GeoFullPhysVol*>("Pixel")));
103 m_mapAX = std::shared_ptr< std::map<std::string, GeoAlignableTransform*>> (new std::map<std::string, GeoAlignableTransform *> (m_sqliteReader->getPublishedNodes<std::string, GeoAlignableTransform*>("Pixel")));
104 }
105
106}
#define endmsg
InDetDD::PixelDetectorManager * m_detectorManager
GeoModelIO::ReadGeoModel * m_sqliteReader
std::shared_ptr< std::map< std::string, GeoAlignableTransform * > > m_mapAX
std::shared_ptr< std::map< std::string, GeoFullPhysVol * > > m_mapFPV
std::unique_ptr< PixelGeometryManager > m_geometryManager
const PixelID * getIdHelper() const
bool dynamicAlignFolders() const
bool services() const
bool servicesOnLadder() const
bool initialLayout() const
bool dc1Geometry() const
bool dbm() const
bool ibl() const
bool alignable() const
std::string description
glabal timer - how long have I taken so far?
Definition hcg.cxx:91
str layout
Definition TileTB.py:76
MsgStream & msg
Definition testRead.cxx:32

◆ PixelDetectorFactoryLite() [2/3]

PixelDetectorFactoryLite::PixelDetectorFactoryLite ( )
delete

◆ PixelDetectorFactoryLite() [3/3]

PixelDetectorFactoryLite::PixelDetectorFactoryLite ( const PixelDetectorFactoryLite & right)
delete

Member Function Documentation

◆ create()

void PixelDetectorFactoryLite::create ( GeoPhysVol * world)
overridevirtual

Definition at line 111 of file PixelDetectorFactoryLite.cxx.

112{
113 msg(MSG::INFO) << "Building Pixel Detector" << endmsg;
114 msg(MSG::INFO) << " " << m_detectorManager->getVersion().fullDescription() << endmsg;
115
116 // Printout the parameters that are different in DC1 and DC2.
117 m_geometryManager->SetCurrentLD(0);
118 m_geometryManager->SetBarrel();
119 msg(MSG::DEBUG) << " B-Layer basic eta pitch: " << m_geometryManager->DesignPitchZ()/Gaudi::Units::micrometer << "um" << endmsg;
120 msg(MSG::DEBUG) << " B-Layer sensor thickness: " << m_geometryManager->PixelBoardThickness()/Gaudi::Units::micrometer << "um" << endmsg;
121
122
123 // The top level volume
124 GeoFullPhysVol *pPixelEnvelopeVol = (*m_mapFPV)["Pixel_Envelope"];
125
126 // Create the Lite Pixel Envelope...
128 pe.Build() ;
129
130 GeoAlignableTransform * transform = (*m_mapAX)["Pixel_Envelope"];
131
132 // Store alignable transform
133 Identifier id = m_geometryManager->getIdHelper()->wafer_id(0,0,0,0);
134 m_detectorManager->addAlignableTransform(2, id, transform, pPixelEnvelopeVol);
135
136 // Add this to the list of top level physical volumes:
137 m_detectorManager->addTreeTop(pPixelEnvelopeVol);
138
139
140 // Initialize the neighbours
141 m_detectorManager->initNeighbours();
142
143 // Set maximum rows/columns in numerology
144 for (int iDesign = 0; iDesign < m_detectorManager->numDesigns(); iDesign++) {
145 m_detectorManager->numerology().setMaxNumPhiCells(m_detectorManager->getPixelDesign(iDesign)->rows());
146 m_detectorManager->numerology().setMaxNumEtaCells(m_detectorManager->getPixelDesign(iDesign)->columns());
147 }
148
149 // Register the callbacks and keys and the level corresponding to the key.
150 if (m_geometryManager->Alignable()) {
151
153 m_detectorManager->addAlignFolderType(InDetDD::static_run1);
154 m_detectorManager->addFolder("/Indet/Align");
155 m_detectorManager->addChannel("/Indet/Align/ID", 2, InDetDD::global);
156 m_detectorManager->addChannel("/Indet/Align/PIX", 1, InDetDD::global);
157 m_detectorManager->addChannel("/Indet/Align/PIXB1", 0, InDetDD::local);
158 m_detectorManager->addChannel("/Indet/Align/PIXB2", 0, InDetDD::local);
159 m_detectorManager->addChannel("/Indet/Align/PIXB3", 0, InDetDD::local);
160 m_detectorManager->addChannel("/Indet/Align/PIXB4", 0, InDetDD::local);
161 m_detectorManager->addChannel("/Indet/Align/PIXEA1", 0, InDetDD::local);
162 m_detectorManager->addChannel("/Indet/Align/PIXEA2", 0, InDetDD::local);
163 m_detectorManager->addChannel("/Indet/Align/PIXEA3", 0, InDetDD::local);
164 m_detectorManager->addChannel("/Indet/Align/PIXEC1", 0, InDetDD::local);
165 m_detectorManager->addChannel("/Indet/Align/PIXEC2", 0, InDetDD::local);
166 m_detectorManager->addChannel("/Indet/Align/PIXEC3", 0, InDetDD::local);
167 }
168
169 else {
171 m_detectorManager->addGlobalFolder("/Indet/AlignL1/ID");
172 m_detectorManager->addGlobalFolder("/Indet/AlignL2/PIX");
173 m_detectorManager->addChannel("/Indet/AlignL1/ID", 2, InDetDD::global);
174 m_detectorManager->addChannel("/Indet/AlignL2/PIX", 1, InDetDD::global);
175 m_detectorManager->addFolder("/Indet/AlignL3");
176 m_detectorManager->addChannel("/Indet/AlignL3/PIXB1", 0, InDetDD::local);
177 m_detectorManager->addChannel("/Indet/AlignL3/PIXB2", 0, InDetDD::local);
178 m_detectorManager->addChannel("/Indet/AlignL3/PIXB3", 0, InDetDD::local);
179 m_detectorManager->addChannel("/Indet/AlignL3/PIXB4", 0, InDetDD::local);
180 m_detectorManager->addChannel("/Indet/AlignL3/PIXEA1", 0, InDetDD::local);
181 m_detectorManager->addChannel("/Indet/AlignL3/PIXEA2", 0, InDetDD::local);
182 m_detectorManager->addChannel("/Indet/AlignL3/PIXEA3", 0, InDetDD::local);
183 m_detectorManager->addChannel("/Indet/AlignL3/PIXEC1", 0, InDetDD::local);
184 m_detectorManager->addChannel("/Indet/AlignL3/PIXEC2", 0, InDetDD::local);
185 m_detectorManager->addChannel("/Indet/AlignL3/PIXEC3", 0, InDetDD::local);
186 }
187
188 // This is the new LB-IOV sensitive IBL bowing DB
189 m_detectorManager->addSpecialFolder("/Indet/IBLDist");
190
191 }
192
193 // Check that there are no missing elements.
194 // Bypass checks for standard ATLAS.
195 if (m_geometryManager->ibl()) {
196 doChecks();
197 }
198}
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
@ timedependent_run2

◆ detStore() [1/2]

StoreGateSvc * InDetDD::DetectorFactoryBase::detStore ( )
inlineinherited

Definition at line 27 of file InDetDetectorFactoryBase.h.

27{return m_athenaComps->detStore();}

◆ detStore() [2/2]

const StoreGateSvc * InDetDD::DetectorFactoryBase::detStore ( ) const
inlineinherited

Definition at line 28 of file InDetDetectorFactoryBase.h.

28{return std::as_const(*m_athenaComps).detStore();}

◆ doChecks()

void PixelDetectorFactoryLite::doChecks ( )
private

Definition at line 200 of file PixelDetectorFactoryLite.cxx.

201{
202 const PixelID * idHelper = m_geometryManager->athenaComps()->getIdHelper();
203 const PixelDetectorManager * manager = m_detectorManager;
204
205 msg(MSG::INFO) << "Doing consistency checks." << endmsg;
206
207 unsigned int maxHash = idHelper->wafer_hash_max();
208
209 int count = 0;
210 int missingCount = 0;
212 for (iter = manager->getDetectorElementBegin(); iter != manager->getDetectorElementEnd(); ++iter){
213 count++;
214 const InDetDD::SiDetectorElement * element = *iter;
215 if (!element) {
216 msg(MSG::WARNING) << "MISSING ELEMENT!!!!!!!!!!! - Element # " << count-1 << endmsg;
217 missingCount++;
218 }
219 }
220
221 if (missingCount) {
222 msg(MSG::ERROR) << "There are missing elements in element array." << endmsg;
223 msg(MSG::INFO) << "Number of elements: " << count << endmsg;
224 msg(MSG::INFO) << "Number missing: " << missingCount << endmsg;
225 }
226
227
228 // ***********************************************************************************
229 // Loop over modules
230 // ***********************************************************************************
231
232 // Barrel
233 int barrelCount = 0;
234 int barrelCountError = 0;
235 for (int iBarrelIndex = 0; iBarrelIndex < manager->numerology().numBarrels(); iBarrelIndex++)
236 {
237 int iBarrel = manager->numerology().barrelId(iBarrelIndex);
238 for (int iLayer = 0; iLayer < manager->numerology().numLayers(); iLayer++) {
239
240 // TEMPORARY FIX
241 // Temporary fix for IBL. Numerology class needs to be fixed.
242 m_geometryManager->SetCurrentLD(iLayer);
243 int etaCorrection = 0;
244 if (!m_geometryManager->allowSkipEtaZero() && manager->numerology().skipEtaZeroForLayer(iLayer)) {
245 etaCorrection = 1;
246 }
247 // END TEMPORARY FIX
248
249 if (manager->numerology().useLayer(iLayer)) {
250 for (int iPhi = 0; iPhi < manager->numerology().numPhiModulesForLayer(iLayer); iPhi++)
251 {
252 for (int iEta = manager->numerology().beginEtaModuleForLayer(iLayer);
253 iEta < manager->numerology().endEtaModuleForLayer(iLayer) - etaCorrection;
254 iEta++)
255 {
256 if (!etaCorrection && !iEta && manager->numerology().skipEtaZeroForLayer(iLayer)) continue; // TEMPORARY FIX
257 Identifier id = idHelper->wafer_id(iBarrel,iLayer,iPhi,iEta);
258 const InDetDD::SiDetectorElement * element = manager->getDetectorElement(id);
259 barrelCount++;
260 std::stringstream ostr;
261 ostr << "[2.1 . " << iBarrel << " . " << iLayer << " . " << iPhi << " . " << iEta << " . 0]";
262 if (!element) {
263 barrelCountError++;
264 msg(MSG::WARNING) << " No element found for id: " << ostr.str() << " " << idHelper->show_to_string(id) << endmsg;
265
266 }
267
268 } // iEta
269
270 } //iPhi
271
272 }
273
274 } //iLayer
275
276 } // Barrel
277
278
279 // Endcap
280 int endcapCount = 0;
281 int endcapCountError = 0;
282 for (int iEndcapIndex = 0; iEndcapIndex < manager->numerology().numEndcaps(); iEndcapIndex++) {
283 int iEndcap = manager->numerology().endcapId(iEndcapIndex);
284 for (int iDisk = 0; iDisk < manager->numerology().numDisks(); iDisk++) {
285 if (manager->numerology().useDisk(iDisk)) {
286 for (int iEta = 0; iEta < manager->numerology().numRingsForDisk(iDisk); iEta++) {
287 for (int iPhi = 0; iPhi < manager->numerology().numPhiModulesForDiskRing(iDisk,iEta); iPhi++) {
288 Identifier id = idHelper->wafer_id(iEndcap,iDisk,iPhi,iEta);
289 const InDetDD::SiDetectorElement * element = manager->getDetectorElement(id);
290 endcapCount++;
291 std::stringstream ostr;
292 ostr << "[2.1." << iEndcap << "." << iDisk << "." << iPhi << "." << iEta << ".0]";
293 if (!element) {
294 endcapCountError++;
295 msg(MSG::WARNING) << " No element found for id: " << ostr.str() << " " << idHelper->show_to_string(id) << endmsg;
296 }
297 } // iEta
298 } //iPhi
299 }
300 } //iDisk
301 } // Endcap;
302
303 // Check DBM endcap modules
304 int endcapCountDBM = 0;
305 int endcapCountErrorDBM = 0;
306 if (m_geometryManager->dbm()) {
307 // Endcap
308 for (int iEndcapIndex = 0; iEndcapIndex < manager->numerology().numEndcapsDBM(); iEndcapIndex++) {
309 int iEndcap = manager->numerology().endcapIdDBM(iEndcapIndex);
310 for (int iDisk = 0; iDisk < manager->numerology().numDisksDBM(); iDisk++) {
311 if (manager->numerology().useDiskDBM(iDisk)) {
312 for (int iEta = 0; iEta < manager->numerology().numRingsForDiskDBM(iDisk); iEta++) {
313 for (int iPhi = 0; iPhi < manager->numerology().numPhiModulesForDiskRingDBM(iDisk,iEta); iPhi++) {
314 Identifier id = idHelper->wafer_id(iEndcap,iDisk,iPhi,iEta);
315 const InDetDD::SiDetectorElement * element = manager->getDetectorElement(id);
316 endcapCountDBM++;
317 std::stringstream ostr;
318 ostr << "[2.1." << iEndcap << "." << iDisk << "." << iPhi << "." << iEta << ".0]";
319 if (!element) {
320 endcapCountErrorDBM++;
321 msg(MSG::WARNING) << " No element found for id (DBM): " << ostr.str() << " " << idHelper->show_to_string(id) << endmsg;
322 }
323 } // iEta
324 } //iPhi
325 }
326 } //iDisk
327 } // Endcap;
328 }
329
330 if (barrelCountError || endcapCountError || endcapCountErrorDBM) {
331 msg(MSG::ERROR) << "There are elements which cannot be found." << endmsg;
332 msg(MSG::INFO) << "Number of barrel elements not found : " << barrelCountError << endmsg;
333 msg(MSG::INFO) << "Number of pixel endcap elements not found : " << endcapCountError << endmsg;
334 msg(MSG::INFO) << "Number of DBM endcap elements not found : " << endcapCountErrorDBM << endmsg;
335 }
336
337 if ( barrelCount+endcapCount+endcapCountDBM != int(maxHash)) {
338 msg(MSG::ERROR) << "Total count does not match maxHash." << endmsg;
339 msg(MSG::INFO) << "Number of barrel elements : " << barrelCount << endmsg;
340 msg(MSG::INFO) << "Number of endcap elements : " << endcapCount << endmsg;
341 msg(MSG::INFO) << "Number of endcap elements (DBM) : " << endcapCountDBM << endmsg;
342 msg(MSG::INFO) << "Total : " << barrelCount+endcapCount+endcapCountDBM << endmsg;
343 msg(MSG::INFO) << "MaxHash : " << maxHash << endmsg;
344 }
345
346 msg(MSG::INFO) << "Number of barrel elements : " << barrelCount << endmsg;
347 msg(MSG::INFO) << "Number of endcap elements : " << endcapCount << endmsg;
348 msg(MSG::INFO) << "Number of endcap elements (DBM) : " << endcapCountDBM << endmsg;
349 msg(MSG::INFO) << "Total : " << barrelCount+endcapCount+endcapCountDBM << endmsg;
350 msg(MSG::INFO) << "MaxHash : " << maxHash << endmsg;
351
352}
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
Definition PixelID.h:360
size_type wafer_hash_max() const
Definition PixelID.cxx:801
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
constexpr unsigned int numLayers()
Definition HIEventDefs.h:23
@ iPhi
Definition ParamDefs.h:47
setScale setgFexType iEta

◆ geoDbTagSvc()

const IGeoDbTagSvc * InDetDD::DetectorFactoryBase::geoDbTagSvc ( ) const
inlineinherited

Definition at line 30 of file InDetDetectorFactoryBase.h.

30{return std::as_const(*m_athenaComps).geoDbTagSvc();}

◆ geomDB()

const IGeometryDBSvc * InDetDD::DetectorFactoryBase::geomDB ( ) const
inlineinherited

Definition at line 34 of file InDetDetectorFactoryBase.h.

34{return m_athenaComps->geomDB();}

◆ getAthenaComps()

InDetDD::AthenaComps * InDetDD::DetectorFactoryBase::getAthenaComps ( )
inlineinherited

Definition at line 42 of file InDetDetectorFactoryBase.h.

42{return m_athenaComps;}

◆ getDetectorManager()

virtual const InDetDD::PixelDetectorManager * PixelDetectorFactoryLite::getDetectorManager ( ) const
inlineoverridevirtual

Definition at line 43 of file PixelDetectorFactoryLite.h.

43{ return m_detectorManager; }

◆ msg()

MsgStream & InDetDD::DetectorFactoryBase::msg ( MSG::Level lvl) const
inlineinherited

Definition at line 37 of file InDetDetectorFactoryBase.h.

37{ return m_athenaComps->msg(lvl); }

◆ msgLvl()

bool InDetDD::DetectorFactoryBase::msgLvl ( MSG::Level lvl)
inlineinherited

Definition at line 40 of file InDetDetectorFactoryBase.h.

40{ return m_athenaComps->msgLvl(lvl); }

◆ operator=()

const PixelDetectorFactoryLite & PixelDetectorFactoryLite::operator= ( const PixelDetectorFactoryLite & right)
delete

◆ rdbAccessSvc()

IRDBAccessSvc * InDetDD::DetectorFactoryBase::rdbAccessSvc ( )
inlineinherited

Definition at line 32 of file InDetDetectorFactoryBase.h.

32{return m_athenaComps->rdbAccessSvc();}

Member Data Documentation

◆ m_athenaComps

InDetDD::AthenaComps* InDetDD::DetectorFactoryBase::m_athenaComps
privateinherited

Definition at line 46 of file InDetDetectorFactoryBase.h.

◆ m_detectorManager

InDetDD::PixelDetectorManager* PixelDetectorFactoryLite::m_detectorManager {nullptr}
private

Definition at line 47 of file PixelDetectorFactoryLite.h.

47{nullptr}; //ownership handed to caller

◆ m_geometryManager

std::unique_ptr<PixelGeometryManager> PixelDetectorFactoryLite::m_geometryManager
private

Definition at line 48 of file PixelDetectorFactoryLite.h.

◆ m_mapAX

std::shared_ptr<std::map<std::string, GeoAlignableTransform*> > PixelDetectorFactoryLite::m_mapAX
private

Definition at line 52 of file PixelDetectorFactoryLite.h.

◆ m_mapFPV

std::shared_ptr<std::map<std::string, GeoFullPhysVol*> > PixelDetectorFactoryLite::m_mapFPV
private

Definition at line 51 of file PixelDetectorFactoryLite.h.

◆ m_sqliteReader

GeoModelIO::ReadGeoModel* PixelDetectorFactoryLite::m_sqliteReader {nullptr}
private

Definition at line 46 of file PixelDetectorFactoryLite.h.

46{nullptr};

◆ m_useDynamicAlignFolders

bool PixelDetectorFactoryLite::m_useDynamicAlignFolders {false}
private

Definition at line 50 of file PixelDetectorFactoryLite.h.

50{false};

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