CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions
SurveyPxbImageReader< T > Class Template Reference

Class to hold one picture of the BPix survey. More...

#include <SurveyPxbImageReader.h>

Public Types

typedef std::vector< Tmeasurements_t
 

Public Member Functions

SurveyPxbImage::count_t read (std::ifstream &infile, measurements_t &measurements, SurveyPxbImage::count_t reserve=830)
 
 SurveyPxbImageReader ()
 Empty default constructor. More...
 
 SurveyPxbImageReader (std::ifstream &infile, measurements_t &measurements, SurveyPxbImage::count_t reserve=800)
 Constructor with ifstream and destination vector. More...
 
 SurveyPxbImageReader (std::string filename, measurements_t &measurements, SurveyPxbImage::count_t reserve=800)
 Constructor with filename and destination vector. More...
 

Detailed Description

template<class T>
class SurveyPxbImageReader< T >

Class to hold one picture of the BPix survey.

Definition at line 14 of file SurveyPxbImageReader.h.

Member Typedef Documentation

template<class T >
typedef std::vector<T> SurveyPxbImageReader< T >::measurements_t

Definition at line 17 of file SurveyPxbImageReader.h.

Constructor & Destructor Documentation

template<class T >
SurveyPxbImageReader< T >::SurveyPxbImageReader ( )
inline

Empty default constructor.

Definition at line 21 of file SurveyPxbImageReader.h.

21 {};
template<class T >
SurveyPxbImageReader< T >::SurveyPxbImageReader ( std::ifstream &  infile,
measurements_t measurements,
SurveyPxbImage::count_t  reserve = 800 
)
inline

Constructor with ifstream and destination vector.

Definition at line 23 of file SurveyPxbImageReader.h.

References SurveyPxbImageReader< T >::read().

24  {
25  read(infile, measurements, reserve);
26  };
SurveyPxbImage::count_t read(std::ifstream &infile, measurements_t &measurements, SurveyPxbImage::count_t reserve=830)
template<class T >
SurveyPxbImageReader< T >::SurveyPxbImageReader ( std::string  filename,
measurements_t measurements,
SurveyPxbImage::count_t  reserve = 800 
)
inline

Constructor with filename and destination vector.

Definition at line 29 of file SurveyPxbImageReader.h.

References MessageLogger_cfi::cerr, and SurveyPxbImageReader< T >::read().

30  {
31  std::ifstream infile(filename.c_str());
32  if (!infile)
33  {
34  std::cerr << "Cannot open file " << filename
35  << " - operation aborted." << std::endl;
36  }
37  read(infile, measurements, reserve);
38  };
SurveyPxbImage::count_t read(std::ifstream &infile, measurements_t &measurements, SurveyPxbImage::count_t reserve=830)

Member Function Documentation

template<class T >
SurveyPxbImage::count_t SurveyPxbImageReader< T >::read ( std::ifstream &  infile,
measurements_t measurements,
SurveyPxbImage::count_t  reserve = 830 
)
inline

Reads a file, parses its content and fills the data vector All data after a hash sign (#) is treated as a comment and not read

Parameters
filenameFilename of the file to be read
measurementsVector containing the measurements, previous content will be deleted
reserveInitial size of the vector, set with vector::reserve()
Returns
number of succesfully read entries

Definition at line 46 of file SurveyPxbImageReader.h.

References popcon2dropbox::copy(), spr::find(), recoMuon::in, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by edmIntegrityCheck.PublishToFileSystem::get(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::goto(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::setFilterBranches(), and SurveyPxbImageReader< T >::SurveyPxbImageReader().

47  {
48 
49  // prepare the measurements vector
50  measurements.clear();
51  measurements.reserve(reserve);
52 
53  // container for the current line
54  std::string aLine;
55 
56  // loop over lines of input file
57  while (std::getline(infile,aLine))
58  {
59  // strip off everything after a hash
60  std::string stripped = "";
61  std::string::iterator iter = std::find(aLine.begin(), aLine.end(), '#');
62  std::copy(aLine.begin(), iter, std::back_inserter(stripped));
63  // read one measurment and add to vector if successfull
64  std::istringstream iss(stripped, std::istringstream::in);
65  T curMeas(iss);
66  if (curMeas.isValid())
67  {
68  measurements.push_back(curMeas);
69  }
70  }
71 
72  return measurements.size();
73  }
def copy(args, dbName)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
long double T