CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Attributes | Private Attributes
SiPixelDetInfoFileReader Class Reference

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

Public Member Functions

const std::vector< uint32_t > & getAllDetIds () const
 
const std::pair< int, int > & getDetUnitDimensions (uint32_t detId) const
 
 SiPixelDetInfoFileReader (std::string filePath)
 
 ~SiPixelDetInfoFileReader ()
 

Static Public Attributes

static constexpr char const *const kPh0DefaultFile = "CalibTracker/SiPixelESProducers/data/PixelSkimmedGeometry.txt"
 
static constexpr char const *const kPh1DefaultFile
 

Private Attributes

std::map< uint32_t, std::pair
< int, int > > 
detData_
 
std::vector< uint32_t > detIds_
 
std::ifstream inputFile_
 

Detailed Description

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

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

Definition at line 28 of file SiPixelDetInfoFileReader.h.

Constructor & Destructor Documentation

SiPixelDetInfoFileReader::SiPixelDetInfoFileReader ( std::string  filePath)
explicit

Definition at line 15 of file SiPixelDetInfoFileReader.cc.

15  {
16  // if(filePath==std::string("")){
17  // filePath = edm::FileInPath(std::string("CalibTracker/SiPixelCommon/data/SiPixelDetInfo.dat") ).fullPath();
18  // }
19 
20  detData_.clear();
21  detIds_.clear();
22 
23  inputFile_.open(filePath.c_str());
24 
25  if (inputFile_.is_open()) {
26  for (;;) {
27  uint32_t detid;
28  int ncols;
29  int nrows;
30 
31  inputFile_ >> detid >> ncols >> nrows;
32 
33  if (!(inputFile_.eof() || inputFile_.fail())) {
34  detIds_.push_back(detid);
35 
36  //inputFile_ >> numberOfAPVs;
37  //inputFile_ >> stripLength;
38 
39  // edm::LogInfo("SiPixelDetInfoFileReader::SiPixelDetInfoFileReader") << detid <<" " <<numberOfAPVs <<" " <<stripLength << " "<< thickness<< endl;
40 
41  std::map<uint32_t, std::pair<int, int> >::const_iterator it = detData_.find(detid);
42 
43  if (it == detData_.end()) {
44  detData_[detid] = pair<int, int>(ncols, nrows);
45 
46  } else {
47  edm::LogError("SiPixelDetInfoFileReader::SiPixelDetInfoFileReader")
48  << "DetId " << detid << " already found on file. Ignoring new data" << endl;
49  detIds_.pop_back();
50  continue;
51  }
52  } else if (inputFile_.eof()) {
53  edm::LogInfo("SiPixelDetInfoFileReader::SiPixelDetInfoFileReader - END of file reached") << endl;
54  break;
55 
56  } else if (inputFile_.fail()) {
57  edm::LogError("SiPixelDetInfoFileReader::SiPixelDetInfoFileReader - ERROR while reading file") << endl;
58  break;
59  }
60  }
61 
62  inputFile_.close();
63 
64  } else {
65  edm::LogError("SiPixelDetInfoFileReader::SiPixelDetInfoFileReader - Unable to open file") << endl;
66  return;
67  }
68 
69  // int i=0;
70  // for(std::map<uint32_t, std::pair<unsigned short, double> >::iterator it =detData_.begin(); it!=detData_.end(); it++ ) {
71  // std::cout<< it->first << " " << (it->second).first << " " << (it->second).second<<endl;
72  // i++;
73  // }
74  // std::cout<<i;
75 }
Log< level::Error, false > LogError
Log< level::Info, false > LogInfo
std::vector< uint32_t > detIds_
std::map< uint32_t, std::pair< int, int > > detData_
SiPixelDetInfoFileReader::~SiPixelDetInfoFileReader ( )

Definition at line 79 of file SiPixelDetInfoFileReader.cc.

79  {
80  edm::LogInfo("SiPixelDetInfoFileReader::~SiPixelDetInfoFileReader");
81 }
Log< level::Info, false > LogInfo

Member Function Documentation

const std::vector< uint32_t > & SiPixelDetInfoFileReader::getAllDetIds ( ) const
const std::pair< int, int > & SiPixelDetInfoFileReader::getDetUnitDimensions ( uint32_t  detId) const

Definition at line 89 of file SiPixelDetInfoFileReader.cc.

Referenced by NearbyPixelClustersAnalyzer::bookModuleHistograms().

89  {
90  std::map<uint32_t, std::pair<int, int> >::const_iterator it = detData_.find(detId);
91 
92  if (it != detData_.end()) {
93  return (*it).second;
94 
95  } else {
96  static const std::pair<int, int> defaultValue(0, 0);
98  "SiPixelDetInfoFileReader::getDetUnitDimensions - Unable to find requested detid. Returning invalid data ")
99  << endl;
100  return defaultValue;
101  }
102 }
std::map< uint32_t, std::pair< int, int > > detData_
Log< level::Warning, false > LogWarning

Member Data Documentation

std::map<uint32_t, std::pair<int, int> > SiPixelDetInfoFileReader::detData_
private

Definition at line 44 of file SiPixelDetInfoFileReader.h.

std::vector<uint32_t> SiPixelDetInfoFileReader::detIds_
private

Definition at line 45 of file SiPixelDetInfoFileReader.h.

std::ifstream SiPixelDetInfoFileReader::inputFile_
private

Definition at line 41 of file SiPixelDetInfoFileReader.h.

constexpr char const* const SiPixelDetInfoFileReader::kPh0DefaultFile = "CalibTracker/SiPixelESProducers/data/PixelSkimmedGeometry.txt"
static

Definition at line 36 of file SiPixelDetInfoFileReader.h.

constexpr char const* const SiPixelDetInfoFileReader::kPh1DefaultFile
static
Initial value:
=
"SLHCUpgradeSimulations/Geometry/data/PhaseI/PixelSkimmedGeometry_phase1.txt"

Definition at line 37 of file SiPixelDetInfoFileReader.h.