Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-10-14 01:44:00

0001 #ifndef L1Trigger_TrackFindingTracklet_interface_MemoryBase_h
0002 #define L1Trigger_TrackFindingTracklet_interface_MemoryBase_h
0003 
0004 #include "L1Trigger/TrackFindingTracklet/interface/Settings.h"
0005 
0006 #include <fstream>
0007 #include <sstream>
0008 #include <cassert>
0009 #include <bitset>
0010 
0011 namespace trklet {
0012 
0013   class MemoryBase {
0014   public:
0015     MemoryBase(std::string name, Settings const& settings);
0016 
0017     virtual ~MemoryBase() = default;
0018 
0019     std::string const& getName() const { return name_; }
0020     std::string getLastPartOfName() const { return name_.substr(name_.find_last_of('_') + 1); }
0021 
0022     virtual void clean() = 0;
0023 
0024     //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
0025     void initLayerDisk(unsigned int pos, int& layer, int& disk);
0026 
0027     unsigned int initLayerDisk(unsigned int pos);
0028 
0029     // Based on memory name check if this memory is used for special seeding:
0030     // overlap is layer-disk seeding
0031     // extra is the L2L3 seeding
0032     // extended is the seeding for displaced tracks
0033     void initSpecialSeeding(unsigned int pos, bool& overlap, bool& extra, bool& extended);
0034 
0035     //Used for a hack below due to MAC OS case insensitiviy problem for files
0036     void findAndReplaceAll(std::string& data, std::string toSearch, std::string replaceStr);
0037 
0038     void openFile(bool first, std::string dirName, std::string filebase);
0039 
0040     static size_t find_nth(const std::string& haystack, size_t pos, const std::string& needle, size_t nth);
0041 
0042     //Format index position in hex
0043     static std::string hexstr(unsigned int index);
0044 
0045   protected:
0046     std::string name_;
0047     unsigned int iSector_;
0048 
0049     std::ofstream out_;
0050     int bx_;
0051     int event_;
0052 
0053     Settings const& settings_;
0054   };
0055 };  // namespace trklet
0056 #endif