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

L1Trigger/TrackerDTC Debugged and Analyzer added. #29520

Merged
merged 2 commits into from
May 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 52 additions & 31 deletions DataFormats/L1TrackTrigger/interface/TTDTC.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,59 +16,80 @@
*/
class TTDTC {
public:
// outer tracker DTC types
typedef std::bitset<TTBV::S> BV; // bit accurate Stub
typedef std::pair<TTStubRef, BV> Frame; // TTStub with bit accurate Stub
typedef std::vector<Frame> Stream; // stub collection transported over an optical link between DTC and TFP
typedef std::vector<Stream> Streams; // collection of optical links
// bit accurate Stub
typedef std::bitset<TTBV::S> BV;
// TTStub with bit accurate Stub
typedef std::pair<TTStubRef, BV> Frame;
// stub collection transported over an optical link between DTC and TFP
typedef std::vector<Frame> Stream;
// collection of optical links
typedef std::vector<Stream> Streams;

private:
// number of ATCA slots per shelf
static constexpr int numSlots_ = 12;

public:
TTDTC() {}

TTDTC(int numRegions, int numOverlappingRegions, int numDTCsPerRegion);

~TTDTC() {}

// Access to product configurations
int numRegions() const;
int numDTCBoards() const;
int numDTCChannel() const;
int numTFPChannel() const;

// number of phi slices the outer tracker readout is organized in [default 9]
int numRegions() const { return numRegions_; }
// number of DTC boards used to readout a detector region [default 24]
int numDTCBoards() const { return numDTCsPerRegion_; }
// number of regions a reconstructable particle may cross [default 2]
int numDTCChannel() const { return numOverlappingRegions_; }
// number of DTC boards connected to one TFP [default 48]
int numTFPChannel() const { return numDTCsPerTFP_; }
// all regions [default 0..8]
const std::vector<int>& tfpRegions() const { return regions_; }
// all TFP channel [default 0..47]
const std::vector<int>& tfpChannels() const { return channels_; }
// write one specific stream of TTStubRefs using DTC identifier (region[0-8], board[0-23], channel[0-1])
// dtcRegions aka detector regions are defined by tk layout
void setStream(int dtcRegion, int dtcBoard, int dtcChannel, const Stream& stream);

// all TFP identifier (region[0-8], channel[0-47])
std::vector<int> tfpRegions() const;
std::vector<int> tfpChannels() const;

// read one specific stream of TTStubRefs using TFP identifier (region[0-8], channel[0-47])
// tfpRegions aka processing regions are rotated by -0.5 region width w.r.t detector regions
const Stream& stream(int tfpRegion, int tfpChannel) const;

// total number of frames
int size() const;
// total number of stubs
int nStubs() const;
// total number of gaps
int nGaps() const;
// converts dtc id into tk layout scheme
int tkLayoutId(int dtcId) const;

// converts tk layout id into dtc id
int dtcId(int tkLayoutId) const;
// converts TFP identifier (region[0-8], channel[0-47]) into dtcId [0-215]
int dtcId(int tfpRegion, int tfpChannel) const;
// checks if given dtcId is connected to PS or 2S sensormodules
bool psModlue(int dtcId) const;
// checks if given dtcId is connected to -z (false) or +z (true)
bool side(int dtcId) const;
// ATCA slot number [0-11] of given dtcId
int slot(int dtcId) const;

private:
// converts DTC identifier (region[0-8], board[0-23], channel[0-1]) into allStreams_ index [0-431]
int index(int dtcRegion, int dtcBoard, int dtcChannel) const;

// converts TFP identifier (region[0-8], channel[0-47]) into allStreams_ index [0-431]
int index(int tfpRegion, int tfpChannel) const;

private:
static constexpr int numSlots_ = 12; // number of ATCA slots per shelf

int numRegions_; // number of phi slices the outer tracker readout is organized in [default 9]
int numOverlappingRegions_; // number of regions a reconstructable particle may cross [default 2]
int numDTCsPerRegion_; // number of DTC boards used to readout a detector region [default 24]
int numDTCsPerTFP_; // number of DTC boards connected to one TFP [default 48]

Streams streams_; // collection of all optical links between DTC and TFP [default 432 links]
// number of phi slices the outer tracker readout is organized in [default 9]
int numRegions_;
// number of regions a reconstructable particle may cross [default 2]
int numOverlappingRegions_;
// number of DTC boards used to readout a detector region [default 24]
int numDTCsPerRegion_;
// number of DTC boards connected to one TFP [default 48]
int numDTCsPerTFP_;
// all regions [default 0..8]
std::vector<int> regions_;
// all TFP channel [default 0..47]
std::vector<int> channels_;
// collection of all optical links between DTC and TFP [default 432 links]
Streams streams_;
};

