Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include "CalibTracker/SiStripCommon/plugins/SiStripDetInfoFileWriter.h"
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010 #include "FWCore/Framework/interface/ESHandle.h"
00011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00012
00013 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00014 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00015 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00016 #include "Geometry/CommonTopologies/interface/StripTopology.h"
00017 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
00018
00019
00020 using namespace cms;
00021 using namespace std;
00022
00023
00024 SiStripDetInfoFileWriter::SiStripDetInfoFileWriter(const edm::ParameterSet& iConfig) {
00025
00026
00027 edm::LogInfo("SiStripDetInfoFileWriter::SiStripDetInfoFileWriter");
00028
00029 filePath_ = iConfig.getUntrackedParameter<std::string>("FilePath",std::string("SiStripDetInfo.dat"));
00030
00031 }
00032
00033
00034 SiStripDetInfoFileWriter::~SiStripDetInfoFileWriter(){
00035
00036 edm::LogInfo("SiStripDetInfoFileWriter::~SiStripDetInfoFileWriter");
00037 }
00038
00039
00040
00041 void SiStripDetInfoFileWriter::beginRun(const edm::EventSetup& iSetup){
00042
00043
00044 outputFile_.open(filePath_.c_str());
00045
00046 if (outputFile_.is_open()){
00047
00048
00049 edm::ESHandle<TrackerGeometry> pDD;
00050
00051 iSetup.get<TrackerDigiGeometryRecord>().get( pDD );
00052
00053 edm::LogInfo("SiStripDetInfoFileWriter::beginRun - got geometry ")<<std::endl;
00054
00055
00056 edm::LogInfo("SiStripDetInfoFileWriter") <<" There are "<<pDD->detUnits().size() <<" detectors"<<std::endl;
00057
00058 for(TrackerGeometry::DetUnitContainer::const_iterator it = pDD->detUnits().begin(); it != pDD->detUnits().end(); it++){
00059
00060 const StripGeomDetUnit* mit = dynamic_cast<StripGeomDetUnit*>(*it);
00061
00062 if(mit!=0){
00063
00064 uint32_t detid=(mit->geographicalId()).rawId();
00065 double stripLength = mit->specificTopology().stripLength();
00066 unsigned short numberOfAPVs= mit->specificTopology().nstrips()/128;
00067 float thickness=mit->specificSurface().bounds().thickness();
00068
00069
00070 if(numberOfAPVs<1 || numberOfAPVs>6 ) {
00071 edm::LogError("SiStripDetInfoFileWriter")<<" Problem with Number of strips in detector.. "<< mit->specificTopology().nstrips() << "Will not write this entry to file"<< endl;
00072 continue;
00073 }
00074
00075 outputFile_ << detid << " "<< numberOfAPVs << " " << stripLength << " "<< thickness << "\n";
00076
00077 }
00078
00079 }
00080
00081 outputFile_.close();
00082
00083 }
00084
00085 else {
00086
00087 edm::LogError("SiStripDetInfoFileWriter::beginRun - Unable to open file")<<endl;
00088 return;
00089
00090 }
00091
00092 }
00093
00094