CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

SiStripFedIdListReader Class Reference

#include <SiStripFedIdListReader.h>

List of all members.

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::SiStripFedIdListReader ( std::string  filePath) [explicit]

Definition at line 8 of file SiStripFedIdListReader.cc.

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

                                                                   {
  fedIds_.clear();
  inputFile_.open( filePath.c_str() );

  if ( inputFile_.is_open() ) {
    
    for(;;) {
      
      uint32_t fed_id; 
      inputFile_ >> fed_id;

      if ( !( inputFile_.eof() || inputFile_.fail() ) ) {
        
        std::vector<uint16_t>::const_iterator it = find( fedIds_.begin(), fedIds_.end(), fed_id );
        if( it == fedIds_.end() ) { fedIds_.push_back(fed_id); }
        else {
          edm::LogWarning("Unknown") 
            << "[SiStripFedIdListReader::" << __func__ << "]"
            << " FedId " << fed_id << " has already been found in file!" << std::endl;
          continue;
        }

      } else if ( inputFile_.eof() ) {
        edm::LogVerbatim("Unknown") 
          << "[SiStripFedIdListReader::" << __func__ << "]"
          << " End of file reached! Found " << fedIds_.size() 
          << " valid FedIds!" << std::endl;
        break;
      } else if ( inputFile_.fail() ) {
        edm::LogVerbatim("Unknown") 
          << "[SiStripFedIdListReader::" << __func__ << "]"
          << " Error while reading file \"" << filePath << "\"!" << std::endl;
        break;
      }
    }

    inputFile_.close();
  } else {
    edm::LogVerbatim("Unknown") 
      << "[SiStripFedIdListReader::" << __func__ << "]"
      << " Unable to open file \"" << filePath << "\"!" << std::endl;
    return;
    
  }

}
SiStripFedIdListReader::SiStripFedIdListReader ( const SiStripFedIdListReader copy) [explicit]

Definition at line 57 of file SiStripFedIdListReader.cc.

References fedIds_.

                                                                                   {
  edm::LogVerbatim("Unknown") 
    << "[SiStripFedIdListReader::" << __func__ << "]";
  fedIds_ = copy.fedIds_;
}
SiStripFedIdListReader::~SiStripFedIdListReader ( )

Definition at line 74 of file SiStripFedIdListReader.cc.

                                               {
  edm::LogVerbatim("Unknown") 
    << "[SiStripFedIdListReader::" << __func__ << "]";
}
SiStripFedIdListReader::SiStripFedIdListReader ( ) [inline, explicit, private]

Definition at line 40 of file SiStripFedIdListReader.h.

{;}

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<<().

{ return fedIds_; }
SiStripFedIdListReader & SiStripFedIdListReader::operator= ( const SiStripFedIdListReader copy)

Definition at line 65 of file SiStripFedIdListReader.cc.

References fedIds_.

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

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().