CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
MuonPathSLFitter Class Reference

#include <MuonPathSLFitter.h>

Inheritance diagram for MuonPathSLFitter:
MuonPathFitter MuonPathAnalyzer

Public Member Functions

void finish () override
 
void initialise (const edm::EventSetup &iEventSetup) override
 
 MuonPathSLFitter (const edm::ParameterSet &pset, edm::ConsumesCollector &iC, std::shared_ptr< GlobalCoordsObtainer > &globalcoordsobtainer)
 
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, std::vector< lat_vector > &lateralities, std::vector< cmsdt::metaPrimitive > &metaPrimitives) override
 
void run (edm::Event &iEvent, const edm::EventSetup &iEventSetup, std::vector< cmsdt::metaPrimitive > &inMPaths, std::vector< cmsdt::metaPrimitive > &outMPaths) override
 
void run (edm::Event &iEvent, const edm::EventSetup &iEventSetup, MuonPathPtrs &inMpath, MuonPathPtrs &outMPath) override
 
 ~MuonPathSLFitter () override
 
- Public Member Functions inherited from MuonPathFitter
fit_common_out_t fit (fit_common_in_t fit_common_in, int XI_WIDTH, int COEFF_WIDTH_T0, int COEFF_WIDTH_POSITION, int COEFF_WIDTH_SLOPE, int PRECISSION_T0, int PRECISSION_POSITION, int PRECISSION_SLOPE, int PROD_RESIZE_T0, int PROD_RESIZE_POSITION, int PROD_RESIZE_SLOPE, int MAX_DRIFT_TDC, int sl)
 
int get_rom_addr (MuonPathPtr &inMPath, latcomb lats)
 
bool hasPosRF (int wh, int sec)
 
 MuonPathFitter (const edm::ParameterSet &pset, edm::ConsumesCollector &iC, std::shared_ptr< GlobalCoordsObtainer > &globalcoordsobtainer)
 
coeffs_t RomDataConvert (std::vector< int > slv, short COEFF_WIDTH_T0, short COEFF_WIDTH_POSITION, short COEFF_WIDTH_SLOPE, short LOLY, short HILY)
 
void setChi2Th (double chi2Th)
 
void setTanPhiTh (double tanPhiTh)
 
 ~MuonPathFitter () override
 
