CMS 3D CMS Logo

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

#include <MuonPathAssociator.h>

Public Member Functions

void finish ()
 
void initialise (const edm::EventSetup &iEventSetup)
 
bool isNotAPrimo (cmsdt::metaPrimitive first, cmsdt::metaPrimitive second)
 
 MuonPathAssociator (const edm::ParameterSet &pset, edm::ConsumesCollector &iC, std::shared_ptr< GlobalCoordsObtainer > &globalcoordsobtainer)
 
void printmPC (cmsdt::metaPrimitive mP)
 
void removeSharingFits (std::vector< cmsdt::metaPrimitive > &chamberMPaths, std::vector< cmsdt::metaPrimitive > &allMPaths)
 
void removeSharingHits (std::vector< cmsdt::metaPrimitive > &firstMPaths, std::vector< cmsdt::metaPrimitive > &secondMPaths, std::vector< cmsdt::metaPrimitive > &allMPaths)
 
void run (edm::Event &iEvent, const edm::EventSetup &iEventSetup, edm::Handle< DTDigiCollection > digis, std::vector< cmsdt::metaPrimitive > &inMPaths, std::vector< cmsdt::metaPrimitive > &outMPaths)
 
bool shareFit (cmsdt::metaPrimitive first, cmsdt::metaPrimitive second)
 
 ~MuonPathAssociator ()
 

Public Attributes

const DTGeometrydtGeo_
 
edm::ESGetToken< DTGeometry, MuonGeometryRecorddtGeomH_
 

Private Member Functions

void correlateMPaths (edm::Handle< DTDigiCollection > digis, std::vector< cmsdt::metaPrimitive > &inMPaths, std::vector< cmsdt::metaPrimitive > &outMPaths)
 
bool hasPosRF (int wh, int sec)
 

Private Attributes

bool allow_confirmation_
 
double chi2corTh_
 
bool clean_chi2_correlation_
 
bool cmssw_for_global_
 
double dBX_correlate_TP_
 
bool debug_
 
double dT0_correlate_TP_
 
double dTanPsi_correlate_TP_
 
std::string geometry_tag_
 
std::shared_ptr< GlobalCoordsObtainerglobalcoordsobtainer_
 
double minx_match_2digis_
 
edm::FileInPath shift_filename_
 
std::map< int, float > shiftinfo_
 
bool useBX_correlation_
 

Detailed Description

Definition at line 35 of file MuonPathAssociator.h.

Constructor & Destructor Documentation

◆ MuonPathAssociator()

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

Definition at line 13 of file MuonPathAssociator.cc.

15  {
16  // Obtention of parameters
17  debug_ = pset.getUntrackedParameter<bool>("debug");
18  clean_chi2_correlation_ = pset.getUntrackedParameter<bool>("clean_chi2_correlation");
19  useBX_correlation_ = pset.getUntrackedParameter<bool>("useBX_correlation");
20  allow_confirmation_ = pset.getUntrackedParameter<bool>("allow_confirmation");
21  dT0_correlate_TP_ = pset.getUntrackedParameter<double>("dT0_correlate_TP");
22  dBX_correlate_TP_ = pset.getUntrackedParameter<int>("dBX_correlate_TP");
23  dTanPsi_correlate_TP_ = pset.getUntrackedParameter<double>("dTanPsi_correlate_TP");
24  minx_match_2digis_ = pset.getUntrackedParameter<double>("minx_match_2digis");
25  chi2corTh_ = pset.getUntrackedParameter<double>("chi2corTh");
26  cmssw_for_global_ = pset.getUntrackedParameter<bool>("cmssw_for_global");
27  geometry_tag_ = pset.getUntrackedParameter<std::string>("geometry_tag");
28 
29  if (debug_)
30  LogDebug("MuonPathAssociator") << "MuonPathAssociator: constructor";
31 
32  //shift
33  int rawId;
34  shift_filename_ = pset.getParameter<edm::FileInPath>("shift_filename");
35  std::ifstream ifin3(shift_filename_.fullPath());
36  double shift;
37  if (ifin3.fail()) {
38  throw cms::Exception("Missing Input File")
39  << "MuonPathAnalyzerPerSL::MuonPathAnalyzerPerSL() - Cannot find " << shift_filename_.fullPath();
40  }
41  while (ifin3.good()) {
42  ifin3 >> rawId >> shift;
43  shiftinfo_[rawId] = shift;
44  }
45 
47  globalcoordsobtainer_ = globalcoordsobtainer;
48 }

References edm::BeginRun, edm::ConsumesCollector::esConsumes(), Exception, LogDebug, muonDTDigis_cfi::pset, edm::shift, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~MuonPathAssociator()

MuonPathAssociator::~MuonPathAssociator ( )

Definition at line 50 of file MuonPathAssociator.cc.

50  {
51  if (debug_)
52  LogDebug("MuonPathAssociator") << "MuonPathAssociator: destructor";
53 }

References LogDebug.

Member Function Documentation

◆ correlateMPaths()

void MuonPathAssociator::correlateMPaths ( edm::Handle< DTDigiCollection digis,
std::vector< cmsdt::metaPrimitive > &  inMPaths,
std::vector< cmsdt::metaPrimitive > &  outMPaths 
)
private

Definition at line 84 of file MuonPathAssociator.cc.

