Skip to content

Commit

Permalink
Restructure TrackletProcessorDisplaced (#297)
Browse files Browse the repository at this point in the history
* initial add of restructured TPD

* clean up new TPD code

* remove unnecessary includes

* remove magic numbers
  • Loading branch information
cgsavard authored Dec 16, 2024
1 parent 44cb866 commit 8baea33
Show file tree
Hide file tree
Showing 5 changed files with 433 additions and 147 deletions.
4 changes: 3 additions & 1 deletion L1Trigger/TrackFindingTracklet/interface/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ namespace trklet {
}

unsigned int teunits(unsigned int iSeed) const { return teunits_[iSeed]; }
unsigned int trpunits(unsigned int iSeed) const { return trpunits_[iSeed]; }

unsigned int NTC(int seed) const { return ntc_[seed]; }

Expand Down Expand Up @@ -666,7 +667,8 @@ namespace trklet {
int chisqphifactbits_{14};
int chisqzfactbits_{14};

std::array<unsigned int, N_SEED> teunits_{{5, 2, 5, 3, 3, 2, 3, 2, 0, 0, 0, 0}}; //teunits used by seed
std::array<unsigned int, N_SEED> teunits_{{5, 2, 5, 3, 3, 2, 3, 2, 0, 0, 0, 0}}; //teunits used by seed
std::array<unsigned int, N_SEED> trpunits_{{0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10}}; //trpunits used by seed

std::array<unsigned int, N_LAYER + N_DISK> vmrlutzbits_{
{7, 7, 7, 7, 7, 7, 3, 3, 3, 3, 3}}; // zbits used by LUT in VMR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include "L1Trigger/TrackFindingTracklet/interface/TrackletCalculatorDisplaced.h"
#include "L1Trigger/TrackFindingTracklet/interface/TrackletLUT.h"
#include "L1Trigger/TrackFindingTracklet/interface/CircularBuffer.h"
#include "L1Trigger/TrackFindingTracklet/interface/TrackletEngineUnit.h"
#include "L1Trigger/TrackFindingTracklet/interface/TrackletParametersMemory.h"
#include "L1Trigger/TrackFindingTracklet/interface/TrackletProjectionsMemory.h"
#include "L1Trigger/TrackFindingTracklet/interface/TripletEngineUnit.h"

#include <vector>
#include <tuple>
Expand Down Expand Up @@ -40,6 +40,10 @@ namespace trklet {

private:
int iTC_;
unsigned int maxStep_;

std::tuple<CircularBuffer<TrpEData>, unsigned int, unsigned int, unsigned int, unsigned int> trpbuffer_;
std::vector<TripletEngineUnit> trpunits_;

unsigned int layerdisk1_;
unsigned int layerdisk2_;
Expand Down
94 changes: 94 additions & 0 deletions L1Trigger/TrackFindingTracklet/interface/TripletEngineUnit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#ifndef L1Trigger_TrackFindingTracklet_interface_TripletEngineUnit_h
#define L1Trigger_TrackFindingTracklet_interface_TripletEngineUnit_h

#include "L1Trigger/TrackFindingTracklet/interface/VMStubsTEMemory.h"
#include "L1Trigger/TrackFindingTracklet/interface/CircularBuffer.h"
#include "L1Trigger/TrackFindingTracklet/interface/TrackletLUT.h"

#include <cassert>
#include <vector>

namespace trklet {

class Settings;
class Stub;
class L1TStub;

struct TrpEData {
const Stub* stub_;
int start_out_;
int start_in_;
int rzbinfirst_out_;
int rzdiffmax_out_;
std::vector<std::tuple<int, int, int> > projbin_out_; // next z/r bin; outer stub mem; nstub
std::vector<std::tuple<int, int, int> > projbin_in_; // next z/r bin; inner stub mem; nstub
};

class TripletEngineUnit {
public:
TripletEngineUnit(const Settings* const settings,
unsigned int layerdisk1,
unsigned int layerdisk2,
unsigned int layerdisk3,
unsigned int iSeed,
std::vector<VMStubsTEMemory*> innervmstubs,
std::vector<VMStubsTEMemory*> outervmstubs);

~TripletEngineUnit() = default;

void init(const TrpEData& trpdata);

bool getGoodTriplet() { return goodtriplet__; }

bool empty() const { return candtriplets_.empty(); }

const std::tuple<const Stub*, const Stub*, const Stub*>& read() { return candtriplets_.read(); }

const std::tuple<const Stub*, const Stub*, const Stub*>& peek() const { return candtriplets_.peek(); }

bool idle() const { return idle_; }

void setNearFull() { nearfull_ = candtriplets_.nearfull(); }

void reset();

void step();

const Stub* innerStub() const { return trpdata_.stub_; }

private:
std::vector<VMStubsTEMemory*> innervmstubs_;
std::vector<VMStubsTEMemory*> outervmstubs_;
TrpEData trpdata_;
const Settings* settings_;
unsigned int layerdisk1_;
unsigned int layerdisk2_;
unsigned int layerdisk3_;
unsigned int iSeed_;
bool nearfull_; //initialized at start of each processing step

//unsigned int memory slot
unsigned int nmem_out_;
unsigned int nmem_in_;
unsigned int istub_out_;
unsigned int istub_in_;
unsigned int next_out_;
unsigned int next_in_;
unsigned int nstub_out_;
unsigned int nstub_in_;
unsigned int outmem_;
unsigned int inmem_;
unsigned int nproj_out_;
unsigned int nproj_in_;

bool idle_;

std::tuple<const Stub*, const Stub*, const Stub*> candtriplet_, candtriplet__;
bool goodtriplet_, goodtriplet__;

//save the candidate matches
CircularBuffer<std::tuple<const Stub*, const Stub*, const Stub*> > candtriplets_;
}; // TripletEngineUnit

}; // namespace trklet
#endif
Loading

0 comments on commit 8baea33

Please sign in to comment.