CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
19 using namespace cms;
20 using namespace std;
21 
22 
24 
25 
26  edm::LogInfo("SiStripDetInfoFileWriter::SiStripDetInfoFileWriter");
27 
28  filePath_ = iConfig.getUntrackedParameter<std::string>("FilePath",std::string("SiStripDetInfo.dat"));
29 
30 }
31 
32 
34 
35  edm::LogInfo("SiStripDetInfoFileWriter::~SiStripDetInfoFileWriter");
36 }
37 
38 
39 
41 
42 
43  outputFile_.open(filePath_.c_str());
44 
45  if (outputFile_.is_open()){
46 
47 
49 
50  iSetup.get<TrackerDigiGeometryRecord>().get( pDD );
51 
52  edm::LogInfo("SiStripDetInfoFileWriter::beginRun - got geometry ")<<std::endl;
53 
54 
55  edm::LogInfo("SiStripDetInfoFileWriter") <<" There are "<<pDD->detUnits().size() <<" detectors"<<std::endl;
56 
57  for(TrackerGeometry::DetUnitContainer::const_iterator it = pDD->detUnits().begin(); it != pDD->detUnits().end(); it++){
58 
59  const StripGeomDetUnit* mit = dynamic_cast<StripGeomDetUnit*>(*it);
60 
61  if(mit!=0){
62 
63  uint32_t detid=(mit->geographicalId()).rawId();
64  double stripLength = mit->specificTopology().stripLength();
65  unsigned short numberOfAPVs= mit->specificTopology().nstrips()/128;
66  float thickness=mit->specificSurface().bounds().thickness();
67 
68 
69  if(numberOfAPVs<1 || numberOfAPVs>6 ) {
70  edm::LogError("SiStripDetInfoFileWriter")<<" Problem with Number of strips in detector.. "<< mit->specificTopology().nstrips() << "Will not write this entry to file"<< endl;
71  continue;
72  }
73 
74  outputFile_ << detid << " "<< numberOfAPVs << " " << stripLength << " "<< thickness << "\n";
75 
76  }
77 
78  }
79 
80  outputFile_.close();
81 
82  }
83 
84  else {
85 
86  edm::LogError("SiStripDetInfoFileWriter::beginRun - Unable to open file")<<endl;
87  return;
88 
89  }
90 
91 }
92 
93 
virtual int nstrips() const =0
T getUntrackedParameter(std::string const &, T const &) const
const Bounds & bounds() const
Definition: Surface.h:128
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
virtual float thickness() const =0
virtual float stripLength() const =0
SiStripDetInfoFileWriter(const edm::ParameterSet &)
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:72
const T & get() const
Definition: EventSetup.h:55
void beginRun(const edm::EventSetup &iSetup)
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:38