- Public Member Functions inherited from MuonPathAnalyzer
 MuonPathAnalyzer (const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
 
virtual ~MuonPathAnalyzer ()
 

Public Attributes

edm::FileInPath shift_theta_filename_
 
std::map< int, float > shiftthetainfo_
 
edm::FileInPath sl1_filename_
 
edm::FileInPath sl2_filename_
 
edm::FileInPath sl3_filename_
 
- Public Attributes inherited from MuonPathFitter
double chi2Th_
 
const bool debug_
 
DTGeometry const * dtGeo_
 
edm::ESGetToken< DTGeometry, MuonGeometryRecorddtGeomH
 
std::shared_ptr< GlobalCoordsObtainerglobalcoordsobtainer_
 
int max_drift_tdc = -1
 
edm::FileInPath maxdrift_filename_
 
int maxdriftinfo_ [5][4][14]
 
edm::FileInPath shift_filename_
 
std::map< int, float > shiftinfo_
 
double tanPhiTh_
 

Private Member Functions

void analyze (MuonPathPtr &inMPath, lat_vector lat_combs, std::vector< cmsdt::metaPrimitive > &metaPrimitives)
 
void fillLuts ()
 
int get_rom_addr (MuonPathPtr &inMPath, latcomb lats)
 

Private Attributes

std::vector< std::vector< int > > lut_sl1
 
std::vector< std::vector< int > > lut_sl2
 
std::vector< std::vector< int > > lut_sl3
 

Detailed Description

Definition at line 14 of file MuonPathSLFitter.h.

Constructor & Destructor Documentation

◆ MuonPathSLFitter()

MuonPathSLFitter::MuonPathSLFitter ( const edm::ParameterSet pset,
edm::ConsumesCollector iC,
std::shared_ptr< GlobalCoordsObtainer > &  globalcoordsobtainer 
)

Definition at line 11 of file MuonPathSLFitter.cc.

References MuonPathFitter::debug_, Exception, fillLuts(), edm::FileInPath::fullPath(), LogDebug, muonDTDigis_cfi::pset, nano_mu_digi_cff::rawId, MuonPathFitter::setChi2Th(), MuonPathFitter::setTanPhiTh(), edm::shift, shift_theta_filename_, shiftthetainfo_, sl1_filename_, sl2_filename_, and sl3_filename_.

14  : MuonPathFitter(pset, iC, globalcoordsobtainer) {
15  if (debug_)
16  LogDebug("MuonPathSLFitter") << "MuonPathSLFitter: constructor";
17 
18  //shift theta
19  int rawId;
20  double shift;
21  shift_theta_filename_ = pset.getParameter<edm::FileInPath>("shift_theta_filename");
22  std::ifstream ifin4(shift_theta_filename_.fullPath());
23  if (ifin4.fail()) {
24  throw cms::Exception("Missing Input File")
25  << "MuonPathSLFitter::MuonPathSLFitter() - Cannot find " << shift_theta_filename_.fullPath();
26  }
27 
28  while (ifin4.good()) {
29  ifin4 >> rawId >> shift;
31  }
32 
33  // LUTs
34  sl1_filename_ = pset.getParameter<edm::FileInPath>("lut_sl1");
35  sl2_filename_ = pset.getParameter<edm::FileInPath>("lut_sl2");
36  sl3_filename_ = pset.getParameter<edm::FileInPath>("lut_sl3");
37 
38  fillLuts();
39 
40  setChi2Th(pset.getParameter<double>("chi2Th"));
41  setTanPhiTh(pset.getParameter<double>("tanPhiTh"));
42 }
void setChi2Th(double chi2Th)
edm::FileInPath shift_theta_filename_
std::string fullPath() const
Definition: FileInPath.cc:161
void setTanPhiTh(double tanPhiTh)
MuonPathFitter(const edm::ParameterSet &pset, edm::ConsumesCollector &iC, std::shared_ptr< GlobalCoordsObtainer > &globalcoordsobtainer)
std::map< int, float > shiftthetainfo_
edm::FileInPath sl3_filename_
edm::FileInPath sl1_filename_
static unsigned int const shift
const bool debug_
edm::FileInPath sl2_filename_
#define LogDebug(id)

◆ ~MuonPathSLFitter()

MuonPathSLFitter::~MuonPathSLFitter ( )
override

Definition at line 44 of file MuonPathSLFitter.cc.

References MuonPathFitter::debug_, and LogDebug.

44  {
45  if (debug_)
46  LogDebug("MuonPathSLFitter") << "MuonPathSLFitter: destructor";
47 }
const bool debug_
#define LogDebug(id)

Member Function Documentation

◆ analyze()

void MuonPathSLFitter::analyze ( MuonPathPtr inMPath,
lat_vector  lat_combs,
std::vector< cmsdt::metaPrimitive > &  metaPrimitives 
)
private

Definition at line 96 of file MuonPathSLFitter.cc.

References funct::abs(), cmsdt::CELL_LENGTH, cmsdt::CELL_SEMIHEIGHT, cmsdt::CELL_SEMILENGTH, DTGeometry::chamber(), IntegrityClient_cfi::ChId, fit_common_in_t::coarse_bctr, fit_common_in_t::coarse_wirepos, cmsdt::COEFF_WIDTH_SL2_POSITION, cmsdt::COEFF_WIDTH_SL_POSITION, cmsdt::COEFF_WIDTH_SL_SLOPE, cmsdt::COEFF_WIDTH_SL_T0, fit_common_in_t::coeffs, MuonPathFitter::dtGeo_, MuonPathFitter::fit(), nano_mu_digi_cff::float, get_rom_addr(), MuonPathFitter::globalcoordsobtainer_, MuonPathFitter::hasPosRF(), fit_common_in_t::hits, fit_common_in_t::hits_valid, mps_fire::i, cmsdt::INCREASED_RES_POS, cmsdt::INCREASED_RES_POS_POW, cmsdt::INCREASED_RES_SLOPE_POW, createfilelist::int, fit_common_in_t::lateralities, DTGeometry::layer(), cmsdt::LHC_CLK_FREQ, lut_sl1, lut_sl2, lut_sl3, MuonPathFitter::max_drift_tdc, NUM_LAYERS, or, phi, PV3DBase< T, PVType, FrameType >::phi(), cmsdt::PHI_CONV, funct::pow(), cmsdt::PRECISSION_SL_POSITION, cmsdt::PRECISSION_SL_SLOPE, cmsdt::PRECISSION_SL_T0, cmsdt::PROD_RESIZE_SL2_POSITION, cmsdt::PROD_RESIZE_SL_POSITION, cmsdt::PROD_RESIZE_SL_SLOPE, cmsdt::PROD_RESIZE_SL_T0, quality, DetId::rawId(), MuonPathFitter::RomDataConvert(), MuonPathFitter::shiftinfo_, shiftthetainfo_, cmsdt::SL1_CELLS_OFFSET, slope, DTLayer::specificTopology(), mathSSE::sqrt(), DTGeometry::superLayer(), MuonPathFitter::tanPhiTh_, cmsdt::TIME_TO_TDC_COUNTS, GeomDet::toGlobal(), GeomDet::toLocal(), cmsdt::VERT_PHI1_PHI3, cmsdt::WIDTH_COARSED_TIME, cmsdt::WIDTH_FULL_TIME, cmsdt::WIREPOS_NORM_LSB_IGNORED, cmsdt::WIREPOS_WIDTH, DTTopology::wirePosition(), l1tPFClustersFromHGC3DClusters_cfi::wp, x, PV3DBase< T, PVType, FrameType >::x(), cmsdt::XI_SL_WIDTH, y, z, and cmsdt::Z_SHIFT_MB4.

Referenced by run().

98  {
99  auto sl = inMPath->primitive(0)->superLayerId(); // 0, 1, 2
100 
101  int selected_lay = 1;
102  if (inMPath->primitive(0)->cameraId() > 0)
103  selected_lay = 0;
104 
105  int dumLayId = inMPath->primitive(selected_lay)->cameraId();
106  auto dtDumlayerId = DTLayerId(dumLayId);
107  DTSuperLayerId MuonPathSLId(dtDumlayerId.wheel(), dtDumlayerId.station(), dtDumlayerId.sector(), sl + 1);
108 
109  DTChamberId ChId(MuonPathSLId.wheel(), MuonPathSLId.station(), MuonPathSLId.sector());
110 
111  DTSuperLayerId MuonPathSL1Id(dtDumlayerId.wheel(), dtDumlayerId.station(), dtDumlayerId.sector(), 1);
112  DTSuperLayerId MuonPathSL2Id(dtDumlayerId.wheel(), dtDumlayerId.station(), dtDumlayerId.sector(), 2);
113  DTSuperLayerId MuonPathSL3Id(dtDumlayerId.wheel(), dtDumlayerId.station(), dtDumlayerId.sector(), 3);
114  DTWireId wireIdSL1(MuonPathSL1Id, 2, 1);
115  DTWireId wireIdSL2(MuonPathSL2Id, 2, 1);
116  DTWireId wireIdSL3(MuonPathSL3Id, 2, 1);
117  auto sl_shift_cm = shiftinfo_[wireIdSL1.rawId()] - shiftinfo_[wireIdSL3.rawId()];
118 
119  fit_common_in_t fit_common_in;
120 
121  // 8-element vectors, for the 8 layers. As here we are fitting one SL only, we leave the other SL values as dummy ones
122  fit_common_in.hits = {};
123  fit_common_in.hits_valid = {};
124 
125  int quality = 3;
126  if (inMPath->missingLayer() != -1)
127  quality = 1;
128 
129  int minISL = 1;
130  int maxISL = 3;
131  if (sl < 1) {
132  minISL = 0;
133  maxISL = 2;
134  }
135 
136  for (int isl = minISL; isl < maxISL; isl++) {
137  for (int i = 0; i < NUM_LAYERS; i++) {
138  if (isl == sl && inMPath->missingLayer() != i) {
139  // Include both valid and non-valid hits. Non-valid values can be whatever, leaving all as -1 to make debugging easier.
140  auto ti = inMPath->primitive(i)->tdcTimeStamp();
141  if (ti != -1)
142  ti = (int)round(((float)TIME_TO_TDC_COUNTS / (float)LHC_CLK_FREQ) * ti);
143  auto wi = inMPath->primitive(i)->channelId();
144  auto ly = inMPath->primitive(i)->layerId();
145  // int layId = inMPath->primitive(i)->cameraId();
146  // auto dtlayerId = DTLayerId(layId);
147  // auto wireId = DTWireId(dtlayerId, wi + 1); // wire start from 1, mixer groups them starting from 0
148  // int rawId = wireId.rawId();
149  // wp in tdc counts (still in floating point)
150  int wp_semicells = (wi - SL1_CELLS_OFFSET) * 2 + 1;
151  if (ly % 2 == 1)
152  wp_semicells -= 1;
153  if (isl == 2)
154  wp_semicells -= (int)round((sl_shift_cm * 10) / CELL_SEMILENGTH);
155 
156  float wp_tdc = wp_semicells * max_drift_tdc;
157  int wp = (int)((long int)(round(wp_tdc * std::pow(2, WIREPOS_WIDTH))) / (int)std::pow(2, WIREPOS_WIDTH));
158  fit_common_in.hits.push_back({ti, wi, ly, wp});
159  // fill valids as well
160  if (inMPath->missingLayer() == i)
161  fit_common_in.hits_valid.push_back(0);
162  else
163  fit_common_in.hits_valid.push_back(1);
164  } else {
165  fit_common_in.hits.push_back({-1, -1, -1, -1});
166  fit_common_in.hits_valid.push_back(0);
167  }
168  }
169  }
170 
171  int smallest_time = 999999, tmp_coarse_wirepos_1 = -1, tmp_coarse_wirepos_3 = -1;
172  // coarse_bctr is the 12 MSB of the smallest tdc
173  for (int isl = 0; isl < 3; isl++) {
174  if (isl != sl)
175  continue;
176  int myisl = isl < 2 ? 0 : 1;
177  for (size_t i = 0; i < NUM_LAYERS; i++) {
178  if (fit_common_in.hits_valid[NUM_LAYERS * myisl + i] == 0)
179  continue;
180  else if (fit_common_in.hits[NUM_LAYERS * myisl + i].ti < smallest_time)
181  smallest_time = fit_common_in.hits[NUM_LAYERS * myisl + i].ti;
182  }
183  if (fit_common_in.hits_valid[NUM_LAYERS * myisl + 0] == 1)
184  tmp_coarse_wirepos_1 = fit_common_in.hits[NUM_LAYERS * myisl + 0].wp;
185  else
186  tmp_coarse_wirepos_1 = fit_common_in.hits[NUM_LAYERS * myisl + 1].wp;
187  if (fit_common_in.hits_valid[NUM_LAYERS * myisl + 3] == 1)
188  tmp_coarse_wirepos_3 = fit_common_in.hits[NUM_LAYERS * myisl + 3].wp;
189  else
190  tmp_coarse_wirepos_3 = fit_common_in.hits[NUM_LAYERS * myisl + 2].wp;
191 
192  tmp_coarse_wirepos_1 = tmp_coarse_wirepos_1 >> WIREPOS_NORM_LSB_IGNORED;
193  tmp_coarse_wirepos_3 = tmp_coarse_wirepos_3 >> WIREPOS_NORM_LSB_IGNORED;
194  }
195  fit_common_in.coarse_bctr = smallest_time >> (WIDTH_FULL_TIME - WIDTH_COARSED_TIME);
196  fit_common_in.coarse_wirepos = (tmp_coarse_wirepos_1 + tmp_coarse_wirepos_3) >> 1;
197 
198  for (auto &lat_comb : lat_combs) {
199  if (lat_comb[0] == 0 && lat_comb[1] == 0 && lat_comb[2] == 0 && lat_comb[3] == 0)
200  continue;
201  fit_common_in.lateralities.clear();
202 
203  auto rom_addr = get_rom_addr(inMPath, lat_comb);
204  coeffs_t coeffs;
205  if (sl == 0) {
206  coeffs =
208  } else if (sl == 1) {
209  coeffs =
211  } else {
212  coeffs =
214  }
215  // Filling lateralities
216  int minISL = 1;
217  int maxISL = 3;
218  if (sl < 1) {
219  minISL = 0;
220  maxISL = 2;
221  }
222 
223  for (int isl = minISL; isl < maxISL; isl++) {
224  for (size_t i = 0; i < NUM_LAYERS; i++) {
225  if (isl == sl) {
226  fit_common_in.lateralities.push_back(lat_comb[i]);
227  } else
228  fit_common_in.lateralities.push_back(-1);
229  }
230  }
231  fit_common_in.coeffs = coeffs;
232 
233  auto fit_common_out = fit(fit_common_in,
234  XI_SL_WIDTH,
245  sl + 1);
246 
247  if (fit_common_out.valid_fit == 1) {
248  float t0_f = ((float)fit_common_out.t0) * (float)LHC_CLK_FREQ / (float)TIME_TO_TDC_COUNTS;
249 
250  float slope_f = -fit_common_out.slope * ((float)CELL_SEMILENGTH / max_drift_tdc) * (1) / (CELL_SEMIHEIGHT * 16.);
251  if (sl != 1 && std::abs(slope_f) > tanPhiTh_)
252  continue;
253 
254  DTWireId wireId(MuonPathSLId, 2, 1);
255  float pos_ch_f = (float)(fit_common_out.position) * ((float)CELL_SEMILENGTH / (float)max_drift_tdc) / 10;
256  pos_ch_f += (SL1_CELLS_OFFSET * CELL_LENGTH) / 10.;
257  if (sl != 1)
258  pos_ch_f += shiftinfo_[wireIdSL1.rawId()];
259  else if (sl == 1)
260  pos_ch_f += shiftthetainfo_[wireIdSL2.rawId()];
261 
262  float pos_sl_f = pos_ch_f - (sl - 1) * slope_f * VERT_PHI1_PHI3 / 2;
263  float chi2_f = fit_common_out.chi2 * std::pow(((float)CELL_SEMILENGTH / (float)max_drift_tdc), 2) / 100;
264 
265  // obtention of global coordinates using luts
266  int pos = (int)(10 * (pos_sl_f - shiftinfo_[wireId.rawId()]) * INCREASED_RES_POS_POW);
267  int slope = (int)(-slope_f * INCREASED_RES_SLOPE_POW);
268 
269  auto global_coords = globalcoordsobtainer_->get_global_coordinates(ChId.rawId(), sl + 1, pos, slope);
270  float phi = global_coords[0];
271  float phiB = global_coords[1];
272 
273  // obtention of global coordinates using cmssw geometry
274  double z = 0;
275  if (ChId.station() == 3 or ChId.station() == 4) {
276  z = Z_SHIFT_MB4;
277  }
278  GlobalPoint jm_x_cmssw_global = dtGeo_->chamber(ChId)->toGlobal(LocalPoint(pos_sl_f, 0., z));
279  int thisec = ChId.sector();
280  if (thisec == 13)
281  thisec = 4;
282  if (thisec == 14)
283  thisec = 10;
284  float phi_cmssw = jm_x_cmssw_global.phi() - PHI_CONV * (thisec - 1);
285  float psi = atan(slope_f);
286  float phiB_cmssw = hasPosRF(ChId.wheel(), ChId.sector()) ? psi - phi_cmssw : -psi - phi_cmssw;
287  if (sl == 0)
288  metaPrimitives.emplace_back(metaPrimitive({MuonPathSLId.rawId(),
289  t0_f,
290  (double)(fit_common_out.position),
291  (double)fit_common_out.slope,
292  phi,
293  phiB,
294  phi_cmssw,
295  phiB_cmssw,
296  chi2_f,
297  quality,
298  inMPath->primitive(0)->channelId(),
299  inMPath->primitive(0)->tdcTimeStamp(),
300  lat_comb[0],
301  inMPath->primitive(1)->channelId(),
302  inMPath->primitive(1)->tdcTimeStamp(),
303  lat_comb[1],
304  inMPath->primitive(2)->channelId(),
305  inMPath->primitive(2)->tdcTimeStamp(),
306  lat_comb[2],
307  inMPath->primitive(3)->channelId(),
308  inMPath->primitive(3)->tdcTimeStamp(),
309  lat_comb[3],
310  -1,
311  -1,
312  -1,
313  -1,
314  -1,
315  -1,
316  -1,
317  -1,
318  -1,
319  -1,
320  -1,
321  -1,
322  -1}));
323  else if (sl == 2)
324  metaPrimitives.emplace_back(metaPrimitive({MuonPathSLId.rawId(),
325  t0_f,
326  (double)(fit_common_out.position),
327  (double)fit_common_out.slope,
328  phi,
329  phiB,
330  phi_cmssw,
331  phiB_cmssw,
332  chi2_f,
333  quality,
334  -1,
335  -1,
336  -1,
337  -1,
338  -1,
339  -1,
340  -1,
341  -1,
342  -1,
343  -1,
344  -1,
345  -1,
346  inMPath->primitive(0)->channelId(),
347  inMPath->primitive(0)->tdcTimeStamp(),
348  lat_comb[0],
349  inMPath->primitive(1)->channelId(),
350  inMPath->primitive(1)->tdcTimeStamp(),
351  lat_comb[1],
352  inMPath->primitive(2)->channelId(),
353  inMPath->primitive(2)->tdcTimeStamp(),
354  lat_comb[2],
355  inMPath->primitive(3)->channelId(),
356  inMPath->primitive(3)->tdcTimeStamp(),
357  lat_comb[3],
358  -1}));
359  else if (sl == 1) {
360  // fw-like calculation
361  DTLayerId SL2_layer2Id(MuonPathSLId, 2);
362  double z_shift = shiftthetainfo_[SL2_layer2Id.rawId()];
363  double pos_cm =
364  pos / 10 / INCREASED_RES_POS_POW; // fixed to have z_shift and the position in the same units (MC)
365  double jm_y = hasPosRF(MuonPathSLId.wheel(), MuonPathSLId.sector()) ? z_shift - pos_cm : z_shift + pos_cm;
366 
367  phi = jm_y;
368 
369  // Fixed sign of k (MC)
370  double k_fromfw = hasPosRF(MuonPathSLId.wheel(), MuonPathSLId.sector()) ? slope_f : -slope_f;
371  phiB = k_fromfw;
372 
373  // cmssw-like calculation
374  LocalPoint wire1_in_layer(dtGeo_->layer(SL2_layer2Id)->specificTopology().wirePosition(1), 0, -0.65);
375  GlobalPoint wire1_in_global = dtGeo_->layer(SL2_layer2Id)->toGlobal(wire1_in_layer);
376  LocalPoint wire1_in_sl = dtGeo_->superLayer(MuonPathSLId)->toLocal(wire1_in_global);
377  double x_shift = wire1_in_sl.x();
378  jm_y = (dtGeo_->superLayer(MuonPathSLId)
379  ->toGlobal(LocalPoint(double(pos) / (10 * pow(2, INCREASED_RES_POS)) + x_shift, 0., 0)))
380  .z();
381  phi_cmssw = jm_y;
382 
383  double x_cmssw = (dtGeo_->superLayer(MuonPathSLId)
384  ->toGlobal(LocalPoint(double(pos) / (10 * pow(2, INCREASED_RES_POS)) + x_shift, 0., 0)))
385  .x();
386  double y_cmssw = (dtGeo_->superLayer(MuonPathSLId)
387  ->toGlobal(LocalPoint(double(pos) / (10 * pow(2, INCREASED_RES_POS)) + x_shift, 0., 0)))
388  .y();
389  double r_cmssw = sqrt(x_cmssw * x_cmssw + y_cmssw * y_cmssw);
390  double k_cmssw = jm_y / r_cmssw;
391  phiB_cmssw = k_cmssw;
392 
393  metaPrimitives.emplace_back(metaPrimitive({MuonPathSLId.rawId(),
394  t0_f,
395  (double)(fit_common_out.position),
396  (double)fit_common_out.slope,
397  phi,
398  phiB,
399  phi_cmssw,
400  phiB_cmssw,
401  chi2_f,
402  quality,
403  inMPath->primitive(0)->channelId(),
404  inMPath->primitive(0)->tdcTimeStamp(),
405  lat_comb[0],
406  inMPath->primitive(1)->channelId(),
407  inMPath->primitive(1)->tdcTimeStamp(),
408  lat_comb[1],
409  inMPath->primitive(2)->channelId(),
410  inMPath->primitive(2)->tdcTimeStamp(),
411  lat_comb[2],
412  inMPath->primitive(3)->channelId(),
413  inMPath->primitive(3)->tdcTimeStamp(),
414  lat_comb[3],
415  -1,
416  -1,
417  -1,
418  -1,
419  -1,
420  -1,
421  -1,
422  -1,
423  -1,
424  -1,
425  -1,
426  -1,
427  -1}));
428  }
429  } // (fit_common_out.valid_fit == 1)
430  } // loop in lat_combs
431  return;
432 }
constexpr int COEFF_WIDTH_SL_POSITION
Definition: constants.h:264
std::vector< int > lateralities
std::vector< SLhitP > hits
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
constexpr int PROD_RESIZE_SL2_POSITION
Definition: constants.h:274
constexpr int PROD_RESIZE_SL_SLOPE
Definition: constants.h:275
constexpr int PRECISSION_SL_POSITION
Definition: constants.h:269
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
static const double slope[3]
int get_rom_addr(MuonPathPtr &inMPath, latcomb lats)
constexpr int WIDTH_COARSED_TIME
Definition: constants.h:252
constexpr int PROD_RESIZE_SL_POSITION
Definition: constants.h:273
constexpr int WIREPOS_WIDTH
Definition: constants.h:257
std::map< std::string, int, std::less< std::string > > psi
std::map< int, float > shiftinfo_
constexpr int CELL_LENGTH
Definition: constants.h:313
constexpr int CELL_SEMILENGTH
Definition: constants.h:314
string quality
T x() const
Definition: PV3DBase.h:59
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.
Definition: DTGeometry.cc:92
constexpr int INCREASED_RES_SLOPE_POW
Definition: constants.h:416
constexpr int COEFF_WIDTH_SL_T0
Definition: constants.h:263
bool hasPosRF(int wh, int sec)
T sqrt(T t)
Definition: SSEVec.h:19
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
constexpr int SL1_CELLS_OFFSET
Definition: constants.h:247
constexpr int COEFF_WIDTH_SL_SLOPE
Definition: constants.h:266
constexpr float Z_SHIFT_MB4
Definition: constants.h:397
std::vector< std::vector< int > > lut_sl1
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr int WIDTH_FULL_TIME
Definition: constants.h:251
std::vector< std::vector< int > > lut_sl3
const DTTopology & specificTopology() const
Definition: DTLayer.cc:37
std::map< int, float > shiftthetainfo_
std::shared_ptr< GlobalCoordsObtainer > globalcoordsobtainer_
coeffs_t RomDataConvert(std::vector< int > slv, short COEFF_WIDTH_T0, short COEFF_WIDTH_POSITION, short COEFF_WIDTH_SLOPE, short LOLY, short HILY)
constexpr float CELL_SEMIHEIGHT
Definition: constants.h:312
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
constexpr double PHI_CONV
Definition: constants.h:394
constexpr int COEFF_WIDTH_SL2_POSITION
Definition: constants.h:265
constexpr int TIME_TO_TDC_COUNTS
Definition: constants.h:235
constexpr int PROD_RESIZE_SL_T0
Definition: constants.h:272
constexpr float VERT_PHI1_PHI3
Definition: constants.h:324
constexpr int LHC_CLK_FREQ
Definition: constants.h:222
constexpr int PRECISSION_SL_T0
Definition: constants.h:268
constexpr int PRECISSION_SL_SLOPE
Definition: constants.h:270
constexpr int XI_SL_WIDTH
Definition: constants.h:261
DTGeometry const * dtGeo_
constexpr int INCREASED_RES_POS_POW
Definition: constants.h:415
constexpr int WIREPOS_NORM_LSB_IGNORED
Definition: constants.h:258
fit_common_out_t fit(fit_common_in_t fit_common_in, int XI_WIDTH, int COEFF_WIDTH_T0, int COEFF_WIDTH_POSITION, int COEFF_WIDTH_SLOPE, int PRECISSION_T0, int PRECISSION_POSITION, int PRECISSION_SLOPE, int PROD_RESIZE_T0, int PROD_RESIZE_POSITION, int PROD_RESIZE_SLOPE, int MAX_DRIFT_TDC, int sl)
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
std::vector< int > hits_valid
std::vector< std::vector< int > > lut_sl2
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:63
constexpr int INCREASED_RES_POS
Definition: constants.h:411
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96

◆ fillLuts()

void MuonPathSLFitter::fillLuts ( )
private

Definition at line 434 of file MuonPathSLFitter.cc.

References edm::FileInPath::fullPath(), mps_fire::i, mps_splice::line, lut_sl1, lut_sl2, lut_sl3, groupFilesInBlocks::reverse, sl1_filename_, sl2_filename_, sl3_filename_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by MuonPathSLFitter().

434  {
435  std::ifstream ifinsl1(sl1_filename_.fullPath());
437  while (ifinsl1.good()) {
438  ifinsl1 >> line;
439 
440  std::vector<int> myNumbers;
441  for (size_t i = 0; i < line.size(); i++) {
442  // This converts the char into an int and pushes it into vec
443  myNumbers.push_back(line[i] - '0'); // The digits will be in the same order as before
444  }
445  std::reverse(myNumbers.begin(), myNumbers.end());
446  lut_sl1.push_back(myNumbers);
447  }
448 
449  std::ifstream ifinsl2(sl2_filename_.fullPath());
450  while (ifinsl2.good()) {
451  ifinsl2 >> line;
452 
453  std::vector<int> myNumbers;
454  for (size_t i = 0; i < line.size(); i++) {
455  // This converts the char into an int and pushes it into vec
456  myNumbers.push_back(line[i] - '0'); // The digits will be in the same order as before
457  }
458  std::reverse(myNumbers.begin(), myNumbers.end());
459  lut_sl2.push_back(myNumbers);
460  }
461 
462  std::ifstream ifinsl3(sl3_filename_.fullPath());
463  while (ifinsl3.good()) {
464  ifinsl3 >> line;
465 
466  std::vector<int> myNumbers;
467  for (size_t i = 0; i < line.size(); i++) {
468  // This converts the char into an int and pushes it into vec
469  myNumbers.push_back(line[i] - '0'); // The digits will be in the same order as before
470  }
471  std::reverse(myNumbers.begin(), myNumbers.end());
472  lut_sl3.push_back(myNumbers);
473  }
474 
475  return;
476 }
std::string fullPath() const
Definition: FileInPath.cc:161
std::vector< std::vector< int > > lut_sl1
std::vector< std::vector< int > > lut_sl3
edm::FileInPath sl3_filename_
edm::FileInPath sl1_filename_
edm::FileInPath sl2_filename_
std::vector< std::vector< int > > lut_sl2

◆ finish()

void MuonPathSLFitter::finish ( )
overridevirtual

Reimplemented from MuonPathAnalyzer.

Definition at line 87 of file MuonPathSLFitter.cc.

References MuonPathFitter::debug_, and LogDebug.

Referenced by progressbar.ProgressBar::__next__().

87  {
88  if (debug_)
89  LogDebug("MuonPathSLFitter") << "MuonPathSLFitter: finish";
90 };
const bool debug_
#define LogDebug(id)

◆ get_rom_addr()

int MuonPathSLFitter::get_rom_addr ( MuonPathPtr inMPath,
latcomb  lats 
)
private

Definition at line 478 of file MuonPathSLFitter.cc.

References groupFilesInBlocks::reverse, and vhdl_unsigned_to_int().

Referenced by analyze().

478  {
479  std::vector<int> rom_addr;
480  auto missing_layer = inMPath->missingLayer();
481  if (missing_layer == -1) {
482  rom_addr.push_back(1);
483  rom_addr.push_back(0);
484  } else {
485  if (missing_layer == 0) {
486  rom_addr.push_back(0);
487  rom_addr.push_back(0);
488  } else if (missing_layer == 1) {
489  rom_addr.push_back(0);
490  rom_addr.push_back(1);
491  } else if (missing_layer == 2) {
492  rom_addr.push_back(1);
493  rom_addr.push_back(0);
494  } else { // missing_layer == 3
495  rom_addr.push_back(1);
496  rom_addr.push_back(1);
497  }
498  }
499  for (size_t ilat = 0; ilat < lats.size(); ilat++) {
500  if ((int)ilat == missing_layer) // only applies to 3-hit, as in 4-hit missL=-1
501  continue;
502  auto lat = lats[ilat];
503  if (lat == -1)
504  lat = 0;
505  rom_addr.push_back(lat);
506  }
507  std::reverse(rom_addr.begin(), rom_addr.end());
508  return vhdl_unsigned_to_int(rom_addr);
509 }
int vhdl_unsigned_to_int(std::vector< int > v)

◆ initialise()

void MuonPathSLFitter::initialise ( const edm::EventSetup iEventSetup)
overridevirtual

Reimplemented from MuonPathAnalyzer.

Definition at line 52 of file MuonPathSLFitter.cc.

References MuonPathFitter::debug_, MuonPathFitter::dtGeo_, MuonPathFitter::dtGeomH, relativeConstraints::geom, edm::EventSetup::getHandle(), and LogDebug.

52  {
53  if (debug_)
54  LogDebug("MuonPathSLFitter") << "MuonPathSLFitter::initialiase";
55 
56  auto geom = iEventSetup.getHandle(dtGeomH);
57  dtGeo_ = &(*geom);
58 }
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomH
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
DTGeometry const * dtGeo_
const bool debug_
#define LogDebug(id)

◆ run() [1/4]

void MuonPathSLFitter::run ( edm::Event iEvent,
const edm::EventSetup iEventSetup,
MuonPathPtrs inMpath,
std::vector< cmsdt::metaPrimitive > &  metaPrimitives 
)
inlineoverridevirtual

Implements MuonPathAnalyzer.

Definition at line 24 of file MuonPathSLFitter.h.

27  {};

◆ run() [2/4]

void MuonPathSLFitter::run ( edm::Event iEvent,
const edm::EventSetup iEventSetup,
MuonPathPtrs inMpath,
std::vector< lat_vector > &  lateralities,
std::vector< cmsdt::metaPrimitive > &  metaPrimitives 
)
overridevirtual

Implements MuonPathAnalyzer.

Definition at line 60 of file MuonPathSLFitter.cc.

References analyze(), MuonPathFitter::debug_, mps_fire::i, LogDebug, MuonPathFitter::max_drift_tdc, MuonPathFitter::maxdriftinfo_, nano_mu_digi_cff::rawId, DTChamberId::sector(), DTChamberId::station(), and DTChamberId::wheel().

64  {
65  if (debug_)
66  LogDebug("MuonPathSLFitter") << "MuonPathSLFitter: run";
67 
68  // fit per SL (need to allow for multiple outputs for a single mpath)
69  // for (auto &muonpath : muonpaths) {
70  if (!muonpaths.empty()) {
71  auto muonpath = muonpaths[0];
72  int rawId = muonpath->primitive(0)->cameraId();
73  if (muonpath->primitive(0)->cameraId() == -1) {
74  rawId = muonpath->primitive(1)->cameraId();
75  }
76  const DTLayerId dtLId(rawId);
77  max_drift_tdc = maxdriftinfo_[dtLId.wheel() + 2][dtLId.station() - 1][dtLId.sector() - 1];
78  }
79 
80  for (size_t i = 0; i < muonpaths.size(); i++) {
81  auto muonpath = muonpaths[i];
82  auto lats = lateralities[i];
83  analyze(muonpath, lats, metaPrimitives);
84  }
85 }
int maxdriftinfo_[5][4][14]
void analyze(MuonPathPtr &inMPath, lat_vector lat_combs, std::vector< cmsdt::metaPrimitive > &metaPrimitives)
const bool debug_
#define LogDebug(id)

◆ run() [3/4]

void MuonPathSLFitter::run ( edm::Event iEvent,
const edm::EventSetup iEventSetup,
std::vector< cmsdt::metaPrimitive > &  inMPaths,
std::vector< cmsdt::metaPrimitive > &  outMPaths 
)
inlineoverridevirtual

Implements MuonPathAnalyzer.

Definition at line 33 of file MuonPathSLFitter.h.

36  {};

◆ run() [4/4]

void MuonPathSLFitter::run ( edm::Event iEvent,
const edm::EventSetup iEventSetup,
MuonPathPtrs inMpath,
MuonPathPtrs outMPath 
)
inlineoverridevirtual

Implements MuonPathAnalyzer.

Definition at line 37 of file MuonPathSLFitter.h.

40  {};

Member Data Documentation

◆ lut_sl1

std::vector<std::vector<int> > MuonPathSLFitter::lut_sl1
private

Definition at line 64 of file MuonPathSLFitter.h.

Referenced by analyze(), and fillLuts().

◆ lut_sl2

std::vector<std::vector<int> > MuonPathSLFitter::lut_sl2
private

Definition at line 65 of file MuonPathSLFitter.h.

Referenced by analyze(), and fillLuts().

◆ lut_sl3

std::vector<std::vector<int> > MuonPathSLFitter::lut_sl3
private

Definition at line 66 of file MuonPathSLFitter.h.

Referenced by analyze(), and fillLuts().

◆ shift_theta_filename_

edm::FileInPath MuonPathSLFitter::shift_theta_filename_

Definition at line 47 of file MuonPathSLFitter.h.

Referenced by MuonPathSLFitter().

◆ shiftthetainfo_

std::map<int, float> MuonPathSLFitter::shiftthetainfo_

Definition at line 48 of file MuonPathSLFitter.h.

Referenced by analyze(), and MuonPathSLFitter().

◆ sl1_filename_

edm::FileInPath MuonPathSLFitter::sl1_filename_

Definition at line 51 of file MuonPathSLFitter.h.

Referenced by fillLuts(), and MuonPathSLFitter().

◆ sl2_filename_

edm::FileInPath MuonPathSLFitter::sl2_filename_

Definition at line 52 of file MuonPathSLFitter.h.

Referenced by fillLuts(), and MuonPathSLFitter().

◆ sl3_filename_

edm::FileInPath MuonPathSLFitter::sl3_filename_

Definition at line 53 of file MuonPathSLFitter.h.

Referenced by fillLuts(), and MuonPathSLFitter().