Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-07 22:33:30

0001 #include "L1Trigger/TrackFindingTracklet/interface/CleanTrackMemory.h"
0002 #include "L1Trigger/TrackFindingTracklet/interface/Tracklet.h"
0003 #include "L1Trigger/TrackFindingTracklet/interface/SLHCEvent.h"
0004 #include <iomanip>
0005 #include <filesystem>
0006 
0007 using namespace std;
0008 using namespace trklet;
0009 
0010 CleanTrackMemory::CleanTrackMemory(string name, Settings const& settings, double phimin, double phimax)
0011     : MemoryBase(name, settings) {
0012   phimin_ = phimin;
0013   phimax_ = phimax;
0014 }
0015 
0016 void CleanTrackMemory::writeCT(bool first, unsigned int iSector) {
0017   iSector_ = iSector;
0018   const string dirCT = settings_.memPath() + "CleanTrack/";
0019 
0020   std::ostringstream oss;
0021   oss << dirCT << "CleanTrack_" << getName() << "_" << std::setfill('0') << std::setw(2) << (iSector_ + 1) << ".dat";
0022   auto const& fname = oss.str();
0023 
0024   openfile(out_, first, dirCT, fname, __FILE__, __LINE__);
0025 
0026   out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
0027 
0028   for (unsigned int j = 0; j < tracks_.size(); j++) {
0029     out_ << "0x";
0030     out_ << std::setfill('0') << std::setw(2);
0031     out_ << hex << j << dec << " ";
0032     out_ << tracks_[j]->trackfitstr() << " " << trklet::hexFormat(tracks_[j]->trackfitstr());
0033     out_ << "\n";
0034   }
0035   out_.close();
0036 
0037   // --------------------------------------------------------------
0038   // print separately ALL cleaned tracks in single file
0039   if (settings_.writeMonitorData("CT")) {
0040     std::string fnameAll = "CleanTracksAll.dat";
0041     if (first && getName() == "CT_L1L2" && iSector_ == 0)
0042       out_.open(fnameAll);
0043     else
0044       out_.open(fnameAll, std::ofstream::app);
0045 
0046     if (!tracks_.empty())
0047       out_ << "BX= " << (bitset<3>)bx_ << " event= " << event_ << " seed= " << getName()
0048            << " phisector= " << iSector_ + 1 << endl;
0049 
0050     for (unsigned int j = 0; j < tracks_.size(); j++) {
0051       if (j < 16)
0052         out_ << "0";
0053       out_ << hex << j << dec << " ";
0054       out_ << tracks_[j]->trackfitstr();
0055       out_ << "\n";
0056     }
0057     out_.close();
0058   }
0059   // --------------------------------------------------------------
0060 
0061   bx_++;
0062   event_++;
0063   if (bx_ > 7)
0064     bx_ = 0;
0065 }