CMS 3D CMS Logo

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

#include <TrackletEngine.h>

Inheritance diagram for trklet::TrackletEngine:
trklet::ProcessBase

Public Member Functions

void addInput (MemoryBase *memory, std::string input) override
 
void addOutput (MemoryBase *memory, std::string output) override
 
void execute ()
 
void setVMPhiBin ()
 
 TrackletEngine (std::string name, Settings const &settings, Globals *global)
 
 ~TrackletEngine () override=default
 
- Public Member Functions inherited from trklet::ProcessBase
unsigned int getISeed (const std::string &name)
 
std::string const & getName () const
 
unsigned int initLayerDisk (unsigned int pos)
 
void initLayerDisk (unsigned int pos, int &layer, int &disk)
 
void initLayerDisk (unsigned int pos, int &layer, int &disk, int &layerdisk)
 
void initLayerDisksandISeed (unsigned int &layerdisk1, unsigned int &layerdisk2, unsigned int &iSeed)
 
unsigned int nbits (unsigned int power)
 
 ProcessBase (std::string name, Settings const &settings, Globals *global)
 
virtual ~ProcessBase ()=default
 

Private Attributes

unsigned int innerphibits_
 
TrackletLUT innerptlut_
 
VMStubsTEMemoryinnervmstubs_
 
unsigned int iSeed_
 
unsigned int layerdisk1_
 
unsigned int layerdisk2_
 
unsigned int outerphibits_
 
TrackletLUT outerptlut_
 
VMStubsTEMemoryoutervmstubs_
 
StubPairsMemorystubpairs_
 

Additional Inherited Members

- Protected Attributes inherited from trklet::ProcessBase
Globalsglobals_
 
std::string name_
 
Settings const & settings_
 

Detailed Description

Definition at line 18 of file TrackletEngine.h.

Constructor & Destructor Documentation

◆ TrackletEngine()

TrackletEngine::TrackletEngine ( std::string  name,
Settings const &  settings,
Globals global 
)

Definition at line 16 of file TrackletEngine.cc.

17  : ProcessBase(name, settings, global), innerptlut_(settings), outerptlut_(settings) {
18  stubpairs_ = nullptr;
19  innervmstubs_ = nullptr;
20  outervmstubs_ = nullptr;
21 
23 
24  innerphibits_ = settings.nfinephi(0, iSeed_);
25  outerphibits_ = settings.nfinephi(1, iSeed_);
26 }

References trklet::ProcessBase::initLayerDisksandISeed(), innerphibits_, innervmstubs_, iSeed_, layerdisk1_, layerdisk2_, trklet::Settings::nfinephi(), outerphibits_, outervmstubs_, and stubpairs_.

◆ ~TrackletEngine()

trklet::TrackletEngine::~TrackletEngine ( )
overridedefault

Member Function Documentation

◆ addInput()

void TrackletEngine::addInput ( MemoryBase memory,
std::string  input 
)
overridevirtual

Implements trklet::ProcessBase.

Definition at line 42 of file TrackletEngine.cc.

42  {
43  if (settings_.writetrace()) {
44  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding input from " << memory->getName() << " to input "
45  << input;
46  }
47  if (input == "innervmstubin") {
48  VMStubsTEMemory* tmp = dynamic_cast<VMStubsTEMemory*>(memory);
49  assert(tmp != nullptr);
51  setVMPhiBin();
52  return;
53  }
54  if (input == "outervmstubin") {
55  VMStubsTEMemory* tmp = dynamic_cast<VMStubsTEMemory*>(memory);
56  assert(tmp != nullptr);
58  setVMPhiBin();
59  return;
60  }
61  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find input : " << input;
62 }

References cms::cuda::assert(), Exception, innervmstubs_, input, trklet::ProcessBase::name_, outervmstubs_, trklet::ProcessBase::settings_, setVMPhiBin(), createJobs::tmp, and trklet::Settings::writetrace().

◆ addOutput()

void TrackletEngine::addOutput ( MemoryBase memory,
std::string  output 
)
overridevirtual

Implements trklet::ProcessBase.

Definition at line 28 of file TrackletEngine.cc.

