CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
tmtt::DigitalStub Class Reference

#include <DigitalStub.h>

Public Member Functions

double bend () const
 
double bend_orig () const
 
bool changePhiSec (unsigned int iPhiSec)
 
 DigitalStub (const Settings *settings, double r, double phi, double z, unsigned int iPhiSec)
 
 DigitalStub (const Settings *settings, double phi_orig, double r_orig, double z_orig, unsigned int mbin_min_orig, unsigned int mbin_max_orig, double bend_orig, unsigned int iPhiSec)
 
int iDigi_Bend () const
 
int iDigi_PhiN () const
 
int iDigi_PhiS () const
 
unsigned int iDigi_R () const
 
int iDigi_Rt () const
 
int iDigi_Z () const
 
unsigned int iNonant (unsigned int iPhiSec) const
 
int mbin_max () const
 
unsigned int mbin_max_orig () const
 
int mbin_min () const
 
unsigned int mbin_min_orig () const
 
double phi_GP () const
 
double phi_HT_TF () const
 
double phi_orig () const
 
double phiN () const
 
double phiN_orig () const
 
double phiS () const
 
double phiS_orig () const
 
double r_GP_HT () const
 
double r_orig () const
 
double r_SF_TF () const
 
double rt_GP_HT () const
 
double rt_orig () const
 
double rt_SF_TF () const
 
double z () const
 
double z_orig () const
 

Private Member Functions

void checkAccuracy () const
 
void checkInRange () const
 
void digitize (unsigned int iPhiSec)
 
void setCfgParams (const Settings *settings)
 
void undigitize (unsigned int iPhiSec)
 

Private Attributes

double bend_
 
double bend_orig_
 
unsigned int bendBits_
 
double bendMult_
 
double bendRange_
 
double chosenRofPhi_
 
int iDigi_Bend_
 
int iDigi_PhiN_
 
int iDigi_PhiS_
 
unsigned int iDigi_R_
 
int iDigi_Rt_
 
int iDigi_Z_
 
int iFirmwareType_
 
unsigned int iPhiSec_done_
 
int mbin_max_
 
unsigned int mbin_max_orig_
 
int mbin_min_
 
unsigned int mbin_min_orig_
 
int min_array_mbin_
 
unsigned int nbinsPt_
 
unsigned int numPhiNonants_
 
unsigned int numPhiSectors_
 
double phi_GP_
 
double phi_HT_TF_
 
double phi_orig_
 
double phiCentreSec0_
 
double phiN_
 
double phiN_orig_
 
unsigned int phiNBits_
 
double phiNMult_
 
double phiNonantCentre_
 
double phiNonantWidth_
 
double phiNRange_
 
double phiS_
 
double phiS_orig_
 
unsigned int phiSBits_
 
unsigned int phiSectorBits_
 
double phiSectorCentre_
 
double phiSectorWidth_
 
double phiSMult_
 
double phiSRange_
 
double r_GP_HT_
 
double r_orig_
 
double r_SF_TF_
 
double rt_GP_HT_
 
double rt_orig_
 
double rt_SF_TF_
 
unsigned int rtBits_
 
double rtMult_
 
double rtRange_
 
double z_
 
double z_orig_
 
unsigned int zBits_
 
double zMult_
 
double zRange_
 

Detailed Description

Definition at line 14 of file DigitalStub.h.

Constructor & Destructor Documentation

◆ DigitalStub() [1/2]

tmtt::DigitalStub::DigitalStub ( const Settings settings,
double  r,
double  phi,
double  z,
unsigned int  iPhiSec 
)

Definition at line 15 of file DigitalStub.cc.

References chosenRofPhi_, reco::deltaPhi(), iDigi_PhiS_, iDigi_Rt_, iDigi_Z_, iPhiSec_done_, M_PI, numPhiNonants_, numPhiSectors_, phi_orig_, phiCentreSec0_, phiS_orig_, phiSectorCentre_, phiSectorWidth_, phiSMult_, r_orig_, rt_orig_, rtMult_, z(), z_orig_, and zMult_.

