File indexing completed on 2024-04-06 12:19:39
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef DT_BTI_CHIP_H
0015 #define DT_BTI_CHIP_H
0016
0017
0018
0019
0020 class DTBtiHit;
0021 class DTBtiTrig;
0022 class DTBtiTrigData;
0023 class DTDigi;
0024
0025
0026
0027
0028 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0029 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0030 #include "DataFormats/MuonDetId/interface/DTBtiId.h"
0031 #include "L1Trigger/DTUtilities/interface/DTTrigGeom.h"
0032 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfig.h"
0033 #include "L1TriggerConfig/DTTPGConfig/interface/BitArray.h"
0034 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfigBti.h"
0035 #include "L1Trigger/DTBti/interface/DTBtiCard.h"
0036
0037
0038
0039
0040 #include <vector>
0041 #include <memory>
0042 #include <array>
0043
0044
0045
0046
0047
0048 class DTBtiChip {
0049 public:
0050
0051
0052
0053
0054 DTBtiChip(DTBtiCard* card, DTTrigGeom* geom, int supl, int n, DTConfigBti* _config);
0055
0056
0057 DTBtiChip(DTBtiChip&& bti) = delete;
0058 DTBtiChip(DTBtiChip const& bti) = delete;
0059
0060
0061 ~DTBtiChip();
0062
0063
0064 DTBtiChip& operator=(DTBtiChip&& bti) = delete;
0065 DTBtiChip& operator=(DTBtiChip const& bti) = delete;
0066
0067
0068 void add_digi(int cell, const DTDigi* digi);
0069
0070
0071 void add_digi_clock(int cell, int clock_digi);
0072
0073
0074 std::vector<const DTDigi*> const& get_CellDigis(int cell) const { return _digis[cell]; }
0075
0076
0077 void run();
0078
0079
0080 void clear();
0081
0082
0083
0084 void addTrig(int step, std::unique_ptr<DTBtiTrig> btitrig);
0085
0086
0087
0088
0089 inline int number() const { return _id.bti(); }
0090
0091
0092 inline int superlayer() const { return _id.superlayer(); }
0093
0094
0095 inline LocalPoint localPosition() const { return _geom->localPosition(_id); }
0096
0097
0098 inline GlobalPoint CMSPosition() const { return _geom->CMSPosition(_id); }
0099
0100
0101 int nCellHit() const;
0102
0103
0104 int nTrig(int step) const;
0105
0106
0107 std::vector<std::unique_ptr<DTBtiTrig>> const& trigList(int step) const;
0108
0109
0110 DTBtiTrig const* trigger(int step, unsigned n) const;
0111
0112
0113 DTBtiTrigData triggerData(int step, unsigned n) const;
0114
0115
0116
0117
0118
0119 inline DTConfigBti* config() const { return _config; }
0120
0121
0122 inline DTTrigGeom* geom() const { return _geom; }
0123
0124
0125 inline DTBtiId id() const { return _id; }
0126
0127
0128 inline int wheel() const { return _geom->wheel(); }
0129
0130
0131 inline int station() const { return _geom->station(); }
0132
0133
0134 inline int sector() const { return _geom->sector(); }
0135
0136 void init_clock();
0137
0138 private:
0139 void init();
0140 void tick();
0141
0142 inline int currentStep() const { return (int)(((float)(_curStep) + 0.5) / 2); }
0143 inline int currentIntStep() const { return _curStep; }
0144 void computeSums();
0145 void sum(const int s, const int a, const int b);
0146 void computeEqs();
0147 void findTrig();
0148 int keepTrig(const int eq, const int acp, const int code);
0149 int keepTrigPatt(int flag, const int eq, const int pattType, int hlflag);
0150 bool matchEq(float eqA, float eqB, int AC);
0151 void acceptMask(BitArray<80>* BitArrPtr, int k, int accep);
0152 void doLTS();
0153 int store(const int eq,
0154 const int code,
0155 const int K,
0156 const int X,
0157 float KeqAB = 0.,
0158 float KeqBC = 0.,
0159 float KeqCD = 0.,
0160 float KeqAC = 0.,
0161 float KeqBD = 0.,
0162 float KeqAD = 0.);
0163 void eraseTrigger(int step, unsigned n);
0164 void setSnap();
0165 void reSumSet();
0166 int reSum(int a, int b) { return reSumAr[a][b + 2]; }
0167 int reSum23(int a, int b) { return reSumAr23[a][b + 2]; }
0168
0169 private:
0170
0171 DTBtiCard* _card;
0172
0173 DTTrigGeom* _geom;
0174 DTConfigBti* _config;
0175
0176 DTBtiId _id;
0177
0178
0179 std::array<std::vector<const DTDigi*>, 9> _digis;
0180
0181 std::array<std::vector<int>, 9> _digis_clock;
0182
0183
0184 std::array<std::vector<std::unique_ptr<DTBtiTrig>>, DTConfig::NSTEPL - DTConfig::NSTEPF + 1> _trigs;
0185
0186
0187 int _curStep;
0188 std::array<std::vector<DTBtiHit*>, 9> _hits;
0189 std::array<int, 9> _thisStepUsedTimes;
0190 std::array<DTBtiHit*, 9> _thisStepUsedHit;
0191 int _nStepUsedHits;
0192 std::array<float, 25> _sums, _difs;
0193 float _Keq[32][6];
0194 float _Xeq[32][2];
0195 int _MinKAcc;
0196 int _MaxKAcc;
0197 int _MinKleftTraco;
0198 int _MaxKleftTraco;
0199 int _MinKcenterTraco;
0200 int _MaxKcenterTraco;
0201 int _MinKrightTraco;
0202 int _MaxKrightTraco;
0203
0204 float _XeqAC_patt0, _XeqBD_patt0;
0205 float _XeqAB_patt0, _XeqCD_patt0;
0206
0207 float _KTR[32][2];
0208 float _JTR[32][3];
0209 int init_done;
0210 std::array<int, 9> _busyStart_clock;
0211
0212
0213 int ST43, RE43, ST23, RE23, ST, ST2, ST3, ST4, ST5, ST7;
0214
0215 int reSumAr[3][5];
0216 int reSumAr23[3][5];
0217 };
0218 #endif