CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

SiStripDetInfoFileWriter Class Reference

#include <CalibTracker/SiStripCommon/src/SiStripDetInfoFileWriter.cc>

Inheritance diagram for SiStripDetInfoFileWriter:
edm::EDAnalyzer

List of all members.

Public Member Functions

 SiStripDetInfoFileWriter (const edm::ParameterSet &)
 ~SiStripDetInfoFileWriter ()

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
void beginRun (const edm::EventSetup &iSetup)

Private Attributes

std::string filePath_
std::ofstream outputFile_

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 27 of file SiStripDetInfoFileWriter.h.


Constructor & Destructor Documentation

SiStripDetInfoFileWriter::SiStripDetInfoFileWriter ( const edm::ParameterSet iConfig) [explicit]

Definition at line 24 of file SiStripDetInfoFileWriter.cc.

References edm::ParameterSet::getUntrackedParameter().

                                                                                 {

  
  edm::LogInfo("SiStripDetInfoFileWriter::SiStripDetInfoFileWriter");

  filePath_ = iConfig.getUntrackedParameter<std::string>("FilePath",std::string("SiStripDetInfo.dat"));

}
SiStripDetInfoFileWriter::~SiStripDetInfoFileWriter ( )

Definition at line 34 of file SiStripDetInfoFileWriter.cc.

                                                   {

   edm::LogInfo("SiStripDetInfoFileWriter::~SiStripDetInfoFileWriter");
}

Member Function Documentation

void SiStripDetInfoFileWriter::analyze ( const edm::Event ,
const edm::EventSetup  
) [inline, private, virtual]

Implements edm::EDAnalyzer.

Definition at line 38 of file SiStripDetInfoFileWriter.h.

{};
void SiStripDetInfoFileWriter::beginRun ( const edm::EventSetup iSetup) [private]

Definition at line 41 of file SiStripDetInfoFileWriter.cc.

References BoundSurface::bounds(), cond::rpcobgas::detid, GeomDet::geographicalId(), edm::EventSetup::get(), StripTopology::nstrips(), GeomDet::specificSurface(), StripGeomDetUnit::specificTopology(), StripTopology::stripLength(), and Bounds::thickness().

                                                                  {


  outputFile_.open(filePath_.c_str());

  if (outputFile_.is_open()){


    edm::ESHandle<TrackerGeometry> pDD;

    iSetup.get<TrackerDigiGeometryRecord>().get( pDD );

    edm::LogInfo("SiStripDetInfoFileWriter::beginRun - got geometry  ")<<std::endl;

    
    edm::LogInfo("SiStripDetInfoFileWriter") <<" There are "<<pDD->detUnits().size() <<" detectors"<<std::endl;
    
    for(TrackerGeometry::DetUnitContainer::const_iterator it = pDD->detUnits().begin(); it != pDD->detUnits().end(); it++){
  
      const StripGeomDetUnit* mit = dynamic_cast<StripGeomDetUnit*>(*it);

      if(mit!=0){

        uint32_t detid=(mit->geographicalId()).rawId();
        double stripLength = mit->specificTopology().stripLength();
        unsigned short numberOfAPVs= mit->specificTopology().nstrips()/128;
        float thickness=mit->specificSurface().bounds().thickness();


        if(numberOfAPVs<1 || numberOfAPVs>6 ) {
          edm::LogError("SiStripDetInfoFileWriter")<<" Problem with Number of strips in detector.. "<< mit->specificTopology().nstrips() <<  "Will not write this entry to file"<< endl;
          continue;
        }

        outputFile_ << detid << " "<< numberOfAPVs << " " << stripLength << " "<< thickness << "\n";

      }

    }
    
    outputFile_.close();

  }
  
  else {

    edm::LogError("SiStripDetInfoFileWriter::beginRun - Unable to open file")<<endl;
    return;
  
  }

}

Member Data Documentation

std::string SiStripDetInfoFileWriter::filePath_ [private]

Definition at line 44 of file SiStripDetInfoFileWriter.h.

std::ofstream SiStripDetInfoFileWriter::outputFile_ [private]

Definition at line 38 of file SiStripDetInfoFileWriter.h.