CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
trackerTFP::GeometricProcessor Class Reference

#include <GeometricProcessor.h>

Public Member Functions

void consume (const TTDTC &ttDTC)
 
 GeometricProcessor (const edm::ParameterSet &iConfig, const tt::Setup *setup_, const DataFormats *dataFormats, int region)
 
void produce (tt::StreamsStub &accepted, tt::StreamsStub &lost)
 
 ~GeometricProcessor ()
 

Private Member Functions

template<class T >
Tpop_front (std::deque< T *> &ts) const
 

Private Attributes

const DataFormatsdataFormats_
 
bool enableTruncation_
 
std::vector< std::vector< std::deque< StubPP * > > > input_
 
const int region_
 
const tt::Setupsetup_
 
std::vector< StubGPstubsGP_
 
std::vector< StubPPstubsPP_
 

Detailed Description

Definition at line 14 of file GeometricProcessor.h.

Constructor & Destructor Documentation

◆ GeometricProcessor()

trackerTFP::GeometricProcessor::GeometricProcessor ( const edm::ParameterSet iConfig,
const tt::Setup setup_,
const DataFormats dataFormats,
int  region 
)

Definition at line 15 of file GeometricProcessor.cc.

19  : enableTruncation_(iConfig.getParameter<bool>("EnableTruncation")),
20  setup_(setup),
21  dataFormats_(dataFormats),
22  region_(region),
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
int numChannel(Process p) const
Definition: DataFormats.h:498
std::vector< std::vector< std::deque< StubPP * > > > input_

◆ ~GeometricProcessor()

trackerTFP::GeometricProcessor::~GeometricProcessor ( )
inline

Definition at line 20 of file GeometricProcessor.h.

20 {}

Member Function Documentation

◆ consume()

void trackerTFP::GeometricProcessor::consume ( const TTDTC ttDTC)

Definition at line 26 of file GeometricProcessor.cc.

References dataFormats_, amptDefault_cfi::frame, trackerTFP::gp, input, input_, trackerTFP::StubPP::inSector(), trackerTFP::DataFormats::numChannel(), trackerTFP::pp, push_back(), region_, nano_mu_digi_cff::sector, TTDTC::stream(), cms::cuda::stream, stubsGP_, stubsPP_, and trackerHitRTTI::vector.

26  {
27  auto validFrame = [](int sum, const FrameStub& frame) { return sum + (frame.first.isNonnull() ? 1 : 0); };
28  int nStubsPP(0);
29  for (int channel = 0; channel < dataFormats_->numChannel(Process::pp); channel++) {
30  const StreamStub& stream = ttDTC.stream(region_, channel);
31  nStubsPP += accumulate(stream.begin(), stream.end(), 0, validFrame);
32  }
33  stubsPP_.reserve(nStubsPP);
34  for (int channel = 0; channel < dataFormats_->numChannel(Process::pp); channel++) {
35  for (const FrameStub& frame : ttDTC.stream(region_, channel)) {
36  StubPP* stub = nullptr;
37  if (frame.first.isNonnull()) {
38  stubsPP_.emplace_back(frame, dataFormats_);
39  stub = &stubsPP_.back();
40  }
42  // adding gaps (nullptr) if no stub available or not in sector to emulate f/w
43  input_[sector][channel].push_back(stub && stub->inSector(sector) ? stub : nullptr);
44  }
45  }
46  // remove all gaps between end and last stub
47  for (vector<deque<StubPP*>>& input : input_)
48  for (deque<StubPP*>& stubs : input)
49  for (auto it = stubs.end(); it != stubs.begin();)
50  it = (*--it) ? stubs.begin() : stubs.erase(it);
51  auto validStub = [](int sum, StubPP* stub) { return sum + (stub ? 1 : 0); };
52  int nStubsGP(0);
53  for (const vector<deque<StubPP*>>& sector : input_)
54  for (const deque<StubPP*>& channel : sector)
55  nStubsGP += accumulate(channel.begin(), channel.end(), 0, validStub);
56  stubsGP_.reserve(nStubsGP);
57  }
std::pair< TTStubRef, Frame > FrameStub
Definition: TTTypes.h:60
std::vector< FrameStub > StreamStub
Definition: TTTypes.h:63
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
static std::string const input
Definition: EdmProvDump.cc:50
int numChannel(Process p) const
Definition: DataFormats.h:498
std::vector< std::vector< std::deque< StubPP * > > > input_
std::vector< StubPP > stubsPP_
std::vector< StubGP > stubsGP_
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
const tt::StreamStub & stream(int tfpRegion, int tfpChannel) const
Definition: TTDTC.cc:48

◆ pop_front()

template<class T >
T * trackerTFP::GeometricProcessor::pop_front ( std::deque< T *> &  ts) const
private

Definition at line 122 of file GeometricProcessor.cc.

References submitPVValidationJobs::t.

Referenced by produce().

122  {
123  T* t = nullptr;
124  if (!ts.empty()) {
125  t = ts.front();
126  ts.pop_front();
127  }
128  return t;
129  }
long double T

◆ produce()

void trackerTFP::GeometricProcessor::produce ( tt::StreamsStub accepted,
tt::StreamsStub lost 
)

Definition at line 60 of file GeometricProcessor.cc.

References dataFormats_, enableTruncation_, trackerTFP::gp, tt::Setup::gpDepthMemory(), input_, PixelMapPlotter::inputs, remoteMonitoring_LASER_era2018_cfg::limit, GetRecoTauVFromDQM_MC_cff::next, trackerTFP::DataFormats::numChannel(), tt::Setup::numFrames(), tt::Setup::numSectorsPhi(), or, pop_front(), trackerTFP::pp, put(), region_, nano_mu_digi_cff::sector, trackerTFP::sectorEta, trackerTFP::sectorPhi, setup_, findQualityFiles::size, svgfig::stack, cms::cuda::stream, stubsGP_, and HcalDetIdTransform::transform().

