CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
trklet::InputLinkMemory Class Reference

#include <InputLinkMemory.h>

Inheritance diagram for trklet::InputLinkMemory:
trklet::MemoryBase

Public Member Functions

bool addStub (Settings const &settings, Globals *globals, L1TStub &al1stub, Stub &stub, std::string dtc)
 
void clean () override
 
StubgetStub (unsigned int i)
 
 InputLinkMemory (std::string name, Settings const &settings, unsigned int iSector, double, double)
 
unsigned int nStubs () const
 
void writeStubs (bool first)
 
 ~InputLinkMemory () override=default
 
- Public Member Functions inherited from trklet::MemoryBase
void findAndReplaceAll (std::string &data, std::string toSearch, std::string replaceStr)
 
std::string getLastPartOfName () const
 
std::string const & getName () const
 
unsigned int initLayerDisk (unsigned int pos)
 
void initLayerDisk (unsigned int pos, int &layer, int &disk)
 
void initSpecialSeeding (unsigned int pos, bool &overlap, bool &extra, bool &extended)
 
 MemoryBase (std::string name, Settings const &settings, unsigned int iSector)
 
void openFile (bool first, std::string dirName, std::string filebase)
 
virtual ~MemoryBase ()=default
 

Private Attributes

unsigned int layerdisk_
 
int phiregion_
 
std::vector< Stub * > stubs_
 

Additional Inherited Members

- Static Public Member Functions inherited from trklet::MemoryBase
static size_t find_nth (const std::string &haystack, size_t pos, const std::string &needle, size_t nth)
 
- Protected Attributes inherited from trklet::MemoryBase
int bx_
 
int event_
 
unsigned int iSector_
 
std::string name_
 
std::ofstream out_
 
Settings const & settings_
 

Detailed Description

Definition at line 18 of file InputLinkMemory.h.

Constructor & Destructor Documentation

◆ InputLinkMemory()

InputLinkMemory::InputLinkMemory ( std::string  name,
Settings const &  settings,
unsigned int  iSector,
double  ,
double   
)

Definition at line 17 of file InputLinkMemory.cc.

18  : MemoryBase(name, settings, iSector) {
19  string subname = name.substr(5, 7);
20  phiregion_ = subname[3] - 'A';
21  assert(phiregion_ >= 0 && phiregion_ < 8);
22 
24 }

References cms::cuda::assert(), trklet::MemoryBase::initLayerDisk(), layerdisk_, Skims_PA_cff::name, and phiregion_.

◆ ~InputLinkMemory()

trklet::InputLinkMemory::~InputLinkMemory ( )
overridedefault

Member Function Documentation

◆ addStub()

bool InputLinkMemory::addStub ( Settings const &  settings,
Globals globals,
L1TStub al1stub,
Stub stub,
std::string  dtc 
)

Definition at line 26 of file InputLinkMemory.cc.