16  : phiSBits_(settings->phiSBits()), // No. of bits to store phiS coord.
17  phiSRange_(settings->phiSRange()), // Range of phiS coord. in radians.
18  rtBits_(settings->rtBits()), // No. of bits to store rT coord.
19  rtRange_(settings->rtRange()), // Range of rT coord. in cm.
20  zBits_(settings->zBits()), // No. of bits to store z coord.
21  zRange_(settings->zRange()), // Range of z coord in cm.
23  rtMult_(pow(2, rtBits_) / rtRange_),
24  zMult_(pow(2, zBits_) / zRange_),
25  numPhiSectors_(settings->numPhiSectors()),
26  numPhiNonants_(9),
27  phiSectorWidth_(2. * M_PI / double(numPhiSectors_)),
28  chosenRofPhi_(settings->chosenRofPhi()) {
29  // Centre of this sector in phi. (Nonant 0 is centred on x-axis).
30  phiCentreSec0_ = -M_PI / double(numPhiNonants_) + M_PI / double(numPhiSectors_);
31  phiSectorCentre_ = phiSectorWidth_ * double(iPhiSec) + phiCentreSec0_;
32 
33  // Used to check if new digi requests are for same sector as old
34  iPhiSec_done_ = iPhiSec;
35 
36  r_orig_ = r;
37  phi_orig_ = phi;
38  z_orig_ = z;
39 
42 
43  // Digitize
44  iDigi_Rt_ = floor(rt_orig_ * rtMult_);
45  iDigi_PhiS_ = floor(phiS_orig_ * phiSMult_);
46  iDigi_Z_ = floor(z_orig_ * zMult_);
47  }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
unsigned int phiSBits_
Definition: DigitalStub.h:97
unsigned int rtBits_
Definition: DigitalStub.h:99
unsigned int zBits_
Definition: DigitalStub.h:101
double phiSectorCentre_
Definition: DigitalStub.h:124
double phiSectorWidth_
Definition: DigitalStub.h:119
unsigned int iPhiSec_done_
Definition: DigitalStub.h:134
unsigned int numPhiNonants_
Definition: DigitalStub.h:117
#define M_PI
double z() const
Definition: DigitalStub.h:69
unsigned int numPhiSectors_
Definition: DigitalStub.h:116
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ DigitalStub() [2/2]

tmtt::DigitalStub::DigitalStub ( const Settings settings,
double  phi_orig,
double  r_orig,
double  z_orig,
unsigned int  mbin_min_orig,
unsigned int  mbin_max_orig,
double  bend_orig,
unsigned int  iPhiSec 
)

Definition at line 53 of file DigitalStub.cc.

References bend_orig(), bend_orig_, checkAccuracy(), checkInRange(), chosenRofPhi_, reco::deltaPhi(), digitize(), iNonant(), iPhiSec_done_, mbin_max_orig(), mbin_max_orig_, mbin_min_orig(), mbin_min_orig_, phi_orig(), phi_orig_, phiCentreSec0_, phiN_orig_, phiNonantCentre_, phiNonantWidth_, phiS_orig_, phiSectorCentre_, phiSectorWidth_, r_orig(), r_orig_, rt_orig_, setCfgParams(), undigitize(), z_orig(), and z_orig_.

60  {
61  // Set cfg params
62  this->setCfgParams(settings);
63 
64  // Store variable prior to digitisation
65  r_orig_ = r_orig;
68  z_orig_ = z_orig;
72 
73  // Phi of centre of phi sector and of nonant.
74  unsigned int iNonant = this->iNonant(iPhiSec);
75  phiSectorCentre_ = phiSectorWidth_ * double(iPhiSec) + phiCentreSec0_;
77 
80 
81  // Used to check if new digi requests are for same sector as old
82  iPhiSec_done_ = iPhiSec;
83 
84  // Check that stub coords. are within assumed digitization range.
85  this->checkInRange();
86 
87  // Digitize and then undigitize stub.
88  this->digitize(iPhiSec);
89  this->undigitize(iPhiSec);
90 
91  // Check that digitization followed by undigitization doesn't change results too much.
92  this->checkAccuracy();
93  }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
double phiNonantCentre_
Definition: DigitalStub.h:125
double bend_orig() const
Definition: DigitalStub.h:45
void digitize(unsigned int iPhiSec)
Definition: DigitalStub.cc:167
double z_orig() const
Definition: DigitalStub.h:42
void checkInRange() const
Definition: DigitalStub.cc:215
unsigned int mbin_min_orig() const
Definition: DigitalStub.h:43
void setCfgParams(const Settings *settings)
Definition: DigitalStub.cc:123
unsigned int mbin_min_orig_
Definition: DigitalStub.h:143
double phiSectorCentre_
Definition: DigitalStub.h:124
double phiSectorWidth_
Definition: DigitalStub.h:119
unsigned int iPhiSec_done_
Definition: DigitalStub.h:134
double phi_orig() const
Definition: DigitalStub.h:39
unsigned int iNonant(unsigned int iPhiSec) const
Definition: DigitalStub.h:73
unsigned int mbin_max_orig() const
Definition: DigitalStub.h:44
void undigitize(unsigned int iPhiSec)
Definition: DigitalStub.cc:191
unsigned int mbin_max_orig_
Definition: DigitalStub.h:144
void checkAccuracy() const
Definition: DigitalStub.cc:236
double r_orig() const
Definition: DigitalStub.h:37
double phiNonantWidth_
Definition: DigitalStub.h:120

Member Function Documentation

◆ bend()

double tmtt::DigitalStub::bend ( ) const
inline

Definition at line 62 of file DigitalStub.h.

References bend_.

62 { return bend_; }

◆ bend_orig()

double tmtt::DigitalStub::bend_orig ( ) const
inline

Definition at line 45 of file DigitalStub.h.

References bend_orig_.

Referenced by DigitalStub().

45 { return bend_orig_; }

◆ changePhiSec()

bool tmtt::DigitalStub::changePhiSec ( unsigned int  iPhiSec)

Definition at line 97 of file DigitalStub.cc.