86  {
87  if (debug_)
88  LogDebug("MuonPathAssociator") << "starting correlation";
89 
90  for (int wh = -2; wh <= 2; wh++) { //wheel num: -2, -1, 0, +1, +2
91  for (int st = 1; st <= 4; st++) { //station num (MB): 1, 2, 3, 4
92  for (int se = 1; se <= 14; se++) { //sector number: 1-12, special sectors 13, 14 to account for bigger MB4s
93  if (se >= 13 && st != 4)
94  continue;
95 
96  DTChamberId ChId(wh, st, se);
97  DTSuperLayerId sl1Id(wh, st, se, 1);
98  DTSuperLayerId sl3Id(wh, st, se, 3);
99 
100  //filterSL1
101  std::vector<metaPrimitive> SL1metaPrimitives;
102  for (const auto &metaprimitiveIt : inMPaths) {
103  if (metaprimitiveIt.rawId == sl1Id.rawId())
104  SL1metaPrimitives.push_back(metaprimitiveIt);
105  }
106 
107  //filterSL3
108  std::vector<metaPrimitive> SL3metaPrimitives;
109  for (const auto &metaprimitiveIt : inMPaths) {
110  if (metaprimitiveIt.rawId == sl3Id.rawId())
111  SL3metaPrimitives.push_back(metaprimitiveIt);
112  }
113 
114  if (SL1metaPrimitives.empty() and SL3metaPrimitives.empty())
115  continue;
116 
117  if (debug_)
118  LogDebug("MuonPathAssociator") << "correlating " << SL1metaPrimitives.size() << " metaPrim in SL1 and "
119  << SL3metaPrimitives.size() << " in SL3 for " << sl3Id;
120 
121  bool at_least_one_correlation = false;
122  bool at_least_one_SL1_confirmation = false;
123  bool at_least_one_SL3_confirmation = false;
124 
125  bool useFitSL1[SL1metaPrimitives.size()];
126  for (unsigned int i = 0; i < SL1metaPrimitives.size(); i++)
127  useFitSL1[i] = false;
128  bool useFitSL3[SL3metaPrimitives.size()];
129  for (unsigned int i = 0; i < SL3metaPrimitives.size(); i++)
130  useFitSL3[i] = false;
131 
132  //SL1-SL3
133  vector<metaPrimitive> chamberMetaPrimitives;
134  vector<metaPrimitive> confirmedMetaPrimitives;
135  vector<metaPrimitive> normalMetaPrimitives;
136  int sl1 = 0;
137  int sl3 = 0;
138  for (auto SL1metaPrimitive = SL1metaPrimitives.begin(); SL1metaPrimitive != SL1metaPrimitives.end();
139  ++SL1metaPrimitive, sl1++, sl3 = -1) {
141  at_least_one_correlation = false;
142  for (auto SL3metaPrimitive = SL3metaPrimitives.begin(); SL3metaPrimitive != SL3metaPrimitives.end();
143  ++SL3metaPrimitive, sl3++) {
144  if (std::abs(SL1metaPrimitive->tanPhi - SL3metaPrimitive->tanPhi) > dTanPsi_correlate_TP_)
145  continue; //TanPsi match, SliceTest only
146  if (useBX_correlation_) {
147  if (abs(round(SL1metaPrimitive->t0 / (float)LHC_CLK_FREQ) -
148  round(SL3metaPrimitive->t0 / (float)LHC_CLK_FREQ)) > dBX_correlate_TP_)
149  continue; //BX match
150  } else {
151  if (std::abs(SL1metaPrimitive->t0 - SL3metaPrimitive->t0) >= dT0_correlate_TP_)
152  continue; //time match
153  }
154  long int PosSL1 = (int)round(INCREASED_RES_POS_POW * 10 * SL1metaPrimitive->x);
155  long int PosSL3 = (int)round(INCREASED_RES_POS_POW * 10 * SL3metaPrimitive->x);
156  double NewSlope = -999.;
157 
158  long int pos = (PosSL3 + PosSL1) / 2;
159  // FW always rounds down (e.g 29.5 -> 29, -29.5 -> -30). For negative numbers, we don't do the same.
160  // Let's fix it (this also happens for the slope)
161  if (((PosSL3 + PosSL1) % 2 != 0) && (pos < 0)) {
162  pos--;
163  }
164 
165  long int difPos_mm_x4 = PosSL3 - PosSL1;
166  long int tanPsi_x4096_x128 = (difPos_mm_x4)*VERT_PHI1_PHI3_INV;
167  long int tanpsi = tanPsi_x4096_x128 / ((long int)pow(2, 5 + INCREASED_RES_POS));
168  if (tanpsi < 0 && tanPsi_x4096_x128 % ((long int)pow(2, 5 + INCREASED_RES_POS)) != 0)
169  tanpsi--;
170  NewSlope = -tanpsi / (double)INCREASED_RES_SLOPE_POW;
171  double MeanT0 = (SL1metaPrimitive->t0 + SL3metaPrimitive->t0) / 2;
172  double MeanPos = (PosSL3 + PosSL1) / (2. * INCREASED_RES_POS_POW * 10);
173 
174  DTSuperLayerId SLId1(SL1metaPrimitive->rawId);
175  DTSuperLayerId SLId3(SL3metaPrimitive->rawId);
176  DTWireId wireId1(SLId1, 2, 1);
177  DTWireId wireId3(SLId3, 2, 1);
178 
179  int shift_sl1 = int(round(shiftinfo_[wireId1.rawId()] * INCREASED_RES_POS_POW * 10));
180  int shift_sl3 = int(round(shiftinfo_[wireId3.rawId()] * INCREASED_RES_POS_POW * 10));
181  if (shift_sl1 < shift_sl3) {
182  pos -= shift_sl1;
183  } else
184  pos -= shift_sl3;
185 
186  int wi[8], tdc[8], lat[8];
187  wi[0] = SL1metaPrimitive->wi1;
188  tdc[0] = SL1metaPrimitive->tdc1;
189  lat[0] = SL1metaPrimitive->lat1;
190  wi[1] = SL1metaPrimitive->wi2;
191  tdc[1] = SL1metaPrimitive->tdc2;
192  lat[1] = SL1metaPrimitive->lat2;
193  wi[2] = SL1metaPrimitive->wi3;
194  tdc[2] = SL1metaPrimitive->tdc3;
195  lat[2] = SL1metaPrimitive->lat3;
196  wi[3] = SL1metaPrimitive->wi4;
197  tdc[3] = SL1metaPrimitive->tdc4;
198  lat[3] = SL1metaPrimitive->lat4;
199  wi[4] = SL3metaPrimitive->wi1;
200  tdc[4] = SL3metaPrimitive->tdc1;
201  lat[4] = SL3metaPrimitive->lat1;
202  wi[5] = SL3metaPrimitive->wi2;
203  tdc[5] = SL3metaPrimitive->tdc2;
204  lat[5] = SL3metaPrimitive->lat2;
205  wi[6] = SL3metaPrimitive->wi3;
206  tdc[6] = SL3metaPrimitive->tdc3;
207  lat[6] = SL3metaPrimitive->lat3;
208  wi[7] = SL3metaPrimitive->wi4;
209  tdc[7] = SL3metaPrimitive->tdc4;
210  lat[7] = SL3metaPrimitive->lat4;
211 
212  long int chi2 = 0;
213 
214  long int Z_FACTOR_CORR[8] = {-6, -2, 2, 6, -6, -2, 2, 6};
215 
216  for (int i = 0; i < 8; i++) {
217  int sign = 2 * (i / 4) - 1;
218  Z_FACTOR_CORR[i] = Z_FACTOR_CORR[i] * CELL_HEIGHT + CH_CENTER_TO_MID_SL_X2 * sign;
219  }
220  long int sum_A, sum_B;
221  for (int i = 0; i < NUM_LAYERS_2SL; i++) {
222  long int shift, slTime;
223  if (i / NUM_LAYERS == 0) { // layers 0 - 3 -> SL1
224  shift = shift_sl1;
225  slTime = SL1metaPrimitive->t0;
226  } else { // layers 4 - 7 -> SL3
227  shift = shift_sl3;
228  slTime = SL3metaPrimitive->t0;
229  }
230  if (wi[i] != -1) {
231  long int drift_dist_um_x4 = DRIFT_SPEED_X4 * (((long int)tdc[i]) - slTime);
232  long int wireHorizPos_x4 =
233  (CELL_LENGTH * wi[i] + ((i + 1) % 2) * CELL_SEMILENGTH) * INCREASED_RES_POS_POW;
234  long int pos_mm_x4;
235 
236  if (lat[i] == 0) {
237  pos_mm_x4 = wireHorizPos_x4 - (drift_dist_um_x4 >> 10);
238  } else {
239  pos_mm_x4 = wireHorizPos_x4 + (drift_dist_um_x4 >> 10);
240  }
241  sum_A = shift + pos_mm_x4 - (long int)round(MeanPos * 10 * INCREASED_RES_POS_POW);
242  sum_A = sum_A << (14 - INCREASED_RES_POS);
243  sum_B = Z_FACTOR_CORR[i] * (long int)round(-NewSlope * INCREASED_RES_SLOPE_POW);
244  chi2 += ((sum_A - sum_B) * (sum_A - sum_B)) >> 2;
245  }
246  }
247 
248  double newChi2 = (double)(chi2 >> INCREASED_RES_POS_POW) / (1024. * 100.);
249 
250  if (newChi2 > chi2corTh_)
251  continue;
252 
253  // Fill the used vectors
254  useFitSL1[sl1] = true;
255  useFitSL3[sl3] = true;
256 
257  int quality = 0;
258  if (SL3metaPrimitive->quality == LOWQ and SL1metaPrimitive->quality == LOWQ)
259  quality = LOWLOWQ;
260 
261  if ((SL3metaPrimitive->quality == HIGHQ && SL1metaPrimitive->quality == LOWQ) or
262  (SL1metaPrimitive->quality == HIGHQ && SL3metaPrimitive->quality == LOWQ))
263  quality = HIGHLOWQ;
264 
265  if (SL3metaPrimitive->quality == HIGHQ && SL1metaPrimitive->quality == HIGHQ)
266  quality = HIGHHIGHQ;
267 
268  double phi = -999.;
269  double phiB = -999.;
270  if (cmssw_for_global_) {
271  double z = 0;
272  if (ChId.station() >= 3)
273  z = Z_SHIFT_MB4;
274  GlobalPoint jm_x_cmssw_global = dtGeo_->chamber(ChId)->toGlobal(
275  LocalPoint(MeanPos, 0., z)); //Jm_x is already extrapolated to the middle of the SL
276  int thisec = ChId.sector();
277  if (se == 13)
278  thisec = 4;
279  if (se == 14)
280  thisec = 10;
281  phi = jm_x_cmssw_global.phi() - PHI_CONV * (thisec - 1);
282  double psi = atan(NewSlope);
283  phiB = hasPosRF(ChId.wheel(), ChId.sector()) ? psi - phi : -psi - phi;
284  } else {
285  auto global_coords = globalcoordsobtainer_->get_global_coordinates(ChId.rawId(), 0, pos, tanpsi);
286 
287  phi = global_coords[0];
288  phiB = global_coords[1];
289  }
290 
292  outMPaths.emplace_back(ChId.rawId(),
293  MeanT0,
294  MeanPos,
295  NewSlope,
296  phi,
297  phiB,
298  newChi2,
299  quality,
300  SL1metaPrimitive->wi1,
301  SL1metaPrimitive->tdc1,
302  SL1metaPrimitive->lat1,
303  SL1metaPrimitive->wi2,
304  SL1metaPrimitive->tdc2,
305  SL1metaPrimitive->lat2,
306  SL1metaPrimitive->wi3,
307  SL1metaPrimitive->tdc3,
308  SL1metaPrimitive->lat3,
309  SL1metaPrimitive->wi4,
310  SL1metaPrimitive->tdc4,
311  SL1metaPrimitive->lat4,
312  SL3metaPrimitive->wi1,
313  SL3metaPrimitive->tdc1,
314  SL3metaPrimitive->lat1,
315  SL3metaPrimitive->wi2,
316  SL3metaPrimitive->tdc2,
317  SL3metaPrimitive->lat2,
318  SL3metaPrimitive->wi3,
319  SL3metaPrimitive->tdc3,
320  SL3metaPrimitive->lat3,
321  SL3metaPrimitive->wi4,
322  SL3metaPrimitive->tdc4,
323  SL3metaPrimitive->lat4);
324  else
325  chamberMetaPrimitives.emplace_back(ChId.rawId(),
326  MeanT0,
327  MeanPos,
328  NewSlope,
329  phi,
330  phiB,
331  newChi2,
332  quality,
333  SL1metaPrimitive->wi1,
334  SL1metaPrimitive->tdc1,
335  SL1metaPrimitive->lat1,
336  SL1metaPrimitive->wi2,
337  SL1metaPrimitive->tdc2,
338  SL1metaPrimitive->lat2,
339  SL1metaPrimitive->wi3,
340  SL1metaPrimitive->tdc3,
341  SL1metaPrimitive->lat3,
342  SL1metaPrimitive->wi4,
343  SL1metaPrimitive->tdc4,
344  SL1metaPrimitive->lat4,
345  SL3metaPrimitive->wi1,
346  SL3metaPrimitive->tdc1,
347  SL3metaPrimitive->lat1,
348  SL3metaPrimitive->wi2,
349  SL3metaPrimitive->tdc2,
350  SL3metaPrimitive->lat2,
351  SL3metaPrimitive->wi3,
352  SL3metaPrimitive->tdc3,
353  SL3metaPrimitive->lat3,
354  SL3metaPrimitive->wi4,
355  SL3metaPrimitive->tdc4,
356  SL3metaPrimitive->lat4);
357 
358  at_least_one_correlation = true;
359  }
360 
361  if (at_least_one_correlation == false &&
362  allow_confirmation_ == true) { //no correlation was found, trying with pairs of two digis in the other SL
363  int matched_digis = 0;
364  double minx = minx_match_2digis_;
365  double min2x = minx_match_2digis_;
366  int best_tdc = -1;
367  int next_tdc = -1;
368  int best_wire = -1;
369  int next_wire = -1;
370  int best_layer = -1;
371  int next_layer = -1;
372  int best_lat = -1;
373  int next_lat = -1;
374  int lat = -1;
375  for (const auto &dtLayerId_It : *dtdigis) {
376  const DTLayerId dtLId = dtLayerId_It.first;
377  // creating a new DTSuperLayerId object to compare with the required SL id
378  const DTSuperLayerId dtSLId(dtLId.wheel(), dtLId.station(), dtLId.sector(), 3);
379  if (dtSLId.rawId() != sl3Id.rawId())
380  continue;
381  double l_shift = 0;
382  if (dtLId.layer() == 4)
383  l_shift = X_POS_L4;
384  else if (dtLId.layer() == 3)
385  l_shift = X_POS_L3;
386  else if (dtLId.layer() == 2)
387  l_shift = -1 * X_POS_L3;
388  else if (dtLId.layer() == 1)
389  l_shift = -1 * X_POS_L4;
390  double x_inSL3 = SL1metaPrimitive->x - SL1metaPrimitive->tanPhi * (VERT_PHI1_PHI3 + l_shift);
391  for (auto digiIt = (dtLayerId_It.second).first; digiIt != (dtLayerId_It.second).second; ++digiIt) {
392  DTWireId wireId(dtLId, (*digiIt).wire());
393  double x_wire =
394  shiftinfo_[wireId.rawId()] + ((*digiIt).time() - SL1metaPrimitive->t0) * DRIFT_SPEED / 10.;
395  double x_wire_left =
396  shiftinfo_[wireId.rawId()] - ((*digiIt).time() - SL1metaPrimitive->t0) * DRIFT_SPEED / 10.;
397  lat = 1;
398  if (std::abs(x_inSL3 - x_wire) > std::abs(x_inSL3 - x_wire_left)) {
399  x_wire = x_wire_left; //choose the closest laterality
400  lat = 0;
401  }
402  if (std::abs(x_inSL3 - x_wire) < minx) {
403  min2x = minx;
404  minx = std::abs(x_inSL3 - x_wire);
405  next_wire = best_wire;
406  next_tdc = best_tdc;
407  next_layer = best_layer;
408  next_lat = best_lat;
409 
410  best_wire = (*digiIt).wire();
411  best_tdc = (*digiIt).time();
412  best_layer = dtLId.layer();
413  best_lat = lat;
414  matched_digis++;
415  } else if ((std::abs(x_inSL3 - x_wire) >= minx) && (std::abs(x_inSL3 - x_wire) < min2x)) {
416  min2x = std::abs(x_inSL3 - x_wire);
417  next_wire = (*digiIt).wire();
418  next_tdc = (*digiIt).time();
419  next_layer = dtLId.layer();
420  next_lat = lat;
421  matched_digis++;
422  }
423  }
424  }
425  if (matched_digis >= 2 and best_layer != -1 and next_layer != -1) {
426  int new_quality = CHIGHQ;
427  if (SL1metaPrimitive->quality == LOWQ)
428  new_quality = CLOWQ;
429 
430  int wi1 = -1;
431  int tdc1 = -1;
432  int lat1 = -1;
433  int wi2 = -1;
434  int tdc2 = -1;
435  int lat2 = -1;
436  int wi3 = -1;
437  int tdc3 = -1;
438  int lat3 = -1;
439  int wi4 = -1;
440  int tdc4 = -1;
441  int lat4 = -1;
442 
443  if (next_layer == 1) {
444  wi1 = next_wire;
445  tdc1 = next_tdc;
446  lat1 = next_lat;
447  }
448  if (next_layer == 2) {
449  wi2 = next_wire;
450  tdc2 = next_tdc;
451  lat2 = next_lat;
452  }
453  if (next_layer == 3) {
454  wi3 = next_wire;
455  tdc3 = next_tdc;
456  lat3 = next_lat;
457  }
458  if (next_layer == 4) {
459  wi4 = next_wire;
460  tdc4 = next_tdc;
461  lat4 = next_lat;
462  }
463 
464  if (best_layer == 1) {
465  wi1 = best_wire;
466  tdc1 = best_tdc;
467  lat1 = best_lat;
468  }
469  if (best_layer == 2) {
470  wi2 = best_wire;
471  tdc2 = best_tdc;
472  lat2 = best_lat;
473  }
474  if (best_layer == 3) {
475  wi3 = best_wire;
476  tdc3 = best_tdc;
477  lat3 = best_lat;
478  }
479  if (best_layer == 4) {
480  wi4 = best_wire;
481  tdc4 = best_tdc;
482  lat4 = best_lat;
483  }
484 
486  outMPaths.emplace_back(metaPrimitive({ChId.rawId(),
487  SL1metaPrimitive->t0,
488  SL1metaPrimitive->x,
489  SL1metaPrimitive->tanPhi,
490  SL1metaPrimitive->phi,
491  SL1metaPrimitive->phiB,
492  SL1metaPrimitive->chi2,
493  new_quality,
494  SL1metaPrimitive->wi1,
495  SL1metaPrimitive->tdc1,
496  SL1metaPrimitive->lat1,
497  SL1metaPrimitive->wi2,
498  SL1metaPrimitive->tdc2,
499  SL1metaPrimitive->lat2,
500  SL1metaPrimitive->wi3,
501  SL1metaPrimitive->tdc3,
502  SL1metaPrimitive->lat3,
503  SL1metaPrimitive->wi4,
504  SL1metaPrimitive->tdc4,
505  SL1metaPrimitive->lat4,
506  wi1,
507  tdc1,
508  lat1,
509  wi2,
510  tdc2,
511  lat2,
512  wi3,
513  tdc3,
514  lat3,
515  wi4,
516  tdc4,
517  lat4,
518  -1}));
519  else
520  confirmedMetaPrimitives.emplace_back(metaPrimitive({ChId.rawId(),
521  SL1metaPrimitive->t0,
522  SL1metaPrimitive->x,
523  SL1metaPrimitive->tanPhi,
524  SL1metaPrimitive->phi,
525  SL1metaPrimitive->phiB,
526  SL1metaPrimitive->chi2,
527  new_quality,
528  SL1metaPrimitive->wi1,
529  SL1metaPrimitive->tdc1,
530  SL1metaPrimitive->lat1,
531  SL1metaPrimitive->wi2,
532  SL1metaPrimitive->tdc2,
533  SL1metaPrimitive->lat2,
534  SL1metaPrimitive->wi3,
535  SL1metaPrimitive->tdc3,
536  SL1metaPrimitive->lat3,
537  SL1metaPrimitive->wi4,
538  SL1metaPrimitive->tdc4,
539  SL1metaPrimitive->lat4,
540  wi1,
541  tdc1,
542  lat1,
543  wi2,
544  tdc2,
545  lat2,
546  wi3,
547  tdc3,
548  lat3,
549  wi4,
550  tdc4,
551  lat4,
552  -1}));
553  useFitSL1[sl1] = true;
554  at_least_one_SL1_confirmation = true;
555  }
556  }
557  }
558 
559  //finish SL1-SL3
560 
561  //SL3-SL1
562  sl3 = 0;
563  for (auto SL3metaPrimitive = SL3metaPrimitives.begin(); SL3metaPrimitive != SL3metaPrimitives.end();
564  ++SL3metaPrimitive, sl3++) {
565  if (useFitSL3[sl3])
566  continue;
567  if ((at_least_one_correlation == false || clean_chi2_correlation_) &&
568  allow_confirmation_) { //no correlation was found, trying with pairs of two digis in the other SL
569 
570  int matched_digis = 0;
571  double minx = minx_match_2digis_;
572  double min2x = minx_match_2digis_;
573  int best_tdc = -1;
574  int next_tdc = -1;
575  int best_wire = -1;
576  int next_wire = -1;
577  int best_layer = -1;
578  int next_layer = -1;
579  int best_lat = -1;
580  int next_lat = -1;
581  int lat = -1;
582 
583  for (const auto &dtLayerId_It : *dtdigis) {
584  const DTLayerId dtLId = dtLayerId_It.first;
585  // creating a new DTSuperLayerId object to compare with the required SL id
586  const DTSuperLayerId dtSLId(dtLId.wheel(), dtLId.station(), dtLId.sector(), 1);
587  if (dtSLId.rawId() != sl1Id.rawId())
588  continue;
589  double l_shift = 0;
590  if (dtLId.layer() == 4)
591  l_shift = X_POS_L4;
592  if (dtLId.layer() == 3)
593  l_shift = X_POS_L3;
594  if (dtLId.layer() == 2)
595  l_shift = -1 * X_POS_L3;
596  if (dtLId.layer() == 1)
597  l_shift = -1 * X_POS_L4;
598  double x_inSL1 = SL3metaPrimitive->x + SL3metaPrimitive->tanPhi * (VERT_PHI1_PHI3 - l_shift);
599  for (auto digiIt = (dtLayerId_It.second).first; digiIt != (dtLayerId_It.second).second; ++digiIt) {
600  DTWireId wireId(dtLId, (*digiIt).wire());
601  double x_wire =
602  shiftinfo_[wireId.rawId()] + ((*digiIt).time() - SL3metaPrimitive->t0) * DRIFT_SPEED / 10.;
603  double x_wire_left =
604  shiftinfo_[wireId.rawId()] - ((*digiIt).time() - SL3metaPrimitive->t0) * DRIFT_SPEED / 10.;
605  lat = 1;
606  if (std::abs(x_inSL1 - x_wire) > std::abs(x_inSL1 - x_wire_left)) {
607  x_wire = x_wire_left; //choose the closest laterality
608  lat = 0;
609  }
610  if (std::abs(x_inSL1 - x_wire) < minx) {
611  minx = std::abs(x_inSL1 - x_wire);
612  next_wire = best_wire;
613  next_tdc = best_tdc;
614  next_layer = best_layer;
615  next_lat = best_lat;
616 
617  best_wire = (*digiIt).wire();
618  best_tdc = (*digiIt).time();
619  best_layer = dtLId.layer();
620  best_lat = lat;
621  matched_digis++;
622  } else if ((std::abs(x_inSL1 - x_wire) >= minx) && (std::abs(x_inSL1 - x_wire) < min2x)) {
623  minx = std::abs(x_inSL1 - x_wire);
624  next_wire = (*digiIt).wire();
625  next_tdc = (*digiIt).time();
626  next_layer = dtLId.layer();
627  next_lat = lat;
628  matched_digis++;
629  }
630  }
631  }
632  if (matched_digis >= 2 and best_layer != -1 and next_layer != -1) {
633  int new_quality = CHIGHQ;
634  if (SL3metaPrimitive->quality == LOWQ)
635  new_quality = CLOWQ;
636 
637  int wi1 = -1;
638  int tdc1 = -1;
639  int lat1 = -1;
640  int wi2 = -1;
641  int tdc2 = -1;
642  int lat2 = -1;
643  int wi3 = -1;
644  int tdc3 = -1;
645  int lat3 = -1;
646  int wi4 = -1;
647  int tdc4 = -1;
648  int lat4 = -1;
649 
650  if (next_layer == 1) {
651  wi1 = next_wire;
652  tdc1 = next_tdc;
653  lat1 = next_lat;
654  }
655  if (next_layer == 2) {
656  wi2 = next_wire;
657  tdc2 = next_tdc;
658  lat2 = next_lat;
659  }
660  if (next_layer == 3) {
661  wi3 = next_wire;
662  tdc3 = next_tdc;
663  lat3 = next_lat;
664  }
665  if (next_layer == 4) {
666  wi4 = next_wire;
667  tdc4 = next_tdc;
668  lat4 = next_lat;
669  }
670 
671  if (best_layer == 1) {
672  wi1 = best_wire;
673  tdc1 = best_tdc;
674  lat1 = best_lat;
675  }
676  if (best_layer == 2) {
677  wi2 = best_wire;
678  tdc2 = best_tdc;
679  lat2 = best_lat;
680  }
681  if (best_layer == 3) {
682  wi3 = best_wire;
683  tdc3 = best_tdc;
684  lat3 = best_lat;
685  }
686  if (best_layer == 4) {
687  wi4 = best_wire;
688  tdc4 = best_tdc;
689  lat4 = best_lat;
690  }
691 
693  outMPaths.push_back(metaPrimitive({ChId.rawId(),
694  SL3metaPrimitive->t0,
695  SL3metaPrimitive->x,
696  SL3metaPrimitive->tanPhi,
697  SL3metaPrimitive->phi,
698  SL3metaPrimitive->phiB,
699  SL3metaPrimitive->chi2,
700  new_quality,
701  wi1,
702  tdc1,
703  lat1,
704  wi2,
705  tdc2,
706  lat2,
707  wi3,
708  tdc3,
709  lat3,
710  wi4,
711  tdc4,
712  lat4,
713  SL3metaPrimitive->wi1,
714  SL3metaPrimitive->tdc1,
715  SL3metaPrimitive->lat1,
716  SL3metaPrimitive->wi2,
717  SL3metaPrimitive->tdc2,
718  SL3metaPrimitive->lat2,
719  SL3metaPrimitive->wi3,
720  SL3metaPrimitive->tdc3,
721  SL3metaPrimitive->lat3,
722  SL3metaPrimitive->wi4,
723  SL3metaPrimitive->tdc4,
724  SL3metaPrimitive->lat4,
725  -1}));
726  else
727  confirmedMetaPrimitives.push_back(metaPrimitive({ChId.rawId(),
728  SL3metaPrimitive->t0,
729  SL3metaPrimitive->x,
730  SL3metaPrimitive->tanPhi,
731  SL3metaPrimitive->phi,
732  SL3metaPrimitive->phiB,
733  SL3metaPrimitive->chi2,
734  new_quality,
735  wi1,
736  tdc1,
737  lat1,
738  wi2,
739  tdc2,
740  lat2,
741  wi3,
742  tdc3,
743  lat3,
744  wi4,
745  tdc4,
746  lat4,
747  SL3metaPrimitive->wi1,
748  SL3metaPrimitive->tdc1,
749  SL3metaPrimitive->lat1,
750  SL3metaPrimitive->wi2,
751  SL3metaPrimitive->tdc2,
752  SL3metaPrimitive->lat2,
753  SL3metaPrimitive->wi3,
754  SL3metaPrimitive->tdc3,
755  SL3metaPrimitive->lat3,
756  SL3metaPrimitive->wi4,
757  SL3metaPrimitive->tdc4,
758  SL3metaPrimitive->lat4,
759  -1}));
760  useFitSL3[sl3] = true;
761  at_least_one_SL3_confirmation = true;
762  }
763  }
764  }
765  // Start correlation cleaning
767  if (debug_)
768  LogDebug("MuonPathAssociator") << "Pushing back correlated MPs to the MPs collection";
769  removeSharingFits(chamberMetaPrimitives, outMPaths);
770  }
772  if (debug_)
773  LogDebug("MuonPathAssociator") << "Pushing back confirmed MPs to the complete vector";
774  removeSharingHits(confirmedMetaPrimitives, chamberMetaPrimitives, outMPaths);
775  }
776 
777  //finish SL3-SL1
778  if (at_least_one_correlation == false || clean_chi2_correlation_) {
779  if (debug_ && !at_least_one_correlation)
780  LogDebug("MuonPathAssociator")
781  << "correlation we found zero correlations, adding both collections as they are to the outMPaths";
782  if (debug_)
783  LogDebug("MuonPathAssociator")
784  << "correlation sizes:" << SL1metaPrimitives.size() << " " << SL3metaPrimitives.size();
785  if (at_least_one_SL1_confirmation == false || clean_chi2_correlation_) {
786  sl1 = 0;
787  for (auto SL1metaPrimitive = SL1metaPrimitives.begin(); SL1metaPrimitive != SL1metaPrimitives.end();
788  ++SL1metaPrimitive, sl1++) {
789  if (useFitSL1[sl1])
790  continue;
791 
792  DTSuperLayerId SLId(SL1metaPrimitive->rawId);
793  DTChamberId(SLId.wheel(), SLId.station(), SLId.sector());
794  metaPrimitive newSL1metaPrimitive = {ChId.rawId(),
795  SL1metaPrimitive->t0,
796  SL1metaPrimitive->x,
797  SL1metaPrimitive->tanPhi,
798  SL1metaPrimitive->phi,
799  SL1metaPrimitive->phiB,
800  SL1metaPrimitive->chi2,
801  SL1metaPrimitive->quality,
802  SL1metaPrimitive->wi1,
803  SL1metaPrimitive->tdc1,
804  SL1metaPrimitive->lat1,
805  SL1metaPrimitive->wi2,
806  SL1metaPrimitive->tdc2,
807  SL1metaPrimitive->lat2,
808  SL1metaPrimitive->wi3,
809  SL1metaPrimitive->tdc3,
810  SL1metaPrimitive->lat3,
811  SL1metaPrimitive->wi4,
812  SL1metaPrimitive->tdc4,
813  SL1metaPrimitive->lat4,
814  -1,
815  -1,
816  -1,
817  -1,
818  -1,
819  -1,
820  -1,
821  -1,
822  -1,
823  -1,
824  -1,
825  -1,
826  -1};
827 
828  bool ok = true;
829  for (auto &metaPrimitive : chamberMetaPrimitives) {
830  if (!isNotAPrimo(newSL1metaPrimitive, metaPrimitive)) {
831  ok = false;
832  break;
833  }
834  }
835  if (!ok)
836  continue;
837 
839  outMPaths.push_back(newSL1metaPrimitive);
840  else
841  normalMetaPrimitives.push_back(newSL1metaPrimitive);
842  }
843  }
844  if (at_least_one_SL3_confirmation == false || clean_chi2_correlation_) {
845  sl3 = 0;
846  for (auto SL3metaPrimitive = SL3metaPrimitives.begin(); SL3metaPrimitive != SL3metaPrimitives.end();
847  ++SL3metaPrimitive, sl3++) {
848  if (useFitSL3[sl3])
849  continue;
850  DTSuperLayerId SLId(SL3metaPrimitive->rawId);
851  DTChamberId(SLId.wheel(), SLId.station(), SLId.sector());
852  metaPrimitive newSL3metaPrimitive = {ChId.rawId(),
853  SL3metaPrimitive->t0,
854  SL3metaPrimitive->x,
855  SL3metaPrimitive->tanPhi,
856  SL3metaPrimitive->phi,
857  SL3metaPrimitive->phiB,
858  SL3metaPrimitive->chi2,
859  SL3metaPrimitive->quality,
860  -1,
861  -1,
862  -1,
863  -1,
864  -1,
865  -1,
866  -1,
867  -1,
868  -1,
869  -1,
870  -1,
871  -1,
872  SL3metaPrimitive->wi1,
873  SL3metaPrimitive->tdc1,
874  SL3metaPrimitive->lat1,
875  SL3metaPrimitive->wi2,
876  SL3metaPrimitive->tdc2,
877  SL3metaPrimitive->lat2,
878  SL3metaPrimitive->wi3,
879  SL3metaPrimitive->tdc3,
880  SL3metaPrimitive->lat3,
881  SL3metaPrimitive->wi4,
882  SL3metaPrimitive->tdc4,
883  SL3metaPrimitive->lat4,
884  -1};
885 
887  outMPaths.push_back(newSL3metaPrimitive);
888  else
889  normalMetaPrimitives.push_back(newSL3metaPrimitive);
890  }
891  }
892  }
893 
894  SL1metaPrimitives.clear();
895  SL1metaPrimitives.erase(SL1metaPrimitives.begin(), SL1metaPrimitives.end());
896  SL3metaPrimitives.clear();
897  SL3metaPrimitives.erase(SL3metaPrimitives.begin(), SL3metaPrimitives.end());
898 
899  vector<metaPrimitive> auxMetaPrimitives;
901  if (debug_)
902  LogDebug("MuonPathAssociator") << "Pushing back normal MPs to the auxiliar vector";
903  removeSharingHits(normalMetaPrimitives, confirmedMetaPrimitives, auxMetaPrimitives);
904  }
906  if (debug_)
907  LogDebug("MuonPathAssociator") << "Pushing back normal MPs to the MPs collection";
908  removeSharingHits(auxMetaPrimitives, chamberMetaPrimitives, outMPaths);
909  }
910  }
911  }
912  }
913 
914  //eta TP we do not correlate with other superlayer in the same chamber so we forward them all
915  std::vector<metaPrimitive> SL2metaPrimitives;
916 
917  for (int wh = -2; wh <= 2; wh++) {
918  for (int st = 1; st <= 4; st++) {
919  for (int se = 1; se <= 14; se++) {
920  if (se >= 13 && st != 4)
921  continue;
922 
923  DTChamberId ChId(wh, st, se);
924  DTSuperLayerId sl2Id(wh, st, se, 2);
925 
926  //filterSL2 etaTP
927  for (auto metaprimitiveIt = inMPaths.begin(); metaprimitiveIt != inMPaths.end(); ++metaprimitiveIt)
928  if (metaprimitiveIt->rawId == sl2Id.rawId()) {
929  SL2metaPrimitives.push_back(*metaprimitiveIt);
930  //std::cout<<"pushing back eta metaprimitive: ";
931  printmPC(*metaprimitiveIt);
932  outMPaths.push_back(*metaprimitiveIt);
933  }
934  }
935  }
936  }
937 
938  LogDebug("MuonPathAssociator") << "\t etaTP: added " << SL2metaPrimitives.size() << "to outMPaths" << std::endl;
939 
940  SL2metaPrimitives.clear();
941  SL2metaPrimitives.erase(SL2metaPrimitives.begin(), SL2metaPrimitives.end());
942 }

