File indexing completed on 2024-04-06 12:19:47
0001 #include "L1Trigger/DTTriggerPhase2/interface/LateralityBasicProvider.h"
0002 #include <cmath>
0003 #include <memory>
0004
0005 using namespace edm;
0006 using namespace std;
0007 using namespace cmsdt;
0008
0009
0010
0011 LateralityBasicProvider::LateralityBasicProvider(const ParameterSet &pset, edm::ConsumesCollector &iC)
0012 : LateralityProvider(pset, iC), debug_(pset.getUntrackedParameter<bool>("debug")) {
0013 if (debug_)
0014 LogDebug("LateralityBasicProvider") << "LateralityBasicProvider: constructor";
0015
0016 fill_lat_combinations();
0017 }
0018
0019 LateralityBasicProvider::~LateralityBasicProvider() {
0020 if (debug_)
0021 LogDebug("LateralityBasicProvider") << "LateralityBasicProvider: destructor";
0022 }
0023
0024
0025
0026
0027 void LateralityBasicProvider::initialise(const edm::EventSetup &iEventSetup) {
0028 if (debug_)
0029 LogDebug("LateralityBasicProvider") << "LateralityBasicProvider::initialiase";
0030 }
0031
0032 void LateralityBasicProvider::run(edm::Event &iEvent,
0033 const edm::EventSetup &iEventSetup,
0034 MuonPathPtrs &muonpaths,
0035 std::vector<lat_vector> &lateralities) {
0036 if (debug_)
0037 LogDebug("LateralityBasicProvider") << "LateralityBasicProvider: run";
0038
0039
0040 for (auto &muonpath : muonpaths) {
0041 analyze(muonpath, lateralities);
0042 }
0043 }
0044
0045 void LateralityBasicProvider::finish() {
0046 if (debug_)
0047 LogDebug("LateralityBasicProvider") << "LateralityBasicProvider: finish";
0048 };
0049
0050
0051
0052
0053
0054 void LateralityBasicProvider::analyze(MuonPathPtr &inMPath, std::vector<lat_vector> &lateralities) {
0055 if (debug_)
0056 LogDebug("LateralityBasicProvider") << "DTp2:analyze \t\t\t\t starts";
0057 for (auto &lat_combination : lat_combinations) {
0058 if (inMPath->missingLayer() == lat_combination.missing_layer &&
0059 inMPath->cellLayout()[0] == lat_combination.cellLayout[0] &&
0060 inMPath->cellLayout()[1] == lat_combination.cellLayout[1] &&
0061 inMPath->cellLayout()[2] == lat_combination.cellLayout[2] &&
0062 inMPath->cellLayout()[3] == lat_combination.cellLayout[3]) {
0063 lateralities.push_back(lat_combination.latcombs);
0064 return;
0065 }
0066 }
0067 lateralities.push_back(LAT_VECTOR_NULL);
0068 return;
0069 }
0070
0071 void LateralityBasicProvider::fill_lat_combinations() {
0072 lat_combinations.push_back({-1, {0, 0, 0, -1}, {{0, 0, 0, 1}, {0, 0, 1, 1}, {0, 1, 1, 1}, {0, 0, 0, 0}}});
0073 lat_combinations.push_back({-1, {0, 0, 1, -1}, {{0, 0, 1, 0}, {0, 1, 1, 0}, {1, 1, 1, 0}, {0, 0, 0, 0}}});
0074 lat_combinations.push_back({-1, {0, 1, 0, -1}, {{0, 1, 0, 0}, {0, 1, 0, 1}, {1, 1, 0, 0}, {1, 1, 0, 1}}});
0075 lat_combinations.push_back({-1, {0, 1, 1, -1}, {{0, 1, 0, 0}, {0, 1, 1, 0}, {0, 1, 1, 1}, {0, 0, 0, 0}}});
0076 lat_combinations.push_back({-1, {1, 0, 0, -1}, {{1, 0, 0, 0}, {1, 0, 0, 1}, {1, 0, 1, 1}, {0, 0, 0, 0}}});
0077 lat_combinations.push_back({-1, {1, 0, 1, -1}, {{0, 0, 1, 0}, {0, 0, 1, 1}, {1, 0, 1, 0}, {1, 0, 1, 1}}});
0078 lat_combinations.push_back({-1, {1, 1, 0, -1}, {{0, 0, 0, 1}, {1, 0, 0, 1}, {1, 1, 0, 1}, {0, 0, 0, 0}}});
0079 lat_combinations.push_back({-1, {1, 1, 1, -1}, {{1, 0, 0, 0}, {1, 1, 0, 0}, {1, 1, 1, 0}, {0, 0, 0, 0}}});
0080 lat_combinations.push_back({0, {0, 0, 0, -1}, {{0, 0, 0, 1}, {0, 0, 1, 1}, {0, 0, 0, 0}, {0, 0, 0, 0}}});
0081 lat_combinations.push_back({0, {0, 0, 1, -1}, {{0, 0, 1, 0}, {0, 0, 1, 1}, {0, 1, 1, 0}, {0, 0, 0, 0}}});
0082 lat_combinations.push_back({0, {0, 1, 0, -1}, {{0, 0, 0, 1}, {0, 1, 0, 0}, {0, 1, 0, 1}, {0, 0, 0, 0}}});
0083 lat_combinations.push_back({0, {0, 1, 1, -1}, {{0, 1, 0, 0}, {0, 1, 1, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}});
0084 lat_combinations.push_back({1, {0, 0, 0, -1}, {{0, 0, 0, 1}, {0, 0, 1, 1}, {0, 0, 0, 0}, {0, 0, 0, 0}}});
0085 lat_combinations.push_back({1, {0, 0, 1, -1}, {{0, 0, 1, 0}, {1, 0, 1, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}});
0086 lat_combinations.push_back({1, {0, 1, 0, -1}, {{0, 0, 0, 1}, {1, 0, 0, 0}, {1, 0, 0, 1}, {0, 0, 0, 0}}});
0087 lat_combinations.push_back({1, {0, 1, 1, -1}, {{0, 0, 1, 0}, {0, 0, 1, 1}, {1, 0, 1, 0}, {0, 0, 0, 0}}});
0088 lat_combinations.push_back({1, {1, 1, 0, -1}, {{0, 0, 0, 1}, {1, 0, 0, 1}, {0, 0, 0, 0}, {0, 0, 0, 0}}});
0089 lat_combinations.push_back({1, {1, 1, 1, -1}, {{1, 0, 0, 0}, {1, 0, 1, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}});
0090 lat_combinations.push_back({2, {0, 0, 0, -1}, {{0, 0, 0, 1}, {0, 1, 0, 1}, {0, 0, 0, 0}, {0, 0, 0, 0}}});
0091 lat_combinations.push_back({2, {0, 0, 1, -1}, {{0, 1, 0, 0}, {0, 1, 0, 1}, {1, 1, 0, 0}, {0, 0, 0, 0}}});
0092 lat_combinations.push_back({2, {0, 1, 1, -1}, {{0, 1, 0, 0}, {0, 1, 0, 1}, {0, 0, 0, 0}, {0, 0, 0, 0}}});
0093 lat_combinations.push_back({2, {1, 0, 0, -1}, {{1, 0, 0, 0}, {1, 0, 0, 1}, {0, 0, 0, 0}, {0, 0, 0, 0}}});
0094 lat_combinations.push_back({2, {1, 0, 1, -1}, {{0, 0, 0, 1}, {1, 0, 0, 0}, {1, 0, 0, 1}, {0, 0, 0, 0}}});
0095 lat_combinations.push_back({2, {1, 1, 1, -1}, {{1, 0, 0, 0}, {1, 1, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}});
0096 lat_combinations.push_back({3, {0, 0, 0, -1}, {{0, 0, 1, 0}, {0, 1, 1, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}});
0097 lat_combinations.push_back({3, {0, 1, 0, -1}, {{0, 1, 0, 0}, {0, 1, 1, 0}, {1, 1, 0, 0}, {0, 0, 0, 0}}});
0098 lat_combinations.push_back({3, {1, 0, 0, -1}, {{0, 0, 1, 0}, {1, 0, 0, 0}, {1, 0, 1, 0}, {0, 0, 0, 0}}});
0099 lat_combinations.push_back({3, {1, 1, 0, -1}, {{1, 0, 0, 0}, {1, 1, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}});
0100 };