#endif
67 changes: 48 additions & 19 deletions DataFormats/L1TrackTrigger/src/TTDTC.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ TTDTC::TTDTC(int numRegions, int numOverlappingRegions, int numDTCsPerRegion)
numOverlappingRegions_(numOverlappingRegions),
numDTCsPerRegion_(numDTCsPerRegion),
numDTCsPerTFP_(numOverlappingRegions * numDTCsPerRegion),
streams_(numRegions_ * numDTCsPerRegion_ * numOverlappingRegions_) {}

// Access to product configurations
int TTDTC::numRegions() const { return numRegions_; }
int TTDTC::numDTCBoards() const { return numDTCsPerRegion_; }
int TTDTC::numDTCChannel() const { return numOverlappingRegions_; }
int TTDTC::numTFPChannel() const { return numDTCsPerTFP_; }
regions_(numRegions_),
channels_(numDTCsPerRegion_ * numOverlappingRegions_),
streams_(numRegions_ * channels_.size()) {
iota(regions_.begin(), regions_.end(), 0);
iota(channels_.begin(), channels_.end(), 0);
}

// write one specific stream of TTStubRefs using DTC identifier (region[0-8], board[0-23], channel[0-1])
// dtcRegions aka detector regions are defined by tk layout
Expand All @@ -43,18 +42,6 @@ void TTDTC::setStream(int dtcRegion, int dtcBoard, int dtcChannel, const Stream&
streams_[index(dtcRegion, dtcBoard, dtcChannel)] = move(stream);
}

// all TFP identifier (region[0-8], channel[0-47])
vector<int> TTDTC::tfpRegions() const {
vector<int> vec(numRegions_);
iota(vec.begin(), vec.end(), 0);
return vec;
}
vector<int> TTDTC::tfpChannels() const {
vector<int> vec(numDTCsPerTFP_);
iota(vec.begin(), vec.end(), 0);
return vec;
}