References funct::abs(), cmsdt::CELL_HEIGHT, cmsdt::CELL_LENGTH, cmsdt::CELL_SEMILENGTH, cmsdt::CH_CENTER_TO_MID_SL_X2, hltPixelTracks_cff::chi2, IntegrityClient_cfi::ChId, cmsdt::CHIGHQ, cmsdt::CLOWQ, cmsdt::DRIFT_SPEED, cmsdt::DRIFT_SPEED_X4, cmsdt::HIGHHIGHQ, cmsdt::HIGHLOWQ, cmsdt::HIGHQ, mps_fire::i, cmsdt::INCREASED_RES_POS, cmsdt::INCREASED_RES_POS_POW, cmsdt::INCREASED_RES_SLOPE_POW, createfilelist::int, DTLayerId::layer(), cmsdt::LHC_CLK_FREQ, LogDebug, cmsdt::LOWLOWQ, cmsdt::LOWQ, NUM_LAYERS, cmsdt::NUM_LAYERS_2SL, convertSQLiteXML::ok, or, PV3DBase< T, PVType, FrameType >::phi(), cmsdt::PHI_CONV, funct::pow(), quality, DetId::rawId(), edm::second(), DTChamberId::sector(), edm::shift, Validation_hcalonly_cfi::sign, DTChamberId::station(), cmsdt::VERT_PHI1_PHI3, cmsdt::VERT_PHI1_PHI3_INV, DTChamberId::wheel(), cmsdt::X_POS_L3, cmsdt::X_POS_L4, and cmsdt::Z_SHIFT_MB4.