27  {
28  if (layerdisk_ < N_LAYER && globals->phiCorr(layerdisk_) == nullptr) {
29  globals->phiCorr(layerdisk_) = new VMRouterPhiCorrTable(settings);
30  int nbits = 3;
31  if (layerdisk_ >= N_PSLAYER)
32  nbits = 4;
33  globals->phiCorr(layerdisk_)->init(layerdisk_ + 1, nbits, 3);
34  }
35 
36  unsigned int stublayerdisk = stub.layerdisk();
37  assert(stublayerdisk < 11);
38 
39  if (stublayerdisk != layerdisk_)
40  return false;
41 
42  if (layerdisk_ < N_LAYER) {
43  FPGAWord r = stub.r();
44  int bendbin = stub.bend().value();
45  int rbin = (r.value() + (1 << (r.nbits() - 1))) >> (r.nbits() - 3);
46  const VMRouterPhiCorrTable& phiCorrTable = *globals->phiCorr(layerdisk_);
47  int iphicorr = phiCorrTable.getphiCorrValue(bendbin, rbin);
48  stub.setPhiCorr(iphicorr);
49  }
50 
51  FPGAWord iphi = stub.phicorr();
52  unsigned int nallbits = settings_.nbitsallstubs(layerdisk_);
53  int phibin = iphi.bits(iphi.nbits() - nallbits, nallbits);
54  int iphivmRaw = iphi.bits(iphi.nbits() - 5, 5);
55 
56  if (phibin != phiregion_)
57  return false;
58 
59  if (getName().substr(10, dtc.size()) != dtc)
60  return false;
61 
62  string half = getName().substr(getName().size() - 3, 3);
63  if (half[1] != 'n') {
64  half = getName().substr(getName().size() - 1, 1);
65  }
66 
67  assert(half[0] == 'A' || half[0] == 'B');
68 
69  if (half[0] == 'B' && iphivmRaw <= 15)
70  return false;
71  if (half[0] == 'A' && iphivmRaw > 15)
72  return false;
73 
74  if (settings_.debugTracklet()) {
75  edm::LogVerbatim("Tracklet") << "Will add stub in " << getName() << " "
76  << "iphiwmRaw = " << iphivmRaw << " phi=" << al1stub.phi() << " z=" << al1stub.z()
77  << " r=" << al1stub.r();
78  }
79  if (stubs_.size() < settings_.maxStep("Link")) {
80  Stub* stubptr = new Stub(stub);
81  stubptr->setl1tstub(new L1TStub(al1stub));
82 
83  stubs_.emplace_back(stubptr);
84  }
85  return true;
86 }

References cms::cuda::assert(), trklet::Stub::bend(), trklet::Settings::debugTracklet(), trklet::MemoryBase::getName(), trklet::VMRouterPhiCorrTable::getphiCorrValue(), trklet::VMRouterPhiCorrTable::init(), LEDCalibrationChannels::iphi, trklet::Stub::layerdisk(), layerdisk_, trklet::Settings::maxStep(), trklet::N_LAYER, trklet::N_PSLAYER, trklet::Settings::nbitsallstubs(), trklet::L1TStub::phi(), trklet::Globals::phiCorr(), trklet::Stub::phicorr(), phiregion_, trklet::Stub::r(), trklet::L1TStub::r(), alignCSCRings::r, trklet::Stub::setl1tstub(), trklet::Stub::setPhiCorr(), trklet::MemoryBase::settings_, findQualityFiles::size, stubs_, trklet::FPGAWord::value(), and trklet::L1TStub::z().

◆ clean()

void InputLinkMemory::clean ( )
overridevirtual

Implements trklet::MemoryBase.

Definition at line 101 of file InputLinkMemory.cc.

101  {
102  for (auto& stub : stubs_) {
103  delete stub->l1tstub();
104  delete stub;
105  }
106  stubs_.clear();
107 }

References stubs_.

◆ getStub()

Stub* trklet::InputLinkMemory::getStub ( unsigned int  i)
inline

Definition at line 28 of file InputLinkMemory.h.

28 { return stubs_[i]; }

References mps_fire::i, and stubs_.

◆ nStubs()

unsigned int trklet::InputLinkMemory::nStubs ( ) const
inline

Definition at line 26 of file InputLinkMemory.h.

26 { return stubs_.size(); }

References stubs_.

◆ writeStubs()

void InputLinkMemory::writeStubs ( bool  first)

Definition at line 88 of file InputLinkMemory.cc.

88  {
89  const string dirIS = settings_.memPath() + "InputStubs/";
90  openFile(first, dirIS, "InputStubs_");
91 
92  for (unsigned int j = 0; j < stubs_.size(); j++) {
93  string stub = stubs_[j]->str();
94  out_ << std::setfill('0') << std::setw(2);
95  out_ << hex << j << dec;
96  out_ << " " << stub << " " << trklet::hexFormat(stub) << endl;
97  }
98  out_.close();
99 }

References TauDecayModes::dec, first, trklet::hexFormat(), dqmiolumiharvest::j, trklet::Settings::memPath(), trklet::MemoryBase::openFile(), trklet::MemoryBase::out_, trklet::MemoryBase::settings_, and stubs_.

Member Data Documentation

◆ layerdisk_

unsigned int trklet::InputLinkMemory::layerdisk_
private

Definition at line 37 of file InputLinkMemory.h.

Referenced by addStub(), and InputLinkMemory().

