Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of dependencies of ChannelAssignement #144

Merged
merged 12 commits into from
May 13, 2022
12 changes: 9 additions & 3 deletions L1Trigger/TrackFindingTracklet/interface/ChannelAssignment.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,22 @@ namespace trklet {
int numChannelsTrack() const { return numChannelsTrack_; }
// number of used channels for stubs
int numChannelsStub() const { return numChannelsStub_; }
// number of used seed types in tracklet algorithm
int numSeedTypes() const { return numSeedTypes_; }
// sets layerId (0-7 in sequence the seed type projects to) of given TTStubRef and seedType, returns false if seeed stub
bool layerId(int seedType, const TTStubRef& ttStubRef, int& layerId) const;
// return tracklet layerId (barrel: [0-5], endcap: [6-10]) for given TTStubRef
int trackletLayerId(const TTStubRef& ttStubRef) const;
// number layers a given seed type projects to
int numProjectionLayers(int seedType) const { return (int)seedTypesProjectionLayers_.at(seedType).size(); }
// max. no. layers that any seed type projects to
int maxNumProjectionLayers() const { return maxNumProjectionLayers_; }
// map of used DTC tfp channels in InputRouter
std::vector<int> channelEncoding() const { return channelEncoding_; }
const std::vector<int>& channelEncoding() const { return channelEncoding_; }
// index of first stub channel belonging to given track channel
int offsetStub(int channelTrack) const;
// seed layers for given seed type id
std::vector<int> seedingLayers(int seedType) const { return seedTypesSeedLayers_.at(seedType); }
const std::vector<int>& seedingLayers(int seedType) const { return seedTypesSeedLayers_.at(seedType); }
//
tt::SensorModule::Type type(const TTStubRef& ttStubRef) const { return setup_->type(ttStubRef); }
//
Expand Down Expand Up @@ -68,6 +72,8 @@ namespace trklet {
std::vector<std::vector<int>> seedTypesSeedLayers_;
// layers a seed types can project to using default layer id [barrel: 1-6, discs: 11-15]
std::vector<std::vector<int>> seedTypesProjectionLayers_;
// max. number of layers to which any seed type projects
int maxNumProjectionLayers_;
// map of used DTC tfp channels in InputRouter
std::vector<int> channelEncoding_;
// accumulated number of projections layer from seed 0 to vector index
Expand All @@ -80,4 +86,4 @@ namespace trklet {

EVENTSETUP_DATA_DEFAULT_RECORD(trklet::ChannelAssignment, trklet::ChannelAssignmentRcd);

#endif
#endif
8 changes: 3 additions & 5 deletions L1Trigger/TrackFindingTracklet/interface/FitTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "L1Trigger/TrackFindingTracklet/interface/TrackletParametersMemory.h"
#include "L1Trigger/TrackFindingTracklet/interface/FullMatchMemory.h"
#include "L1Trigger/TrackFindingTracklet/interface/TrackFitMemory.h"
#include "L1Trigger/TrackFindingTracklet/interface/ChannelAssignment.h"
#include "L1Trigger/TrackFindingTracklet/interface/StubStreamData.h"

#include <vector>
#include <deque>
Expand All @@ -15,7 +15,6 @@ namespace trklet {
class Settings;
class Globals;
class Stub;
class L1TStub;

class FitTrack : public ProcessBase {
public:
Expand All @@ -40,9 +39,8 @@ namespace trklet {

std::vector<Tracklet*> orderedMatches(std::vector<FullMatchMemory*>& fullmatch);

void execute(const ChannelAssignment* channelAssignment,
std::deque<tt::Frame>& streamTrack,
std::vector<std::deque<tt::FrameStub>>& streamsStub,
void execute(std::deque<std::string>& streamTrackRaw,
std::vector<std::deque<StubStreamData>>& stubStream,
unsigned int iSector);

private:
Expand Down
7 changes: 1 addition & 6 deletions L1Trigger/TrackFindingTracklet/interface/L1TStub.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define L1Trigger_TrackFindingTracklet_interface_L1TStub_h

#include "L1Trigger/TrackFindingTracklet/interface/Settings.h"
#include "DataFormats/L1TrackTrigger/interface/TTTypes.h"

#include <iostream>
#include <fstream>
Expand All @@ -27,8 +26,7 @@ namespace trklet {
double z,
double bend,
double strip,
std::vector<int> tps,
const TTStubRef& ttStubRef);
std::vector<int> tps);

~L1TStub() = default;

Expand Down Expand Up @@ -109,8 +107,6 @@ namespace trklet {

const std::string& stubword() const { return stubword_; }

TTStubRef ttStubRef() const { return ttStubRef_; }

private:
int layerdisk_;
std::string DTClink_;
Expand All @@ -135,7 +131,6 @@ namespace trklet {

unsigned int isPSmodule_;
unsigned int isFlipped_;
TTStubRef ttStubRef_;
};
}; // namespace trklet
#endif
3 changes: 1 addition & 2 deletions L1Trigger/TrackFindingTracklet/interface/SLHCEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ namespace trklet {
double z,
double bend,
double strip,
std::vector<int> tpstt,
const TTStubRef& ttStubRef);
std::vector<int> tpstt);

const L1TStub& lastStub() const { return stubs_.back(); }

Expand Down
71 changes: 36 additions & 35 deletions L1Trigger/TrackFindingTracklet/interface/Sector.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "L1Trigger/TrackFindingTracklet/interface/L1TStub.h"
#include "L1Trigger/TrackFindingTracklet/interface/SLHCEvent.h"
#include "L1Trigger/TrackFindingTracklet/interface/ChannelAssignment.h"
#include "L1Trigger/TrackFindingTracklet/interface/StubStreamData.h"

#include <string>
#include <map>
Expand Down Expand Up @@ -115,7 +115,8 @@ namespace trklet {
void executeME();
void executeMC();
void executeMP();
void executeFT(const ChannelAssignment* channelAssignment, tt::Streams& streamsTrack, tt::StreamsStub& streamsStub);
void executeFT(std::vector<std::vector<std::string>>& streamsTrackRaw,
std::vector<std::vector<StubStreamData>>& streamsStubRaw);
void executePD(std::vector<Track>& tracks);

std::vector<Tracklet*> getAllTracklets() const;
Expand All @@ -127,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 @@ -148,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
36 changes: 36 additions & 0 deletions L1Trigger/TrackFindingTracklet/interface/StubStreamData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef L1Trigger_TrackFindingTracklet_interface_StubStreamData_h
#define L1Trigger_TrackFindingTracklet_interface_StubStreamData_h

#include "L1Trigger/TrackFindingTracklet/interface/L1TStub.h"

#include <string>

// Represents an element of the bit-accurate stub stream from TrackBuilder output
// (This class only needed to support stand-alone running of this code).

namespace trklet {

class L1TStub;

class StubStreamData {
public:
StubStreamData() {}

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

~StubStreamData() = default;

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

private:
int iSeed_{-1};
L1TStub stub_;
std::string dataBits_{""};
};
}; // namespace trklet
#endif
16 changes: 5 additions & 11 deletions L1Trigger/TrackFindingTracklet/interface/TrackletEventProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#define L1Trigger_TrackFindingTracklet_interface_TrackletEventProcessor_h

#include "L1Trigger/TrackFindingTracklet/interface/Timer.h"
#include "DataFormats/L1TrackTrigger/interface/TTTypes.h"

#include <map>
#include <memory>
Expand All @@ -23,31 +22,28 @@ namespace trklet {
class Sector;
class HistBase;
class Track;
class ChannelAssignment;
class StubStreamData;

class TrackletEventProcessor {
public:
TrackletEventProcessor();

~TrackletEventProcessor();

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

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

void printSummary();

const std::vector<Track>& tracks() const { return tracks_; }

void produce(tt::Streams& streamsTrack, tt::StreamsStub& streamsStub);

private:
void configure(std::istream& inwire, std::istream& inmem, std::istream& inproc);

const Settings* settings_{nullptr};
const ChannelAssignment* channelAssignment_{nullptr};

std::unique_ptr<Globals> globals_;

Expand Down Expand Up @@ -75,8 +71,6 @@ namespace trklet {
Timer PDTimer_;

std::vector<Track> tracks_;
tt::Streams streamsTrack_;
tt::StreamsStub streamsStub_;
};

}; // namespace trklet
Expand Down
Loading