◆ finish()

void MuonPathAssociator::finish ( )

Definition at line 79 of file MuonPathAssociator.cc.

79  {
80  if (debug_)
81  LogDebug("MuonPathAssociator") << "MuonPathAssociator: finish";
82 };

References LogDebug.

Referenced by progressbar.ProgressBar::__next__().

◆ hasPosRF()

bool MuonPathAssociator::hasPosRF ( int  wh,
int  sec 
)
inlineprivate

Definition at line 74 of file MuonPathAssociator.h.

74 { return wh > 0 || (wh == 0 && sec % 4 > 1); }

References fileinputsource_cfi::sec.

◆ initialise()

void MuonPathAssociator::initialise ( const edm::EventSetup iEventSetup)

Definition at line 58 of file MuonPathAssociator.cc.

58  {
59  if (debug_)
60  LogDebug("MuonPathAssociator") << "MuonPathAssociator::initialiase";
61 
63  iEventSetup.get<MuonGeometryRecord>().get(geometry_tag_, geom);
64  dtGeo_ = &(*geom);
65 }

References relativeConstraints::geom, edm::EventSetup::get(), edm::get(), and LogDebug.

◆ isNotAPrimo()

bool MuonPathAssociator::isNotAPrimo ( cmsdt::metaPrimitive  first,
cmsdt::metaPrimitive  second 
)