60  {
61  for (int sector = 0; sector < dataFormats_->numChannel(Process::gp); sector++) {
62  vector<deque<StubPP*>>& inputs = input_[sector];
63  vector<deque<StubGP*>> stacks(dataFormats_->numChannel(Process::pp));
64  const int sectorPhi = sector % setup_->numSectorsPhi();
65  const int sectorEta = sector / setup_->numSectorsPhi();
66  auto size = [](int sum, const deque<StubPP*>& stubs) { return sum + stubs.size(); };
67  const int nStubs = accumulate(inputs.begin(), inputs.end(), 0, size);
68  vector<StubGP*> acceptedSector;
69  vector<StubGP*> lostSector;
70  acceptedSector.reserve(nStubs);
71  lostSector.reserve(nStubs);
72  // clock accurate firmware emulation, each while trip describes one clock tick, one stub in and one stub out per tick
73  while (!all_of(inputs.begin(), inputs.end(), [](const deque<StubPP*>& stubs) { return stubs.empty(); }) or
74  !all_of(stacks.begin(), stacks.end(), [](const deque<StubGP*>& stubs) { return stubs.empty(); })) {
75  // fill input fifos
76  for (int channel = 0; channel < dataFormats_->numChannel(Process::pp); channel++) {
77  deque<StubGP*>& stack = stacks[channel];
78  StubPP* stub = pop_front(inputs[channel]);
79  if (stub) {
80  stubsGP_.emplace_back(*stub, sectorPhi, sectorEta);
81  if (enableTruncation_ && (int)stack.size() == setup_->gpDepthMemory() - 1)
82  lostSector.push_back(pop_front(stack));
83  stack.push_back(&stubsGP_.back());
84  }
85  }
86  // merge input fifos to one stream, prioritizing higher input channel over lower channel
87  bool nothingToRoute(true);
88  for (int channel = dataFormats_->numChannel(Process::pp) - 1; channel >= 0; channel--) {
89  StubGP* stub = pop_front(stacks[channel]);
90  if (stub) {
91  nothingToRoute = false;
92  acceptedSector.push_back(stub);
93  break;
94  }
95  }
96  if (nothingToRoute)
97  acceptedSector.push_back(nullptr);
98  }
99  // truncate if desired
100  if (enableTruncation_ && (int)acceptedSector.size() > setup_->numFrames()) {
101  const auto limit = next(acceptedSector.begin(), setup_->numFrames());
102  copy_if(limit, acceptedSector.end(), back_inserter(lostSector), [](const StubGP* stub) { return stub; });
103  acceptedSector.erase(limit, acceptedSector.end());
104  }
105  // remove all gaps between end and last stub
106  for (auto it = acceptedSector.end(); it != acceptedSector.begin();)
107  it = (*--it) ? acceptedSector.begin() : acceptedSector.erase(it);
108  // fill products
109  auto put = [](const vector<StubGP*>& stubs, StreamStub& stream) {
110  auto toFrame = [](StubGP* stub) { return stub ? stub->frame() : FrameStub(); };
111  stream.reserve(stubs.size());
112  transform(stubs.begin(), stubs.end(), back_inserter(stream), toFrame);
113  };
115  put(acceptedSector, accepted[index]);
116  put(lostSector, lost[index]);
117  }
118  }
size
Write out results.
int numSectorsPhi() const
Definition: Setup.h:409
std::pair< TTStubRef, Frame > FrameStub
Definition: TTTypes.h:60
std::vector< FrameStub > StreamStub
Definition: TTTypes.h:63
int numFrames() const
Definition: Setup.h:153
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
void put(edm::Event &evt, double value, const char *instanceName)
int numChannel(Process p) const
Definition: DataFormats.h:498
std::vector< std::vector< std::deque< StubPP * > > > input_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
T * pop_front(std::deque< T *> &ts) const
stack
Definition: svgfig.py:559
std::vector< StubGP > stubsGP_
int gpDepthMemory() const
Definition: Setup.h:415
unsigned transform(const HcalDetId &id, unsigned transformCode)

Member Data Documentation

◆ dataFormats_

const DataFormats* trackerTFP::GeometricProcessor::dataFormats_
private

Definition at line 37 of file GeometricProcessor.h.

Referenced by consume(), and produce().

◆ enableTruncation_

bool trackerTFP::GeometricProcessor::enableTruncation_
private

Definition at line 33 of file GeometricProcessor.h.

Referenced by produce().

◆ input_

std::vector<std::vector<std::deque<StubPP*> > > trackerTFP::GeometricProcessor::input_
private

Definition at line 45 of file GeometricProcessor.h.

Referenced by consume(), and produce().

◆ region_

const int trackerTFP::GeometricProcessor::region_
private

Definition at line 39 of file GeometricProcessor.h.

Referenced by consume(), and produce().

◆ setup_

const tt::Setup* trackerTFP::GeometricProcessor::setup_
private

◆ stubsGP_

std::vector<StubGP> trackerTFP::GeometricProcessor::stubsGP_
private

Definition at line 43 of file GeometricProcessor.h.

Referenced by consume(), and produce().

◆ stubsPP_

std::vector<StubPP> trackerTFP::GeometricProcessor::stubsPP_
private

Definition at line 41 of file GeometricProcessor.h.

Referenced by consume().