CMS 3D CMS Logo

SiStripDetInfoFileWriter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Package: SiStripCommon
3 // Class: SiStripDetInfoFileWriter
4 // Original Author: G. Bruno
5 // Created: Mon May 20 10:04:31 CET 2007
6 
11 
17 
18 using namespace cms;
19 using namespace std;
20 
22  edm::LogInfo("SiStripDetInfoFileWriter::SiStripDetInfoFileWriter");
23 
24  filePath_ = iConfig.getUntrackedParameter<std::string>("FilePath", std::string("SiStripDetInfo.dat"));
25 }
26 
28  edm::LogInfo("SiStripDetInfoFileWriter::~SiStripDetInfoFileWriter");
29 }
30 
32  outputFile_.open(filePath_.c_str());
33 
34  if (outputFile_.is_open()) {
36 
37  iSetup.get<TrackerDigiGeometryRecord>().get(pDD);
38 
39  edm::LogInfo("SiStripDetInfoFileWriter::beginRun - got geometry ") << std::endl;
40 
41  edm::LogInfo("SiStripDetInfoFileWriter") << " There are " << pDD->detUnits().size() << " detectors" << std::endl;
42 
43  for (const auto& it : pDD->detUnits()) {
44  const StripGeomDetUnit* mit = dynamic_cast<StripGeomDetUnit const*>(it);
45 
46  if (mit != nullptr) {
47  uint32_t detid = (mit->geographicalId()).rawId();
48  double stripLength = mit->specificTopology().stripLength();
49  unsigned short numberOfAPVs = mit->specificTopology().nstrips() / 128;
50  float thickness = mit->specificSurface().bounds().thickness();
51 
52  if (numberOfAPVs < 1 || numberOfAPVs > 6) {
53  edm::LogError("SiStripDetInfoFileWriter")
54  << " Problem with Number of strips in detector.. " << mit->specificTopology().nstrips()
55  << "Will not write this entry to file" << endl;
56  continue;
57  }
58 
59  outputFile_ << detid << " " << numberOfAPVs << " " << stripLength << " " << thickness << "\n";
60  }
61  }
62 
63  outputFile_.close();
64 
65  }
66 
67  else {
68  edm::LogError("SiStripDetInfoFileWriter::beginRun - Unable to open file") << endl;
69  return;
70  }
71 }
StripGeomDetUnit.h
MessageLogger.h
TrackerGeometry.h
ESHandle.h
edm::Run
Definition: Run.h:45
edm::LogInfo
Definition: MessageLogger.h:254
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
StripTopology.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
SiStripDetInfoFileWriter::SiStripDetInfoFileWriter
SiStripDetInfoFileWriter(const edm::ParameterSet &)
Definition: SiStripDetInfoFileWriter.cc:21
TrackerGeometry::detUnits
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: TrackerGeometry.h:61
Calorimetry_cff.thickness
thickness
Definition: Calorimetry_cff.py:114
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
Surface::bounds
const Bounds & bounds() const
Definition: Surface.h:87
edm::ESHandle< TrackerGeometry >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripDetInfoFileWriter.h
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
TrackerDigiGeometryRecord.h
Bounds::thickness
virtual float thickness() const =0
StripTopology::stripLength
virtual float stripLength() const =0
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
edm::EventSetup
Definition: EventSetup.h:57
GeomDet::specificSurface
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40
get
#define get
SiStripDetInfoFileWriter::~SiStripDetInfoFileWriter
~SiStripDetInfoFileWriter() override
Definition: SiStripDetInfoFileWriter.cc:27
StripTopology::nstrips
virtual int nstrips() const =0
GeomDet.h
std
Definition: JetResolutionObject.h:76
StripGeomDetUnit::specificTopology
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
Definition: StripGeomDetUnit.cc:17
ParameterSet.h
SiStripDetInfoFileWriter::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &iSetup) override
Definition: SiStripDetInfoFileWriter.cc:31
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21
StripGeomDetUnit
Definition: StripGeomDetUnit.h:15