Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:06

0001 #include "L1Trigger/TrackFindingTracklet/interface/VMStubsMEMemory.h"
0002 #include "L1Trigger/TrackFindingTracklet/interface/Settings.h"
0003 #include <iomanip>
0004 #include <filesystem>
0005 
0006 using namespace std;
0007 using namespace trklet;
0008 
0009 VMStubsMEMemory::VMStubsMEMemory(string name, Settings const& settings) : MemoryBase(name, settings) {
0010   unsigned int layerdisk = initLayerDisk(6);
0011   if (layerdisk < N_LAYER) {
0012     binnedstubs_.resize(settings_.NLONGVMBINS());
0013   } else {
0014     //For disks we have NLONGVMBITS on each disk
0015     binnedstubs_.resize(2 * settings_.NLONGVMBINS());
0016   }
0017 }
0018 
0019 void VMStubsMEMemory::writeStubs(bool first, unsigned int iSector) {
0020   iSector_ = iSector;
0021   const string dirVM = settings_.memPath() + "VMStubsME/";
0022 
0023   std::ostringstream oss;
0024   oss << dirVM << "VMStubs_" << getName();
0025   //get rid of duplicates
0026   auto const& tmp = oss.str();
0027   int len = tmp.size();
0028   if (tmp[len - 2] == 'n' && tmp[len - 1] > '1' && tmp[len - 1] <= '9')
0029     return;
0030   oss << "_" << std::setfill('0') << std::setw(2) << (iSector_ + 1) << ".dat";
0031   auto const& fname = oss.str();
0032 
0033   openfile(out_, first, dirVM, fname, __FILE__, __LINE__);
0034 
0035   out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
0036 
0037   for (unsigned int i = 0; i < binnedstubs_.size(); i++) {
0038     for (unsigned int j = 0; j < binnedstubs_[i].size(); j++) {
0039       string stub = binnedstubs_[i][j].stubindex().str();
0040       stub += "|" + binnedstubs_[i][j].bend().str();
0041 
0042       FPGAWord finephipos = binnedstubs_[i][j].finephi();
0043       stub += "|" + finephipos.str();
0044       FPGAWord finepos = binnedstubs_[i][j].finerz();
0045       stub += "|" + finepos.str();
0046       out_ << hexstr(i) << " " << hexstr(j) << " " << stub << " " << trklet::hexFormat(stub) << endl;
0047     }
0048   }
0049   out_.close();
0050 
0051   bx_++;
0052   event_++;
0053   if (bx_ > 7)
0054     bx_ = 0;
0055 }