18 LogDebug(
"TrapezoidalGrouping") <<
"TrapezoidalGrouping: constructor";
32 LogDebug(
"TrapezoidalGrouping") <<
"TrapezoidalGrouping: destructor";
40 LogDebug(
"TrapezoidalGrouping") <<
"TrapezoidalGrouping::initialiase";
51 LogDebug(
"TrapezoidalGrouping") <<
"TrapezoidalGrouping::run Reading SL" << supLayer;
55 int layer_to_pivot =
hit.layerId();
56 int channel_to_pivot =
hit.channelId();
58 std::vector<DTPrimitives> hit_mpaths;
59 std::vector<int> hit_tasks;
60 for (
size_t itask = 0; itask <
task_list.size(); itask++) {
66 if (layer_to_pivot == 1 || layer_to_pivot == 2) {
67 if (itask == 14 || itask == 17)
73 std::vector<DTPrimitives> task_mpaths;
74 std::stack<std::pair<DTPrimitives, int>> mpath_cells_per_task;
77 while (!mpath_cells_per_task.empty()) {
78 auto mpath_cells =
std::move(mpath_cells_per_task.top());
79 std::vector<DTPrimitives> tmp_mpaths = {mpath_cells.first};
80 auto task_index = mpath_cells.second;
81 auto cell =
task[task_index];
84 if (channel_to_pivot + horizontal_shift >= 0 && channel_to_pivot + horizontal_shift <
NUM_CH_PER_LAYER) {
87 channelIn_[layer_to_pivot + vertical_shift][channel_to_pivot + horizontal_shift],
90 mpath_cells_per_task.pop();
91 for (
const auto &tmp_mpath : tmp_mpaths) {
92 mpath_cells_per_task.push(std::make_pair(tmp_mpath, task_index + 1));
94 while (!mpath_cells_per_task.empty()) {
95 if (mpath_cells_per_task.top().second == (
int)
task.size()) {
96 task_mpaths.push_back(mpath_cells_per_task.top().first);
97 mpath_cells_per_task.pop();
102 for (
auto &task_mpath : task_mpaths) {
103 hit_mpaths.push_back(task_mpath);
104 hit_tasks.push_back(itask);
108 for (
size_t ipath = 0; ipath < hit_mpaths.size(); ipath++) {
109 auto ptrPrimitive = hit_mpaths[ipath];
110 auto itask = hit_tasks[ipath];
113 if (ptrPrimitive.size() < 3)
122 dtpAux.setTDCTimeStamp(-1);
123 dtpAux.setChannelId(-1);
125 dtpAux.setSuperLayerId(
hit.superLayerId());
126 dtpAux.setCameraId(-1);
127 ptrPrimitive.push_back(dtpAux);
129 if (ptrPrimitive.size() < 4)
134 std::stable_sort(ptrPrimitive.begin(), ptrPrimitive.end(),
hitLayerSort);
136 auto ptrMuonPath = std::make_shared<MuonPath>(ptrPrimitive);
139 mpaths.push_back(
std::move(ptrMuonPath));
145 LogDebug(
"TrapezoidalGrouping") <<
"[TrapezoidalGrouping::run] end";
164 for (
const auto &dtLayerId_It : *digis) {
165 const DTLayerId dtLId = dtLayerId_It.first;
173 int wire = (*digiIt).wire() - 1;
174 int digiTIME = (*digiIt).time();
175 int digiTIMEPhase2 = digiTIME;
178 LogDebug(
"TrapezoidalGrouping") <<
"[TrapezoidalGrouping::setInChannels] SL" << sl <<
" L" <<
layer <<
" : " 179 <<
wire <<
" " << digiTIMEPhase2;
181 dtpAux.setTDCTimeStamp(digiTIMEPhase2);
182 dtpAux.setChannelId(
wire);
183 dtpAux.setLayerId(
layer);
184 dtpAux.setSuperLayerId(sl);
185 dtpAux.setCameraId(dtLId.
rawId());
201 std::vector<DTPrimitives> input_paths,
204 std::vector<DTPrimitives> output_paths;
205 for (
auto &
hit : hits_per_cell) {
211 if (
std::find(hits_in_trapezoid.begin(), hits_in_trapezoid.end(),
hit) == hits_in_trapezoid.end())
212 hits_in_trapezoid.push_back(
hit);
215 std::vector<DTPrimitives> empty_paths;
219 for (
auto &input_path : input_paths) {
220 auto tmp_path = input_path;
221 tmp_path.push_back(
hit);
222 output_paths.push_back(tmp_path);
225 if (output_paths.empty())
std::vector< std::vector< short > > task_list
bool hitLayerSort(const DTPrimitive &hit1, const DTPrimitive &hit2)
void setInChannels(const DTDigiCollection *digi, int sl)
int MISSING_LAYER_LAYOUTS_PER_TASK[4][24]
short trapezoid_horizontal_mapping[4][9]
std::vector< MuonPathPtr > MuonPathPtrs
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
bool hitTimeSort(const DTPrimitive &hit1, const DTPrimitive &hit2)
U second(std::pair< T, U > const &p)
constexpr int NUM_SUPERLAYERS
constexpr int PATHFINDER_INPUT_HITS_LIMIT
~TrapezoidalGrouping() override
TrapezoidalGrouping(const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
constexpr int MAX_FRAME_DIF
short trapezoid_vertical_mapping[4][9]
void run(edm::Event &iEvent, const edm::EventSetup &iEventSetup, const DTDigiCollection &digis, MuonPathPtrs &outMpath) override
const int tdcTimeStamp() const
void initialise(const edm::EventSetup &iEventSetup) override
int superlayer() const
Return the superlayer number (deprecated method name)
constexpr int NUM_CH_PER_LAYER
constexpr uint32_t rawId() const
get the raw id
std::vector< DigiType >::const_iterator const_iterator
constexpr int LHC_CLK_FREQ
int layer() const
Return the layer number.
std::vector< DTPrimitives > group_hits(DTPrimitive pivot_hit, std::vector< DTPrimitives > input_paths, DTPrimitives hits_per_cell, DTPrimitives &hits_in_trapezoid)
constexpr int BX_PER_FRAME
std::vector< DTPrimitive > DTPrimitives
DTPrimitives channelIn_[cmsdt::NUM_LAYERS][cmsdt::NUM_CH_PER_LAYER]
int CELL_HORIZONTAL_LAYOUTS_PER_TASK[4][24][4]