CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
SiStripDetInfoFileReader Class Reference

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

Classes

struct  DetInfo
 

Public Member Functions

const std::map< uint32_t, DetInfo > & getAllData () const
 
const std::vector< uint32_t > & getAllDetIds () const
 
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength (uint32_t detId) const
 
const float & getThickness (uint32_t detId) const
 
SiStripDetInfoFileReaderoperator= (const SiStripDetInfoFileReader &copy)
 
 SiStripDetInfoFileReader ()
 
 SiStripDetInfoFileReader (const edm::ParameterSet &, const edm::ActivityRegistry &)
 
 SiStripDetInfoFileReader (std::string filePath)
 
 SiStripDetInfoFileReader (const SiStripDetInfoFileReader &)
 
 ~SiStripDetInfoFileReader ()
 

Private Member Functions

void reader (std::string filePath)
 

Private Attributes

std::map< uint32_t, DetInfodetData_
 
std::vector< uint32_t > detIds_
 
std::ifstream inputFile_
 

Detailed Description

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

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

Definition at line 30 of file SiStripDetInfoFileReader.h.

Constructor & Destructor Documentation

SiStripDetInfoFileReader::SiStripDetInfoFileReader ( )
inlineexplicit
SiStripDetInfoFileReader::SiStripDetInfoFileReader ( const edm::ParameterSet pset,
const edm::ActivityRegistry ar 
)
explicit

Definition at line 21 of file SiStripDetInfoFileReader.cc.

References personalPlayback::fp, edm::FileInPath::fullPath(), edm::ParameterSet::getUntrackedParameter(), DQM::reader, and AlCaHLTBitMon_QueryRunRegistry::string.

21  {
23  pset.getUntrackedParameter<std::string>("filePath", "CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"));
24  reader(fp.fullPath());
25 }
T getUntrackedParameter(std::string const &, T const &) const
void reader(std::string filePath)
SiStripDetInfoFileReader::SiStripDetInfoFileReader ( std::string  filePath)
explicit

Definition at line 32 of file SiStripDetInfoFileReader.cc.

References DQM::reader.

SiStripDetInfoFileReader::SiStripDetInfoFileReader ( const SiStripDetInfoFileReader copy)
explicit

Definition at line 27 of file SiStripDetInfoFileReader.cc.

References detData_, and detIds_.

27  {
28  detData_ = copy.detData_;
29  detIds_ = copy.detIds_;
30 }
std::map< uint32_t, DetInfo > detData_
std::vector< uint32_t > detIds_
SiStripDetInfoFileReader::~SiStripDetInfoFileReader ( )

Definition at line 99 of file SiStripDetInfoFileReader.cc.

Referenced by SiStripDetInfoFileReader().

99 {}

Member Function Documentation

const std::map<uint32_t, DetInfo>& SiStripDetInfoFileReader::getAllData ( ) const
inline
const std::vector<uint32_t>& SiStripDetInfoFileReader::getAllDetIds ( ) const
inline
const std::pair< unsigned short, double > SiStripDetInfoFileReader::getNumberOfApvsAndStripLength ( uint32_t  detId) const

Definition at line 101 of file SiStripDetInfoFileReader.cc.

Referenced by SiStripQuality::add(), SiStripHitEffFromCalibTree::algoAnalyze(), OverlapValidation::analyze(), SiStripBaseCondObjDQM::bookProfileMEs(), SiStripBaseCondObjDQM::bookSummaryProfileMEs(), SiStripQuality::compact(), SiStripQuality::fillBadComponents(), SiStripPI::fillBCArrays(), SiStripNoisesDQM::fillMEsForDet(), SiStripPedestalsDQM::fillMEsForDet(), SiStripThresholdDQM::fillMEsForDet(), SiStripApvGainsDQM::fillMEsForDet(), SiStripQualityDQM::fillMEsForDet(), SiStripNoisesDQM::fillMEsForLayer(), SiStripPedestalsDQM::fillMEsForLayer(), SiStripThresholdDQM::fillMEsForLayer(), SiStripApvGainsDQM::fillMEsForLayer(), SiStripQualityDQM::fillMEsForLayer(), SiStripPI::fillTotalComponents(), getAllDetIds(), SiStripBadModuleByHandBuilder::getNewObject(), SiStripFedCablingFakeESSource::make(), SiStripHitEffFromCalibTree::makeSQLite(), SiStripQuality::operator-=(), SiStripBadModuleConfigurableFakeESSource::produce(), SiStripQualityStatistics::SetBadComponents(), SiStripQualityDQM::SetBadComponents(), SiStripHitEffFromCalibTree::SetBadComponents(), and SiStripQualityStatistics::updateAndSave().