Definition at line 1041 of file MuonPathAssociator.cc.

1041  {
1042  int hitsSL1 = (first.wi1 != -1) + (first.wi2 != -1) + (first.wi3 != -1) + (first.wi4 != -1);
1043  int hitsSL3 = (first.wi5 != -1) + (first.wi6 != -1) + (first.wi7 != -1) + (first.wi8 != -1);
1044 
1045  bool lay1 = (first.wi1 == second.wi1) && (first.tdc1 = second.tdc1) && (first.wi1 != -1);
1046  bool lay2 = (first.wi2 == second.wi2) && (first.tdc2 = second.tdc2) && (first.wi2 != -1);
1047  bool lay3 = (first.wi3 == second.wi3) && (first.tdc3 = second.tdc3) && (first.wi3 != -1);
1048  bool lay4 = (first.wi4 == second.wi4) && (first.tdc4 = second.tdc4) && (first.wi4 != -1);
1049  bool lay5 = (first.wi5 == second.wi5) && (first.tdc5 = second.tdc5) && (first.wi5 != -1);
1050  bool lay6 = (first.wi6 == second.wi6) && (first.tdc6 = second.tdc6) && (first.wi6 != -1);
1051  bool lay7 = (first.wi7 == second.wi7) && (first.tdc7 = second.tdc7) && (first.wi7 != -1);
1052  bool lay8 = (first.wi8 == second.wi8) && (first.tdc8 = second.tdc8) && (first.wi8 != -1);
1053 
1054  return (((!lay1 && !lay2 && !lay3 && !lay4) || hitsSL1 < 3) && ((!lay5 && !lay6 && !lay7 && !lay8) || hitsSL3 < 3));
1055 }

