ATLAS Offline Software
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 
10 // Framework includes
14 #include <GaudiKernel/IAppMgrUI.h>
15 
16 // Pixel includes
21 
22 // std
23 #include <fstream>
24 
25 // messaging
26 ANA_MSG_HEADER(ITkPixel)
27 ANA_MSG_SOURCE(ITkPixel, "Identifiers")
28 using namespace ITkPixel;
29 
30 
31 int 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") );
53  const InDetDD::SiDetectorElementCollection* elements{detManager->getDetectorElementCollection()};
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 }
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
main
int main(int argc, char *argv[])
Definition: ITkPixelIdentifiersDump.cxx:31
InDetDD::SiDetectorElementCollection
Definition: SiDetectorElementCollection.h:30
InDetDD::PixelModuleDesign
Definition: PixelModuleDesign.h:48
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
ANA_MSG_HEADER
#define ANA_MSG_HEADER(NAME)
for standalone code this creates a new message category
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:113
DumpGeoConfig.outFileName
string outFileName
Definition: DumpGeoConfig.py:252
PixelDetectorManager.h
LArCellNtuple.argv
argv
Definition: LArCellNtuple.py:152
dqt_zlumi_alleff_HIST.fout
fout
Definition: dqt_zlumi_alleff_HIST.py:59
InDetDD::PixelModuleDesign::numberOfCircuits
int numberOfCircuits() const
Total number of circuits:
Definition: PixelModuleDesign.h:315
MessageCheck.h
macros for messaging and checking status codes
AthAlgTool.h
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
InDetDD::PixelDetectorManager
Definition: PixelDetectorManager.h:47
ANA_MSG_SOURCE
#define ANA_MSG_SOURCE(NAME, TITLE)
the source code part of ANA_MSG_SOURCE
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:133
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
SiDetectorElement.h
ANA_CHECK_SET_TYPE
#define ANA_CHECK_SET_TYPE(TYPE)
set the type for ANA_CHECK to report failures
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:314
PixelModuleDesign.h
AthService.h
InDetDD::SiDetectorElement::design
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
PixelID
Definition: PixelID.h:67
ServiceHandle< StoreGateSvc >
Identifier
Definition: IdentifierFieldParser.cxx:14