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 (const SiStripDetInfoFileReader &)
 
 SiStripDetInfoFileReader (std::string filePath)
 
 ~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() [1/4]

SiStripDetInfoFileReader::SiStripDetInfoFileReader ( )
inlineexplicit

Definition at line 42 of file SiStripDetInfoFileReader.h.

42 {};

◆ SiStripDetInfoFileReader() [2/4]

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

Definition at line 21 of file SiStripDetInfoFileReader.cc.

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

References personalPlayback::fp, muonDTDigis_cfi::pset, DQM::reader, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ SiStripDetInfoFileReader() [3/4]

SiStripDetInfoFileReader::SiStripDetInfoFileReader ( std::string  filePath)
explicit

◆ SiStripDetInfoFileReader() [4/4]

SiStripDetInfoFileReader::SiStripDetInfoFileReader ( const SiStripDetInfoFileReader copy)
explicit

Definition at line 27 of file SiStripDetInfoFileReader.cc.

27  {
28  detData_ = copy.detData_;
29  detIds_ = copy.detIds_;
30 }

References filterCSVwithJSON::copy.

◆ ~SiStripDetInfoFileReader()

SiStripDetInfoFileReader::~SiStripDetInfoFileReader ( )

Definition at line 99 of file SiStripDetInfoFileReader.cc.

99 {}

Member Function Documentation

◆ getAllData()

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

◆ getAllDetIds()

const std::vector<uint32_t>& SiStripDetInfoFileReader::getAllDetIds ( ) const
inline

◆ getNumberOfApvsAndStripLength()

const std::pair< unsigned short, double > SiStripDetInfoFileReader::getNumberOfApvsAndStripLength ( uint32_t  detId) const

Definition at line 101 of file SiStripDetInfoFileReader.cc.

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 }

Referenced by SiStripQuality::add(), SiStripHitEffFromCalibTree::algoAnalyze(), OverlapValidation::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(), SiStripFedCablingFakeESSource::make(), SiStripHitEffFromCalibTree::makeSQLite(), SiStripQuality::operator-=(), SiStripBadModuleConfigurableFakeESSource::produce(), SiStripQualityStatistics::SetBadComponents(), SiStripQualityDQM::SetBadComponents(), SiStripHitEffFromCalibTree::SetBadComponents(), and SiStripQualityStatistics::updateAndSave().

◆ getThickness()

const float & SiStripDetInfoFileReader::getThickness ( uint32_t  detId) const

Definition at line 117 of file SiStripDetInfoFileReader.cc.

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 }

◆ operator=()

SiStripDetInfoFileReader & SiStripDetInfoFileReader::operator= ( const SiStripDetInfoFileReader copy)

Definition at line 15 of file SiStripDetInfoFileReader.cc.

15  {
16  detData_ = copy.detData_;
17  detIds_ = copy.detIds_;
18  return *this;
19 }

References filterCSVwithJSON::copy.

◆ reader()

void SiStripDetInfoFileReader::reader ( std::string  filePath)
private

Definition at line 34 of file SiStripDetInfoFileReader.cc.

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 }

References dt4ml_dqm_sourceclient-live_cfg::filePath, and Calorimetry_cff::thickness.

Member Data Documentation

◆ detData_

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

Definition at line 66 of file SiStripDetInfoFileReader.h.

Referenced by getAllData().

◆ detIds_

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

Definition at line 69 of file SiStripDetInfoFileReader.h.

Referenced by getAllDetIds().

◆ inputFile_

std::ifstream SiStripDetInfoFileReader::inputFile_
private

Definition at line 63 of file SiStripDetInfoFileReader.h.

SiStripDetInfoFileReader::detIds_
std::vector< uint32_t > detIds_
Definition: SiStripDetInfoFileReader.h:69
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
personalPlayback.fp
fp
Definition: personalPlayback.py:523
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
edm::FileInPath
Definition: FileInPath.h:64
Calorimetry_cff.thickness
thickness
Definition: Calorimetry_cff.py:114
dt4ml_dqm_sourceclient-live_cfg.filePath
filePath
CUSTOMIZE FOR ML.
Definition: dt4ml_dqm_sourceclient-live_cfg.py:45
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripDetInfoFileReader::reader
void reader(std::string filePath)
Definition: SiStripDetInfoFileReader.cc:34
SiStripDetInfoFileReader::inputFile_
std::ifstream inputFile_
Definition: SiStripDetInfoFileReader.h:63
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
SiStripDetInfoFileReader::detData_
std::map< uint32_t, DetInfo > detData_
Definition: SiStripDetInfoFileReader.h:66