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 
10 
14 
15 using namespace cms;
16 using namespace std;
17 
19  edm::LogInfo("SiStripDetInfoFileWriter::SiStripDetInfoFileWriter");
20 
21  filePath_ = iConfig.getUntrackedParameter<std::string>("FilePath", std::string("SiStripDetInfo.dat"));
22  tkGeomToken_ = esConsumes<edm::Transition::BeginRun>();
23 }
24 
26  edm::LogInfo("SiStripDetInfoFileWriter::~SiStripDetInfoFileWriter");
27 }
28 
30  outputFile_.open(filePath_.c_str());
31 
32  if (outputFile_.is_open()) {
33  const auto& dd = iSetup.getData(tkGeomToken_);
34 
35  edm::LogInfo("SiStripDetInfoFileWriter::beginRun - got geometry ") << std::endl;
36 
37  edm::LogInfo("SiStripDetInfoFileWriter") << " There are " << dd.detUnits().size() << " detectors" << std::endl;
38 
39  for (const auto& it : dd.detUnits()) {
40  const StripGeomDetUnit* mit = dynamic_cast<StripGeomDetUnit const*>(it);
41 
42  if (mit != nullptr) {
43  uint32_t detid = (mit->geographicalId()).rawId();
44  double stripLength = mit->specificTopology().stripLength();
45  unsigned short numberOfAPVs = mit->specificTopology().nstrips() / 128;
46  float thickness = mit->specificSurface().bounds().thickness();
47 
48  if (numberOfAPVs < 1 || numberOfAPVs > 6) {
49  edm::LogError("SiStripDetInfoFileWriter")
50  << " Problem with Number of strips in detector.. " << mit->specificTopology().nstrips()
51  << "Will not write this entry to file" << endl;
52  continue;
53  }
54 
55  outputFile_ << detid << " " << numberOfAPVs << " " << stripLength << " " << thickness << "\n";
56  }
57  }
58 
59  outputFile_.close();
60 
61  }
62 
63  else {
64  edm::LogError("SiStripDetInfoFileWriter::beginRun - Unable to open file") << endl;
65  return;
66  }
67 }
StripGeomDetUnit.h
MessageLogger.h
edm::Run
Definition: Run.h:45
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
StripTopology.h
SiStripDetInfoFileWriter::SiStripDetInfoFileWriter
SiStripDetInfoFileWriter(const edm::ParameterSet &)
Definition: SiStripDetInfoFileWriter.cc:18
Calorimetry_cff.thickness
thickness
Definition: Calorimetry_cff.py:115
Surface::bounds
const Bounds & bounds() const
Definition: Surface.h:87
createTree.dd
string dd
Definition: createTree.py:154
SiStripDetInfoFileWriter.h
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
Bounds::thickness
virtual float thickness() const =0
StripTopology::stripLength
virtual float stripLength() const =0
edm::ParameterSet
Definition: ParameterSet.h:47
edm::EventSetup
Definition: EventSetup.h:58
GeomDet::specificSurface
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
SiStripDetInfoFileWriter::~SiStripDetInfoFileWriter
~SiStripDetInfoFileWriter() override
Definition: SiStripDetInfoFileWriter.cc:25
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
StripTopology::nstrips
virtual int nstrips() const =0
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
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:29
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21
StripGeomDetUnit
Definition: StripGeomDetUnit.h:15