28  {
29  if (settings_.writetrace()) {
30  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding output to " << memory->getName() << " to output "
31  << output;
32  }
33  if (output == "stubpairout") {
34  StubPairsMemory* tmp = dynamic_cast<StubPairsMemory*>(memory);
35  assert(tmp != nullptr);
36  stubpairs_ = tmp;
37  return;
38  }
39  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find output : " << output;
40 }

References cms::cuda::assert(), Exception, trklet::ProcessBase::name_, convertSQLitetoXML_cfg::output, trklet::ProcessBase::settings_, stubpairs_, createJobs::tmp, and trklet::Settings::writetrace().

◆ execute()

void TrackletEngine::execute ( void  )

Definition at line 64 of file TrackletEngine.cc.

64  {
65  if (!settings_.useSeed(iSeed_))
66  return;
67 
68  unsigned int countall = 0;
69  unsigned int countpass = 0;
70 
71  assert(innervmstubs_ != nullptr);
72  assert(outervmstubs_ != nullptr);
73 
74  for (unsigned int i = 0; i < innervmstubs_->nVMStubs(); i++) {
75  const VMStubTE& innervmstub = innervmstubs_->getVMStubTE(i);
76  FPGAWord lookupbits = innervmstub.vmbits();
77 
78  unsigned int nbits = 7;
79  if (iSeed_ == 4 || iSeed_ == 5)
80  nbits = 6;
81  int rzdiffmax = lookupbits.bits(nbits, lookupbits.nbits() - nbits);
82  int rzbinfirst = lookupbits.bits(0, 3);
83  int start = lookupbits.bits(4, nbits - 4);
84  int next = lookupbits.bits(3, 1);
85 
86  if ((iSeed_ == 4 || iSeed_ == 5) && innervmstub.stub()->disk().value() < 0) { //TODO - need to store negative disk
87  start += 4;
88  }
89  int last = start + next;
90 
91  for (int ibin = start; ibin <= last; ibin++) {
92  for (unsigned int j = 0; j < outervmstubs_->nVMStubsBinned(ibin); j++) {
93  if (countall >= settings_.maxStep("TE"))
94  break;
95  countall++;
96  const VMStubTE& outervmstub = outervmstubs_->getVMStubTEBinned(ibin, j);
97 
98  int rzbin = outervmstub.vmbits().bits(0, 3);
99 
100  FPGAWord iphiinnerbin = innervmstub.finephi();
101  FPGAWord iphiouterbin = outervmstub.finephi();
102 
103  unsigned int index = (iphiinnerbin.value() << outerphibits_) + iphiouterbin.value();
104 
105  if (iSeed_ >= 4) { //Also use r-position
106  int ir = ((ibin & 3) << 1) + (rzbin >> 2);
107  index = (index << 3) + ir;
108  }
109 
110  if (start != ibin)
111  rzbin += 8;
112  if ((rzbin < rzbinfirst) || (rzbin - rzbinfirst > rzdiffmax)) {
113  continue;
114  }
115 
116  FPGAWord innerbend = innervmstub.bend();
117  FPGAWord outerbend = outervmstub.bend();
118 
119  int ptinnerindex = (index << innerbend.nbits()) + innerbend.value();
120  int ptouterindex = (index << outerbend.nbits()) + outerbend.value();
121 
122  if (!(innerptlut_.lookup(ptinnerindex) && outerptlut_.lookup(ptouterindex))) {
123  if (settings_.debugTracklet()) {
124  edm::LogVerbatim("Tracklet") << "Stub pair rejected because of stub pt cut bends : "
126  innervmstub.bend().value(), layerdisk1_, innervmstub.isPSmodule())
127  << " "
129  outervmstub.bend().value(), layerdisk2_, outervmstub.isPSmodule());
130  }
131  continue;
132  }
133 
134  if (settings_.debugTracklet())
135  edm::LogVerbatim("Tracklet") << "Adding stub pair in " << getName();
136 
137  stubpairs_->addStubPair(innervmstub, outervmstub);
138  countpass++;
139  }
140  }
141  }
142 
143  if (settings_.writeMonitorData("TE")) {
144  globals_->ofstream("trackletengine.txt") << getName() << " " << countall << " " << countpass << endl;
145  }
146 }

