ATLAS Offline Software
Loading...
Searching...
No Matches
ITkPixelIdentifiersDump.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10// Framework includes
14#include <GaudiKernel/IAppMgrUI.h>
15
16// Pixel includes
21
22// std
23#include <fstream>
24
25// messaging
26ANA_MSG_HEADER(ITkPixel)
27ANA_MSG_SOURCE(ITkPixel, "Identifiers")
28using namespace ITkPixel;
29
30
31int main(int argc, char *argv[])
32{
33 ANA_CHECK_SET_TYPE (int); // makes ANA_CHECK return ints if exiting function
34
35 std::string outFileName{"ITkPixelIdentifiers.dat"};
36 if (argc > 1) {
37 outFileName = argv[1];
38 }
39
40 IAppMgrUI *appMgr = Gaudi::createApplicationMgr();
41 SmartIF<IProperty> propMgr = appMgr;
42 ANA_CHECK( propMgr->setProperty( "EvtSel", "NONE" ) );
43 ANA_CHECK( propMgr->setProperty( "JobOptionsType", "FILE" ) );
44 ANA_CHECK( propMgr->setProperty( "JobOptionsPath", "PixelReadoutGeometry/ITkPixelIdentifiersDumpConfig.txt" ) );
45
46 ANA_CHECK( appMgr->configure() );
47 ANA_CHECK( appMgr->initialize() );
48
49 ServiceHandle<StoreGateSvc> detectorStore("DetectorStore", "ITkPixelIdentifiers");
50
51 const InDetDD::PixelDetectorManager *detManager{};
52 ANA_CHECK( detectorStore->retrieve(detManager, "ITkPixel") );
54
55 const PixelID *pixelID{};
56 ANA_CHECK( detectorStore->retrieve(pixelID, "PixelID") );
57
58 std::ofstream fout{outFileName};
59 fout << "# "
60 << "Hash" << "\t"
61 << "ID" << "\t"
62 << "B/EC" << "\t"
63 << "Layer" << "\t"
64 << "phi" << "\t"
65 << "eta" << "\t"
66 << "FEs" << std::endl;
67
68 for (unsigned int moduleHash{}; moduleHash < pixelID->wafer_hash_max(); moduleHash++) {
69 IdentifierHash wafer_hash = IdentifierHash(moduleHash);
70 Identifier wafer_id = pixelID->wafer_id(wafer_hash);
71 const InDetDD::SiDetectorElement *element = elements->getDetectorElement(wafer_hash);
72 const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design());
73
74 fout << moduleHash << "\t"
75 << wafer_id.get_compact() << "\t"
76 << pixelID->barrel_ec(wafer_id) << "\t"
77 << pixelID->layer_disk(wafer_id) << "\t"
78 << pixelID->phi_module(wafer_id) << "\t"
79 << pixelID->eta_module(wafer_id) << "\t"
80 << p_design->numberOfCircuits() << std::endl;
81 }
82
83 fout.close();
84
85 ANA_CHECK( appMgr->finalize() );
86 ANA_CHECK( appMgr->terminate() );
87
88 return 0;
89}
macros for messaging and checking status codes
#define ANA_CHECK(EXP)
check whether the given expression was successful
#define ANA_MSG_HEADER(NAME)
for standalone code this creates a new message category
#define ANA_MSG_SOURCE(NAME, TITLE)
the source code part of ANA_MSG_SOURCE
#define ANA_CHECK_SET_TYPE(TYPE)
set the type for ANA_CHECK to report failures
int main(int, char **)
Main class for all the CppUnit test classes.
This is an Identifier helper class for the Pixel subdetector.
This is a "hash" representation of an Identifier.
value_type get_compact() const
Get the compact id.
Dedicated detector manager extending the functionality of the SiDetectorManager with dedicated pixel ...
virtual const SiDetectorElementCollection * getDetectorElementCollection() const override
access to whole collection via Iterators
Class used to describe the design of a module (diode segmentation and readout scheme)
int numberOfCircuits() const
Total number of circuits:
Class to hold the SiDetectorElement objects to be put in the detector store.
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
Class to hold geometrical description of a silicon detector element.
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
This is an Identifier helper class for the Pixel subdetector.
Definition PixelID.h:67
int layer_disk(const Identifier &id) const
Definition PixelID.h:607
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
Definition PixelID.h:360
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition PixelID.h:600
size_type wafer_hash_max() const
Definition PixelID.cxx:801
int eta_module(const Identifier &id) const
Definition PixelID.h:632
int phi_module(const Identifier &id) const
Definition PixelID.h:625
static TFile * fout
Definition listroot.cxx:40