CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // $Id: SiPixelDetInfoFileWriter.cc,v 1.4 2010/01/14 09:36:57 ursl Exp $
7 
12 
18 
19 
20 using namespace cms;
21 using namespace std;
22 
23 
25 
26 
27  edm::LogInfo("SiPixelDetInfoFileWriter::SiPixelDetInfoFileWriter");
28 
29  filePath_ = iConfig.getUntrackedParameter<std::string>("FilePath",std::string("SiPixelDetInfo.dat"));
30 
31 }
32 
33 
35 
36  edm::LogInfo("SiPixelDetInfoFileWriter::~SiPixelDetInfoFileWriter");
37 }
38 
39 
40 
42 
43  outputFile_.open(filePath_.c_str());
44 
45  if (outputFile_.is_open()){
46 
48 
49  iSetup.get<TrackerDigiGeometryRecord>().get( pDD );
50 
51  edm::LogInfo("SiPixelDetInfoFileWriter::beginJob - got geometry ")<<std::endl;
52  edm::LogInfo("SiPixelDetInfoFileWriter") <<" There are "<<pDD->detUnits().size() <<" detectors"<<std::endl;
53 
54  int nPixelDets = 0;
55 
56  for(TrackerGeometry::DetUnitContainer::const_iterator it = pDD->detUnits().begin(); it != pDD->detUnits().end(); it++){
57 
58  const PixelGeomDetUnit* mit = dynamic_cast<PixelGeomDetUnit*>(*it);
59 
60  if(mit!=0){
61  nPixelDets++;
62  const PixelTopology & topol = mit->specificTopology();
63  // Get the module sizes.
64  int nrows = topol.nrows(); // rows in x
65  int ncols = topol.ncolumns(); // cols in y
66  uint32_t detid=(mit->geographicalId()).rawId();
67 
68 
69  outputFile_ << detid << " "<< ncols << " " << nrows << "\n";
70 
71  }
72  }
73  outputFile_.close();
74  edm::LogInfo("SiPixelDetInfoFileWriter::beginJob - Loop finished. ")<< nPixelDets << " Pixel DetUnits found " << std::endl;
75  }
76 
77  else {
78 
79  edm::LogError("SiPixelDetInfoFileWriter::beginJob - Unable to open file")<<endl;
80  return;
81 
82  }
83 
84 }
85 
86 
88 
89 }
90 
92 
93 }
T getUntrackedParameter(std::string const &, T const &) const
virtual int ncolumns() const =0
virtual int nrows() const =0
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:72
void analyze(const edm::Event &, const edm::EventSetup &)
const T & get() const
Definition: EventSetup.h:55
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
SiPixelDetInfoFileWriter(const edm::ParameterSet &)
void beginRun(const edm::Run &, const edm::EventSetup &)
Definition: Run.h:36