CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

SiPixelDetInfoFileWriter Class Reference

#include <CalibTracker/SiPixelCommon/src/SiPixelDetInfoFileWriter.cc>

Inheritance diagram for SiPixelDetInfoFileWriter:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Private Member Functions

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

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 SiPixelDetInfoFileWriter.h.


Constructor & Destructor Documentation

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

Definition at line 24 of file SiPixelDetInfoFileWriter.cc.

References edm::ParameterSet::getUntrackedParameter().

                                                                                 {

  
  edm::LogInfo("SiPixelDetInfoFileWriter::SiPixelDetInfoFileWriter");

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

}
SiPixelDetInfoFileWriter::~SiPixelDetInfoFileWriter ( )

Definition at line 34 of file SiPixelDetInfoFileWriter.cc.

                                                   {

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 91 of file SiPixelDetInfoFileWriter.cc.

                                                                              {

}
void SiPixelDetInfoFileWriter::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 87 of file SiPixelDetInfoFileWriter.cc.

                                        {

}
void SiPixelDetInfoFileWriter::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 41 of file SiPixelDetInfoFileWriter.cc.

References cond::rpcobgas::detid, GeomDet::geographicalId(), edm::EventSetup::get(), PixelTopology::ncolumns(), PixelTopology::nrows(), and PixelGeomDetUnit::specificTopology().

                                                                                      {

  outputFile_.open(filePath_.c_str());

  if (outputFile_.is_open()){

    edm::ESHandle<TrackerGeometry> pDD;

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

    edm::LogInfo("SiPixelDetInfoFileWriter::beginJob - got geometry  ")<<std::endl;    
    edm::LogInfo("SiPixelDetInfoFileWriter") <<" There are "<<pDD->detUnits().size() <<" detectors"<<std::endl;
    
    int nPixelDets = 0;

    for(TrackerGeometry::DetUnitContainer::const_iterator it = pDD->detUnits().begin(); it != pDD->detUnits().end(); it++){
  
      const PixelGeomDetUnit* mit = dynamic_cast<PixelGeomDetUnit*>(*it);

      if(mit!=0){
        nPixelDets++;
      const PixelTopology & topol = mit->specificTopology();       
      // Get the module sizes.
      int nrows = topol.nrows();      // rows in x
      int ncols = topol.ncolumns();   // cols in y      
      uint32_t detid=(mit->geographicalId()).rawId();
      
      
      outputFile_ << detid << " "<< ncols << " " << nrows << "\n";
      
      }
    }    
    outputFile_.close();
    edm::LogInfo("SiPixelDetInfoFileWriter::beginJob - Loop finished. ")<< nPixelDets << " Pixel DetUnits found " << std::endl;
  }
  
  else {

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

}

Member Data Documentation

std::string SiPixelDetInfoFileWriter::filePath_ [private]

Definition at line 44 of file SiPixelDetInfoFileWriter.h.

std::ofstream SiPixelDetInfoFileWriter::outputFile_ [private]

Definition at line 43 of file SiPixelDetInfoFileWriter.h.