File indexing completed on 2024-04-06 12:19:45
0001 #ifndef Phase2L1Trigger_DTTrigger_TrapezoidalGrouping_h
0002 #define Phase2L1Trigger_DTTrigger_TrapezoidalGrouping_h
0003
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006
0007 #include "DataFormats/MuonDetId/interface/DTChamberId.h"
0008 #include "DataFormats/MuonDetId/interface/DTSuperLayerId.h"
0009 #include "DataFormats/MuonDetId/interface/DTLayerId.h"
0010 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0011 #include "DataFormats/DTDigi/interface/DTDigiCollection.h"
0012
0013 #include "L1Trigger/DTTriggerPhase2/interface/MuonPath.h"
0014 #include "L1Trigger/DTTriggerPhase2/interface/constants.h"
0015
0016 #include "L1Trigger/DTTriggerPhase2/interface/MotherGrouping.h"
0017
0018 #include <iostream>
0019 #include <fstream>
0020 #include <stack>
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 inline bool hitWireSort(const DTPrimitive& hit1, const DTPrimitive& hit2) {
0040 int wi1 = hit1.channelId();
0041 int wi2 = hit2.channelId();
0042
0043 if (wi1 < wi2)
0044 return true;
0045 else
0046 return false;
0047 }
0048
0049 inline bool hitLayerSort(const DTPrimitive& hit1, const DTPrimitive& hit2) {
0050 int lay1 = hit1.layerId();
0051 int lay2 = hit2.layerId();
0052
0053 if (lay1 < lay2)
0054 return true;
0055 else if (lay1 > lay2)
0056 return false;
0057 else
0058 return hitWireSort(hit1, hit2);
0059 }
0060
0061 inline bool hitTimeSort(const DTPrimitive& hit1, const DTPrimitive& hit2) {
0062 int tdc1 = hit1.tdcTimeStamp();
0063 int tdc2 = hit2.tdcTimeStamp();
0064
0065 if (tdc1 < tdc2)
0066 return true;
0067 else if (tdc1 > tdc2)
0068 return false;
0069 else
0070 return hitLayerSort(hit1, hit2);
0071 }
0072
0073 namespace dtamgrouping {
0074
0075
0076 constexpr int CHANNELS_PATH_ARRANGEMENTS[8][4] = {
0077 {0, 1, 3, 6}, {0, 1, 3, 7}, {0, 1, 4, 7}, {0, 1, 4, 8}, {0, 2, 4, 7}, {0, 2, 4, 8}, {0, 2, 5, 8}, {0, 2, 5, 9}};
0078
0079
0080
0081
0082 constexpr int CELL_HORIZONTAL_LAYOUTS[8][4] = {{0, -1, -2, -3},
0083 {0, -1, -2, -1},
0084 {0, -1, 0, -1},
0085 {0, -1, 0, 1},
0086 {0, 1, 0, -1},
0087 {0, 1, 0, 1},
0088 {0, 1, 2, 1},
0089 {0, 1, 2, 3}};
0090 }
0091
0092
0093
0094
0095
0096 class TrapezoidalGrouping : public MotherGrouping {
0097 public:
0098
0099 TrapezoidalGrouping(const edm::ParameterSet& pset, edm::ConsumesCollector& iC);
0100 ~TrapezoidalGrouping() override;
0101
0102
0103 void initialise(const edm::EventSetup& iEventSetup) override;
0104 void run(edm::Event& iEvent,
0105 const edm::EventSetup& iEventSetup,
0106 const DTDigiCollection& digis,
0107 MuonPathPtrs& outMpath) override;
0108 void finish() override;
0109
0110
0111
0112
0113
0114 private:
0115
0116 void setInChannels(const DTDigiCollection* digi, int sl);
0117 std::vector<DTPrimitives> group_hits(DTPrimitive pivot_hit,
0118 std::vector<DTPrimitives> input_paths,
0119 DTPrimitives hits_per_cell,
0120 DTPrimitives& hits_in_trapezoid);
0121
0122
0123 const bool debug_;
0124
0125 DTPrimitives muxInChannels_[cmsdt::NUM_CELLS_PER_BLOCK];
0126 DTPrimitives channelIn_[cmsdt::NUM_LAYERS][cmsdt::NUM_CH_PER_LAYER];
0127 DTPrimitives all_hits;
0128 DTPrimitives chInDummy_;
0129 int prevTDCTimeStamps_[4];
0130 int currentBaseChannel_;
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161 short trapezoid_vertical_mapping[4][9] = {{1, 1, 2, 2, 2, 3, 3, 3, 3},
0162 {1, 1, 2, 2, 2, -1, -1, -1, -1},
0163 {-1, -1, -2, -2, -2, 1, 1, 1, 1},
0164 {-1, -1, -2, -2, -2, -3, -3, -3, -3}};
0165
0166 short trapezoid_horizontal_mapping[4][9] = {{0, 1, -1, 0, 1, -1, 0, 1, 2},
0167 {-1, 0, -1, 0, 1, 0, -1, 0, -1},
0168 {0, 1, -1, 0, 1, 1, 0, 1, 0},
0169 {-1, 0, -1, 0, 1, -2, -1, 0, 1}};
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181 std::vector<std::vector<short>> task_list = {
0182 {0, 2, 5},
0183 {0, 2, 6},
0184 {0, 3, 6},
0185 {0, 3, 7},
0186 {1, 3, 6},
0187 {1, 3, 7},
0188 {1, 4, 7},
0189 {1, 4, 8},
0190
0191 {0, 2},
0192 {0, 3},
0193 {1, 3},
0194 {1, 4},
0195 {0, 5},
0196 {0, 6},
0197 {0, 7},
0198 {1, 6},
0199 {1, 7},
0200 {1, 8},
0201 {2, 5},
0202 {2, 6},
0203 {3, 6},
0204 {3, 7},
0205 {4, 7},
0206 {4, 8}};
0207
0208 int CELL_HORIZONTAL_LAYOUTS_PER_TASK[4][24][4] = {
0209 {
0210 {0, 0, 0, -1},
0211 {0, 0, 1, -1},
0212 {0, 1, 0, -1},
0213 {0, 1, 1, -1},
0214 {1, 0, 0, -1},
0215 {1, 0, 1, -1},
0216 {1, 1, 0, -1},
0217 {1, 1, 1, -1},
0218
0219 {0, 0, 0, -1},
0220 {0, 1, 0, -1},
0221 {1, 0, 0, -1},
0222 {1, 1, 0, -1},
0223
0224 {0, 0, 0, -1},
0225 {0, 0, 1, -1},
0226 {0, 1, 1, -1},
0227 {1, 0, 0, -1},
0228 {1, 0, 1, -1},
0229 {1, 1, 1, -1},
0230
0231 {0, 0, 0, -1},
0232 {0, 0, 1, -1},
0233 {0, 1, 0, -1},
0234 {0, 1, 1, -1},
0235 {1, 1, 0, -1},
0236 {1, 1, 1, -1}},
0237
0238 {
0239 {0, 0, 0, -1},
0240 {1, 0, 0, -1},
0241 {1, 0, 1, -1},
0242 {0, 0, 1, -1},
0243 {1, 1, 0, -1},
0244 {0, 1, 0, -1},
0245 {0, 1, 1, -1},
0246 {1, 1, 1, -1},
0247
0248 {0, 0, 0, -1},
0249 {0, 0, 1, -1},
0250 {0, 1, 0, -1},
0251 {0, 1, 1, -1},
0252
0253 {0, 0, 0, -1},
0254 {1, 0, 0, -1},
0255 {0, 0, 0, -1},
0256 {1, 1, 0, -1},
0257 {0, 1, 0, -1},
0258 {1, 1, 0, -1},
0259
0260 {0, 0, 0, -1},
0261 {1, 0, 0, -1},
0262 {1, 0, 1, -1},
0263 {0, 0, 1, -1},
0264 {0, 1, 1, -1},
0265 {1, 1, 1, -1}},
0266
0267 {
0268 {1, 1, 1, -1},
0269 {1, 1, 0, -1},
0270 {0, 1, 0, -1},
0271 {0, 1, 1, -1},
0272 {1, 0, 0, -1},
0273 {1, 0, 1, -1},
0274 {0, 0, 1, -1},
0275 {0, 0, 0, -1},
0276
0277 {1, 1, 0, -1},
0278 {0, 1, 0, -1},
0279 {1, 0, 0, -1},
0280 {0, 0, 0, -1},
0281
0282 {0, 1, 1, -1},
0283 {0, 1, 0, -1},
0284 {0, 1, 1, -1},
0285 {0, 0, 0, -1},
0286 {0, 0, 1, -1},
0287 {0, 0, 0, -1},
0288
0289 {1, 1, 1, -1},
0290 {1, 1, 0, -1},
0291 {0, 1, 0, -1},
0292 {0, 1, 1, -1},
0293 {0, 0, 1, -1},
0294 {0, 0, 0, -1}},
0295
0296 {
0297 {1, 1, 1, -1},
0298 {0, 1, 1, -1},
0299 {1, 0, 1, -1},
0300 {0, 0, 1, -1},
0301 {1, 1, 0, -1},
0302 {0, 1, 0, -1},
0303 {1, 0, 0, -1},
0304 {0, 0, 0, -1},
0305
0306 {0, 1, 1, -1},
0307 {0, 0, 1, -1},
0308 {0, 1, 0, -1},
0309 {0, 0, 0, -1},
0310
0311 {1, 1, 1, -1},
0312 {0, 1, 1, -1},
0313 {0, 0, 1, -1},
0314 {1, 1, 0, -1},
0315 {0, 1, 0, -1},
0316 {0, 0, 0, -1},
0317
0318 {1, 1, 1, -1},
0319 {0, 1, 1, -1},
0320 {1, 0, 1, -1},
0321 {0, 0, 1, -1},
0322 {1, 0, 0, -1},
0323 {0, 0, 0, -1}}};
0324
0325 int MISSING_LAYER_LAYOUTS_PER_TASK[4][24] = {
0326 {-1, -1, -1, -1, -1, -1, -1, -1, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1},
0327 {-1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2},
0328 {-1, -1, -1, -1, -1, -1, -1, -1, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1},
0329 {-1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2}};
0330 };
0331
0332 #endif