Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33243 from dtp2-tpg-am/AM_11_3_X_Integration
Updates to the Phase-2 DT Trigger primitive generation code
- Loading branch information
Showing
19 changed files
with
3,155 additions
and
1,314 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThContainer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//------------------------------------------------- | ||
// | ||
// Class L1Phase2MuDTPhContainer | ||
// | ||
// Description: trigger primtive data for the | ||
// muon barrel Phase2 trigger | ||
// | ||
// | ||
// Author List: Federica Primavera Bologna INFN | ||
// | ||
// | ||
//-------------------------------------------------- | ||
#ifndef L1Phase2MuDTThContainer_H | ||
#define L1Phase2MuDTThContainer_H | ||
|
||
//------------------------------------ | ||
// Collaborating Class Declarations -- | ||
//------------------------------------ | ||
#include "DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThDigi.h" | ||
|
||
//---------------------- | ||
// Base Class Headers -- | ||
//---------------------- | ||
#include <vector> | ||
|
||
//--------------- | ||
// C++ Headers -- | ||
//--------------- | ||
|
||
// --------------------- | ||
// -- Class Interface -- | ||
// --------------------- | ||
|
||
class L1Phase2MuDTThContainer { | ||
public: | ||
typedef std::vector<L1Phase2MuDTThDigi> Segment_Container; | ||
typedef Segment_Container::const_iterator Segment_iterator; | ||
|
||
// Constructor | ||
L1Phase2MuDTThContainer(); | ||
|
||
void setContainer(const Segment_Container& inputSegments); | ||
|
||
Segment_Container const* getContainer() const; | ||
|
||
private: | ||
Segment_Container m_segments; | ||
}; | ||
|
||
#endif |
47 changes: 47 additions & 0 deletions
47
DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThDigi.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef L1Phase2MuDTThDigi_H | ||
#define L1Phase2MuDTThDigi_H | ||
|
||
class L1Phase2MuDTThDigi { | ||
public: | ||
// Constructors | ||
L1Phase2MuDTThDigi(); | ||
|
||
L1Phase2MuDTThDigi(int bx, int wh, int sc, int st, int z, int k, int qual, int idx, int t0, int chi2, int rpc = -10); | ||
|
||
// Operations | ||
int bxNum() const; | ||
|
||
int whNum() const; | ||
int scNum() const; | ||
int stNum() const; | ||
|
||
int z() const; | ||
int k() const; | ||
|
||
int quality() const; | ||
int index() const; | ||
|
||
int t0() const; | ||
int chi2() const; | ||
|
||
int rpcFlag() const; | ||
|
||
private: | ||
int m_bx; | ||
int m_wheel; | ||
int m_sector; | ||
int m_station; | ||
|
||
int m_zGlobal; | ||
int m_kSlope; | ||
|
||
int m_qualityCode; | ||
int m_index; | ||
|
||
int m_t0; | ||
int m_chi2; | ||
|
||
int m_rpcFlag; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include "DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThContainer.h" | ||
|
||
L1Phase2MuDTThContainer::L1Phase2MuDTThContainer() {} | ||
|
||
void L1Phase2MuDTThContainer::setContainer(const Segment_Container& inputSegments) { m_segments = inputSegments; } | ||
|
||
L1Phase2MuDTThContainer::Segment_Container const* L1Phase2MuDTThContainer::getContainer() const { return &m_segments; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include "DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThDigi.h" | ||
|
||
L1Phase2MuDTThDigi::L1Phase2MuDTThDigi() | ||
: m_bx(-100), | ||
m_wheel(0), | ||
m_sector(0), | ||
m_station(0), | ||
m_zGlobal(0), | ||
m_kSlope(0), | ||
m_qualityCode(-1), | ||
m_index(0), | ||
m_t0(0), | ||
m_chi2(0), | ||
m_rpcFlag(-10) {} | ||
|
||
L1Phase2MuDTThDigi::L1Phase2MuDTThDigi( | ||
int bx, int wh, int sc, int st, int z, int k, int qual, int idx, int t0, int chi2, int rpc) | ||
: m_bx(bx), | ||
m_wheel(wh), | ||
m_sector(sc), | ||
m_station(st), | ||
m_zGlobal(z), | ||
m_kSlope(k), | ||
m_qualityCode(qual), | ||
m_index(idx), | ||
m_t0(t0), | ||
m_chi2(chi2), | ||
m_rpcFlag(rpc) {} | ||
|
||
int L1Phase2MuDTThDigi::bxNum() const { return m_bx; } | ||
|
||
int L1Phase2MuDTThDigi::whNum() const { return m_wheel; } | ||
|
||
int L1Phase2MuDTThDigi::scNum() const { return m_sector; } | ||
|
||
int L1Phase2MuDTThDigi::stNum() const { return m_station; } | ||
|
||
int L1Phase2MuDTThDigi::z() const { return m_zGlobal; } | ||
|
||
int L1Phase2MuDTThDigi::k() const { return m_kSlope; } | ||
|
||
int L1Phase2MuDTThDigi::quality() const { return m_qualityCode; } | ||
|
||
int L1Phase2MuDTThDigi::index() const { return m_index; } | ||
|
||
int L1Phase2MuDTThDigi::t0() const { return m_t0; } | ||
|
||
int L1Phase2MuDTThDigi::chi2() const { return m_chi2; } | ||
|
||
int L1Phase2MuDTThDigi::rpcFlag() const { return m_rpcFlag; } |
80 changes: 80 additions & 0 deletions
80
L1Trigger/DTTriggerPhase2/interface/GlobalCoordsObtainer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#ifndef L1Trigger_DTTriggerPhase2_GlobalCoordsObtainer_h | ||
#define L1Trigger_DTTriggerPhase2_GlobalCoordsObtainer_h | ||
|
||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "FWCore/Utilities/interface/ESGetToken.h" | ||
#include "FWCore/Framework/interface/ConsumesCollector.h" | ||
#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/Framework/interface/Run.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
|
||
#include "DataFormats/MuonDetId/interface/DTChamberId.h" | ||
|
||
#include "L1Trigger/DTTriggerPhase2/interface/constants.h" | ||
|
||
#include <cmath> | ||
#include <fstream> | ||
#include <iostream> | ||
|
||
// =============================================================================== | ||
// Previous definitions and declarations | ||
// =============================================================================== | ||
|
||
struct lut_value { | ||
long int a; | ||
long int b; | ||
}; | ||
|
||
struct lut_group { | ||
std::map<int, lut_value> phic; | ||
std::map<int, lut_value> phi1; | ||
std::map<int, lut_value> phi3; | ||
std::map<int, lut_value> phib; | ||
}; | ||
|
||
struct global_constant_per_sl { | ||
double perp; | ||
double x_phi0; | ||
}; | ||
|
||
struct global_constant { | ||
uint32_t chid; | ||
global_constant_per_sl sl1; | ||
global_constant_per_sl sl3; | ||
}; | ||
|
||
// =============================================================================== | ||
// Class declarations | ||
// =============================================================================== | ||
|
||
class GlobalCoordsObtainer { | ||
public: | ||
GlobalCoordsObtainer(const edm::ParameterSet& pset); | ||
~GlobalCoordsObtainer(); | ||
|
||
void generate_luts(); | ||
std::vector<double> get_global_coordinates(uint32_t, int, int, int); | ||
|
||
private: | ||
std::map<int, lut_value> calc_atan_lut(int, int, double, double, double, int, int, int, int, int); | ||
// utilities to go to and from 2 complement | ||
int to_two_comp(int val, int size) { | ||
if (val >= 0) | ||
return val; | ||
return std::pow(2, size) + val; | ||
} | ||
|
||
int from_two_comp(int val, int size) { return val - ((2 * val) & (1 << size)); } | ||
|
||
// attributes | ||
bool cmssw_for_global_; | ||
edm::FileInPath global_coords_filename_; | ||
std::vector<global_constant> global_constants; | ||
std::map<uint32_t, lut_group> luts; | ||
}; | ||
|
||
#endif |
118 changes: 118 additions & 0 deletions
118
L1Trigger/DTTriggerPhase2/interface/MuonPathAnalyticAnalyzer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
#ifndef L1Trigger_DTTriggerPhase2_MuonPathAnalyticAnalyzer_h | ||
#define L1Trigger_DTTriggerPhase2_MuonPathAnalyticAnalyzer_h | ||
|
||
#include "L1Trigger/DTTriggerPhase2/interface/MuonPathAnalyzer.h" | ||
|
||
// =============================================================================== | ||
// Previous definitions and declarations | ||
// =============================================================================== | ||
|
||
struct MAGNITUDE { | ||
int add; | ||
int coeff[4]; | ||
int mult; | ||
}; | ||
|
||
struct CONSTANTS { | ||
MAGNITUDE pos; | ||
MAGNITUDE slope; | ||
MAGNITUDE slope_xhh; | ||
MAGNITUDE t0; | ||
}; | ||
|
||
struct LATCOMB_CONSTANTS { | ||
int latcomb; | ||
CONSTANTS constants; | ||
}; | ||
|
||
struct CELL_VALID_LAYOUT { | ||
int cell_horiz_layout[4]; | ||
int valid[4]; | ||
}; | ||
|
||
struct CELL_VALID_LAYOUT_CONSTANTS { | ||
CELL_VALID_LAYOUT cell_valid_layout; | ||
LATCOMB_CONSTANTS latcomb_constants[6]; | ||
}; | ||
|
||
// =============================================================================== | ||
// Class declarations | ||
// =============================================================================== | ||
|
||
class MuonPathAnalyticAnalyzer : public MuonPathAnalyzer { | ||
public: | ||
// Constructors and destructor | ||
MuonPathAnalyticAnalyzer(const edm::ParameterSet &pset, | ||
edm::ConsumesCollector &iC, | ||
std::shared_ptr<GlobalCoordsObtainer> &globalcoordsobtainer); | ||
~MuonPathAnalyticAnalyzer() override; | ||
|
||
// Main methods | ||
void initialise(const edm::EventSetup &iEventSetup) override; | ||
void run(edm::Event &iEvent, | ||
const edm::EventSetup &iEventSetup, | ||
MuonPathPtrs &inMpath, | ||
std::vector<cmsdt::metaPrimitive> &metaPrimitives) override; | ||
void run(edm::Event &iEvent, | ||
const edm::EventSetup &iEventSetup, | ||
MuonPathPtrs &inMpath, | ||
MuonPathPtrs &outMPath) override{}; | ||
|
||
void finish() override; | ||
|
||
// Other public methods | ||
|
||
bool hasPosRF(int wh, int sec) { return wh > 0 || (wh == 0 && sec % 4 > 1); }; | ||
|
||
// Public attributes | ||
DTGeometry const *dtGeo_; | ||
edm::ESGetToken<DTGeometry, MuonGeometryRecord> dtGeomH; | ||
|
||
//shift | ||
edm::FileInPath shift_filename_; | ||
std::map<int, float> shiftinfo_; | ||
|
||
//shift theta | ||
edm::FileInPath shift_theta_filename_; | ||
std::map<int, float> shiftthetainfo_; | ||
|
||
int chosen_sl_; | ||
|
||
private: | ||
// Private methods | ||
void analyze(MuonPathPtr &inMPath, std::vector<cmsdt::metaPrimitive> &metaPrimitives); | ||
void fillLAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER(); | ||
void segment_fitter(DTSuperLayerId MuonPathSLId, | ||
int wires[4], | ||
int t0s[4], | ||
int valid[4], | ||
int reduced_times[4], | ||
int cell_horiz_layout[4], | ||
LATCOMB_CONSTANTS latcomb_consts, | ||
int xwire_mm[4], | ||
int coarse_pos, | ||
int coarse_offset, | ||
std::vector<cmsdt::metaPrimitive> &metaPrimitives); | ||
int compute_parameter(MAGNITUDE constants, int t0s[4], int DIV_SHR_BITS, int INCREASED_RES); | ||
std::vector<int> getLateralityCombination(int latcomb); | ||
|
||
// Private attributes | ||
|
||
bool debug_; | ||
double chi2Th_; | ||
double tanPhiTh_; | ||
double tanPhiThw2max_; | ||
double tanPhiThw2min_; | ||
double tanPhiThw1max_; | ||
double tanPhiThw1min_; | ||
double tanPhiThw0_; | ||
int cellLayout_[cmsdt::NUM_LAYERS]; | ||
bool cmssw_for_global_; | ||
std::string geometry_tag_; | ||
std::vector<CELL_VALID_LAYOUT_CONSTANTS> LAYOUT_VALID_TO_LATCOMB_CONSTS_ENCODER; | ||
|
||
// global coordinates | ||
std::shared_ptr<GlobalCoordsObtainer> globalcoordsobtainer_; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.