Skip to content

Commit

Permalink
ran scram b code-format
Browse files Browse the repository at this point in the history
  • Loading branch information
tomalin committed May 12, 2022
1 parent 0354c3f commit a465123
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 72 deletions.
1 change: 0 additions & 1 deletion L1Trigger/TrackFindingTracklet/interface/L1TStub.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ namespace trklet {

unsigned int isPSmodule_;
unsigned int isFlipped_;

};
}; // namespace trklet
#endif
66 changes: 33 additions & 33 deletions L1Trigger/TrackFindingTracklet/interface/Sector.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ namespace trklet {
double phimax() const { return phimax_; }

template <typename TV, typename... Args>
void addMemToVec(std::vector<std::unique_ptr<TV> >& memvec, const std::string& memName, Args&... args) {
void addMemToVec(std::vector<std::unique_ptr<TV>>& memvec, const std::string& memName, Args&... args) {
memvec.push_back(std::make_unique<TV>(memName, std::forward<Args>(args)...));
Memories_[memName] = memvec.back().get();
MemoriesV_.push_back(memvec.back().get());
}

template <typename TV, typename... Args>
void addProcToVec(std::vector<std::unique_ptr<TV> >& procvec, const std::string& procName, Args&... args) {
void addProcToVec(std::vector<std::unique_ptr<TV>>& procvec, const std::string& procName, Args&... args) {
procvec.push_back(std::make_unique<TV>(procName, std::forward<Args>(args)...));
Processes_[procName] = procvec.back().get();
}
Expand All @@ -149,39 +149,39 @@ namespace trklet {

std::map<std::string, MemoryBase*> Memories_;
std::vector<MemoryBase*> MemoriesV_;
std::vector<std::unique_ptr<DTCLinkMemory> > DL_;
std::vector<std::unique_ptr<InputLinkMemory> > IL_;
std::vector<std::unique_ptr<AllStubsMemory> > AS_;
std::vector<std::unique_ptr<AllInnerStubsMemory> > AIS_;
std::vector<std::unique_ptr<VMStubsTEMemory> > VMSTE_;
std::vector<std::unique_ptr<VMStubsMEMemory> > VMSME_;
std::vector<std::unique_ptr<StubPairsMemory> > SP_;
std::vector<std::unique_ptr<StubTripletsMemory> > ST_;
std::vector<std::unique_ptr<TrackletParametersMemory> > TPAR_;
std::vector<std::unique_ptr<TrackletProjectionsMemory> > TPROJ_;
std::vector<std::unique_ptr<AllProjectionsMemory> > AP_;
std::vector<std::unique_ptr<VMProjectionsMemory> > VMPROJ_;
std::vector<std::unique_ptr<CandidateMatchMemory> > CM_;
std::vector<std::unique_ptr<FullMatchMemory> > FM_;
std::vector<std::unique_ptr<TrackFitMemory> > TF_;
std::vector<std::unique_ptr<CleanTrackMemory> > CT_;
std::vector<std::unique_ptr<DTCLinkMemory>> DL_;
std::vector<std::unique_ptr<InputLinkMemory>> IL_;
std::vector<std::unique_ptr<AllStubsMemory>> AS_;
std::vector<std::unique_ptr<AllInnerStubsMemory>> AIS_;
std::vector<std::unique_ptr<VMStubsTEMemory>> VMSTE_;
std::vector<std::unique_ptr<VMStubsMEMemory>> VMSME_;
std::vector<std::unique_ptr<StubPairsMemory>> SP_;
std::vector<std::unique_ptr<StubTripletsMemory>> ST_;
std::vector<std::unique_ptr<TrackletParametersMemory>> TPAR_;
std::vector<std::unique_ptr<TrackletProjectionsMemory>> TPROJ_;
std::vector<std::unique_ptr<AllProjectionsMemory>> AP_;
std::vector<std::unique_ptr<VMProjectionsMemory>> VMPROJ_;
std::vector<std::unique_ptr<CandidateMatchMemory>> CM_;
std::vector<std::unique_ptr<FullMatchMemory>> FM_;
std::vector<std::unique_ptr<TrackFitMemory>> TF_;
std::vector<std::unique_ptr<CleanTrackMemory>> CT_;

std::map<std::string, ProcessBase*> Processes_;
std::vector<std::unique_ptr<InputRouter> > IR_;
std::vector<std::unique_ptr<VMRouter> > VMR_;
std::vector<std::unique_ptr<VMRouterCM> > VMRCM_;
std::vector<std::unique_ptr<TrackletEngine> > TE_;
std::vector<std::unique_ptr<TrackletEngineDisplaced> > TED_;
std::vector<std::unique_ptr<TripletEngine> > TRE_;
std::vector<std::unique_ptr<TrackletProcessor> > TP_;
std::vector<std::unique_ptr<TrackletCalculator> > TC_;
std::vector<std::unique_ptr<TrackletCalculatorDisplaced> > TCD_;
std::vector<std::unique_ptr<ProjectionRouter> > PR_;
std::vector<std::unique_ptr<MatchEngine> > ME_;
std::vector<std::unique_ptr<MatchCalculator> > MC_;
std::vector<std::unique_ptr<MatchProcessor> > MP_;
std::vector<std::unique_ptr<FitTrack> > FT_;
std::vector<std::unique_ptr<PurgeDuplicate> > PD_;
std::vector<std::unique_ptr<InputRouter>> IR_;
std::vector<std::unique_ptr<VMRouter>> VMR_;
std::vector<std::unique_ptr<VMRouterCM>> VMRCM_;
std::vector<std::unique_ptr<TrackletEngine>> TE_;
std::vector<std::unique_ptr<TrackletEngineDisplaced>> TED_;
std::vector<std::unique_ptr<TripletEngine>> TRE_;
std::vector<std::unique_ptr<TrackletProcessor>> TP_;
std::vector<std::unique_ptr<TrackletCalculator>> TC_;
std::vector<std::unique_ptr<TrackletCalculatorDisplaced>> TCD_;
std::vector<std::unique_ptr<ProjectionRouter>> PR_;
std::vector<std::unique_ptr<MatchEngine>> ME_;
std::vector<std::unique_ptr<MatchCalculator>> MC_;
std::vector<std::unique_ptr<MatchProcessor>> MP_;
std::vector<std::unique_ptr<FitTrack>> FT_;
std::vector<std::unique_ptr<PurgeDuplicate>> PD_;
};
}; // namespace trklet
#endif
17 changes: 8 additions & 9 deletions L1Trigger/TrackFindingTracklet/interface/StubStreamData.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,23 @@ namespace trklet {

class StubStreamData {
public:
StubStreamData() {}
StubStreamData(int iSeed, const L1TStub& stub, const std::string& residuals):
iSeed_(iSeed), stub_(stub), residuals_(residuals) {}
StubStreamData() {}

StubStreamData(int iSeed, const L1TStub& stub, const std::string& residuals)
: iSeed_(iSeed), stub_(stub), residuals_(residuals) {}

~StubStreamData() = default;

int iSeed() const {return iSeed_;} // Seed type
bool valid() const {return (iSeed_ >= 0);} // Valid stub
const L1TStub& stub() const {return stub_;}
int iSeed() const { return iSeed_; } // Seed type
bool valid() const { return (iSeed_ >= 0); } // Valid stub
const L1TStub& stub() const { return stub_; }
// String containing valid bit + r coordinate + phi residual + r or z residual.
const std::string& residuals() const {return residuals_;}
const std::string& residuals() const { return residuals_; }

private:
int iSeed_{-1};
L1TStub stub_;
std::string residuals_{""};

};
}; // namespace trklet
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ namespace trklet {

~TrackletEventProcessor();

void init(Settings const& theSettings,
const tt::Setup* setup = nullptr);
void init(Settings const& theSettings, const tt::Setup* setup = nullptr);

void event(SLHCEvent& ev,
std::vector<std::vector<std::string>>& streamsTrackRaw,
std::vector<std::vector<StubStreamData>>& streamsStubRaw);
std::vector<std::vector<std::string>>& streamsTrackRaw,
std::vector<std::vector<StubStreamData>>& streamsStubRaw);

void printSummary();

Expand Down
29 changes: 15 additions & 14 deletions L1Trigger/TrackFindingTracklet/plugins/L1FPGATrackProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -612,15 +612,15 @@ void L1FPGATrackProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe

const std::vector<trklet::Track>& tracks = eventProcessor.tracks();


// number of track channels
const unsigned int numStreamsTrack = N_SECTOR * channelAssignment_->numChannelsTrack();
// number of stub channels
const unsigned int numStreamsStub = N_SECTOR * channelAssignment_->numChannelsStub();
// number of stub channels if all seed types streams padded to have same number of stub channels (for coding simplicity)
unsigned int maxNumProjectionLayers = 0;
for (int iSeedType = 0; iSeedType < channelAssignment_->numSeedTypes(); iSeedType++) {
maxNumProjectionLayers = max(maxNumProjectionLayers, (unsigned int) channelAssignment_->numProjectionLayers(iSeedType));
maxNumProjectionLayers =
max(maxNumProjectionLayers, (unsigned int)channelAssignment_->numProjectionLayers(iSeedType));
}
const unsigned int numStreamsStubRaw = numStreamsTrack * maxNumProjectionLayers;

Expand Down Expand Up @@ -713,35 +713,36 @@ void L1FPGATrackProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe
Streams streamsTrack(numStreamsTrack);
StreamsStub streamsStub(numStreamsStub);

for(unsigned int chanTrk=0; chanTrk<numStreamsTrack; chanTrk++) {
for(unsigned int itk=0; itk<streamsTrackRaw[chanTrk].size(); itk++) {
for (unsigned int chanTrk = 0; chanTrk < numStreamsTrack; chanTrk++) {
for (unsigned int itk = 0; itk < streamsTrackRaw[chanTrk].size(); itk++) {
std::string bitsTrk = streamsTrackRaw[chanTrk][itk];
int iSeed = chanTrk%channelAssignment_->numChannelsTrack(); // seed type
int iSeed = chanTrk % channelAssignment_->numChannelsTrack(); // seed type
streamsTrack[chanTrk].emplace_back(bitsTrk);

const unsigned int chanStubOffsetIn = chanTrk*maxNumProjectionLayers;
const unsigned int chanStubOffsetIn = chanTrk * maxNumProjectionLayers;
const unsigned int chanStubOffsetOut = channelAssignment_->offsetStub(chanTrk);
const unsigned int numProjLayers = channelAssignment_->numProjectionLayers(iSeed);
TTBV hitMap(0, numProjLayers);
// remove padding from stub stream
for(unsigned int iproj=0; iproj<maxNumProjectionLayers; iproj++) {
for (unsigned int iproj = 0; iproj < maxNumProjectionLayers; iproj++) {
// FW current has one (perhaps invalid) stub per layer per track.
const StubStreamData& stubdata = streamsStubRaw[chanStubOffsetIn+iproj][itk];
const StubStreamData& stubdata = streamsStubRaw[chanStubOffsetIn + iproj][itk];
const L1TStub& stub = stubdata.stub();
if (stubdata.valid()) {
const TTStubRef ttStubRef = stubMap[stub];
int layerId(-1);
if (!channelAssignment_->layerId(stubdata.iSeed(), ttStubRef, layerId)) continue;
if (!channelAssignment_->layerId(stubdata.iSeed(), ttStubRef, layerId))
continue;
hitMap.set(layerId);
streamsStub[chanStubOffsetOut+layerId].emplace_back(ttStubRef,stubdata.residuals());
streamsStub[chanStubOffsetOut + layerId].emplace_back(ttStubRef, stubdata.residuals());
}
}
for (int layerId : hitMap.ids(false)) { // invalid stubs
streamsStub[chanStubOffsetOut+layerId].emplace_back(tt::FrameStub());
for (int layerId : hitMap.ids(false)) { // invalid stubs
streamsStub[chanStubOffsetOut + layerId].emplace_back(tt::FrameStub());
}
}
}
}

iEvent.emplace(edPutTokenTracks_, move(streamsTrack));
iEvent.emplace(edPutTokenStubs_, move(streamsStub));

Expand Down
9 changes: 5 additions & 4 deletions L1Trigger/TrackFindingTracklet/src/FitTrack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ void FitTrack::execute(vector<string>& streamTrackRaw,
streamTrackRaw.emplace_back(valid + seed + rinv + phi0 + z0 + t);

unsigned int ihit(0);
for(unsigned int ilayer = 0 ; ilayer < N_LAYER + N_DISK ; ilayer++){
for (unsigned int ilayer = 0; ilayer < N_LAYER + N_DISK; ilayer++) {
if (bestTracklet->match(ilayer)) {
const Residual& resid = bestTracklet->resid(ilayer);
// create bit accurate 64 bit word
Expand All @@ -1067,13 +1067,14 @@ void FitTrack::execute(vector<string>& streamTrackRaw,
const L1TStub* stub = resid.stubptr()->l1tstub();
static constexpr int widthDisk2Sidentifier = 8;
bool disk2S = (stub->disk() != 0) && (stub->isPSmodule() == 0);
if (disk2S) r = string(widthDisk2Sidentifier, '0') + r;
if (disk2S)
r = string(widthDisk2Sidentifier, '0') + r;
// store seed, L1TStub, and bit accurate 64 bit word in clock accurate output
streamsStubRaw[ihit++].emplace_back(StubStreamData(seedType,*stub,valid + r + phi + rz));
streamsStubRaw[ihit++].emplace_back(StubStreamData(seedType, *stub, valid + r + phi + rz));
}
}
// fill all layer with no stubs with gaps
while (ihit<streamsStubRaw.size()) {
while (ihit < streamsStubRaw.size()) {
streamsStubRaw[ihit++].emplace_back(StubStreamData());
}
}
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/TrackFindingTracklet/src/Sector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ void Sector::executeMP() {

void Sector::executeFT(vector<vector<string>>& streamsTrackRaw, vector<vector<StubStreamData>>& streamsStubRaw) {
const int numChannels = streamsTrackRaw.size() / N_SECTOR;
const int maxNumProjectionLayers = streamsStubRaw.size()/streamsTrackRaw.size();
const int maxNumProjectionLayers = streamsStubRaw.size() / streamsTrackRaw.size();
const int offsetTrack = isector_ * numChannels;
int channelTrack(0);

Expand Down
7 changes: 3 additions & 4 deletions L1Trigger/TrackFindingTracklet/src/TrackletEventProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ TrackletEventProcessor::~TrackletEventProcessor() {
}
}

void TrackletEventProcessor::init(Settings const& theSettings,
const tt::Setup* setup) {
void TrackletEventProcessor::init(Settings const& theSettings, const tt::Setup* setup) {
settings_ = &theSettings;
globals_ = make_unique<Globals>(*settings_);

Expand Down Expand Up @@ -175,8 +174,8 @@ void TrackletEventProcessor::configure(istream& inwire, istream& inmem, istream&
}

void TrackletEventProcessor::event(SLHCEvent& ev,
vector<vector<string>>& streamsTrackRaw,
vector<vector<StubStreamData>>& streamsStubRaw) {
vector<vector<string>>& streamsTrackRaw,
vector<vector<StubStreamData>>& streamsStubRaw) {
globals_->event() = &ev;

tracks_.clear();
Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/TrackFindingTracklet/test/fpga.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ int main(const int argc, const char **argv) {
edm::LogVerbatim("Tracklet") << "Process event: " << eventnum << " with " << ev.nstubs() << " stubs and "
<< ev.nsimtracks() << " simtracks";

std::vector<std::vector<std::string>> tracksStream(N_SECTOR*8);
std::vector<std::vector<StubStreamData>> stubsStream(N_SECTOR*8*8);
std::vector<std::vector<std::string>> tracksStream(N_SECTOR * 8);
std::vector<std::vector<StubStreamData>> stubsStream(N_SECTOR * 8 * 8);

eventProcessor.event(ev, tracksStream, stubsStream);

Expand Down

0 comments on commit a465123

Please sign in to comment.