References reco::deltaPhi(), iDigi_PhiN_, iDigi_PhiS_, iNonant(), iPhiSec_done_, phi_GP_, phi_HT_TF_, phi_orig_, phiCentreSec0_, phiN_, phiN_orig_, phiNMult_, phiNonantCentre_, phiNonantWidth_, phiS_, phiS_orig_, phiSectorCentre_, phiSectorWidth_, and phiSMult_.

97  {
98  bool doUpdate = (iPhiSec != iPhiSec_done_);
99 
100  if (doUpdate) {
101  // phi sector has changed since last time digitisation was done, so update.
102  iPhiSec_done_ = iPhiSec;
103  unsigned int iNonant = this->iNonant(iPhiSec);
104  // Update original, floating point phi w.r.t. phi sector/nonant centre.
105  phiSectorCentre_ = phiSectorWidth_ * double(iPhiSec) + phiCentreSec0_;
109  // Update digitised phi.
110  iDigi_PhiN_ = floor(phiN_orig_ * phiNMult_);
111  iDigi_PhiS_ = floor(phiS_orig_ * phiSMult_);
112  // Update digitized then undigitized phi.
113  phiN_ = (iDigi_PhiN_ + 0.5) / phiNMult_;
115  phiS_ = (iDigi_PhiS_ + 0.5) / phiSMult_;
117  }
118  return doUpdate;
119  }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
double phiNonantCentre_
Definition: DigitalStub.h:125
double phiSectorCentre_
Definition: DigitalStub.h:124
double phiSectorWidth_
Definition: DigitalStub.h:119
unsigned int iPhiSec_done_
Definition: DigitalStub.h:134
unsigned int iNonant(unsigned int iPhiSec) const
Definition: DigitalStub.h:73
double phiNonantWidth_
Definition: DigitalStub.h:120

◆ checkAccuracy()

void tmtt::DigitalStub::checkAccuracy ( ) const
private

Definition at line 236 of file DigitalStub.cc.

References funct::abs(), bend_, bend_orig_, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), reco::deltaPhi(), Exception, phi_HT_TF_, phi_orig_, r_GP_HT_, r_orig_, z_, and z_orig_.

Referenced by DigitalStub().

236  {
237  double TA = reco::deltaPhi(phi_HT_TF_, phi_orig_);
238  double TB = r_GP_HT_ - r_orig_;
239  double TC = z_ - z_orig_;
240  double TD = bend_ - bend_orig_;
241 
242  // Compare to small numbers, representing acceptable precision loss.
243  constexpr double smallTA = 0.001, smallTB = 0.3, smallTC = 0.25, smallTD = 0.01;
244  if (std::abs(TA) > smallTA || std::abs(TB) > smallTB || std::abs(TC) > smallTC || std::abs(TD) > smallTD) {
245  throw cms::Exception("LogicError") << "WARNING: DigitalStub lost precision: " << TA << " " << TB << " " << TC
246  << " " << TD;
247  }
248  }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ checkInRange()

void tmtt::DigitalStub::checkInRange ( ) const
private

Definition at line 215 of file DigitalStub.cc.

References funct::abs(), bend_orig_, bendRange_, Exception, rt_orig_, rtRange_, z_orig_, and zRange_.

Referenced by DigitalStub().

