CMS 3D CMS Logo

SiPixelDetInfoFileWriter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Package: SiPixelESProducers
3 // Class: SiPixelDetInfoFileWriter
4 // Original Author: V.Chiochia (adapted from the Strip version by G.Bruno)
5 // Created: Mon May 20 10:04:31 CET 2007
6 
10 
14 
15 using namespace cms;
16 using namespace std;
17 
19  edm::LogInfo("SiPixelDetInfoFileWriter::SiPixelDetInfoFileWriter");
20 
21  trackerGeomTokenBeginRun_ = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord, edm::Transition::BeginRun>();
22  filePath_ = iConfig.getUntrackedParameter<std::string>("FilePath", std::string("SiPixelDetInfo.dat"));
23 }
24 
26  edm::LogInfo("SiPixelDetInfoFileWriter::~SiPixelDetInfoFileWriter");
27 }
28 
30  outputFile_.open(filePath_.c_str());
31 
32  if (outputFile_.is_open()) {
33  edm::ESHandle<TrackerGeometry> pDD = iSetup.getHandle(trackerGeomTokenBeginRun_);
34 
35  edm::LogInfo("SiPixelDetInfoFileWriter::beginJob - got geometry ") << std::endl;
36  edm::LogInfo("SiPixelDetInfoFileWriter") << " There are " << pDD->detUnits().size() << " detectors" << std::endl;
37 
38  int nPixelDets = 0;
39 
40  for (const auto &it : pDD->detUnits()) {
41  const PixelGeomDetUnit *mit = dynamic_cast<PixelGeomDetUnit const *>(it);
42 
43  if (mit != nullptr) {
44  nPixelDets++;
45  const PixelTopology &topol = mit->specificTopology();
46  // Get the module sizes.
47  int nrows = topol.nrows(); // rows in x
48  int ncols = topol.ncolumns(); // cols in y
49  uint32_t detid = (mit->geographicalId()).rawId();
50 
51  outputFile_ << detid << " " << ncols << " " << nrows << "\n";
52  }
53  }
54  outputFile_.close();
55  edm::LogInfo("SiPixelDetInfoFileWriter::beginJob - Loop finished. ")
56  << nPixelDets << " Pixel DetUnits found " << std::endl;
57  }
58 
59  else {
60  edm::LogError("SiPixelDetInfoFileWriter::beginJob - Unable to open file") << endl;
61  return;
62  }
63 }
64 
66 
hgcalPlots.ncols
ncols
Definition: hgcalPlots.py:104
MessageLogger.h
SiPixelDetInfoFileWriter::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: SiPixelDetInfoFileWriter.cc:29
PixelTopology.h
edm::Run
Definition: Run.h:45
SiPixelDetInfoFileWriter::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: SiPixelDetInfoFileWriter.cc:67
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiPixelDetInfoFileWriter::~SiPixelDetInfoFileWriter
~SiPixelDetInfoFileWriter() override
Definition: SiPixelDetInfoFileWriter.cc:25
TrackerGeometry::detUnits
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: TrackerGeometry.h:61
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
SiPixelDetInfoFileWriter::SiPixelDetInfoFileWriter
SiPixelDetInfoFileWriter(const edm::ParameterSet &)
Definition: SiPixelDetInfoFileWriter.cc:18
edm::ESHandle< TrackerGeometry >
PixelTopology::ncolumns
virtual int ncolumns() const =0
PixelTopology
Definition: PixelTopology.h:10
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
edm::ParameterSet
Definition: ParameterSet.h:47
PixelGeomDetUnit::specificTopology
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
Definition: PixelGeomDetUnit.cc:17
SiPixelDetInfoFileWriter::beginJob
void beginJob() override
Definition: SiPixelDetInfoFileWriter.cc:65
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
edm::EventSetup
Definition: EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GeomDet.h
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
PixelGeomDetUnit.h
ParameterSet.h
SiPixelDetInfoFileWriter.h
edm::Event
Definition: Event.h:73
PixelTopology::nrows
virtual int nrows() const =0
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21