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 30 of file SiStripDetInfoFileReader.h.

Constructor & Destructor Documentation

SiStripDetInfoFileReader::SiStripDetInfoFileReader ( )
inlineexplicit

Definition at line 45 of file SiStripDetInfoFileReader.h.

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

Definition at line 21 of file SiStripDetInfoFileReader.cc.

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

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

Definition at line 31 of file SiStripDetInfoFileReader.cc.

References matplotRender::reader.

31  {
32  reader(filePath);
33 }
void reader(std::string filePath)
SiStripDetInfoFileReader::SiStripDetInfoFileReader ( const SiStripDetInfoFileReader copy)
explicit

Definition at line 26 of file SiStripDetInfoFileReader.cc.

References detData_, and detIds_.

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

Definition at line 116 of file SiStripDetInfoFileReader.cc.

116  {
117 }

Member Function Documentation

const std::map<uint32_t, DetInfo >& SiStripDetInfoFileReader::getAllData ( ) const
inline

Definition at line 62 of file SiStripDetInfoFileReader.h.

References detData_.

Referenced by SiStripQualityHotStripIdentifier::bookHistos().

62 {return detData_;}
std::map< uint32_t, DetInfo > detData_
const std::vector<uint32_t>& SiStripDetInfoFileReader::getAllDetIds ( ) const
inline
const std::pair< unsigned short, double > SiStripDetInfoFileReader::getNumberOfApvsAndStripLength ( uint32_t  detId) const

Definition at line 120 of file SiStripDetInfoFileReader.cc.

Referenced by SiStripHitEffFromCalibTree::algoAnalyze(), SiStripQualityStatistics::analyze(), SiStripBaseCondObjDQM::bookProfileMEs(), SiStripBaseCondObjDQM::bookSummaryProfileMEs(), OccupancyPlots::endRun(), SiStripNoisesDQM::fillMEsForDet(), SiStripThresholdDQM::fillMEsForDet(), SiStripPedestalsDQM::fillMEsForDet(), SiStripApvGainsDQM::fillMEsForDet(), SiStripQualityDQM::fillMEsForDet(), SiStripNoisesDQM::fillMEsForLayer(), SiStripPedestalsDQM::fillMEsForLayer(), SiStripThresholdDQM::fillMEsForLayer(), SiStripApvGainsDQM::fillMEsForLayer(), SiStripQualityDQM::fillMEsForLayer(), SiStripBadModuleByHandBuilder::getNewObject(), SiStripCorrelateBadStripAndNoise::iterateOnBadStrips(), SiStripHitEffFromCalibTree::makeSQLite(), SiStripCondObjBuilderFromDb::retrieveNumberAPVPairs(), SiStripQualityStatistics::SetBadComponents(), SiStripQualityDQM::SetBadComponents(), SiStripHitEffFromCalibTree::SetBadComponents(), and SiStripCondObjBuilderFromDb::setValuesApvLatency().

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

Definition at line 139 of file SiStripDetInfoFileReader.cc.

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

Definition at line 15 of file SiStripDetInfoFileReader.cc.

References detData_, and detIds_.

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

References cond::rpcobgas::detid.

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

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

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

Definition at line 75 of file SiStripDetInfoFileReader.h.

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

std::ifstream SiStripDetInfoFileReader::inputFile_
private

Definition at line 69 of file SiStripDetInfoFileReader.h.