215  {
216  if (std::abs(rt_orig_) >= 0.5 * rtRange_)
217  throw cms::Exception("BadConfig") << "DigitalStub: Stub rT is out of assumed digitization range."
218  << " |rt| = " << std::abs(rt_orig_) << " > " << 0.5 * rtRange_;
219  if (std::abs(z_orig_) >= 0.5 * zRange_)
220  throw cms::Exception("BadConfig") << "DigitalStub: Stub z is out of assumed digitization range."
221  << " |z| = " << std::abs(z_orig_) << " > " << 0.5 * zRange_;
222  if (std::abs(bend_orig_) >= 0.5 * bendRange_)
223  throw cms::Exception("BadConfig") << "DigitalStub: Stub bend is out of assumed digitization range."
224  << " |bend| = " << std::abs(bend_orig_) << " > " << 0.5 * bendRange_;
225  //--- Can't check phi range, as DigitalStub called for stubs before sector assignment.
226  //if (std::abs(phiS_orig_) >= 0.5 * phiSRange_)
227  // throw cms::Exception("BadConfig") << "DigitalStub: Stub phiS is out of assumed digitization range."
228  // << " |phiS| = " << std::abs(phiS_orig_) << " > " << 0.5 * phiSRange_;
229  //if (std::abs(phiN_orig_) >= 0.5 * phiNRange_)
230  // throw cms::Exception("BadConfig") << "DigitalStub: Stub phiN is out of assumed digitization range."
231  // << " |phiN| = " << std::abs(phiN_orig_) << " > " << 0.5 * phiNRange_;
232  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ digitize()

void tmtt::DigitalStub::digitize ( unsigned int  iPhiSec)
private

Definition at line 167 of file DigitalStub.cc.

References bend_orig_, bendMult_, chosenRofPhi_, iDigi_Bend_, iDigi_PhiN_, iDigi_PhiS_, iDigi_R_, iDigi_Rt_, iDigi_Z_, mbin_max_, mbin_max_orig_, mbin_min_, mbin_min_orig_, min_array_mbin_, phiN_orig_, phiNMult_, phiS_orig_, phiSMult_, rt_orig_, rtMult_, z_orig_, and zMult_.

Referenced by DigitalStub().

167  {
168  //--- Digitize variables used exclusively in GP input.
169  iDigi_PhiN_ = floor(phiN_orig_ * phiNMult_);
170  iDigi_Bend_ = round(bend_orig_ * bendMult_); // discrete values, so digitisation different
171 
172  //--- Digitize variables used exclusively in HT input.
173  iDigi_PhiS_ = floor(phiS_orig_ * phiSMult_);
174 
175  // Offset m-bin range allowed by bend to correspond to firmware.
178 
179  //--- Digitize variables used in both GP & HT input.
180  iDigi_Rt_ = floor(rt_orig_ * rtMult_);
181 
182  //-- Digitize variables used by SF & TF input
183  iDigi_R_ = iDigi_Rt_ + std::round(chosenRofPhi_ * rtMult_);
184 
185  //-- Digitize variables used by everything
186  iDigi_Z_ = floor(z_orig_ * zMult_);
187  }
unsigned int mbin_min_orig_
Definition: DigitalStub.h:143
unsigned int mbin_max_orig_
Definition: DigitalStub.h:144
unsigned int iDigi_R_
Definition: DigitalStub.h:155

◆ iDigi_Bend()

int tmtt::DigitalStub::iDigi_Bend ( ) const
inline

Definition at line 50 of file DigitalStub.h.

References iDigi_Bend_.

50 { return iDigi_Bend_; }

◆ iDigi_PhiN()

int tmtt::DigitalStub::iDigi_PhiN ( ) const
inline

Definition at line 49 of file DigitalStub.h.

References iDigi_PhiN_.

49 { return iDigi_PhiN_; }

◆ iDigi_PhiS()

int tmtt::DigitalStub::iDigi_PhiS ( ) const
inline

Definition at line 51 of file DigitalStub.h.

References iDigi_PhiS_.

Referenced by tmtt::SimpleLR4::fit().

51 { return iDigi_PhiS_; }

◆ iDigi_R()

unsigned int tmtt::DigitalStub::iDigi_R ( ) const
inline

Definition at line 55 of file DigitalStub.h.

References iDigi_R_.

55 { return iDigi_R_; }
unsigned int iDigi_R_
Definition: DigitalStub.h:155

◆ iDigi_Rt()

int tmtt::DigitalStub::iDigi_Rt ( ) const
inline

Definition at line 54 of file DigitalStub.h.

References iDigi_Rt_.

Referenced by tmtt::SimpleLR4::fit(), and tmtt::Sector::insideEtaSubSecs().

54 { return iDigi_Rt_; }

◆ iDigi_Z()

int tmtt::DigitalStub::iDigi_Z ( ) const
inline

Definition at line 56 of file DigitalStub.h.

References iDigi_Z_.

Referenced by tmtt::SimpleLR4::fit(), and tmtt::Sector::insideEtaSubSecs().

56 { return iDigi_Z_; }

◆ iNonant()

unsigned int tmtt::DigitalStub::iNonant ( unsigned int  iPhiSec) const
inline

Definition at line 73 of file DigitalStub.h.

References numPhiNonants_, and numPhiSectors_.

Referenced by changePhiSec(), and DigitalStub().

73 { return floor(iPhiSec * numPhiNonants_ / numPhiSectors_); }
unsigned int numPhiNonants_
Definition: DigitalStub.h:117
unsigned int numPhiSectors_
Definition: DigitalStub.h:116

◆ mbin_max()

int tmtt::DigitalStub::mbin_max ( ) const
inline

Definition at line 53 of file DigitalStub.h.

References mbin_max_.

53 { return mbin_max_; }

◆ mbin_max_orig()

unsigned int tmtt::DigitalStub::mbin_max_orig ( ) const
inline

Definition at line 44 of file DigitalStub.h.

References mbin_max_orig_.

Referenced by DigitalStub().

44 { return mbin_max_orig_; }
unsigned int mbin_max_orig_
Definition: DigitalStub.h:144

◆ mbin_min()

int tmtt::DigitalStub::mbin_min ( ) const
inline

Definition at line 52 of file DigitalStub.h.

References mbin_min_.

52 { return mbin_min_; }

◆ mbin_min_orig()

unsigned int tmtt::DigitalStub::mbin_min_orig ( ) const
inline

Definition at line 43 of file DigitalStub.h.

References mbin_min_orig_.

Referenced by DigitalStub().

43 { return mbin_min_orig_; }
unsigned int mbin_min_orig_
Definition: DigitalStub.h:143

◆ phi_GP()

double tmtt::DigitalStub::phi_GP ( ) const
inline

Definition at line 61 of file DigitalStub.h.

References phi_GP_.

61 { return phi_GP_; }

◆ phi_HT_TF()

double tmtt::DigitalStub::phi_HT_TF ( ) const
inline

Definition at line 64 of file DigitalStub.h.

References phi_HT_TF_.

64 { return phi_HT_TF_; }

◆ phi_orig()

double tmtt::DigitalStub::phi_orig ( ) const
inline

Definition at line 39 of file DigitalStub.h.

References phi_orig_.

Referenced by DigitalStub().

39 { return phi_orig_; }

◆ phiN()

double tmtt::DigitalStub::phiN ( ) const
inline

Definition at line 60 of file DigitalStub.h.

References phiN_.

60 { return phiN_; }

◆ phiN_orig()

double tmtt::DigitalStub::phiN_orig ( ) const
inline

Definition at line 41 of file DigitalStub.h.

References phiN_orig_.

41 { return phiN_orig_; } // with respect to centre of nonant

◆ phiS()

double tmtt::DigitalStub::phiS ( ) const
inline

Definition at line 63 of file DigitalStub.h.

References phiS_.

Referenced by tmtt::SimpleLR4::fit().

63 { return phiS_; }

◆ phiS_orig()

double tmtt::DigitalStub::phiS_orig ( ) const
inline

Definition at line 40 of file DigitalStub.h.

References phiS_orig_.

40 { return phiS_orig_; } // with respect to centre of sector

◆ r_GP_HT()

double tmtt::DigitalStub::r_GP_HT ( ) const
inline

Definition at line 66 of file DigitalStub.h.

References r_GP_HT_.

66 { return r_GP_HT_; }

◆ r_orig()

double tmtt::DigitalStub::r_orig ( ) const
inline

Definition at line 37 of file DigitalStub.h.

References r_orig_.

Referenced by DigitalStub().

37 { return r_orig_; }

◆ r_SF_TF()

double tmtt::DigitalStub::r_SF_TF ( ) const
inline

Definition at line 67 of file DigitalStub.h.

References r_SF_TF_.

67 { return r_SF_TF_; }

◆ rt_GP_HT()

double tmtt::DigitalStub::rt_GP_HT ( ) const
inline

Definition at line 65 of file DigitalStub.h.

References rt_GP_HT_.

65 { return rt_GP_HT_; }

◆ rt_orig()

double tmtt::DigitalStub::rt_orig ( ) const
inline

Definition at line 38 of file DigitalStub.h.

References rt_orig_.

38 { return rt_orig_; } // r with respect to reference radius

◆ rt_SF_TF()

double tmtt::DigitalStub::rt_SF_TF ( ) const
inline

Definition at line 68 of file DigitalStub.h.

References rt_SF_TF_.

Referenced by tmtt::SimpleLR4::fit().

68 { return rt_SF_TF_; }

◆ setCfgParams()

void tmtt::DigitalStub::setCfgParams ( const Settings settings)
private

Definition at line 123 of file DigitalStub.cc.

References tmtt::Settings::bendBits(), bendBits_, bendMult_, bendRange_, tmtt::Settings::chosenRofPhi(), chosenRofPhi_, tmtt::Settings::houghNbinsPt(), createfilelist::int, M_PI, min_array_mbin_, nbinsPt_, tmtt::Settings::numPhiNonants(), numPhiNonants_, tmtt::Settings::numPhiSectors(), numPhiSectors_, phiCentreSec0_, tmtt::Settings::phiNBits(), phiNBits_, phiNMult_, phiNonantWidth_, tmtt::Settings::phiNRange(), phiNRange_, tmtt::Settings::phiSBits(), phiSBits_, tmtt::Settings::phiSectorBits(), phiSectorBits_, phiSectorWidth_, phiSMult_, tmtt::Settings::phiSRange(), phiSRange_, funct::pow(), tmtt::Settings::rtBits(), rtBits_, rtMult_, tmtt::Settings::rtRange(), rtRange_, tmtt::Settings::zBits(), zBits_, zMult_, tmtt::Settings::zRange(), and zRange_.

Referenced by DigitalStub().

123  {
124  // Digitization configuration parameters
125  phiSectorBits_ = settings->phiSectorBits(); // No. of bits to store phi sector number
126  //--- Parameters available in HT board.
127  phiSBits_ = settings->phiSBits(); // No. of bits to store phiS coord.
128  phiSRange_ = settings->phiSRange(); // Range of phiS coord. in radians.
129  rtBits_ = settings->rtBits(); // No. of bits to store rT coord.
130  rtRange_ = settings->rtRange(); // Range of rT coord. in cm.
131  zBits_ = settings->zBits(); // No. of bits to store z coord.
132  zRange_ = settings->zRange(); // Range of z coord in cm.
133  //--- Parameters available in GP board (excluding any in common with HT specified above).
134  phiNBits_ = settings->phiNBits(); // No. of bits to store phiN parameter.
135  phiNRange_ = settings->phiNRange(); // Range of phiN parameter
136  bendBits_ = settings->bendBits(); // No. of bits to store stub bend.
137 
138  // Number of phi sectors and phi nonants.
139  numPhiSectors_ = settings->numPhiSectors();
140  numPhiNonants_ = settings->numPhiNonants();
141  // Phi sector and phi nonant width (radians)
142  phiSectorWidth_ = 2. * M_PI / double(numPhiSectors_);
143  phiNonantWidth_ = 2. * M_PI / double(numPhiNonants_);
144  // Centre of phi sector 0.
145  phiCentreSec0_ = -M_PI / double(numPhiNonants_) + M_PI / double(numPhiSectors_);
146  // Radius from beamline with respect to which stub r coord. is measured.
147  chosenRofPhi_ = settings->chosenRofPhi();
148 
149  // Number of q/Pt bins in Hough transform array.
150  nbinsPt_ = (int)settings->houghNbinsPt();
151  // Min. of m-bin range in firmware,
152  min_array_mbin_ = (nbinsPt_ % 2 == 0) ? -(nbinsPt_ / 2) : -(nbinsPt_ - 1) / 2;
153 
154  // Calculate multipliers to digitize the floating point numbers.
156  rtMult_ = pow(2, rtBits_) / rtRange_;
157  zMult_ = pow(2, zBits_) / zRange_;
159 
160  // No precision lost by digitization, since original bend (after encoding) has steps of 0.25 (in units of pitch).
161  bendMult_ = 4.;
162  bendRange_ = round(pow(2, bendBits_) / bendMult_); // discrete values, so digitisation different
163  }
unsigned int nbinsPt_
Definition: DigitalStub.h:129
unsigned int phiSBits_
Definition: DigitalStub.h:97
unsigned int rtBits_
Definition: DigitalStub.h:99
unsigned int zBits_
Definition: DigitalStub.h:101
double phiSectorWidth_
Definition: DigitalStub.h:119
unsigned int numPhiNonants_
Definition: DigitalStub.h:117
#define M_PI
unsigned int bendBits_
Definition: DigitalStub.h:105
unsigned int phiSectorBits_
Definition: DigitalStub.h:96
unsigned int phiNBits_
Definition: DigitalStub.h:103
unsigned int numPhiSectors_
Definition: DigitalStub.h:116
double phiNonantWidth_
Definition: DigitalStub.h:120
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ undigitize()

void tmtt::DigitalStub::undigitize ( unsigned int  iPhiSec)
private

Definition at line 191 of file DigitalStub.cc.

References bend_, bendMult_, chosenRofPhi_, reco::deltaPhi(), iDigi_Bend_, iDigi_PhiN_, iDigi_PhiS_, iDigi_R_, iDigi_Rt_, iDigi_Z_, phi_GP_, phi_HT_TF_, phiN_, phiNMult_, phiNonantCentre_, phiS_, phiSectorCentre_, phiSMult_, r_GP_HT_, r_SF_TF_, rt_GP_HT_, rt_SF_TF_, rtMult_, z_, and zMult_.

Referenced by DigitalStub().

191  {
192  //--- Undigitize variables used exclusively in GP.
193  phiN_ = (iDigi_PhiN_ + 0.5) / phiNMult_;
195  bend_ = iDigi_Bend_ / bendMult_; // discrete values, so digitisation different
196 
197  //--- Undigitize variables used exclusively by HT & SF/TF
198  phiS_ = (iDigi_PhiS_ + 0.5) / phiSMult_;
200 
201  //--- Undigitize variables used in both GP & HT.
202  rt_GP_HT_ = (iDigi_Rt_ + 0.5) / rtMult_;
204 
205  //--- Undigitize variables used exclusively by SF/TF.
206  r_SF_TF_ = (iDigi_R_ + 0.5) / rtMult_;
208 
209  //--- Undigitize variables used exclusively by everything.
210  z_ = (iDigi_Z_ + 0.5) / zMult_;
211  }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
double phiNonantCentre_
Definition: DigitalStub.h:125
double phiSectorCentre_
Definition: DigitalStub.h:124
unsigned int iDigi_R_
Definition: DigitalStub.h:155

◆ z()

double tmtt::DigitalStub::z ( ) const
inline

Definition at line 69 of file DigitalStub.h.

References z_.

Referenced by DigitalStub(), tmtt::SimpleLR4::fit(), geometryXMLparser.Alignable::pos(), and ntupleDataFormat._HitObject::r3D().

69 { return z_; }

◆ z_orig()

double tmtt::DigitalStub::z_orig ( ) const
inline

Definition at line 42 of file DigitalStub.h.

References z_orig_.

Referenced by DigitalStub().

42 { return z_orig_; }

Member Data Documentation

◆ bend_

double tmtt::DigitalStub::bend_
private

Definition at line 161 of file DigitalStub.h.

Referenced by bend(), checkAccuracy(), and undigitize().

◆ bend_orig_

double tmtt::DigitalStub::bend_orig_
private

Definition at line 145 of file DigitalStub.h.

Referenced by bend_orig(), checkAccuracy(), checkInRange(), DigitalStub(), and digitize().

◆ bendBits_

unsigned int tmtt::DigitalStub::bendBits_
private

Definition at line 105 of file DigitalStub.h.

Referenced by setCfgParams().

◆ bendMult_

double tmtt::DigitalStub::bendMult_
private

Definition at line 113 of file DigitalStub.h.

Referenced by digitize(), setCfgParams(), and undigitize().

◆ bendRange_

double tmtt::DigitalStub::bendRange_
private

Definition at line 106 of file DigitalStub.h.

Referenced by checkInRange(), and setCfgParams().

◆ chosenRofPhi_

double tmtt::DigitalStub::chosenRofPhi_
private

Definition at line 127 of file DigitalStub.h.

Referenced by DigitalStub(), digitize(), setCfgParams(), and undigitize().

◆ iDigi_Bend_

int tmtt::DigitalStub::iDigi_Bend_
private

Definition at line 150 of file DigitalStub.h.

Referenced by digitize(), iDigi_Bend(), and undigitize().

◆ iDigi_PhiN_

int tmtt::DigitalStub::iDigi_PhiN_
private

Definition at line 149 of file DigitalStub.h.

Referenced by changePhiSec(), digitize(), iDigi_PhiN(), and undigitize().

◆ iDigi_PhiS_

int tmtt::DigitalStub::iDigi_PhiS_
private

Definition at line 151 of file DigitalStub.h.

Referenced by changePhiSec(), DigitalStub(), digitize(), iDigi_PhiS(), and undigitize().

◆ iDigi_R_

unsigned int tmtt::DigitalStub::iDigi_R_
private

Definition at line 155 of file DigitalStub.h.

Referenced by digitize(), iDigi_R(), and undigitize().

◆ iDigi_Rt_

int tmtt::DigitalStub::iDigi_Rt_
private

Definition at line 154 of file DigitalStub.h.

Referenced by DigitalStub(), digitize(), iDigi_Rt(), and undigitize().

◆ iDigi_Z_

int tmtt::DigitalStub::iDigi_Z_
private

Definition at line 156 of file DigitalStub.h.

Referenced by DigitalStub(), digitize(), iDigi_Z(), and undigitize().

◆ iFirmwareType_

int tmtt::DigitalStub::iFirmwareType_
private

Definition at line 95 of file DigitalStub.h.

◆ iPhiSec_done_

unsigned int tmtt::DigitalStub::iPhiSec_done_
private

Definition at line 134 of file DigitalStub.h.

Referenced by changePhiSec(), and DigitalStub().

◆ mbin_max_

int tmtt::DigitalStub::mbin_max_
private

Definition at line 153 of file DigitalStub.h.

Referenced by digitize(), and mbin_max().

◆ mbin_max_orig_

unsigned int tmtt::DigitalStub::mbin_max_orig_
private

Definition at line 144 of file DigitalStub.h.

Referenced by DigitalStub(), digitize(), and mbin_max_orig().

◆ mbin_min_

int tmtt::DigitalStub::mbin_min_
private

Definition at line 152 of file DigitalStub.h.

Referenced by digitize(), and mbin_min().

◆ mbin_min_orig_

unsigned int tmtt::DigitalStub::mbin_min_orig_
private

Definition at line 143 of file DigitalStub.h.

Referenced by DigitalStub(), digitize(), and mbin_min_orig().

◆ min_array_mbin_

int tmtt::DigitalStub::min_array_mbin_
private

Definition at line 131 of file DigitalStub.h.

Referenced by digitize(), and setCfgParams().

◆ nbinsPt_

unsigned int tmtt::DigitalStub::nbinsPt_
private

Definition at line 129 of file DigitalStub.h.

Referenced by setCfgParams().

◆ numPhiNonants_

unsigned int tmtt::DigitalStub::numPhiNonants_
private

Definition at line 117 of file DigitalStub.h.

Referenced by DigitalStub(), iNonant(), and setCfgParams().

◆ numPhiSectors_

unsigned int tmtt::DigitalStub::numPhiSectors_
private

Definition at line 116 of file DigitalStub.h.

Referenced by DigitalStub(), iNonant(), and setCfgParams().

◆ phi_GP_

double tmtt::DigitalStub::phi_GP_
private

Definition at line 160 of file DigitalStub.h.

Referenced by changePhiSec(), phi_GP(), and undigitize().

◆ phi_HT_TF_

double tmtt::DigitalStub::phi_HT_TF_
private

Definition at line 163 of file DigitalStub.h.

Referenced by changePhiSec(), checkAccuracy(), phi_HT_TF(), and undigitize().

◆ phi_orig_

double tmtt::DigitalStub::phi_orig_
private

Definition at line 139 of file DigitalStub.h.

Referenced by changePhiSec(), checkAccuracy(), DigitalStub(), and phi_orig().

◆ phiCentreSec0_

double tmtt::DigitalStub::phiCentreSec0_
private

Definition at line 122 of file DigitalStub.h.

Referenced by changePhiSec(), DigitalStub(), and setCfgParams().

◆ phiN_

double tmtt::DigitalStub::phiN_
private

Definition at line 159 of file DigitalStub.h.

Referenced by changePhiSec(), phiN(), and undigitize().

◆ phiN_orig_

double tmtt::DigitalStub::phiN_orig_
private

Definition at line 141 of file DigitalStub.h.

Referenced by changePhiSec(), DigitalStub(), digitize(), and phiN_orig().

◆ phiNBits_

unsigned int tmtt::DigitalStub::phiNBits_
private

Definition at line 103 of file DigitalStub.h.

Referenced by setCfgParams().

◆ phiNMult_

double tmtt::DigitalStub::phiNMult_
private

Definition at line 112 of file DigitalStub.h.

Referenced by changePhiSec(), digitize(), setCfgParams(), and undigitize().

◆ phiNonantCentre_

double tmtt::DigitalStub::phiNonantCentre_
private

Definition at line 125 of file DigitalStub.h.

Referenced by changePhiSec(), DigitalStub(), and undigitize().

◆ phiNonantWidth_

double tmtt::DigitalStub::phiNonantWidth_
private

Definition at line 120 of file DigitalStub.h.

Referenced by changePhiSec(), DigitalStub(), and setCfgParams().

◆ phiNRange_

double tmtt::DigitalStub::phiNRange_
private

Definition at line 104 of file DigitalStub.h.

Referenced by setCfgParams().

◆ phiS_

double tmtt::DigitalStub::phiS_
private

Definition at line 162 of file DigitalStub.h.

Referenced by changePhiSec(), phiS(), and undigitize().

◆ phiS_orig_

double tmtt::DigitalStub::phiS_orig_
private

Definition at line 140 of file DigitalStub.h.

Referenced by changePhiSec(), DigitalStub(), digitize(), and phiS_orig().

◆ phiSBits_

unsigned int tmtt::DigitalStub::phiSBits_
private

Definition at line 97 of file DigitalStub.h.

Referenced by setCfgParams().

◆ phiSectorBits_

unsigned int tmtt::DigitalStub::phiSectorBits_
private

Definition at line 96 of file DigitalStub.h.

Referenced by setCfgParams().

◆ phiSectorCentre_

double tmtt::DigitalStub::phiSectorCentre_
private

Definition at line 124 of file DigitalStub.h.

Referenced by changePhiSec(), DigitalStub(), and undigitize().

◆ phiSectorWidth_

double tmtt::DigitalStub::phiSectorWidth_
private

Definition at line 119 of file DigitalStub.h.

Referenced by changePhiSec(), DigitalStub(), and setCfgParams().

◆ phiSMult_

double tmtt::DigitalStub::phiSMult_
private

Definition at line 109 of file DigitalStub.h.

Referenced by changePhiSec(), DigitalStub(), digitize(), setCfgParams(), and undigitize().

◆ phiSRange_

double tmtt::DigitalStub::phiSRange_
private

Definition at line 98 of file DigitalStub.h.

Referenced by setCfgParams().

◆ r_GP_HT_

double tmtt::DigitalStub::r_GP_HT_
private

Definition at line 165 of file DigitalStub.h.

Referenced by checkAccuracy(), r_GP_HT(), and undigitize().

◆ r_orig_

double tmtt::DigitalStub::r_orig_
private

Definition at line 137 of file DigitalStub.h.

Referenced by checkAccuracy(), DigitalStub(), and r_orig().

◆ r_SF_TF_

double tmtt::DigitalStub::r_SF_TF_
private

Definition at line 166 of file DigitalStub.h.

Referenced by r_SF_TF(), and undigitize().

◆ rt_GP_HT_

double tmtt::DigitalStub::rt_GP_HT_
private

Definition at line 164 of file DigitalStub.h.

Referenced by rt_GP_HT(), and undigitize().

◆ rt_orig_

double tmtt::DigitalStub::rt_orig_
private

Definition at line 138 of file DigitalStub.h.

Referenced by checkInRange(), DigitalStub(), digitize(), and rt_orig().

◆ rt_SF_TF_

double tmtt::DigitalStub::rt_SF_TF_
private

Definition at line 167 of file DigitalStub.h.

Referenced by rt_SF_TF(), and undigitize().

◆ rtBits_

unsigned int tmtt::DigitalStub::rtBits_
private

Definition at line 99 of file DigitalStub.h.

Referenced by setCfgParams().

◆ rtMult_

double tmtt::DigitalStub::rtMult_
private

Definition at line 110 of file DigitalStub.h.

Referenced by DigitalStub(), digitize(), setCfgParams(), and undigitize().

◆ rtRange_

double tmtt::DigitalStub::rtRange_
private

Definition at line 100 of file DigitalStub.h.

Referenced by checkInRange(), and setCfgParams().

◆ z_

double tmtt::DigitalStub::z_
private

Definition at line 168 of file DigitalStub.h.

Referenced by checkAccuracy(), undigitize(), and z().

◆ z_orig_

double tmtt::DigitalStub::z_orig_
private

Definition at line 142 of file DigitalStub.h.

Referenced by checkAccuracy(), checkInRange(), DigitalStub(), digitize(), and z_orig().

◆ zBits_

unsigned int tmtt::DigitalStub::zBits_
private

Definition at line 101 of file DigitalStub.h.

Referenced by setCfgParams().

◆ zMult_

double tmtt::DigitalStub::zMult_
private

Definition at line 111 of file DigitalStub.h.

Referenced by DigitalStub(), digitize(), setCfgParams(), and undigitize().

◆ zRange_

double tmtt::DigitalStub::zRange_
private

Definition at line 102 of file DigitalStub.h.

Referenced by checkInRange(), and setCfgParams().