References edm::first(), and edm::second().

◆ printmPC()

void MuonPathAssociator::printmPC ( cmsdt::metaPrimitive  mP)

Definition at line 1057 of file MuonPathAssociator.cc.

1057  {
1058  DTChamberId ChId(mP.rawId);
1059  LogDebug("MuonPathAssociator") << ChId << "\t"
1060  << " " << setw(2) << left << mP.wi1 << " " << setw(2) << left << mP.wi2 << " "
1061  << setw(2) << left << mP.wi3 << " " << setw(2) << left << mP.wi4 << " " << setw(2)
1062  << left << mP.wi5 << " " << setw(2) << left << mP.wi6 << " " << setw(2) << left
1063  << mP.wi7 << " " << setw(2) << left << mP.wi8 << " " << setw(5) << left << mP.tdc1
1064  << " " << setw(5) << left << mP.tdc2 << " " << setw(5) << left << mP.tdc3 << " "
1065  << setw(5) << left << mP.tdc4 << " " << setw(5) << left << mP.tdc5 << " " << setw(5)
1066  << left << mP.tdc6 << " " << setw(5) << left << mP.tdc7 << " " << setw(5) << left
1067  << mP.tdc8 << " " << setw(2) << left << mP.lat1 << " " << setw(2) << left << mP.lat2
1068  << " " << setw(2) << left << mP.lat3 << " " << setw(2) << left << mP.lat4 << " "
1069  << setw(2) << left << mP.lat5 << " " << setw(2) << left << mP.lat6 << " " << setw(2)
1070  << left << mP.lat7 << " " << setw(2) << left << mP.lat8 << " " << setw(10) << right
1071  << mP.x << " " << setw(9) << left << mP.tanPhi << " " << setw(5) << left << mP.t0
1072  << " " << setw(13) << left << mP.chi2 << " \n";
1073 }

References cmsdt::metaPrimitive::chi2, IntegrityClient_cfi::ChId, cmsdt::metaPrimitive::lat1, cmsdt::metaPrimitive::lat2, cmsdt::metaPrimitive::lat3, cmsdt::metaPrimitive::lat4, cmsdt::metaPrimitive::lat5, cmsdt::metaPrimitive::lat6, cmsdt::metaPrimitive::lat7, cmsdt::metaPrimitive::lat8, LogDebug, cmsdt::metaPrimitive::rawId, cmsdt::metaPrimitive::t0, cmsdt::metaPrimitive::tanPhi, cmsdt::metaPrimitive::tdc1, cmsdt::metaPrimitive::tdc2, cmsdt::metaPrimitive::tdc3, cmsdt::metaPrimitive::tdc4, cmsdt::metaPrimitive::tdc5, cmsdt::metaPrimitive::tdc6, cmsdt::metaPrimitive::tdc7, cmsdt::metaPrimitive::tdc8, cmsdt::metaPrimitive::wi1, cmsdt::metaPrimitive::wi2, cmsdt::metaPrimitive::wi3, cmsdt::metaPrimitive::wi4, cmsdt::metaPrimitive::wi5, cmsdt::metaPrimitive::wi6, cmsdt::metaPrimitive::wi7, cmsdt::metaPrimitive::wi8, and cmsdt::metaPrimitive::x.

◆ removeSharingFits()

void MuonPathAssociator::removeSharingFits ( std::vector< cmsdt::metaPrimitive > &  chamberMPaths,
std::vector< cmsdt::metaPrimitive > &  allMPaths 
)

Definition at line 944 of file MuonPathAssociator.cc.

944  {
945  bool useFit[chamberMPaths.size()];
946  for (unsigned int i = 0; i < chamberMPaths.size(); i++) {
947  useFit[i] = true;
948  }
949  for (unsigned int i = 0; i < chamberMPaths.size(); i++) {
950  if (debug_)
951  LogDebug("MuonPathAssociator") << "Looking at prim" << i;
952  if (!useFit[i])
953  continue;
954  for (unsigned int j = i + 1; j < chamberMPaths.size(); j++) {
955  if (debug_)
956  LogDebug("MuonPathAssociator") << "Comparing with prim " << j;
957  if (!useFit[j])
958  continue;
959  metaPrimitive first = chamberMPaths[i];
960  metaPrimitive second = chamberMPaths[j];
961  if (shareFit(first, second)) {
962  if (first.quality > second.quality)
963  useFit[j] = false;
964  else if (first.quality < second.quality)
965  useFit[i] = false;
966  else {
967  if (first.chi2 < second.chi2)
968  useFit[j] = false;
969  else {
970  useFit[i] = false;
971  break;
972  }
973  }
974  }
975  }
976  if (useFit[i]) {
977  if (debug_)
978  printmPC(chamberMPaths[i]);
979  allMPaths.push_back(chamberMPaths[i]);
980  }
981  }
982  if (debug_)
983  LogDebug("MuonPathAssociator") << "---Swapping chamber---";
984 }