101  {
102  std::map<uint32_t, DetInfo>::const_iterator it = detData_.find(detId);
103 
104  if (it != detData_.end()) {
105  return std::pair<unsigned short, double>(it->second.nApvs, it->second.stripLength);
106 
107  } else {
108  std::pair<unsigned short, double> defaultValue(0, 0.);
110  "SiStripDetInfoFileReader::getNumberOfApvsAndStripLength - Unable to find requested detid. Returning invalid "
111  "data ")
112  << endl;
113  return defaultValue;
114  }
115 }
std::map< uint32_t, DetInfo > detData_
const float & SiStripDetInfoFileReader::getThickness ( uint32_t  detId) const

Definition at line 117 of file SiStripDetInfoFileReader.cc.

Referenced by getAllDetIds().

117  {
118  std::map<uint32_t, DetInfo>::const_iterator it = detData_.find(detId);
119 
120  if (it != detData_.end()) {
121  return it->second.thickness;
122 
123  } else {
124  static const float defaultValue = 0;
125  edm::LogWarning("SiStripDetInfoFileReader::getThickness - Unable to find requested detid. Returning invalid data ")
126  << endl;
127  return defaultValue;
128  }
129 }
std::map< uint32_t, DetInfo > detData_
SiStripDetInfoFileReader & SiStripDetInfoFileReader::operator= ( const SiStripDetInfoFileReader copy)

Definition at line 15 of file SiStripDetInfoFileReader.cc.

References detData_, and detIds_.

Referenced by SiStripDetInfoFileReader().

15  {
16  detData_ = copy.detData_;
17  detIds_ = copy.detIds_;
18  return *this;
19 }
std::map< uint32_t, DetInfo > detData_
std::vector< uint32_t > detIds_
void SiStripDetInfoFileReader::reader ( std::string  filePath)
private

Definition at line 34 of file SiStripDetInfoFileReader.cc.

References Calorimetry_cff::thickness.

Referenced by getAllData().

34  {
35  // if(filePath==std::string("")){
36  // filePath = edm::FileInPath(std::string("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat") ).fullPath();
37  // }
38 
39  edm::LogInfo("SiStripDetInfoFileReader") << "filePath " << filePath << std::endl;
40 
41  detData_.clear();
42  detIds_.clear();
43 
44  inputFile_.open(filePath.c_str());
45 
46  if (inputFile_.is_open()) {
47  for (;;) {
48  uint32_t detid;
49  double stripLength;
50  unsigned short numberOfAPVs;
51  float thickness;
52 
53  inputFile_ >> detid >> numberOfAPVs >> stripLength >> thickness;
54 
55  if (!(inputFile_.eof() || inputFile_.fail())) {
56  detIds_.push_back(detid);
57 
58  // inputFile_ >> numberOfAPVs;
59  // inputFile_ >> stripLength;
60 
61  // edm::LogInfo("SiStripDetInfoFileReader::SiStripDetInfoFileReader") << detid <<" " <<numberOfAPVs <<" " <<stripLength << " "<< thickness<< endl;
62 
63  std::map<uint32_t, DetInfo>::const_iterator it = detData_.find(detid);
64 
65  if (it == detData_.end()) {
66  detData_[detid] = DetInfo(numberOfAPVs, stripLength, thickness);
67  } else {
68  edm::LogError("SiStripDetInfoFileReader::SiStripDetInfoFileReader")
69  << "DetId " << detid << " already found on file. Ignoring new data" << endl;
70 
71  detIds_.pop_back();
72  continue;
73  }
74  } else if (inputFile_.eof()) {
75  edm::LogInfo("SiStripDetInfoFileReader::SiStripDetInfoFileReader - END of file reached") << endl;
76  break;
77 
78  } else if (inputFile_.fail()) {
79  edm::LogError("SiStripDetInfoFileReader::SiStripDetInfoFileReader - ERROR while reading file") << endl;
80  break;
81  }
82  }
83 
84  inputFile_.close();
85 
86  } else {
87  edm::LogError("SiStripDetInfoFileReader::SiStripDetInfoFileReader - Unable to open file") << endl;
88  return;
89  }
90 
91  // int i=0;
92  // for(std::map<uint32_t, std::pair<unsigned short, double> >::iterator it =detData_.begin(); it!=detData_.end(); it++ ) {
93  // std::cout<< it->first << " " << (it->second).first << " " << (it->second).second<<endl;
94  // i++;
95  // }
96  // std::cout<<i;
97 }
std::map< uint32_t, DetInfo > detData_
std::vector< uint32_t > detIds_

Member Data Documentation

std::map<uint32_t, DetInfo> SiStripDetInfoFileReader::detData_
private

Definition at line 66 of file SiStripDetInfoFileReader.h.

Referenced by getAllData(), operator=(), and SiStripDetInfoFileReader().

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

Definition at line 69 of file SiStripDetInfoFileReader.h.

Referenced by getAllDetIds(), operator=(), and SiStripDetInfoFileReader().

std::ifstream SiStripDetInfoFileReader::inputFile_
private

Definition at line 63 of file SiStripDetInfoFileReader.h.