File indexing completed on 2023-03-17 11:13:58
0001 #include "L1Trigger/TrackFindingTracklet/interface/VMProjectionsMemory.h"
0002 #include "L1Trigger/TrackFindingTracklet/interface/Tracklet.h"
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 #include <iomanip>
0005 #include <filesystem>
0006
0007 using namespace std;
0008 using namespace trklet;
0009
0010 VMProjectionsMemory::VMProjectionsMemory(string name, Settings const& settings) : MemoryBase(name, settings) {
0011 initLayerDisk(7, layer_, disk_);
0012 }
0013
0014 void VMProjectionsMemory::addTracklet(Tracklet* tracklet, unsigned int allprojindex) {
0015 std::pair<Tracklet*, unsigned int> tmp(tracklet, allprojindex);
0016
0017 if (!tracklets_.empty()) {
0018 assert(tracklets_[tracklets_.size() - 1].first->TCID() <= tracklet->TCID());
0019 }
0020 tracklets_.push_back(tmp);
0021 }
0022
0023 void VMProjectionsMemory::writeVMPROJ(bool first, unsigned int iSector) {
0024 iSector_ = iSector;
0025 const string dirVM = settings_.memPath() + "VMProjections/";
0026
0027 std::ostringstream oss;
0028 oss << dirVM + "VMProjections_" << getName();
0029
0030 auto const& tmp = oss.str();
0031 int len = tmp.size();
0032 if (tmp[len - 2] == 'n' && tmp[len - 1] > '1' && tmp[len - 1] <= '9')
0033 return;
0034 oss << "_" << std::setfill('0') << std::setw(2) << (iSector_ + 1) << ".dat";
0035 auto const& fname = oss.str();
0036
0037 openfile(out_, first, dirVM, fname, __FILE__, __LINE__);
0038
0039 out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
0040
0041 for (unsigned int j = 0; j < tracklets_.size(); j++) {
0042 string vmproj = (layer_ > 0) ? tracklets_[j].first->vmstrlayer(layer_, tracklets_[j].second)
0043 : tracklets_[j].first->vmstrdisk(disk_, tracklets_[j].second);
0044 out_ << hexstr(j) << " " << vmproj << " " << trklet::hexFormat(vmproj) << endl;
0045 }
0046 out_.close();
0047
0048 bx_++;
0049 event_++;
0050 if (bx_ > 7)
0051 bx_ = 0;
0052 }