References edm::first(), mps_fire::i, dqmiolumiharvest::j, LogDebug, edm::second(), and TrackerOfflineValidationSummary_cfi::useFit.

◆ removeSharingHits()

void MuonPathAssociator::removeSharingHits ( std::vector< cmsdt::metaPrimitive > &  firstMPaths,
std::vector< cmsdt::metaPrimitive > &  secondMPaths,
std::vector< cmsdt::metaPrimitive > &  allMPaths 
)

Definition at line 986 of file MuonPathAssociator.cc.

988  {
989  for (auto &firstMP : firstMPaths) {
990  if (debug_)
991  LogDebug("MuonPathAssociator") << "----------------------------------";
992  if (debug_)
993  LogDebug("MuonPathAssociator") << "Turn for ";
994  if (debug_)
995  printmPC(firstMP);
996  bool ok = true;
997  for (auto &secondMP : secondMPaths) {
998  if (debug_)
999  LogDebug("MuonPathAssociator") << "Comparing with ";
1000  if (debug_)
1001  printmPC(secondMP);
1002  if (!isNotAPrimo(firstMP, secondMP)) {
1003  ok = false;
1004  break;
1005  }
1006  }
1007  if (ok) {
1008  allMPaths.push_back(firstMP);
1009  if (debug_)
1010  printmPC(firstMP);
1011  }
1012  if (debug_)
1013  LogDebug("MuonPathAssociator") << "----------------------------------";
1014  }
1015 }

References LogDebug, and convertSQLiteXML::ok.

◆ run()

void MuonPathAssociator::run ( edm::Event iEvent,
const edm::EventSetup iEventSetup,
edm::Handle< DTDigiCollection digis,
std::vector< cmsdt::metaPrimitive > &  inMPaths,
std::vector< cmsdt::metaPrimitive > &  outMPaths 
)

Definition at line 67 of file MuonPathAssociator.cc.

71  {
73  correlateMPaths(digis, inMPaths, outMPaths);
74  else {
75  outMPaths.insert(outMPaths.end(), inMPaths.begin(), inMPaths.end());
76  }
77 }

◆ shareFit()

bool MuonPathAssociator::shareFit ( cmsdt::metaPrimitive  first,
cmsdt::metaPrimitive  second 
)

Definition at line 1017 of file MuonPathAssociator.cc.

1017  {
1018  bool lay1 = (first.wi1 == second.wi1) && (first.tdc1 = second.tdc1);
1019  bool lay2 = (first.wi2 == second.wi2) && (first.tdc2 = second.tdc2);
1020  bool lay3 = (first.wi3 == second.wi3) && (first.tdc3 = second.tdc3);
1021  bool lay4 = (first.wi4 == second.wi4) && (first.tdc4 = second.tdc4);
1022  bool lay5 = (first.wi5 == second.wi5) && (first.tdc5 = second.tdc5);
1023  bool lay6 = (first.wi6 == second.wi6) && (first.tdc6 = second.tdc6);
1024  bool lay7 = (first.wi7 == second.wi7) && (first.tdc7 = second.tdc7);
1025  bool lay8 = (first.wi8 == second.wi8) && (first.tdc8 = second.tdc8);
1026 
1027  if (lay1 && lay2 && lay3 && lay4) {
1028  if (lay5 || lay6 || lay7 || lay8)
1029  return true;
1030  else
1031  return false;
1032  } else if (lay5 && lay6 && lay7 && lay8) {
1033  if (lay1 || lay2 || lay3 || lay4)
1034  return true;
1035  else
1036  return false;
1037  } else
1038  return false;
1039 }

References edm::first(), and edm::second().

Member Data Documentation

◆ allow_confirmation_

bool MuonPathAssociator::allow_confirmation_
private

Definition at line 80 of file MuonPathAssociator.h.

◆ chi2corTh_

double MuonPathAssociator::chi2corTh_
private

Definition at line 85 of file MuonPathAssociator.h.

◆ clean_chi2_correlation_

bool MuonPathAssociator::clean_chi2_correlation_
private

Definition at line 78 of file MuonPathAssociator.h.

◆ cmssw_for_global_

bool MuonPathAssociator::cmssw_for_global_
private

Definition at line 86 of file MuonPathAssociator.h.

◆ dBX_correlate_TP_

double MuonPathAssociator::dBX_correlate_TP_
private

Definition at line 82 of file MuonPathAssociator.h.

◆ debug_

bool MuonPathAssociator::debug_
private

Definition at line 77 of file MuonPathAssociator.h.

◆ dT0_correlate_TP_

double MuonPathAssociator::dT0_correlate_TP_
private

Definition at line 81 of file MuonPathAssociator.h.

◆ dTanPsi_correlate_TP_

double MuonPathAssociator::dTanPsi_correlate_TP_
private

Definition at line 83 of file MuonPathAssociator.h.

◆ dtGeo_

const DTGeometry* MuonPathAssociator::dtGeo_

Definition at line 65 of file MuonPathAssociator.h.

◆ dtGeomH_

edm::ESGetToken<DTGeometry, MuonGeometryRecord> MuonPathAssociator::dtGeomH_

Definition at line 66 of file MuonPathAssociator.h.

◆ geometry_tag_

std::string MuonPathAssociator::geometry_tag_
private

Definition at line 87 of file MuonPathAssociator.h.

◆ globalcoordsobtainer_

std::shared_ptr<GlobalCoordsObtainer> MuonPathAssociator::globalcoordsobtainer_
private

Definition at line 94 of file MuonPathAssociator.h.

◆ minx_match_2digis_

double MuonPathAssociator::minx_match_2digis_
private

Definition at line 84 of file MuonPathAssociator.h.

◆ shift_filename_

edm::FileInPath MuonPathAssociator::shift_filename_
private

Definition at line 90 of file MuonPathAssociator.h.

◆ shiftinfo_

std::map<int, float> MuonPathAssociator::shiftinfo_
private

Definition at line 91 of file MuonPathAssociator.h.

◆ useBX_correlation_

bool MuonPathAssociator::useBX_correlation_
private

Definition at line 79 of file MuonPathAssociator.h.

