Skip to content

Commit 12dd919

Browse files
authored
Merge pull request #44924 from jfernan2/AMv2.1
[DT] Position fix and new filter to TPs from Phase2 L1T emulator
2 parents 68ed834 + 26adbda commit 12dd919

File tree

9 files changed

+403
-74
lines changed

9 files changed

+403
-74
lines changed

L1Trigger/DTTriggerPhase2/interface/GlobalCoordsObtainer.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ struct lut_value {
2929
};
3030

3131
struct lut_group {
32-
std::map<int, lut_value> phic;
33-
std::map<int, lut_value> phi1;
34-
std::map<int, lut_value> phi3;
32+
std::map<int, lut_value> phi;
3533
std::map<int, lut_value> phib;
3634
};
3735

@@ -58,6 +56,10 @@ class GlobalCoordsObtainer {
5856
void generate_luts();
5957
std::vector<double> get_global_coordinates(uint32_t, int, int, int);
6058

59+
edm::FileInPath maxdrift_filename_;
60+
int maxdriftinfo_[5][4][14];
61+
int max_drift_tdc = -1;
62+
6163
private:
6264
std::map<int, lut_value> calc_atan_lut(int, int, double, double, double, int, int, int, int, int);
6365
// utilities to go to and from 2 complement
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#ifndef Phase2L1Trigger_DTTrigger_MPCoincidenceFilter_h
2+
#define Phase2L1Trigger_DTTrigger_MPCoincidenceFilter_h
3+
4+
#include "L1Trigger/DTTriggerPhase2/interface/MPFilter.h"
5+
6+
#include <iostream>
7+
#include <fstream>
8+
9+
// ===============================================================================
10+
// Previous definitions and declarations
11+
// ===============================================================================
12+
13+
// ===============================================================================
14+
// Class declarations
15+
// ===============================================================================
16+
17+
class MPCoincidenceFilter : public MPFilter {
18+
public:
19+
// Constructors and destructor
20+
MPCoincidenceFilter(const edm::ParameterSet &pset);
21+
~MPCoincidenceFilter() override = default;
22+
23+
// Main methods
24+
void initialise(const edm::EventSetup &iEventSetup) override;
25+
void run(edm::Event &iEvent,
26+
const edm::EventSetup &iEventSetup,
27+
std::vector<cmsdt::metaPrimitive> &inMPath,
28+
std::vector<cmsdt::metaPrimitive> &outMPath) override{};
29+
void run(edm::Event &iEvent,
30+
const edm::EventSetup &iEventSetup,
31+
std::vector<cmsdt::metaPrimitive> &allMPaths,
32+
std::vector<cmsdt::metaPrimitive> &inMPaths,
33+
std::vector<cmsdt::metaPrimitive> &outMPaths) override;
34+
void run(edm::Event &iEvent,
35+
const edm::EventSetup &iEventSetup,
36+
MuonPathPtrs &inMPath,
37+
MuonPathPtrs &outMPath) override{};
38+
39+
void finish() override;
40+
41+
// Other public methods
42+
43+
// Public attributes
44+
45+
std::map<std::string, float> mphi_mean{{"wh-2ch1", 1.0}, {"wh-1ch1", 0.9}, {"wh0ch1", -0.3}, {"wh1ch1", 0.9},
46+
{"wh2ch1", 1.0}, {"wh-2ch2", 1.4}, {"wh-1ch2", -0.4}, {"wh0ch2", -0.3},
47+
{"wh1ch2", -0.4}, {"wh2ch2", 1.5}, {"wh-2ch3", -0.1}, {"wh-1ch3", -0.2},
48+
{"wh0ch3", -0.1}, {"wh1ch3", -0.3}, {"wh2ch3", -0.4}, {"wh-2ch4", -1.0},
49+
{"wh-1ch4", -1.1}, {"wh0ch4", -1.0}, {"wh1ch4", -1.1}, {"wh2ch4", -0.8}};
50+
51+
std::map<std::string, float> mphi_width{{"wh-2ch1", 7.2}, {"wh-1ch1", 7.0}, {"wh0ch1", 11.2}, {"wh1ch1", 7.4},
52+
{"wh2ch1", 7.1}, {"wh-2ch2", 6.6}, {"wh-1ch2", 8.5}, {"wh0ch2", 11.1},
53+
{"wh1ch2", 8.5}, {"wh2ch2", 6.5}, {"wh-2ch3", 8.0}, {"wh-1ch3", 9.2},
54+
{"wh0ch3", 11.2}, {"wh1ch3", 9.1}, {"wh2ch3", 7.8}, {"wh-2ch4", 8.0},
55+
{"wh-1ch4", 9.6}, {"wh0ch4", 11.8}, {"wh1ch4", 9.3}, {"wh2ch4", 7.7}};
56+
57+
std::map<std::string, float> mth_mean{{"wh-2ch1", -17.4}, {"wh-1ch1", -9.5}, {"wh0ch1", -0.8}, {"wh1ch1", -9.8},
58+
{"wh2ch1", -17.1}, {"wh-2ch2", -18.9}, {"wh-1ch2", -6.6}, {"wh0ch2", 0.5},
59+
{"wh1ch2", -6.8}, {"wh2ch2", -19.2}, {"wh-2ch3", -16.3}, {"wh-1ch3", -3.2},
60+
{"wh0ch3", 1.9}, {"wh1ch3", -3.6}, {"wh2ch3", -17.5}, {"wh-2ch4", 0.0},
61+
{"wh-1ch4", 0.0}, {"wh0ch4", 0.0}, {"wh1ch4", 0.0}, {"wh2ch4", 0.0}};
62+
63+
std::map<std::string, float> mth_width{{"wh-2ch1", 33.5}, {"wh-1ch1", 12.6}, {"wh0ch1", 10.1}, {"wh1ch1", 14.4},
64+
{"wh2ch1", 44.8}, {"wh-2ch2", 23.0}, {"wh-1ch2", 13.2}, {"wh0ch2", 11.6},
65+
{"wh1ch2", 14.0}, {"wh2ch2", 25.6}, {"wh-2ch3", 22.5}, {"wh-1ch3", 13.8},
66+
{"wh0ch3", 13.9}, {"wh1ch3", 14.2}, {"wh2ch3", 24.2}, {"wh-2ch4", 9.4},
67+
{"wh-1ch4", 9.4}, {"wh0ch4", 9.4}, {"wh1ch4", 9.4}, {"wh2ch4", 9.4}};
68+
69+
private:
70+
// Private methods
71+
std::vector<cmsdt::metaPrimitive> filter(std::vector<cmsdt::metaPrimitive> inMPs,
72+
std::vector<cmsdt::metaPrimitive> allMPs,
73+
int co_option,
74+
int co_quality,
75+
double shift_back);
76+
77+
// Private attributes
78+
const bool debug_;
79+
int co_option_;
80+
int co_quality_;
81+
int scenario_;
82+
};
83+
84+
#endif

L1Trigger/DTTriggerPhase2/interface/constants.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -424,20 +424,20 @@ namespace cmsdt {
424424
* Local to global coordinates transformation
425425
*/
426426

427-
constexpr int X_SIZE = 18;
428-
constexpr int TANPSI_SIZE = 15;
429-
constexpr int PHI_SIZE = 17; // (1 / 2 ** 17)
430-
constexpr int PHIB_SIZE = 11; // (2 ** 2) / (2 ** 13)
427+
constexpr int X_SIZE = 17;
428+
constexpr int TANPSI_SIZE = 14;
429+
constexpr double PHI_SIZE = 1. / 131072; //pow(2,17) //1 rad range, 17 bits
430+
constexpr double PHIB_SIZE = 4. / 8192; //pow(2,13) //4 rad range, 13 bits
431431

432-
constexpr int PHI_LUT_ADDR_WIDTH = 12;
433-
constexpr int PHI_B_SHL_BITS = 7;
434-
constexpr int PHI_MULT_SHR_BITS = 10;
435-
constexpr int PHI_LUT_A_BITS = 12;
436-
constexpr int PHI_LUT_B_BITS = 20;
432+
constexpr int PHI_LUT_ADDR_WIDTH = 11;
433+
constexpr int PHI_B_SHL_BITS = 5;
434+
constexpr int PHI_MULT_SHR_BITS = 9;
435+
constexpr int PHI_LUT_A_BITS = 11;
436+
constexpr int PHI_LUT_B_BITS = 21;
437437

438438
constexpr int PHIB_LUT_ADDR_WIDTH = 9;
439-
constexpr int PHIB_B_SHL_BITS = 7;
440-
constexpr int PHIB_MULT_SHR_BITS = 10;
439+
constexpr int PHIB_B_SHL_BITS = 6;
440+
constexpr int PHIB_MULT_SHR_BITS = 9;
441441
constexpr int PHIB_LUT_A_BITS = 10;
442442
constexpr int PHIB_LUT_B_BITS = 16;
443443

L1Trigger/DTTriggerPhase2/plugins/DTTrigPhase2Prod.cc

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "L1Trigger/DTTriggerPhase2/interface/MPFilter.h"
4040
#include "L1Trigger/DTTriggerPhase2/interface/MPSLFilter.h"
4141
#include "L1Trigger/DTTriggerPhase2/interface/MPCorFilter.h"
42+
#include "L1Trigger/DTTriggerPhase2/interface/MPCoincidenceFilter.h"
4243
#include "L1Trigger/DTTriggerPhase2/interface/MPQualityEnhancerFilter.h"
4344
#include "L1Trigger/DTTriggerPhase2/interface/MPRedundantFilter.h"
4445
#include "L1Trigger/DTTriggerPhase2/interface/MPCleanHitsFilter.h"
@@ -135,6 +136,8 @@ class DTTrigPhase2Prod : public edm::stream::EDProducer<> {
135136
double dT0_correlate_TP_;
136137
int scenario_;
137138
int df_extended_;
139+
int co_option_; //coincidence
140+
int co_quality_;
138141
int max_index_;
139142

140143
bool output_mixer_;
@@ -162,6 +165,7 @@ class DTTrigPhase2Prod : public edm::stream::EDProducer<> {
162165
std::unique_ptr<MuonPathAnalyzer> mpathassociator_;
163166
std::unique_ptr<MuonPathConfirmator> mpathconfirmator_;
164167
std::unique_ptr<MPFilter> mpathcorfilter_;
168+
std::unique_ptr<MPFilter> mpathcoifilter_;
165169
std::shared_ptr<GlobalCoordsObtainer> globalcoordsobtainer_;
166170

167171
// Buffering
@@ -204,6 +208,8 @@ DTTrigPhase2Prod::DTTrigPhase2Prod(const ParameterSet& pset)
204208
scenario_ = pset.getParameter<int>("scenario");
205209

206210
df_extended_ = pset.getParameter<int>("df_extended");
211+
co_option_ = pset.getParameter<int>("co_option");
212+
co_quality_ = pset.getParameter<int>("co_quality");
207213
max_index_ = pset.getParameter<int>("max_primitives") - 1;
208214

209215
dtDigisToken_ = consumes<DTDigiCollection>(pset.getParameter<edm::InputTag>("digiTag"));
@@ -261,6 +267,7 @@ DTTrigPhase2Prod::DTTrigPhase2Prod(const ParameterSet& pset)
261267
mpathconfirmator_ = std::make_unique<MuonPathConfirmator>(pset, consumesColl);
262268
mpathassociator_ = std::make_unique<MuonPathCorFitter>(pset, consumesColl, globalcoordsobtainer_);
263269
mpathcorfilter_ = std::make_unique<MPCorFilter>(pset);
270+
mpathcoifilter_ = std::make_unique<MPCoincidenceFilter>(pset);
264271
rpc_integrator_ = std::make_unique<RPCIntegrator>(pset, consumesColl);
265272

266273
dtGeomH = esConsumes<DTGeometry, MuonGeometryRecord, edm::Transition::BeginRun>();
@@ -285,6 +292,7 @@ void DTTrigPhase2Prod::beginRun(edm::Run const& iRun, const edm::EventSetup& iEv
285292
mpathhitsfilter_->initialise(iEventSetup);
286293
mpathassociator_->initialise(iEventSetup); // Associator object initialisation
287294
mpathcorfilter_->initialise(iEventSetup);
295+
mpathcoifilter_->initialise(iEventSetup);
288296

289297
if (auto geom = iEventSetup.getHandle(dtGeomH)) {
290298
dtGeo_ = &(*geom);
@@ -818,6 +826,36 @@ void DTTrigPhase2Prod::produce(Event& iEvent, const EventSetup& iEventSetup) {
818826
correlatedMetaPrimitives.clear();
819827
filteredMetaPrimitives.clear();
820828

829+
// Coincidence (co) filter
830+
831+
std::vector<metaPrimitive> allMetaPrimitives;
832+
for (auto& ch_filtcorrelatedMetaPrimitives : filtCorrelatedMetaPrimitives) {
833+
for (const auto& metaPrimitiveIt : ch_filtcorrelatedMetaPrimitives.second) {
834+
allMetaPrimitives.push_back(metaPrimitiveIt);
835+
}
836+
}
837+
838+
std::map<int, std::vector<metaPrimitive>> coMetaPrimitives;
839+
if (algo_ == Standard) {
840+
for (auto& ch_filtcorrelatedMetaPrimitives : filtCorrelatedMetaPrimitives) {
841+
if (!skip_processing_)
842+
mpathcoifilter_->run(iEvent,
843+
iEventSetup,
844+
allMetaPrimitives,
845+
filtCorrelatedMetaPrimitives[ch_filtcorrelatedMetaPrimitives.first],
846+
coMetaPrimitives[ch_filtcorrelatedMetaPrimitives.first]);
847+
else {
848+
for (auto& mp : ch_filtcorrelatedMetaPrimitives.second) {
849+
coMetaPrimitives[ch_filtcorrelatedMetaPrimitives.first].push_back(mp);
850+
}
851+
}
852+
}
853+
}
854+
855+
allMetaPrimitives.clear();
856+
857+
/////////////
858+
821859
double shift_back = 0;
822860
if (scenario_ == MC) //scope for MC
823861
shift_back = 400;
@@ -830,7 +868,7 @@ void DTTrigPhase2Prod::produce(Event& iEvent, const EventSetup& iEventSetup) {
830868
if (useRPC_) {
831869
rpc_integrator_->initialise(iEventSetup, shift_back);
832870
rpc_integrator_->prepareMetaPrimitives(rpcRecHits);
833-
for (auto& ch_correlatedMetaPrimitives : filtCorrelatedMetaPrimitives) {
871+
for (auto& ch_correlatedMetaPrimitives : coMetaPrimitives) {
834872
rpc_integrator_->matchWithDTAndUseRPCTime(ch_correlatedMetaPrimitives.second); // Probably this is a FIXME
835873
}
836874
rpc_integrator_->makeRPCOnlySegments();
@@ -846,11 +884,11 @@ void DTTrigPhase2Prod::produce(Event& iEvent, const EventSetup& iEventSetup) {
846884

847885
// Assigning index value
848886
if (!skip_processing_)
849-
for (auto& ch_correlatedMetaPrimitives : filtCorrelatedMetaPrimitives) {
887+
for (auto& ch_correlatedMetaPrimitives : coMetaPrimitives) {
850888
assignIndex(ch_correlatedMetaPrimitives.second);
851889
}
852890

853-
for (auto& ch_correlatedMetaPrimitives : filtCorrelatedMetaPrimitives) {
891+
for (auto& ch_correlatedMetaPrimitives : coMetaPrimitives) {
854892
for (const auto& metaPrimitiveIt : ch_correlatedMetaPrimitives.second) {
855893
DTChamberId chId(metaPrimitiveIt.rawId);
856894
DTSuperLayerId slId(metaPrimitiveIt.rawId);
@@ -1253,6 +1291,8 @@ void DTTrigPhase2Prod::fillDescriptions(edm::ConfigurationDescriptions& descript
12531291
desc.add<double>("minx_match_2digis", 1.0);
12541292
desc.add<int>("scenario", 0);
12551293
desc.add<int>("df_extended", 0);
1294+
desc.add<int>("co_option", 0);
1295+
desc.add<int>("co_quality", 0);
12561296
desc.add<int>("max_primitives", 999);
12571297
desc.add<bool>("output_mixer", false);
12581298
desc.add<bool>("output_latpredictor", false);

L1Trigger/DTTriggerPhase2/python/dtTriggerPhase2PrimitiveDigis_cfi.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
minx_match_2digis = cms.double(1.),
2424
scenario = cms.int32(0), #0 for mc, 1 for data, 2 for slice test
2525
df_extended = cms.int32(0), # DF: 0 for standard, 1 for extended, 2 for both
26+
co_option = cms.int32(1), # coincidence w.r.t. : -1 = off, 0 = co all, 1 = co phi, 2 = co theta
27+
co_quality = cms.int32(1), # quality cut (>X) for coincidence TP
2628
max_primitives = cms.int32(999),
2729

2830
output_mixer = cms.bool(False),
@@ -40,9 +42,8 @@
4042
lut_2sl = cms.FileInPath('L1Trigger/DTTriggerPhase2/data/fitterlut_2sl.dat'),
4143
shift_filename = cms.FileInPath('L1Trigger/DTTriggerPhase2/data/wire_rawId_x.txt'),
4244
shift_theta_filename = cms.FileInPath('L1Trigger/DTTriggerPhase2/data/theta_shift.txt'),
43-
maxdrift_filename = cms.FileInPath('L1Trigger/DTTriggerPhase2/data/drift_time_per_chamber.txt'),
45+
maxdrift_filename = cms.FileInPath('L1Trigger/DTTriggerPhase2/data/simple_vdrift.txt'),
4446
global_coords_filename = cms.FileInPath('L1Trigger/DTTriggerPhase2/data/global_coord_perp_x_phi0.txt'),
45-
laterality_filename = cms.FileInPath('L1Trigger/DTTriggerPhase2/data/lat_predictions.dat'),
4647
algo = cms.int32(0), # 0 = STD gr., 2 = Hough transform, 1 = PseudoBayes Approach
4748

4849
minHits4Fit = cms.int32(3),

0 commit comments

Comments
 (0)