References trklet::StubPairsMemory::addStubPair(), cms::cuda::assert(), trklet::VMStubTE::bend(), trklet::Settings::benddecode(), trklet::FPGAWord::bits(), trklet::Settings::debugTracklet(), trklet::Stub::disk(), trklet::VMStubTE::finephi(), trklet::ProcessBase::getName(), trklet::VMStubsTEMemory::getVMStubTE(), trklet::VMStubsTEMemory::getVMStubTEBinned(), trklet::ProcessBase::globals_, mps_fire::i, innerptlut_, innervmstubs_, iSeed_, trklet::VMStubTE::isPSmodule(), dqmiolumiharvest::j, dqmdumpme::last, layerdisk1_, layerdisk2_, trklet::TrackletLUT::lookup(), trklet::Settings::maxStep(), trklet::ProcessBase::nbits(), trklet::FPGAWord::nbits(), GetRecoTauVFromDQM_MC_cff::next, trklet::VMStubsTEMemory::nVMStubs(), trklet::VMStubsTEMemory::nVMStubsBinned(), trklet::Globals::ofstream(), outerphibits_, outerptlut_, outervmstubs_, trklet::ProcessBase::settings_, trklet::VMStubTE::stub(), stubpairs_, trklet::Settings::useSeed(), trklet::FPGAWord::value(), trklet::VMStubTE::vmbits(), and trklet::Settings::writeMonitorData().

◆ setVMPhiBin()

void TrackletEngine::setVMPhiBin ( )

Definition at line 148 of file TrackletEngine.cc.

148  {
149  if (innervmstubs_ == nullptr || outervmstubs_ == nullptr)
150  return;
151 
154 
155  double innerphimin, innerphimax;
156  innervmstubs_->getPhiRange(innerphimin, innerphimax, iSeed_, 0);
157 
158  double outerphimin, outerphimax;
159  outervmstubs_->getPhiRange(outerphimin, outerphimax, iSeed_, 1);
160 
161  string innermem = innervmstubs_->getName().substr(6);
162  string outermem = outervmstubs_->getName().substr(6);
163 
165  false,
166  iSeed_,
167  layerdisk1_,
168  layerdisk2_,
171  innerphimin,
172  innerphimax,
173  outerphimin,
174  outerphimax,
175  innermem,
176  outermem);
177 
178  outerptlut_.initteptlut(false,
179  false,
180  iSeed_,
181  layerdisk1_,
182  layerdisk2_,
185  innerphimin,
186  innerphimax,
187  outerphimin,
188  outerphimax,
189  innermem,
190  outermem);
191 
192  TrackletLUT innertememlut(settings_);
193  TrackletLUT outertememlut(settings_);
194 
195  innertememlut.initteptlut(true,
196  true,
197  iSeed_,
198  layerdisk1_,
199  layerdisk2_,
202  innerphimin,
203  innerphimax,
204  outerphimin,
205  outerphimax,
206  innermem,
207  outermem);
208 
209  outertememlut.initteptlut(false,
210  true,
211  iSeed_,
212  layerdisk1_,
213  layerdisk2_,
216  innerphimin,
217  innerphimax,
218  outerphimin,
219  outerphimax,
220  innermem,
221  outermem);
222 
223  innervmstubs_->setbendtable(innertememlut);
224  outervmstubs_->setbendtable(outertememlut);
225 }

References trklet::MemoryBase::getName(), trklet::VMStubsTEMemory::getPhiRange(), trklet::TrackletLUT::initteptlut(), innerphibits_, innerptlut_, innervmstubs_, iSeed_, layerdisk1_, layerdisk2_, outerphibits_, outerptlut_, outervmstubs_, trklet::VMStubsTEMemory::setbendtable(), trklet::VMStubsTEMemory::setother(), and trklet::ProcessBase::settings_.

Referenced by addInput().

Member Data Documentation

◆ innerphibits_

unsigned int trklet::TrackletEngine::innerphibits_
private

Definition at line 49 of file TrackletEngine.h.

Referenced by setVMPhiBin(), and TrackletEngine().

◆ innerptlut_

TrackletLUT trklet::TrackletEngine::innerptlut_
private

Definition at line 45 of file TrackletEngine.h.

Referenced by execute(), and setVMPhiBin().

◆ innervmstubs_

VMStubsTEMemory* trklet::TrackletEngine::innervmstubs_
private

Definition at line 38 of file TrackletEngine.h.