DTGeometry
Definition: DTGeometry.h:28
cmsdt::metaPrimitive
Definition: constants.h:49
MuonPathAssociator::chi2corTh_
double chi2corTh_
Definition: MuonPathAssociator.h:85
DTSuperLayerId
Definition: DTSuperLayerId.h:12
mps_fire.i
i
Definition: mps_fire.py:428
cmsdt::DRIFT_SPEED_X4
constexpr int DRIFT_SPEED_X4
Definition: constants.h:185
cmsdt::CH_CENTER_TO_MID_SL_X2
constexpr int CH_CENTER_TO_MID_SL_X2
Definition: constants.h:194
MuonPathAssociator::clean_chi2_correlation_
bool clean_chi2_correlation_
Definition: MuonPathAssociator.h:78
cmsdt::metaPrimitive::rawId
uint32_t rawId
Definition: constants.h:119
cmsdt::metaPrimitive::x
double x
Definition: constants.h:121
cmsdt::metaPrimitive::lat8
int lat8
Definition: constants.h:150
pos
Definition: PixelAliasList.h:18
cmsdt::metaPrimitive::wi1
int wi1
Definition: constants.h:127
cmsdt::metaPrimitive::wi8
int wi8
Definition: constants.h:148
cmsdt::HIGHQ
Definition: constants.h:42
MuonPathAssociator::dBX_correlate_TP_
double dBX_correlate_TP_
Definition: MuonPathAssociator.h:82
MuonPathAssociator::hasPosRF
bool hasPosRF(int wh, int sec)
Definition: MuonPathAssociator.h:74
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
cmsdt::INCREASED_RES_SLOPE_POW
constexpr int INCREASED_RES_SLOPE_POW
Definition: constants.h:271
cmsdt::INCREASED_RES_POS
constexpr int INCREASED_RES_POS
Definition: constants.h:266
cmsdt::metaPrimitive::lat4
int lat4
Definition: constants.h:138
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
MuonPathAssociator::shareFit
bool shareFit(cmsdt::metaPrimitive first, cmsdt::metaPrimitive second)
Definition: MuonPathAssociator.cc:1017
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
MuonPathAssociator::shift_filename_
edm::FileInPath shift_filename_
Definition: MuonPathAssociator.h:90
cmsdt::INCREASED_RES_POS_POW
constexpr int INCREASED_RES_POS_POW
Definition: constants.h:270
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:97
cmsdt::metaPrimitive::tdc8
int tdc8
Definition: constants.h:149
MuonPathAssociator::removeSharingFits
void removeSharingFits(std::vector< cmsdt::metaPrimitive > &chamberMPaths, std::vector< cmsdt::metaPrimitive > &allMPaths)
Definition: MuonPathAssociator.cc:944
MuonPathAssociator::removeSharingHits
void removeSharingHits(std::vector< cmsdt::metaPrimitive > &firstMPaths, std::vector< cmsdt::metaPrimitive > &secondMPaths, std::vector< cmsdt::metaPrimitive > &allMPaths)
Definition: MuonPathAssociator.cc:986
cmsdt::CHIGHQ
Definition: constants.h:42
DTGeometry::chamber
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:109
MuonPathAssociator::dtGeomH_
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomH_
Definition: MuonPathAssociator.h:66
cmsdt::metaPrimitive::tdc1
int tdc1
Definition: constants.h:128
TrackerOfflineValidationSummary_cfi.useFit
useFit
Definition: TrackerOfflineValidationSummary_cfi.py:5
MuonPathAssociator::dT0_correlate_TP_
double dT0_correlate_TP_
Definition: MuonPathAssociator.h:81
edm::FileInPath
Definition: FileInPath.h:64
MuonPathAssociator::minx_match_2digis_
double minx_match_2digis_
Definition: MuonPathAssociator.h:84
cmsdt::VERT_PHI1_PHI3
constexpr float VERT_PHI1_PHI3
Definition: constants.h:188
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
cmsdt::CELL_SEMILENGTH
constexpr int CELL_SEMILENGTH
Definition: constants.h:181
cmsdt::metaPrimitive::lat5
int lat5
Definition: constants.h:141
DTWireId
Definition: DTWireId.h:12
cmsdt::metaPrimitive::lat6
int lat6
Definition: constants.h:144
cmsdt::metaPrimitive::wi2
int wi2
Definition: constants.h:130
cmsdt::metaPrimitive::tdc7
int tdc7
Definition: constants.h:146
DDAxes::z
cmsdt::metaPrimitive::lat1
int lat1
Definition: constants.h:129
edm::ESHandle< DTGeometry >
cmsdt::metaPrimitive::wi7
int wi7
Definition: constants.h:145
cmsdt::metaPrimitive::wi6
int wi6
Definition: constants.h:142
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
MuonPathAssociator::cmssw_for_global_
bool cmssw_for_global_
Definition: MuonPathAssociator.h:86
cmsdt::metaPrimitive::tdc3
int tdc3
Definition: constants.h:134
cmsdt::metaPrimitive::lat7
int lat7
Definition: constants.h:147
Point3DBase< float, GlobalTag >
cmsdt::VERT_PHI1_PHI3_INV
constexpr int VERT_PHI1_PHI3_INV
Definition: constants.h:191
DTLayerId
Definition: DTLayerId.h:12
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cmsdt::PHI_CONV
constexpr double PHI_CONV
Definition: constants.h:249
cmsdt::metaPrimitive::wi5
int wi5
Definition: constants.h:139
cmsdt::LHC_CLK_FREQ
constexpr int LHC_CLK_FREQ
Definition: constants.h:170
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
cmsdt::CLOWQ
Definition: constants.h:42
cmsdt::metaPrimitive::lat2
int lat2
Definition: constants.h:132
IntegrityClient_cfi.ChId
ChId
Definition: IntegrityClient_cfi.py:18
cmsdt::metaPrimitive::wi4
int wi4
Definition: constants.h:136
MuonPathAssociator::correlateMPaths
void correlateMPaths(edm::Handle< DTDigiCollection > digis, std::vector< cmsdt::metaPrimitive > &inMPaths, std::vector< cmsdt::metaPrimitive > &outMPaths)
Definition: MuonPathAssociator.cc:84
cmsdt::metaPrimitive::tdc5
int tdc5
Definition: constants.h:140
MuonPathAssociator::dTanPsi_correlate_TP_
double dTanPsi_correlate_TP_
Definition: MuonPathAssociator.h:83
createfilelist.int
int
Definition: createfilelist.py:10
cmsdt::metaPrimitive::tdc6
int tdc6
Definition: constants.h:143
MuonPathAssociator::printmPC
void printmPC(cmsdt::metaPrimitive mP)
Definition: MuonPathAssociator.cc:1057
NUM_LAYERS
Definition: CSCALCTDigi.cc:14
cmsdt::HIGHHIGHQ
Definition: constants.h:42
get
#define get
MuonPathAssociator::shiftinfo_
std::map< int, float > shiftinfo_
Definition: MuonPathAssociator.h:91
cmsdt::metaPrimitive::tanPhi
double tanPhi
Definition: constants.h:122
cmsdt::CELL_HEIGHT
constexpr int CELL_HEIGHT
Definition: constants.h:178
fileinputsource_cfi.sec
sec
Definition: fileinputsource_cfi.py:94
cmsdt::Z_SHIFT_MB4
constexpr float Z_SHIFT_MB4
Definition: constants.h:252
cmsdt::metaPrimitive::tdc4
int tdc4
Definition: constants.h:137
DDAxes::phi
cmsdt::HIGHLOWQ
Definition: constants.h:42
cmsdt::DRIFT_SPEED
constexpr float DRIFT_SPEED
Definition: constants.h:183
cmsdt::metaPrimitive::chi2
double chi2
Definition: constants.h:125
psi
std::map< std::string, int, std::less< std::string > > psi
Definition: CountProcessesAction.h:15
cmsdt::CELL_LENGTH
constexpr int CELL_LENGTH
Definition: constants.h:180
DTChamberId::sector
int sector() const
Definition: DTChamberId.h:49
cmsdt::NUM_LAYERS_2SL
constexpr int NUM_LAYERS_2SL
Definition: constants.h:248
cmsdt::LOWQ
Definition: constants.h:42
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
cmsdt::X_POS_L3
constexpr double X_POS_L3
Definition: constants.h:254
MuonPathAssociator::debug_
bool debug_
Definition: MuonPathAssociator.h:77
edm::Transition::BeginRun
Exception
Definition: hltDiff.cc:245
cmsdt::metaPrimitive::tdc2
int tdc2
Definition: constants.h:131
or
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
MuonPathAssociator::useBX_correlation_
bool useBX_correlation_
Definition: MuonPathAssociator.h:79
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DTChamberId
Definition: DTChamberId.h:14
cmsdt::LOWLOWQ
Definition: constants.h:42
MuonPathAssociator::globalcoordsobtainer_
std::shared_ptr< GlobalCoordsObtainer > globalcoordsobtainer_
Definition: MuonPathAssociator.h:94
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
cmsdt::metaPrimitive::lat3
int lat3
Definition: constants.h:135
DTLayerId::layer
int layer() const
Return the layer number.
Definition: DTLayerId.h:42
MuonPathAssociator::dtGeo_
const DTGeometry * dtGeo_
Definition: MuonPathAssociator.h:65
MuonPathAssociator::allow_confirmation_
bool allow_confirmation_
Definition: MuonPathAssociator.h:80
MuonPathAssociator::isNotAPrimo
bool isNotAPrimo(cmsdt::metaPrimitive first, cmsdt::metaPrimitive second)
Definition: MuonPathAssociator.cc:1041
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
DTChamberId::wheel
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
cmsdt::X_POS_L4
constexpr double X_POS_L4
Definition: constants.h:255
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
cmsdt::metaPrimitive::wi3
int wi3
Definition: constants.h:133
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161
DTChamberId::station
int station() const
Return the station number.
Definition: DTChamberId.h:42
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
cmsdt::metaPrimitive::t0
double t0
Definition: constants.h:120
MuonPathAssociator::geometry_tag_
std::string geometry_tag_
Definition: MuonPathAssociator.h:87