CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MemoryBase.h
Go to the documentation of this file.
1 #ifndef L1Trigger_TrackFindingTracklet_interface_MemoryBase_h
2 #define L1Trigger_TrackFindingTracklet_interface_MemoryBase_h
3 
5 
6 #include <fstream>
7 #include <sstream>
8 #include <cassert>
9 #include <bitset>
10 
11 namespace trklet {
12 
13  class MemoryBase {
14  public:
15  MemoryBase(std::string name, Settings const& settings);
16 
17  virtual ~MemoryBase() = default;
18 
19  std::string const& getName() const { return name_; }
20  std::string getLastPartOfName() const { return name_.substr(name_.find_last_of('_') + 1); }
21 
22  virtual void clean() = 0;
23 
24  //method sets the layer and disk based on the name. pos is the position in the memory name where the layer or disk is specified
25  void initLayerDisk(unsigned int pos, int& layer, int& disk);
26 
27  unsigned int initLayerDisk(unsigned int pos);
28 
29  // Based on memory name check if this memory is used for special seeding:
30  // overlap is layer-disk seeding
31  // extra is the L2L3 seeding
32  // extended is the seeding for displaced tracks
33  void initSpecialSeeding(unsigned int pos, bool& overlap, bool& extra, bool& extended);
34 
35  //Used for a hack below due to MAC OS case sensitiviy problem for files
36  void findAndReplaceAll(std::string& data, std::string toSearch, std::string replaceStr);
37 
38  void openFile(bool first, std::string dirName, std::string filebase);
39 
40  static size_t find_nth(const std::string& haystack, size_t pos, const std::string& needle, size_t nth);
41 
42  protected:
44  unsigned int iSector_;
45 
46  std::ofstream out_;
47  int bx_;
48  int event_;
49 
51  };
52 }; // namespace trklet
53 #endif
static size_t find_nth(const std::string &haystack, size_t pos, const std::string &needle, size_t nth)
Definition: MemoryBase.cc:103
unsigned int iSector_
Definition: MemoryBase.h:44
void initSpecialSeeding(unsigned int pos, bool &overlap, bool &extra, bool &extended)
Definition: MemoryBase.cc:42
virtual void clean()=0
MemoryBase(std::string name, Settings const &settings)
Definition: MemoryBase.cc:13
void openFile(bool first, std::string dirName, std::string filebase)
Definition: MemoryBase.cc:74
constexpr std::array< uint8_t, layerIndexSize > layer
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
virtual ~MemoryBase()=default
std::string const & getName() const
Definition: MemoryBase.h:19
Settings const & settings_
Definition: MemoryBase.h:50
void findAndReplaceAll(std::string &data, std::string toSearch, std::string replaceStr)
Definition: MemoryBase.cc:61
std::ofstream out_
Definition: MemoryBase.h:46
std::string getLastPartOfName() const
Definition: MemoryBase.h:20
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
std::string name_
Definition: MemoryBase.h:43
void initLayerDisk(unsigned int pos, int &layer, int &disk)
Definition: MemoryBase.cc:19