Referenced by addInput(), execute(), setVMPhiBin(), and TrackletEngine().

◆ iSeed_

unsigned int trklet::TrackletEngine::iSeed_
private

Definition at line 33 of file TrackletEngine.h.

Referenced by execute(), setVMPhiBin(), and TrackletEngine().

◆ layerdisk1_

unsigned int trklet::TrackletEngine::layerdisk1_
private

Definition at line 34 of file TrackletEngine.h.

Referenced by execute(), setVMPhiBin(), and TrackletEngine().

◆ layerdisk2_

unsigned int trklet::TrackletEngine::layerdisk2_
private

Definition at line 35 of file TrackletEngine.h.

Referenced by execute(), setVMPhiBin(), and TrackletEngine().

◆ outerphibits_

unsigned int trklet::TrackletEngine::outerphibits_
private

Definition at line 50 of file TrackletEngine.h.

Referenced by execute(), setVMPhiBin(), and TrackletEngine().

◆ outerptlut_

TrackletLUT trklet::TrackletEngine::outerptlut_
private

Definition at line 46 of file TrackletEngine.h.

Referenced by execute(), and setVMPhiBin().

◆ outervmstubs_

VMStubsTEMemory* trklet::TrackletEngine::outervmstubs_
private

Definition at line 39 of file TrackletEngine.h.

Referenced by addInput(), execute(), setVMPhiBin(), and TrackletEngine().

◆ stubpairs_

StubPairsMemory* trklet::TrackletEngine::stubpairs_
private

Definition at line 42 of file TrackletEngine.h.

Referenced by addOutput(), execute(), and TrackletEngine().

