CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 (std::string filePath)
 
 SiStripFedIdListReader (const SiStripFedIdListReader &)
 
 ~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::SiStripFedIdListReader ( std::string  filePath)
explicit

Definition at line 8 of file SiStripFedIdListReader.cc.

References fedIds_, spr::find(), and inputFile_.

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 }
Log< level::Info, true > LogVerbatim
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< uint16_t > fedIds_
Log< level::Warning, false > LogWarning
SiStripFedIdListReader::SiStripFedIdListReader ( const SiStripFedIdListReader copy)
explicit

Definition at line 49 of file SiStripFedIdListReader.cc.

References fedIds_.

49  {
50  edm::LogVerbatim("Unknown") << "[SiStripFedIdListReader::" << __func__ << "]";
51  fedIds_ = copy.fedIds_;
52 }
Log< level::Info, true > LogVerbatim
std::vector< uint16_t > fedIds_
SiStripFedIdListReader::~SiStripFedIdListReader ( )

Definition at line 64 of file SiStripFedIdListReader.cc.

64  {
65  edm::LogVerbatim("Unknown") << "[SiStripFedIdListReader::" << __func__ << "]";
66 }
Log< level::Info, true > LogVerbatim
SiStripFedIdListReader::SiStripFedIdListReader ( )
inlineexplicitprivate

Definition at line 37 of file SiStripFedIdListReader.h.

37 { ; }

Member Function Documentation

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

Definition at line 44 of file SiStripFedIdListReader.h.

References fedIds_.

Referenced by operator<<().

44 { return fedIds_; }
std::vector< uint16_t > fedIds_
SiStripFedIdListReader & SiStripFedIdListReader::operator= ( const SiStripFedIdListReader copy)

Definition at line 56 of file SiStripFedIdListReader.cc.

References fedIds_.

56  {
57  edm::LogVerbatim("Unknown") << "[SiStripFedIdListReader::" << __func__ << "]";
58  fedIds_ = copy.fedIds_;
59  return *this;
60 }
Log< level::Info, true > LogVerbatim
std::vector< uint16_t > fedIds_

Member Data Documentation

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

Definition at line 41 of file SiStripFedIdListReader.h.

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

std::ifstream SiStripFedIdListReader::inputFile_
private

Definition at line 39 of file SiStripFedIdListReader.h.

Referenced by SiStripFedIdListReader().