Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:58

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_ << hexstr(j) << " " << tracks_[j]->trackfitstr() << " " << trklet::hexFormat(tracks_[j]->trackfitstr());
0030     out_ << "\n";
0031   }
0032   out_.close();
0033 
0034   // --------------------------------------------------------------
0035   // print separately ALL cleaned tracks in single file
0036   if (settings_.writeMonitorData("CT")) {
0037     std::string fnameAll = "CleanTracksAll.dat";
0038     if (first && getName() == "CT_L1L2" && iSector_ == 0)
0039       out_.open(fnameAll);
0040     else
0041       out_.open(fnameAll, std::ofstream::app);
0042 
0043     if (!tracks_.empty())
0044       out_ << "BX= " << (bitset<3>)bx_ << " event= " << event_ << " seed= " << getName()
0045            << " phisector= " << iSector_ + 1 << endl;
0046 
0047     for (unsigned int j = 0; j < tracks_.size(); j++) {
0048       if (j < 16)
0049         out_ << "0";
0050       out_ << hex << j << dec << " ";
0051       out_ << tracks_[j]->trackfitstr();
0052       out_ << "\n";
0053     }
0054     out_.close();
0055   }
0056   // --------------------------------------------------------------
0057 
0058   bx_++;
0059   event_++;
0060   if (bx_ > 7)
0061     bx_ = 0;
0062 }