CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 <stdint.h>
16 #include <vector>
17 
18 // Boost Headers
19 #include <boost/regex.hpp>
20 
21 
22 class FileData {
23 public:
24  typedef std::map< uint32_t, std::vector<uint64_t> > LinkMap;
26  typedef LinkMap::const_iterator const_iterator;
27 
28  const std::string& name() const { return name_;}
29 
30  const std::vector<uint64_t>& link ( uint32_t i ) const;
31 
32  size_t size() const {return links_.size(); }
33 
34  LinkMap::const_iterator begin() const { return links_.begin(); }
35  LinkMap::const_iterator end() const { return links_.end(); }
36 
37 private:
38 
41 
42  friend class MP7FileReader;
43 };
44 
46 public:
47 
49  typedef std::vector<FileData>::const_iterator const_iterator;
50 
51  MP7FileReader( const std::string& path );
52 
53  virtual ~MP7FileReader();
54 
56  bool valid() const { return valid_; }
57 
59  const std::string& path() const { return path_; }
60 
62  const FileData& get( size_t k ) const;
63 
65  std::vector<std::string> names() const;
66 
68  const_iterator begin() { return buffers_.begin(); }
69 
71  const_iterator end() { return buffers_.end(); }
72 
74  size_t size() const { return buffers_.size(); }
75 
76 
77 private:
79 
80  std::vector<uint32_t> searchLinks();
81 
82  std::vector< std::vector<uint64_t> > readRows();
83 
84  static uint64_t validStrToUint64( const std::string& token );
85 
86  void load();
87 
88  bool valid_;
90  std::ifstream file_;
91 
92 public:
93 
94  std::vector<FileData> buffers_;
95 
96 private:
97  static boost::regex reBoard_;
98  static boost::regex reLink_;
99  static boost::regex reQuadChan_;
100  static boost::regex reFrame_;
101  static boost::regex reValid_;
102 };
103 
104 #endif /* READER_H */
105 
int i
Definition: DBlmapReader.cc:9
static boost::regex reBoard_
Definition: MP7FileReader.h:97
static boost::regex reFrame_
std::ifstream file_
Definition: MP7FileReader.h:90
const_iterator end()
vector&#39;s end iterator
Definition: MP7FileReader.h:71
virtual ~MP7FileReader()
const std::string & path() const
source file path
Definition: MP7FileReader.h:59
LinkMap links_
Definition: MP7FileReader.h:40
std::vector< std::vector< uint64_t > > readRows()
LinkMap::const_iterator begin() const
Definition: MP7FileReader.h:34
size_t size() const
number of rawdata objects stored
Definition: MP7FileReader.h:74
size_t size() const
Definition: MP7FileReader.h:32
static boost::regex reLink_
Definition: MP7FileReader.h:98
MP7FileReader(const std::string &path)
std::map< uint32_t, std::vector< uint64_t > > LinkMap
Definition: MP7FileReader.h:24
LinkMap::const_iterator const_iterator
Definition: MP7FileReader.h:26
LinkMap::value_type value_type
Definition: MP7FileReader.h:25
static uint64_t validStrToUint64(const std::string &token)
std::string path_
Definition: MP7FileReader.h:89
std::string name_
Definition: MP7FileReader.h:39
static boost::regex reQuadChan_
Definition: MP7FileReader.h:99
unsigned long long uint64_t
Definition: Time.h:15
std::vector< FileData > buffers_
Definition: MP7FileReader.h:94
const std::string & name() const
Definition: MP7FileReader.h:28
std::vector< std::string > names() const
raw data name collector
LinkMap::const_iterator end() const
Definition: MP7FileReader.h:35
static boost::regex reValid_
std::vector< FileData >::const_iterator const_iterator
expose vector&#39;s const iterator
Definition: MP7FileReader.h:49
const std::vector< uint64_t > & link(uint32_t i) const
std::vector< uint32_t > searchLinks()
bool valid() const
reader status. valid() == 1 indicates that data was successfully read from file
Definition: MP7FileReader.h:56
std::string searchBoard()
const_iterator begin()
vector&#39;s begin iterator
Definition: MP7FileReader.h:68