// read one specific stream of TTStubRefs using TFP identifier (region[0-8], channel[0-47])
// tfpRegions aka processing regions are rotated by -0.5 region width w.r.t detector regions
const TTDTC::Stream& TTDTC::stream(int tfpRegion, int tfpChannel) const {
Expand All @@ -75,6 +62,30 @@ const TTDTC::Stream& TTDTC::stream(int tfpRegion, int tfpChannel) const {
return streams_.at(index(tfpRegion, tfpChannel));
}

// total number of frames
int TTDTC::size() const {
auto all = [](int& sum, const Stream& stream) { return sum += stream.size(); };
return accumulate(streams_.begin(), streams_.end(), 0, all);
}

// total number of stubs
int TTDTC::nStubs() const {
auto stubs = [](int& sum, const Frame& frame) { return sum += frame.first.isNonnull(); };
int n(0);
for (const Stream& stream : streams_)
n += accumulate(stream.begin(), stream.end(), 0, stubs);
return n;
}

// total number of gaps
int TTDTC::nGaps() const {
auto gaps = [](int& sum, const Frame& frame) { return sum += frame.first.isNull(); };
int n(0);
for (const Stream& stream : streams_)
n += accumulate(stream.begin(), stream.end(), 0, gaps);
return n;
}

// converts dtc id into tk layout scheme
int TTDTC::tkLayoutId(int dtcId) const {
// check argument
Expand Down Expand Up @@ -107,6 +118,24 @@ int TTDTC::dtcId(int tkLayoutId) const {
return region * numDTCsPerRegion_ + side * numSlots_ + slot;
}

// converts TFP identifier (region[0-8], channel[0-47]) into dtc id
int TTDTC::dtcId(int tfpRegion, int tfpChannel) const { return index(tfpRegion, tfpChannel) / numOverlappingRegions_; }

// checks if given DTC id is connected to PS or 2S sensormodules
bool TTDTC::psModlue(int dtcId) const {
// from tklayout: first 3 are 10 gbps PS, next 3 are 5 gbps PS and residual 6 are 5 gbps 2S modules
return slot(dtcId) < numSlots_ / 2;
}

// checks if given dtcId is connected to -z (false) or +z (true)
bool TTDTC::side(int dtcId) const {
const int side = (dtcId % numDTCsPerRegion_) / numSlots_;
// from tkLayout: first 12 +z, next 12 -z
return side == 0;
}
// ATCA slot number [0-11] of given dtcId
int TTDTC::slot(int dtcId) const { return dtcId % numSlots_; }

// converts DTC identifier (region[0-8], board[0-23], channel[0-1]) into streams_ index [0-431]
int TTDTC::index(int dtcRegion, int dtcBoard, int dtcChannel) const {
return (dtcRegion * numDTCsPerRegion_ + dtcBoard) * numOverlappingRegions_ + dtcChannel;
Expand Down
14 changes: 1 addition & 13 deletions L1Trigger/TrackerDTC/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
<!--use name="CommonTools/UtilAlgos"/-->
<!--use name="DataFormats/Common"/-->
<!--use name="DataFormats/Math"/-->
<!--use name="DataFormats/L1TrackTrigger"/-->
<!--use name="FWCore/Framework"/-->
<!--use name="FWCore/ParameterSet"/-->
<!--use name="FWCore/ServiceRegistry"/-->
<!--use name="FWCore/Utilities"/-->
<!--use name="Geometry/Records"/-->
<!--use name="Geometry/TrackerGeometryBuilder"/-->
<!--use name="MagneticField/Engine"/-->
<!--use name="MagneticField/Records"/-->
<!--use name="SimDataFormats/EncodedEventId"/-->
<use name="CommonTools/UtilAlgos"/>
<use name="CondFormats/SiPhase2TrackerObjects"/>
<use name="L1Trigger/TrackTrigger"/>
<export>
Expand Down
22 changes: 16 additions & 6 deletions L1Trigger/TrackerDTC/interface/DTC.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,35 @@ namespace trackerDTC {
typedef std::vector<Stubss> Stubsss;

public:
DTC(Settings* settings, int nStubs);
DTC(Settings* settings, int dtcId, const std::vector<std::vector<TTStubRef>>& modules);
~DTC() {}
// convert and assign TTStubRef to DTC routing block channel
void consume(const std::vector<TTStubRef>& ttStubRefStream, Module* module);
// board level routing in two steps and product filling
void produce(TTDTC& product, int dtcId);
// board level routing in two steps and products filling
void produce(TTDTC& accepted, TTDTC& lost);

private:
// router step 1: merges stubs of all modules connected to one routing block into one stream
void merge(Stubss& inputs, Stubs& output);
void merge(Stubss& inputs, Stubs& output, Stubs& lost);
// router step 2: merges stubs of all routing blocks and splits stubs into one stream per overlapping region
void split(Stubss& inputs, Stubss& outputs);
// conversion from Stubss to TTDTC
void produce(const Stubss& stubss, TTDTC& product);
// pop_front function which additionally returns copy of deleted front
Stub* pop_front(Stubs& stubs);

// helper class to store configurations
Settings* settings_;
// outer tracker detector region [0-8]
int region_;
// outer tracker dtc id in region [0-23]
int board_;
// container of modules connected to this DTC
std::vector<Module*> modules_;
// container of stubs on this DTC
std::vector<Stub> stubs_;
// input stubs organised in routing blocks [0..1] and channel [0..35]
Stubsss input_;
// lost stubs organised in dtc output channel [0..1]
Stubss lost_;
};

} // namespace trackerDTC
Expand Down
21 changes: 6 additions & 15 deletions L1Trigger/TrackerDTC/interface/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,28 @@

#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/Math/interface/deltaPhi.h"
#include "L1Trigger/TrackerDTC/interface/Settings.h"
#include "L1Trigger/TrackerDTC/interface/SettingsHybrid.h"

#include <vector>

namespace trackerDTC {

class Settings;

// representation of an outer tracker sensormodule
class Module {
friend class Stub;

public:
Module(Settings* settings, const ::DetId& detId, int modId);
Module(Settings* settings, const ::DetId& detId, int dtcId);
~Module() {}

// track trigger dtc id [0-215]
int dtcId() const { return dtcId_; }
// DTC module id [0-71]
int dtcChannelId() const { return dtcChannelId_; }

private:
// handles 2 pi overflow
double deltaPhi(double phi) { return reco::deltaPhi(phi, 0.); }

// track trigger dtc id [0-215]
int dtcId_;
// DTC module id [0-71]
int dtcChannelId_;
// outer tracker dtc routing block id [0-1]
int blockId_;
// routing block channel id [0-35]
int blockChannelId_;
// detector region [0-8]
int region_;
// +z or -z
bool side_;
// barrel or endcap
Expand Down
Loading