ATLAS Offline Software
Functions
ITkPixelIdentifiersDump.cxx File Reference
#include <AthenaBaseComps/AthService.h>
#include <AthenaBaseComps/AthAlgTool.h>
#include <AsgMessaging/MessageCheck.h>
#include <GaudiKernel/IAppMgrUI.h>
#include <InDetIdentifier/PixelID.h>
#include <InDetReadoutGeometry/SiDetectorElement.h>
#include <PixelReadoutGeometry/PixelModuleDesign.h>
#include <PixelReadoutGeometry/PixelDetectorManager.h>
#include <fstream>
Include dependency graph for ITkPixelIdentifiersDump.cxx:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 31 of file ITkPixelIdentifiersDump.cxx.

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 }
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
DumpGeoConfig.outFileName
string outFileName
Definition: DumpGeoConfig.py:252
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
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
InDetDD::PixelDetectorManager
Definition: PixelDetectorManager.h:47
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
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
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