trklet::ProcessBase::ProcessBase
ProcessBase(std::string name, Settings const &settings, Globals *global)
Definition: ProcessBase.cc:14
trklet::VMStubsTEMemory::setother
void setother(VMStubsTEMemory *other)
Definition: VMStubsTEMemory.h:48
trklet::TrackletEngine::innerphibits_
unsigned int innerphibits_
Definition: TrackletEngine.h:49
mps_fire.i
i
Definition: mps_fire.py:428
trklet::Settings::writetrace
bool writetrace() const
Definition: Settings.h:183
start
Definition: start.py:1
input
static const std::string input
Definition: EdmProvDump.cc:48
trklet::StubPairsMemory
Definition: StubPairsMemory.h:13
trklet::TrackletLUT::lookup
int lookup(unsigned int index) const
Definition: TrackletLUT.cc:900
trklet::VMStubTE
Definition: VMStubTE.h:15
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
trklet::TrackletEngine::outerphibits_
unsigned int outerphibits_
Definition: TrackletEngine.h:50
memory
Definition: HGCRecHitSoA.h:20
trklet::VMStubsTEMemory::getVMStubTEBinned
const VMStubTE & getVMStubTEBinned(unsigned int bin, unsigned int i) const
Definition: VMStubsTEMemory.h:38
trklet::TrackletEngine::layerdisk2_
unsigned int layerdisk2_
Definition: TrackletEngine.h:35
trklet::TrackletLUT
Definition: TrackletLUT.h:12
trklet::VMStubsTEMemory
Definition: VMStubsTEMemory.h:18
trklet::StubPairsMemory::addStubPair
void addStubPair(const VMStubTE &stub1, const VMStubTE &stub2, const unsigned index=0, const std::string &tedName="")
Definition: StubPairsMemory.h:19
cms::cuda::assert
assert(be >=bs)
trklet::ProcessBase::nbits
unsigned int nbits(unsigned int power)
Definition: ProcessBase.cc:17
trklet::ProcessBase::settings_
Settings const & settings_
Definition: ProcessBase.h:40
trklet::TrackletEngine::outervmstubs_
VMStubsTEMemory * outervmstubs_
Definition: TrackletEngine.h:39
trklet::FPGAWord::nbits
int nbits() const
Definition: FPGAWord.h:25
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
trklet::VMStubTE::isPSmodule
bool isPSmodule() const
Definition: VMStubTE.h:31
trklet::TrackletEngine::setVMPhiBin
void setVMPhiBin()
Definition: TrackletEngine.cc:148
trklet::VMStubTE::bend
const FPGAWord & bend() const
Definition: VMStubTE.h:25
trklet::VMStubsTEMemory::nVMStubs
unsigned int nVMStubs() const
Definition: VMStubsTEMemory.h:30
trklet::Settings::benddecode
double benddecode(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:402
dqmdumpme.last
last
Definition: dqmdumpme.py:56
trklet::Stub::disk
const FPGAWord & disk() const
Definition: Stub.h:68
trklet::MemoryBase::getName
std::string const & getName() const
Definition: MemoryBase.h:19
trklet::FPGAWord::bits
unsigned int bits(unsigned int lsb, unsigned int nbit) const
Definition: FPGAWord.cc:74
trklet::TrackletEngine::iSeed_
unsigned int iSeed_
Definition: TrackletEngine.h:33
trklet::TrackletLUT::initteptlut
void initteptlut(bool fillInner, bool fillTEMem, unsigned int iSeed, unsigned int layerdisk1, unsigned int layerdisk2, unsigned int innerphibits, unsigned int outerphibits, double innerphimin, double innerphimax, double outerphimin, double outerphimax, const std::string &innermem, const std::string &outermem)
Definition: TrackletLUT.cc:240
trklet::ProcessBase::initLayerDisksandISeed
void initLayerDisksandISeed(unsigned int &layerdisk1, unsigned int &layerdisk2, unsigned int &iSeed)
Definition: ProcessBase.cc:63
trklet::VMStubsTEMemory::getVMStubTE
const VMStubTE & getVMStubTE(unsigned int i) const
Definition: VMStubsTEMemory.h:36
trklet::FPGAWord
Definition: FPGAWord.h:9
trklet::VMStubTE::stub
const Stub * stub() const
Definition: VMStubTE.h:29
trklet::TrackletEngine::layerdisk1_
unsigned int layerdisk1_
Definition: TrackletEngine.h:34
trklet::TrackletEngine::outerptlut_
TrackletLUT outerptlut_
Definition: TrackletEngine.h:46
trklet::VMStubTE::vmbits
const FPGAWord & vmbits() const
Definition: VMStubTE.h:27
trklet::FPGAWord::value
int value() const
Definition: FPGAWord.h:24
trklet::TrackletEngine::innerptlut_
TrackletLUT innerptlut_
Definition: TrackletEngine.h:45
trklet::Settings::writeMonitorData
bool writeMonitorData(std::string module) const
Definition: Settings.h:109
trklet::Globals::ofstream
std::ofstream & ofstream(std::string fname)
Definition: Globals.cc:44
trklet::TrackletEngine::innervmstubs_
VMStubsTEMemory * innervmstubs_
Definition: TrackletEngine.h:38
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
trklet::VMStubsTEMemory::getPhiRange
void getPhiRange(double &phimin, double &phimax, unsigned int iSeed, unsigned int inner)
Definition: VMStubsTEMemory.cc:248
trklet::TrackletEngine::stubpairs_
StubPairsMemory * stubpairs_
Definition: TrackletEngine.h:42
Exception
Definition: hltDiff.cc:245
trklet::ProcessBase::getName
std::string const & getName() const
Definition: ProcessBase.h:22
trklet::ProcessBase::name_
std::string name_
Definition: ProcessBase.h:38
trklet::VMStubTE::finephi
const FPGAWord & finephi() const
Definition: VMStubTE.h:23
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
trklet::Settings::debugTracklet
bool debugTracklet() const
Definition: Settings.h:182
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
trklet::Settings::maxStep
unsigned int maxStep(std::string module) const
Definition: Settings.h:116
trklet::VMStubsTEMemory::setbendtable
void setbendtable(const TrackletLUT &bendtable)
Definition: VMStubsTEMemory.cc:277
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
trklet::ProcessBase::globals_
Globals * globals_
Definition: ProcessBase.h:41
trklet::Settings::useSeed
bool useSeed(unsigned int iSeed) const
Definition: Settings.h:94
trklet::VMStubsTEMemory::nVMStubsBinned
unsigned int nVMStubsBinned(unsigned int bin) const
Definition: VMStubsTEMemory.h:32
edm::Log
Definition: MessageLogger.h:70
GetRecoTauVFromDQM_MC_cff.next
next
Definition: GetRecoTauVFromDQM_MC_cff.py:31