CMS 3D CMS Logo

MP7FileReader.h
Go to the documentation of this file.
1 /*
2  * File: MP7FileReader.h
3  * Author: ale
4  *
5  * Created on August 22, 2014, 10:30 AM
6  */
7 
8 #ifndef EventFilter_L1TRawToDigi_MP7FileReader_h
9 #define EventFilter_L1TRawToDigi_MP7FileReader_h
10 
11 // C++ Headers
12 #include <string>
13 #include <fstream>
14 #include <map>
15 #include <cstdint>
16 #include <vector>
17 
18 // Boost Headers
19 #include <boost/regex.hpp>
20 
21 class FileData {
22 public:
23  typedef std::map<uint32_t, std::vector<uint64_t> > LinkMap;
25  typedef LinkMap::const_iterator const_iterator;
26 
27  const std::string& name() const { return name_; }
28 
29  const std::vector<uint64_t>& link(uint32_t i) const;
30 
31  size_t size() const { return links_.size(); }
32 
33  LinkMap::const_iterator begin() const { return links_.begin(); }
34  LinkMap::const_iterator end() const { return links_.end(); }
35 
36 private:
39 
40  friend class MP7FileReader;
41 };
42 
44 public:
46  typedef std::vector<FileData>::const_iterator const_iterator;
47 
49 
50  virtual ~MP7FileReader();
51 
53  bool valid() const { return valid_; }
54 
56  const std::string& path() const { return path_; }
57 
59  const FileData& get(size_t k) const;
60 
62  std::vector<std::string> names() const;
63 
65  const_iterator begin() { return buffers_.begin(); }
66 
68  const_iterator end() { return buffers_.end(); }
69 
71  size_t size() const { return buffers_.size(); }
72 
73 private:
75 
76  std::vector<uint32_t> searchLinks();
77 
78  std::vector<std::vector<uint64_t> > readRows();
79 
81 
82  void load();
83 
84  bool valid_;
86  std::ifstream file_;
87 
88 public:
89  std::vector<FileData> buffers_;
90 
91 private:
92  static boost::regex reBoard_;
93  static boost::regex reLink_;
94  static boost::regex reQuadChan_;
95  static boost::regex reFrame_;
96  static boost::regex reValid_;
97 };
98 
99 #endif /* READER_H */
mps_fire.i
i
Definition: mps_fire.py:428
FileData::name
const std::string & name() const
Definition: MP7FileReader.h:27
FileData
Definition: MP7FileReader.h:21
MP7FileReader::validStrToUint64
static uint64_t validStrToUint64(const std::string &token)
Definition: MP7FileReader.cc:178
MP7FileReader::buffers_
std::vector< FileData > buffers_
Definition: MP7FileReader.h:89
MP7FileReader::readRows
std::vector< std::vector< uint64_t > > readRows()
Definition: MP7FileReader.cc:190
MP7FileReader::size
size_t size() const
number of rawdata objects stored
Definition: MP7FileReader.h:71
MP7FileReader::load
void load()
Definition: MP7FileReader.cc:70
MP7FileReader::~MP7FileReader
virtual ~MP7FileReader()
Definition: MP7FileReader.cc:56
MP7FileReader::reFrame_
static boost::regex reFrame_
Definition: MP7FileReader.h:95
FileData::link
const std::vector< uint64_t > & link(uint32_t i) const
Definition: MP7FileReader.cc:25
MP7FileReader::path_
std::string path_
Definition: MP7FileReader.h:85
FileData::const_iterator
LinkMap::const_iterator const_iterator
Definition: MP7FileReader.h:25
FileData::value_type
LinkMap::value_type value_type
Definition: MP7FileReader.h:24
MP7FileReader::reQuadChan_
static boost::regex reQuadChan_
Definition: MP7FileReader.h:94
FileData::size
size_t size() const
Definition: MP7FileReader.h:31
MP7FileReader::valid
bool valid() const
reader status. valid() == 1 indicates that data was successfully read from file
Definition: MP7FileReader.h:53
MP7FileReader
Definition: MP7FileReader.h:43
FileData::links_
LinkMap links_
Definition: MP7FileReader.h:38
MP7FileReader::reLink_
static boost::regex reLink_
Definition: MP7FileReader.h:93
dqmdumpme.k
k
Definition: dqmdumpme.py:60
MP7FileReader::reValid_
static boost::regex reValid_
Definition: MP7FileReader.h:96
FileData::begin
LinkMap::const_iterator begin() const
Definition: MP7FileReader.h:33
MP7FileReader::valid_
bool valid_
Definition: MP7FileReader.h:84
MP7FileReader::path
const std::string & path() const
source file path
Definition: MP7FileReader.h:56
MP7FileReader::names
std::vector< std::string > names() const
raw data name collector
Definition: MP7FileReader.cc:61
FileData::end
LinkMap::const_iterator end() const
Definition: MP7FileReader.h:34
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
MP7FileReader::searchLinks
std::vector< uint32_t > searchLinks()
Definition: MP7FileReader.cc:143
MP7FileReader::end
const_iterator end()
vector's end iterator
Definition: MP7FileReader.h:68
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MP7FileReader::searchBoard
std::string searchBoard()
Definition: MP7FileReader.cc:116
MP7FileReader::const_iterator
std::vector< FileData >::const_iterator const_iterator
expose vector's const iterator
Definition: MP7FileReader.h:46
MP7FileReader::get
const FileData & get(size_t k) const
data getter via index
Definition: MP7FileReader.cc:59
MP7FileReader::MP7FileReader
MP7FileReader(const std::string &path)
Definition: MP7FileReader.cc:34
FileData::LinkMap
std::map< uint32_t, std::vector< uint64_t > > LinkMap
Definition: MP7FileReader.h:23
FileData::name_
std::string name_
Definition: MP7FileReader.h:37
MP7FileReader::file_
std::ifstream file_
Definition: MP7FileReader.h:86
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
MP7FileReader::begin
const_iterator begin()
vector's begin iterator
Definition: MP7FileReader.h:65
MP7FileReader::reBoard_
static boost::regex reBoard_
Definition: MP7FileReader.h:92
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316