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_
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 std::string & fullPath() const
Definition: FileInPath.cc:144
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(), ALCARECOEcalPhiSym_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, createfilelist::int, fit_common_in_t::lateralities, DTGeometry::layer(), cmsdt::LHC_CLK_FREQ, LogDebug, 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, 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 
268  LogDebug("MuonPathSLFitter")
269  << "========================= SUPERLAYER PRIMITIVE =================================";
270  LogDebug("MuonPathSLFitter") << "WHEEL = " << ChId.wheel();
271  LogDebug("MuonPathSLFitter") << "SECTOR = " << ChId.sector();
272  LogDebug("MuonPathSLFitter") << "STATION = " << ChId.station();
273  LogDebug("MuonPathSLFitter") << "SUPERLAYER = " << sl;
274  LogDebug("MuonPathSLFitter") << "QUALITY = " << quality;
275  LogDebug("MuonPathSLFitter") << "POSITION = " << (double)fit_common_out.position;
276  LogDebug("MuonPathSLFitter") << "SLOPE = " << (double)fit_common_out.slope;
277 
278  auto global_coords = globalcoordsobtainer_->get_global_coordinates(
279  ChId.rawId(), sl + 1, fit_common_out.position, fit_common_out.slope);
280  float phi = global_coords[0];
281  float phiB = global_coords[1];
282 
283  // obtention of global coordinates using cmssw geometry
284  double z = 0;
285  if (ChId.station() == 3 or ChId.station() == 4) {
286  z = Z_SHIFT_MB4;
287  }
288  GlobalPoint jm_x_cmssw_global = dtGeo_->chamber(ChId)->toGlobal(LocalPoint(pos_sl_f, 0., z));
289  int thisec = ChId.sector();
290  if (thisec == 13)
291  thisec = 4;
292  if (thisec == 14)
293  thisec = 10;
294  float phi_cmssw = jm_x_cmssw_global.phi() - PHI_CONV * (thisec - 1);
295  float psi = atan(slope_f);
296  float phiB_cmssw = hasPosRF(ChId.wheel(), ChId.sector()) ? psi - phi_cmssw : -psi - phi_cmssw;
297  if (sl == 0)
298  metaPrimitives.emplace_back(metaPrimitive({MuonPathSLId.rawId(),
299  t0_f,
300  (double)(fit_common_out.position),
301  (double)fit_common_out.slope,
302  phi,
303  phiB,
304  phi_cmssw,
305  phiB_cmssw,
306  chi2_f,
307  quality,
308  inMPath->primitive(0)->channelId(),
309  inMPath->primitive(0)->tdcTimeStamp(),
310  lat_comb[0],
311  inMPath->primitive(1)->channelId(),
312  inMPath->primitive(1)->tdcTimeStamp(),
313  lat_comb[1],
314  inMPath->primitive(2)->channelId(),
315  inMPath->primitive(2)->tdcTimeStamp(),
316  lat_comb[2],
317  inMPath->primitive(3)->channelId(),
318  inMPath->primitive(3)->tdcTimeStamp(),
319  lat_comb[3],
320  -1,
321  -1,
322  -1,
323  -1,
324  -1,
325  -1,
326  -1,
327  -1,
328  -1,
329  -1,
330  -1,
331  -1,
332  -1}));
333  else if (sl == 2)
334  metaPrimitives.emplace_back(metaPrimitive({MuonPathSLId.rawId(),
335  t0_f,
336  (double)(fit_common_out.position),
337  (double)fit_common_out.slope,
338  phi,
339  phiB,
340  phi_cmssw,
341  phiB_cmssw,
342  chi2_f,
343  quality,
344  -1,
345  -1,
346  -1,
347  -1,
348  -1,
349  -1,
350  -1,
351  -1,
352  -1,
353  -1,
354  -1,
355  -1,
356  inMPath->primitive(0)->channelId(),
357  inMPath->primitive(0)->tdcTimeStamp(),
358  lat_comb[0],
359  inMPath->primitive(1)->channelId(),
360  inMPath->primitive(1)->tdcTimeStamp(),
361  lat_comb[1],
362  inMPath->primitive(2)->channelId(),
363  inMPath->primitive(2)->tdcTimeStamp(),
364  lat_comb[2],
365  inMPath->primitive(3)->channelId(),
366  inMPath->primitive(3)->tdcTimeStamp(),
367  lat_comb[3],
368  -1}));
369  else if (sl == 1) {
370  // fw-like calculation
371  DTLayerId SL2_layer2Id(MuonPathSLId, 2);
372  double z_shift = shiftthetainfo_[SL2_layer2Id.rawId()];
373  double pos_cm =
374  pos / 10 / INCREASED_RES_POS_POW; // fixed to have z_shift and the position in the same units (MC)
375  double jm_y = hasPosRF(MuonPathSLId.wheel(), MuonPathSLId.sector()) ? z_shift - pos_cm : z_shift + pos_cm;
376 
377  phi = jm_y;
378 
379  // Fixed sign of k (MC)
380  double k_fromfw = hasPosRF(MuonPathSLId.wheel(), MuonPathSLId.sector()) ? slope_f : -slope_f;
381  phiB = k_fromfw;
382 
383  // cmssw-like calculation
384  LocalPoint wire1_in_layer(dtGeo_->layer(SL2_layer2Id)->specificTopology().wirePosition(1), 0, -0.65);
385  GlobalPoint wire1_in_global = dtGeo_->layer(SL2_layer2Id)->toGlobal(wire1_in_layer);
386  LocalPoint wire1_in_sl = dtGeo_->superLayer(MuonPathSLId)->toLocal(wire1_in_global);
387  double x_shift = wire1_in_sl.x();
388  jm_y = (dtGeo_->superLayer(MuonPathSLId)
389  ->toGlobal(LocalPoint(double(pos) / (10 * pow(2, INCREASED_RES_POS)) + x_shift, 0., 0)))
390  .z();
391  phi_cmssw = jm_y;
392 
393  double x_cmssw = (dtGeo_->superLayer(MuonPathSLId)
394  ->toGlobal(LocalPoint(double(pos) / (10 * pow(2, INCREASED_RES_POS)) + x_shift, 0., 0)))
395  .x();
396  double y_cmssw = (dtGeo_->superLayer(MuonPathSLId)
397  ->toGlobal(LocalPoint(double(pos) / (10 * pow(2, INCREASED_RES_POS)) + x_shift, 0., 0)))
398  .y();
399  double r_cmssw = sqrt(x_cmssw * x_cmssw + y_cmssw * y_cmssw);
400  double k_cmssw = jm_y / r_cmssw;
401  phiB_cmssw = k_cmssw;
402 
403  metaPrimitives.emplace_back(metaPrimitive({MuonPathSLId.rawId(),
404  t0_f,
405  (double)(fit_common_out.position),
406  (double)fit_common_out.slope,
407  phi,
408  phiB,
409  phi_cmssw,
410  phiB_cmssw,
411  chi2_f,
412  quality,
413  inMPath->primitive(0)->channelId(),
414  inMPath->primitive(0)->tdcTimeStamp(),
415  lat_comb[0],
416  inMPath->primitive(1)->channelId(),
417  inMPath->primitive(1)->tdcTimeStamp(),
418  lat_comb[1],
419  inMPath->primitive(2)->channelId(),
420  inMPath->primitive(2)->tdcTimeStamp(),
421  lat_comb[2],
422  inMPath->primitive(3)->channelId(),
423  inMPath->primitive(3)->tdcTimeStamp(),
424  lat_comb[3],
425  -1,
426  -1,
427  -1,
428  -1,
429  -1,
430  -1,
431  -1,
432  -1,
433  -1,
434  -1,
435  -1,
436  -1,
437  -1}));
438  }
439  } // (fit_common_out.valid_fit == 1)
440  } // loop in lat_combs
441  return;
442 }
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
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 COEFF_WIDTH_SL_T0
Definition: constants.h:263
bool hasPosRF(int wh, int sec)
T sqrt(T t)
Definition: SSEVec.h:23
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
#define LogDebug(id)
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 444 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().

