CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
14  for(;;) {
15 
16  uint32_t fed_id;
17  inputFile_ >> fed_id;
18 
19  if ( !( inputFile_.eof() || inputFile_.fail() ) ) {
20 
21  std::vector<uint16_t>::const_iterator it = find( fedIds_.begin(), fedIds_.end(), fed_id );
22  if( it == fedIds_.end() ) { fedIds_.push_back(fed_id); }
23  else {
24  edm::LogWarning("Unknown")
25  << "[SiStripFedIdListReader::" << __func__ << "]"
26  << " FedId " << fed_id << " has already been found in file!" << std::endl;
27  continue;
28  }
29 
30  } else if ( inputFile_.eof() ) {
31  edm::LogVerbatim("Unknown")
32  << "[SiStripFedIdListReader::" << __func__ << "]"
33  << " End of file reached! Found " << fedIds_.size()
34  << " valid FedIds!" << std::endl;
35  break;
36  } else if ( inputFile_.fail() ) {
37  edm::LogVerbatim("Unknown")
38  << "[SiStripFedIdListReader::" << __func__ << "]"
39  << " Error while reading file \"" << filePath << "\"!" << std::endl;
40  break;
41  }
42  }
43 
44  inputFile_.close();
45  } else {
46  edm::LogVerbatim("Unknown")
47  << "[SiStripFedIdListReader::" << __func__ << "]"
48  << " Unable to open file \"" << filePath << "\"!" << std::endl;
49  return;
50 
51  }
52 
53 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< uint16_t > fedIds_
SiStripFedIdListReader::SiStripFedIdListReader ( const SiStripFedIdListReader copy)
explicit

Definition at line 57 of file SiStripFedIdListReader.cc.

References fedIds_.

57  {
58  edm::LogVerbatim("Unknown")
59  << "[SiStripFedIdListReader::" << __func__ << "]";
60  fedIds_ = copy.fedIds_;
61 }
std::vector< uint16_t > fedIds_
SiStripFedIdListReader::~SiStripFedIdListReader ( )

Definition at line 74 of file SiStripFedIdListReader.cc.

74  {
75  edm::LogVerbatim("Unknown")
76  << "[SiStripFedIdListReader::" << __func__ << "]";
77 }
SiStripFedIdListReader::SiStripFedIdListReader ( )
inlineexplicitprivate

Definition at line 40 of file SiStripFedIdListReader.h.

40 {;}

Member Function Documentation

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

Definition at line 48 of file SiStripFedIdListReader.h.

References fedIds_.

Referenced by operator<<().

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

Definition at line 65 of file SiStripFedIdListReader.cc.

References fedIds_.

65  {
66  edm::LogVerbatim("Unknown")
67  << "[SiStripFedIdListReader::" << __func__ << "]";
68  fedIds_ = copy.fedIds_;
69  return *this;
70 }
std::vector< uint16_t > fedIds_

Member Data Documentation

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

Definition at line 44 of file SiStripFedIdListReader.h.

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

std::ifstream SiStripFedIdListReader::inputFile_
private

Definition at line 42 of file SiStripFedIdListReader.h.

Referenced by SiStripFedIdListReader().