File indexing completed on 2024-04-06 12:22:05
0001 #include "L1Trigger/TrackFindingTracklet/interface/TrackletParametersMemory.h"
0002 #include "L1Trigger/TrackFindingTracklet/interface/Settings.h"
0003 #include "L1Trigger/TrackFindingTracklet/interface/Globals.h"
0004 #include "L1Trigger/TrackFindingTracklet/interface/Tracklet.h"
0005 #include <iomanip>
0006 #include <filesystem>
0007
0008 using namespace std;
0009 using namespace trklet;
0010
0011 TrackletParametersMemory::TrackletParametersMemory(string name, Settings const& settings)
0012 : MemoryBase(name, settings) {}
0013
0014 void TrackletParametersMemory::clean() {
0015 for (auto& tracklet : tracklets_) {
0016 delete tracklet;
0017 }
0018 tracklets_.clear();
0019 }
0020
0021 void TrackletParametersMemory::writeTPAR(bool first, unsigned int iSector) {
0022 iSector_ = iSector;
0023 const string dirTP = settings_.memPath() + "TrackletParameters/";
0024
0025 std::ostringstream oss;
0026 oss << dirTP << "TrackletParameters_" << getName() << "_" << std::setfill('0') << std::setw(2) << (iSector_ + 1)
0027 << ".dat";
0028 auto const& fname = oss.str();
0029
0030 openfile(out_, first, dirTP, fname, __FILE__, __LINE__);
0031
0032 out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
0033
0034 for (unsigned int j = 0; j < tracklets_.size(); j++) {
0035 string tpar = tracklets_[j]->trackletparstr();
0036 out_ << hexstr(j) << " " << tpar << " " << trklet::hexFormat(tpar) << endl;
0037 }
0038 out_.close();
0039
0040 bx_++;
0041 event_++;
0042 if (bx_ > 7)
0043 bx_ = 0;
0044 }