444  {
445  std::ifstream ifinsl1(sl1_filename_.fullPath());
447  while (ifinsl1.good()) {
448  ifinsl1 >> line;
449 
450  std::vector<int> myNumbers;
451  for (size_t i = 0; i < line.size(); i++) {
452  // This converts the char into an int and pushes it into vec
453  myNumbers.push_back(line[i] - '0'); // The digits will be in the same order as before
454  }
455  std::reverse(myNumbers.begin(), myNumbers.end());
456  lut_sl1.push_back(myNumbers);
457  }
458 
459  std::ifstream ifinsl2(sl2_filename_.fullPath());
460  while (ifinsl2.good()) {
461  ifinsl2 >> line;
462 
463  std::vector<int> myNumbers;
464  for (size_t i = 0; i < line.size(); i++) {
465  // This converts the char into an int and pushes it into vec
466  myNumbers.push_back(line[i] - '0'); // The digits will be in the same order as before
467  }
468  std::reverse(myNumbers.begin(), myNumbers.end());
469  lut_sl2.push_back(myNumbers);
470  }
471 
472  std::ifstream ifinsl3(sl3_filename_.fullPath());
473  while (ifinsl3.good()) {
474  ifinsl3 >> line;
475 
476  std::vector<int> myNumbers;
477  for (size_t i = 0; i < line.size(); i++) {
478  // This converts the char into an int and pushes it into vec
479  myNumbers.push_back(line[i] - '0'); // The digits will be in the same order as before
480  }
481  std::reverse(myNumbers.begin(), myNumbers.end());
482  lut_sl3.push_back(myNumbers);
483  }
484 
485  return;
486 }
std::vector< std::vector< int > > lut_sl1
std::vector< std::vector< int > > lut_sl3
edm::FileInPath sl3_filename_
edm::FileInPath sl1_filename_
const std::string & fullPath() const
Definition: FileInPath.cc:144
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 488 of file MuonPathSLFitter.cc.

References groupFilesInBlocks::reverse, and vhdl_unsigned_to_int().

Referenced by analyze().

488  {
489  std::vector<int> rom_addr;
490  auto missing_layer = inMPath->missingLayer();
491  if (missing_layer == -1) {
492  rom_addr.push_back(1);
493  rom_addr.push_back(0);
494  } else {
495  if (missing_layer == 0) {
496  rom_addr.push_back(0);
497  rom_addr.push_back(0);
498  } else if (missing_layer == 1) {
499  rom_addr.push_back(0);
500  rom_addr.push_back(1);
501  } else if (missing_layer == 2) {
502  rom_addr.push_back(1);
503  rom_addr.push_back(0);
504  } else { // missing_layer == 3
505  rom_addr.push_back(1);
506  rom_addr.push_back(1);
507  }
508  }
509  for (size_t ilat = 0; ilat < lats.size(); ilat++) {
510  if ((int)ilat == missing_layer) // only applies to 3-hit, as in 4-hit missL=-1
511  continue;
512  auto lat = lats[ilat];
513  if (lat == -1)
514  lat = 0;
515  rom_addr.push_back(lat);
516  }
517  std::reverse(rom_addr.begin(), rom_addr.end());
518  return vhdl_unsigned_to_int(rom_addr);
519 }
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().