◆ phiregion_

int trklet::InputLinkMemory::phiregion_
private

Definition at line 36 of file InputLinkMemory.h.

Referenced by addStub(), and InputLinkMemory().

◆ stubs_

std::vector<Stub*> trklet::InputLinkMemory::stubs_
private

Definition at line 35 of file InputLinkMemory.h.

Referenced by addStub(), clean(), getStub(), nStubs(), and writeStubs().

trklet::N_PSLAYER
constexpr unsigned int N_PSLAYER
Definition: Settings.h:21
trklet::Globals::phiCorr
VMRouterPhiCorrTable *& phiCorr(unsigned int layer)
Definition: Globals.h:44
trklet::VMRouterPhiCorrTable::getphiCorrValue
int getphiCorrValue(int ibend, int irbin) const
Definition: VMRouterPhiCorrTable.cc:47
trklet::VMRouterPhiCorrTable::init
void init(int layer, int bendbits, int rbits)
Definition: VMRouterPhiCorrTable.cc:12
trklet::MemoryBase::settings_
Settings const & settings_
Definition: MemoryBase.h:50
mps_fire.i
i
Definition: mps_fire.py:428
trklet::Stub::bend
const FPGAWord & bend() const
Definition: Stub.h:47
trklet::L1TStub
Definition: L1TStub.h:12
trklet::InputLinkMemory::stubs_
std::vector< Stub * > stubs_
Definition: InputLinkMemory.h:35
trklet::L1TStub::z
double z() const
Definition: L1TStub.h:56
trklet::Settings::memPath
std::string const & memPath() const
Definition: Settings.h:169
trklet::Settings::nbitsallstubs
unsigned int nbitsallstubs(unsigned int layerdisk) const
Definition: Settings.h:93
cms::cuda::assert
assert(be >=bs)
trklet::MemoryBase::out_
std::ofstream out_
Definition: MemoryBase.h:46
trklet::MemoryBase::initLayerDisk
void initLayerDisk(unsigned int pos, int &layer, int &disk)
Definition: MemoryBase.cc:18
trklet::Stub::r
const FPGAWord & r() const
Definition: Stub.h:49
trklet::InputLinkMemory::phiregion_
int phiregion_
Definition: InputLinkMemory.h:36
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
trklet::MemoryBase::getName
std::string const & getName() const
Definition: MemoryBase.h:19
trklet::MemoryBase::openFile
void openFile(bool first, std::string dirName, std::string filebase)
Definition: MemoryBase.cc:73
trklet::Stub
Definition: Stub.h:16
trklet::N_LAYER
constexpr int N_LAYER
Definition: Settings.h:19
trklet::Stub::layerdisk
unsigned int layerdisk() const
Definition: Stub.cc:250
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
trklet::FPGAWord
Definition: FPGAWord.h:9
trklet::FPGAWord::value
int value() const
Definition: FPGAWord.h:24
trklet::MemoryBase::MemoryBase
MemoryBase(std::string name, Settings const &settings, unsigned int iSector)
Definition: MemoryBase.cc:12
trklet::InputLinkMemory::layerdisk_
unsigned int layerdisk_
Definition: InputLinkMemory.h:37
alignCSCRings.r
r
Definition: alignCSCRings.py:93
trklet::Stub::setl1tstub
void setl1tstub(L1TStub *l1tstub)
Definition: Stub.h:71
trklet::Stub::phicorr
const FPGAWord & phicorr() const
Definition: Stub.h:52
trklet::Stub::setPhiCorr
void setPhiCorr(int phiCorr)
Definition: Stub.cc:198
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
trklet::Settings::debugTracklet
bool debugTracklet() const
Definition: Settings.h:161
trklet::VMRouterPhiCorrTable
Definition: VMRouterPhiCorrTable.h:16
trklet::Settings::maxStep
unsigned int maxStep(std::string module) const
Definition: Settings.h:103
trklet::L1TStub::r
double r() const
Definition: L1TStub.h:57
trklet::hexFormat
std::string hexFormat(const std::string &binary)
Definition: Util.h:15
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
trklet::L1TStub::phi
double phi() const
Definition: L1TStub.h:62
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443