CMS 3D CMS Logo

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

#include <SiStripFedIdListReader.h>

Public Member Functions

const std::vector< uint16_t > & fedIds () const
 
SiStripFedIdListReaderoperator= (const SiStripFedIdListReader &)
 
 SiStripFedIdListReader (const SiStripFedIdListReader &)
 
 SiStripFedIdListReader (std::string filePath)
 
 ~SiStripFedIdListReader ()
 

Private Member Functions

 SiStripFedIdListReader ()
 

Private Attributes

std::vector< uint16_t > fedIds_
 
std::ifstream inputFile_
 

Detailed Description

Author
R.Bainbridge

Definition at line 18 of file SiStripFedIdListReader.h.

Constructor & Destructor Documentation

◆ SiStripFedIdListReader() [1/3]

SiStripFedIdListReader::SiStripFedIdListReader ( std::string  filePath)
explicit

Definition at line 8 of file SiStripFedIdListReader.cc.

8  {
9  fedIds_.clear();
10  inputFile_.open(filePath.c_str());
11 
12  if (inputFile_.is_open()) {
13  for (;;) {
14  uint32_t fed_id;
15  inputFile_ >> fed_id;
16 
17  if (!(inputFile_.eof() || inputFile_.fail())) {
18  std::vector<uint16_t>::const_iterator it = find(fedIds_.begin(), fedIds_.end(), fed_id);
19  if (it == fedIds_.end()) {
20  fedIds_.push_back(fed_id);
21  } else {
22  edm::LogWarning("Unknown") << "[SiStripFedIdListReader::" << __func__ << "]"
23  << " FedId " << fed_id << " has already been found in file!" << std::endl;
24  continue;
25  }
26 
27  } else if (inputFile_.eof()) {
28  edm::LogVerbatim("Unknown") << "[SiStripFedIdListReader::" << __func__ << "]"
29  << " End of file reached! Found " << fedIds_.size() << " valid FedIds!"
30  << std::endl;
31  break;
32  } else if (inputFile_.fail()) {
33  edm::LogVerbatim("Unknown") << "[SiStripFedIdListReader::" << __func__ << "]"
34  << " Error while reading file \"" << filePath << "\"!" << std::endl;
35  break;
36  }
37  }
38 
39  inputFile_.close();
40  } else {
41  edm::LogVerbatim("Unknown") << "[SiStripFedIdListReader::" << __func__ << "]"
42  << " Unable to open file \"" << filePath << "\"!" << std::endl;
43  return;
44  }
45 }

References fedIds_, dt4ml_dqm_sourceclient-live_cfg::filePath, spr::find(), and inputFile_.

◆ SiStripFedIdListReader() [2/3]

SiStripFedIdListReader::SiStripFedIdListReader ( const SiStripFedIdListReader copy)
explicit

Definition at line 49 of file SiStripFedIdListReader.cc.

49  {
50  edm::LogVerbatim("Unknown") << "[SiStripFedIdListReader::" << __func__ << "]";
51  fedIds_ = copy.fedIds_;
52 }

References filterCSVwithJSON::copy, and fedIds_.

◆ ~SiStripFedIdListReader()

SiStripFedIdListReader::~SiStripFedIdListReader ( )

Definition at line 64 of file SiStripFedIdListReader.cc.

64  {
65  edm::LogVerbatim("Unknown") << "[SiStripFedIdListReader::" << __func__ << "]";
66 }

◆ SiStripFedIdListReader() [3/3]

SiStripFedIdListReader::SiStripFedIdListReader ( )
inlineexplicitprivate

Definition at line 37 of file SiStripFedIdListReader.h.

37 { ; }

Member Function Documentation

◆ fedIds()

const std::vector< uint16_t > & SiStripFedIdListReader::fedIds ( ) const
inline

Definition at line 44 of file SiStripFedIdListReader.h.

44 { return fedIds_; }

References fedIds_.

◆ operator=()

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

Definition at line 56 of file SiStripFedIdListReader.cc.

56  {
57  edm::LogVerbatim("Unknown") << "[SiStripFedIdListReader::" << __func__ << "]";
58  fedIds_ = copy.fedIds_;
59  return *this;
60 }

References filterCSVwithJSON::copy, and fedIds_.

Member Data Documentation

◆ fedIds_

std::vector<uint16_t> SiStripFedIdListReader::fedIds_
private

Definition at line 41 of file SiStripFedIdListReader.h.

Referenced by fedIds(), operator=(), and SiStripFedIdListReader().

◆ inputFile_

std::ifstream SiStripFedIdListReader::inputFile_
private

Definition at line 39 of file SiStripFedIdListReader.h.

Referenced by SiStripFedIdListReader().

filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
dt4ml_dqm_sourceclient-live_cfg.filePath
filePath
CUSTOMIZE FOR ML.
Definition: dt4ml_dqm_sourceclient-live_cfg.py:45
SiStripFedIdListReader::fedIds_
std::vector< uint16_t > fedIds_
Definition: SiStripFedIdListReader.h:41
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
SiStripFedIdListReader::inputFile_
std::ifstream inputFile_
Definition: SiStripFedIdListReader.h:39