CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 31 of file SiStripDetInfoFileReader.h.

Constructor & Destructor Documentation

SiStripDetInfoFileReader::SiStripDetInfoFileReader ( )
inlineexplicit

Definition at line 46 of file SiStripDetInfoFileReader.h.

46 {};
SiStripDetInfoFileReader::SiStripDetInfoFileReader ( const edm::ParameterSet pset,
const edm::ActivityRegistry ar 
)
explicit

Definition at line 22 of file SiStripDetInfoFileReader.cc.

References edm::FileInPath::fullPath(), edm::ParameterSet::getUntrackedParameter(), and matplotRender::reader.

22  {
23  edm::FileInPath fp(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 matplotRender::reader.

32  {
33  reader(filePath);
34 }
void reader(std::string filePath)
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 117 of file SiStripDetInfoFileReader.cc.

117  {
118 }

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 121 of file SiStripDetInfoFileReader.cc.

Referenced by SiStripQuality::add(), SiStripHitEffFromCalibTree::algoAnalyze(), SiStripQualityStatistics::analyze(), SiStripBaseCondObjDQM::bookProfileMEs(), SiStripBaseCondObjDQM::bookSummaryProfileMEs(), SiStripQuality::compact(), SiStripQuality::fillBadComponents(), SiStripNoisesDQM::fillMEsForDet(), SiStripPedestalsDQM::fillMEsForDet(), SiStripThresholdDQM::fillMEsForDet(), SiStripApvGainsDQM::fillMEsForDet(), SiStripQualityDQM::fillMEsForDet(), SiStripNoisesDQM::fillMEsForLayer(), SiStripPedestalsDQM::fillMEsForLayer(), SiStripThresholdDQM::fillMEsForLayer(), SiStripApvGainsDQM::fillMEsForLayer(), SiStripQualityDQM::fillMEsForLayer(), SiStripBadModuleByHandBuilder::getNewObject(), SiStripCorrelateBadStripAndNoise::iterateOnBadStrips(), SiStripHitEffFromCalibTree::makeSQLite(), SiStripQuality::operator-=(), SiStripCondObjBuilderFromDb::retrieveNumberAPVPairs(), SiStripQualityStatistics::SetBadComponents(), SiStripQualityDQM::SetBadComponents(), SiStripHitEffFromCalibTree::SetBadComponents(), and SiStripCondObjBuilderFromDb::setValuesApvLatency().

121  {
122 
123  std::map<uint32_t, DetInfo >::const_iterator it = detData_.find(detId);
124 
125  if(it!=detData_.end()){
126 
127  return std::pair<unsigned short, double>(it->second.nApvs,it->second.stripLength);
128 
129  }
130  else{
131 
132  static std::pair<unsigned short, double> defaultValue(0,0);
133  edm::LogWarning("SiStripDetInfoFileReader::getNumberOfApvsAndStripLength - Unable to find requested detid. Returning invalid data ")<<endl;
134  return defaultValue;
135 
136  }
137 
138 }
std::map< uint32_t, DetInfo > detData_
const float & SiStripDetInfoFileReader::getThickness ( uint32_t  detId) const

Definition at line 140 of file SiStripDetInfoFileReader.cc.

140  {
141 
142  std::map<uint32_t, DetInfo >::const_iterator it = detData_.find(detId);
143 
144  if(it!=detData_.end()){
145 
146  return it->second.thickness;
147 
148  }
149  else{
150 
151  static float defaultValue=0;
152  edm::LogWarning("SiStripDetInfoFileReader::getThickness - Unable to find requested detid. Returning invalid data ")<<endl;
153  return defaultValue;
154 
155  }
156 
157 }
std::map< uint32_t, DetInfo > detData_
SiStripDetInfoFileReader & SiStripDetInfoFileReader::operator= ( const SiStripDetInfoFileReader copy)

Definition at line 16 of file SiStripDetInfoFileReader.cc.

References detData_, and detIds_.

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

Definition at line 36 of file SiStripDetInfoFileReader.cc.

References cond::rpcobgas::detid.

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

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

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

Definition at line 76 of file SiStripDetInfoFileReader.h.

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

std::ifstream SiStripDetInfoFileReader::inputFile_
private

Definition at line 70 of file SiStripDetInfoFileReader.h.