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

DTGeometry const * dtGeo_
 
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_
 
double dBX_correlate_TP_
 
const bool debug_
 
double dT0_correlate_TP_
 
double dTanPsi_correlate_TP_
 
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.

References edm::BeginRun, debug_, dtGeomH_, edm::ConsumesCollector::esConsumes(), Exception, edm::FileInPath::fullPath(), globalcoordsobtainer_, LogDebug, muonDTDigis_cfi::pset, edm::shift, shift_filename_, and shiftinfo_.

16  : debug_(pset.getUntrackedParameter<bool>("debug")),
17  clean_chi2_correlation_(pset.getParameter<bool>("clean_chi2_correlation")),
18  useBX_correlation_(pset.getParameter<bool>("useBX_correlation")),
19  allow_confirmation_(pset.getParameter<bool>("allow_confirmation")),
20  dT0_correlate_TP_(pset.getParameter<double>("dT0_correlate_TP")),
21  dBX_correlate_TP_(pset.getParameter<int>("dBX_correlate_TP")),
22  dTanPsi_correlate_TP_(pset.getParameter<double>("dTanPsi_correlate_TP")),
23  minx_match_2digis_(pset.getParameter<double>("minx_match_2digis")),
24  chi2corTh_(pset.getParameter<double>("chi2corTh")) {
25  // Obtention of parameters
26 
27  if (debug_)
28  LogDebug("MuonPathAssociator") << "MuonPathAssociator: constructor";
29 
30  //shift
31  int rawId;
32  shift_filename_ = pset.getParameter<edm::FileInPath>("shift_filename");
33  std::ifstream ifin3(shift_filename_.fullPath());
34  double shift;
35  if (ifin3.fail()) {
36  throw cms::Exception("Missing Input File")
37  << "MuonPathAnalyzerPerSL::MuonPathAnalyzerPerSL() - Cannot find " << shift_filename_.fullPath();
38  }
39  while (ifin3.good()) {
40  ifin3 >> rawId >> shift;
41  shiftinfo_[rawId] = shift;
42  }
43 
45  globalcoordsobtainer_ = globalcoordsobtainer;
46 }
std::string fullPath() const
Definition: FileInPath.cc:161
std::map< int, float > shiftinfo_
edm::FileInPath shift_filename_
std::shared_ptr< GlobalCoordsObtainer > globalcoordsobtainer_
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomH_
static unsigned int const shift
#define LogDebug(id)

◆ ~MuonPathAssociator()

MuonPathAssociator::~MuonPathAssociator ( )

Definition at line 48 of file MuonPathAssociator.cc.

References debug_, and LogDebug.

48  {
49  if (debug_)
50  LogDebug("MuonPathAssociator") << "MuonPathAssociator: destructor";
51 }
#define LogDebug(id)

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 81 of file MuonPathAssociator.cc.

References funct::abs(), allow_confirmation_, cmsdt::CELL_HEIGHT, cmsdt::CELL_LENGTH, cmsdt::CELL_SEMILENGTH, cmsdt::CH_CENTER_TO_MID_SL_X2, DTGeometry::chamber(), hltPixelTracks_cff::chi2, chi2corTh_, IntegrityClient_cfi::ChId, cmsdt::CHIGHQ, clean_chi2_correlation_, cmsdt::CLOWQ, dBX_correlate_TP_, debug_, cmsdt::DRIFT_SPEED, cmsdt::DRIFT_SPEED_X4, dT0_correlate_TP_, dTanPsi_correlate_TP_, dtGeo_, globalcoordsobtainer_, hasPosRF(), 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, isNotAPrimo(), DTLayerId::layer(), cmsdt::LHC_CLK_FREQ, LogDebug, cmsdt::LOWLOWQ, cmsdt::LOWQ, minx_match_2digis_, NUM_LAYERS, cmsdt::NUM_LAYERS_2SL, convertSQLiteXML::ok, or, phi, PV3DBase< T, PVType, FrameType >::phi(), cmsdt::PHI_CONV, funct::pow(), printmPC(), quality, DetId::rawId(), removeSharingFits(), removeSharingHits(), edm::second(), DTChamberId::sector(), edm::shift, shiftinfo_, Validation_hcalonly_cfi::sign, DTChamberId::station(), GeomDet::toGlobal(), useBX_correlation_, cmsdt::VERT_PHI1_PHI3, cmsdt::VERT_PHI1_PHI3_INV, DTChamberId::wheel(), cmsdt::X_POS_L3, cmsdt::X_POS_L4, z, and cmsdt::Z_SHIFT_MB4.

Referenced by run().

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

◆ finish()

void MuonPathAssociator::finish ( )

Definition at line 76 of file MuonPathAssociator.cc.

References debug_, and LogDebug.

Referenced by progressbar.ProgressBar::__next__().

76  {
77  if (debug_)
78  LogDebug("MuonPathAssociator") << "MuonPathAssociator: finish";
79 };
#define LogDebug(id)

◆ hasPosRF()

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

Definition at line 74 of file MuonPathAssociator.h.

References fileinputsource_cfi::sec.

Referenced by correlateMPaths().

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

◆ initialise()

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

Definition at line 56 of file MuonPathAssociator.cc.

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

56  {
57  if (debug_)
58  LogDebug("MuonPathAssociator") << "MuonPathAssociator::initialiase";
59 
60  auto geom = iEventSetup.getHandle(dtGeomH_);
61  dtGeo_ = &(*geom);
62 }
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomH_
DTGeometry const * dtGeo_
#define LogDebug(id)

◆ isNotAPrimo()

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

Definition at line 1052 of file MuonPathAssociator.cc.

References first, and edm::second().

Referenced by correlateMPaths(), and removeSharingHits().

1052  {
1053  int hitsSL1 = (first.wi1 != -1) + (first.wi2 != -1) + (first.wi3 != -1) + (first.wi4 != -1);
1054  int hitsSL3 = (first.wi5 != -1) + (first.wi6 != -1) + (first.wi7 != -1) + (first.wi8 != -1);
1055 
1056  bool lay1 = (first.wi1 == second.wi1) && (first.tdc1 = second.tdc1) && (first.wi1 != -1);
1057  bool lay2 = (first.wi2 == second.wi2) && (first.tdc2 = second.tdc2) && (first.wi2 != -1);
1058  bool lay3 = (first.wi3 == second.wi3) && (first.tdc3 = second.tdc3) && (first.wi3 != -1);
1059  bool lay4 = (first.wi4 == second.wi4) && (first.tdc4 = second.tdc4) && (first.wi4 != -1);
1060  bool lay5 = (first.wi5 == second.wi5) && (first.tdc5 = second.tdc5) && (first.wi5 != -1);
1061  bool lay6 = (first.wi6 == second.wi6) && (first.tdc6 = second.tdc6) && (first.wi6 != -1);
1062  bool lay7 = (first.wi7 == second.wi7) && (first.tdc7 = second.tdc7) && (first.wi7 != -1);
1063  bool lay8 = (first.wi8 == second.wi8) && (first.tdc8 = second.tdc8) && (first.wi8 != -1);
1064 
1065  return (((!lay1 && !lay2 && !lay3 && !lay4) || hitsSL1 < 3) && ((!lay5 && !lay6 && !lay7 && !lay8) || hitsSL3 < 3));
1066 }
U second(std::pair< T, U > const &p)

◆ printmPC()

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

Definition at line 1068 of file MuonPathAssociator.cc.

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.

Referenced by correlateMPaths(), removeSharingFits(), and removeSharingHits().

1068  {
1069  DTChamberId ChId(mP.rawId);
1070  LogDebug("MuonPathAssociator") << ChId << "\t"
1071  << " " << setw(2) << left << mP.wi1 << " " << setw(2) << left << mP.wi2 << " "
1072  << setw(2) << left << mP.wi3 << " " << setw(2) << left << mP.wi4 << " " << setw(2)
1073  << left << mP.wi5 << " " << setw(2) << left << mP.wi6 << " " << setw(2) << left
1074  << mP.wi7 << " " << setw(2) << left << mP.wi8 << " " << setw(5) << left << mP.tdc1
1075  << " " << setw(5) << left << mP.tdc2 << " " << setw(5) << left << mP.tdc3 << " "
1076  << setw(5) << left << mP.tdc4 << " " << setw(5) << left << mP.tdc5 << " " << setw(5)
1077  << left << mP.tdc6 << " " << setw(5) << left << mP.tdc7 << " " << setw(5) << left
1078  << mP.tdc8 << " " << setw(2) << left << mP.lat1 << " " << setw(2) << left << mP.lat2
1079  << " " << setw(2) << left << mP.lat3 << " " << setw(2) << left << mP.lat4 << " "
1080  << setw(2) << left << mP.lat5 << " " << setw(2) << left << mP.lat6 << " " << setw(2)
1081  << left << mP.lat7 << " " << setw(2) << left << mP.lat8 << " " << setw(10) << right
1082  << mP.x << " " << setw(9) << left << mP.tanPhi << " " << setw(5) << left << mP.t0
1083  << " " << setw(13) << left << mP.chi2 << " \n";
1084 }
#define LogDebug(id)

◆ removeSharingFits()

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

Definition at line 955 of file MuonPathAssociator.cc.

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

Referenced by correlateMPaths().

955  {
956  bool useFit[chamberMPaths.size()];
957  for (unsigned int i = 0; i < chamberMPaths.size(); i++) {
958  useFit[i] = true;
959  }
960  for (unsigned int i = 0; i < chamberMPaths.size(); i++) {
961  if (debug_)
962  LogDebug("MuonPathAssociator") << "Looking at prim" << i;
963  if (!useFit[i])
964  continue;
965  for (unsigned int j = i + 1; j < chamberMPaths.size(); j++) {
966  if (debug_)
967  LogDebug("MuonPathAssociator") << "Comparing with prim " << j;
968  if (!useFit[j])
969  continue;
970  metaPrimitive first = chamberMPaths[i];
971  metaPrimitive second = chamberMPaths[j];
972  if (shareFit(first, second)) {
973  if (first.quality > second.quality)
974  useFit[j] = false;
975  else if (first.quality < second.quality)
976  useFit[i] = false;
977  else {
978  if (first.chi2 < second.chi2)
979  useFit[j] = false;
980  else {
981  useFit[i] = false;
982  break;
983  }
984  }
985  }
986  }
987  if (useFit[i]) {
988  if (debug_)
989  printmPC(chamberMPaths[i]);
990  allMPaths.push_back(chamberMPaths[i]);
991  }
992  }
993  if (debug_)
994  LogDebug("MuonPathAssociator") << "---Swapping chamber---";
995 }
U second(std::pair< T, U > const &p)
void printmPC(cmsdt::metaPrimitive mP)
bool shareFit(cmsdt::metaPrimitive first, cmsdt::metaPrimitive second)
#define LogDebug(id)

◆ removeSharingHits()

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

Definition at line 997 of file MuonPathAssociator.cc.

References debug_, isNotAPrimo(), LogDebug, convertSQLiteXML::ok, and printmPC().

Referenced by correlateMPaths().

999  {
1000  for (auto &firstMP : firstMPaths) {
1001  if (debug_)
1002  LogDebug("MuonPathAssociator") << "----------------------------------";
1003  if (debug_)
1004  LogDebug("MuonPathAssociator") << "Turn for ";
1005  if (debug_)
1006  printmPC(firstMP);
1007  bool ok = true;
1008  for (auto &secondMP : secondMPaths) {
1009  if (debug_)
1010  LogDebug("MuonPathAssociator") << "Comparing with ";
1011  if (debug_)
1012  printmPC(secondMP);
1013  if (!isNotAPrimo(firstMP, secondMP)) {
1014  ok = false;
1015  break;
1016  }
1017  }
1018  if (ok) {
1019  allMPaths.push_back(firstMP);
1020  if (debug_)
1021  printmPC(firstMP);
1022  }
1023  if (debug_)
1024  LogDebug("MuonPathAssociator") << "----------------------------------";
1025  }
1026 }
bool isNotAPrimo(cmsdt::metaPrimitive first, cmsdt::metaPrimitive second)
void printmPC(cmsdt::metaPrimitive mP)
#define LogDebug(id)

◆ 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 64 of file MuonPathAssociator.cc.

References correlateMPaths(), and dT0_correlate_TP_.

68  {
70  correlateMPaths(digis, inMPaths, outMPaths);
71  else {
72  outMPaths.insert(outMPaths.end(), inMPaths.begin(), inMPaths.end());
73  }
74 }
void correlateMPaths(edm::Handle< DTDigiCollection > digis, std::vector< cmsdt::metaPrimitive > &inMPaths, std::vector< cmsdt::metaPrimitive > &outMPaths)

◆ shareFit()

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

Definition at line 1028 of file MuonPathAssociator.cc.

References first, and edm::second().

Referenced by removeSharingFits().

1028  {
1029  bool lay1 = (first.wi1 == second.wi1) && (first.tdc1 = second.tdc1);
1030  bool lay2 = (first.wi2 == second.wi2) && (first.tdc2 = second.tdc2);
1031  bool lay3 = (first.wi3 == second.wi3) && (first.tdc3 = second.tdc3);
1032  bool lay4 = (first.wi4 == second.wi4) && (first.tdc4 = second.tdc4);
1033  bool lay5 = (first.wi5 == second.wi5) && (first.tdc5 = second.tdc5);
1034  bool lay6 = (first.wi6 == second.wi6) && (first.tdc6 = second.tdc6);
1035  bool lay7 = (first.wi7 == second.wi7) && (first.tdc7 = second.tdc7);
1036  bool lay8 = (first.wi8 == second.wi8) && (first.tdc8 = second.tdc8);
1037 
1038  if (lay1 && lay2 && lay3 && lay4) {
1039  if (lay5 || lay6 || lay7 || lay8)
1040  return true;
1041  else
1042  return false;
1043  } else if (lay5 && lay6 && lay7 && lay8) {
1044  if (lay1 || lay2 || lay3 || lay4)
1045  return true;
1046  else
1047  return false;
1048  } else
1049  return false;
1050 }
U second(std::pair< T, U > const &p)

Member Data Documentation

◆ allow_confirmation_

bool MuonPathAssociator::allow_confirmation_
private

Definition at line 80 of file MuonPathAssociator.h.

Referenced by correlateMPaths().

◆ chi2corTh_

double MuonPathAssociator::chi2corTh_
private

Definition at line 85 of file MuonPathAssociator.h.

Referenced by correlateMPaths().

◆ clean_chi2_correlation_

bool MuonPathAssociator::clean_chi2_correlation_
private

Definition at line 78 of file MuonPathAssociator.h.

Referenced by correlateMPaths().

◆ dBX_correlate_TP_

double MuonPathAssociator::dBX_correlate_TP_
private

Definition at line 82 of file MuonPathAssociator.h.

Referenced by correlateMPaths().

◆ debug_

const bool MuonPathAssociator::debug_
private

◆ dT0_correlate_TP_

double MuonPathAssociator::dT0_correlate_TP_
private

Definition at line 81 of file MuonPathAssociator.h.

Referenced by correlateMPaths(), and run().

◆ dTanPsi_correlate_TP_

double MuonPathAssociator::dTanPsi_correlate_TP_
private

Definition at line 83 of file MuonPathAssociator.h.

Referenced by correlateMPaths().

◆ dtGeo_

DTGeometry const* MuonPathAssociator::dtGeo_

Definition at line 65 of file MuonPathAssociator.h.

Referenced by correlateMPaths(), and initialise().

◆ dtGeomH_

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

Definition at line 66 of file MuonPathAssociator.h.

Referenced by initialise(), and MuonPathAssociator().

◆ globalcoordsobtainer_

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

Definition at line 92 of file MuonPathAssociator.h.

Referenced by correlateMPaths(), and MuonPathAssociator().

◆ minx_match_2digis_

double MuonPathAssociator::minx_match_2digis_
private

Definition at line 84 of file MuonPathAssociator.h.

Referenced by correlateMPaths().

◆ shift_filename_

edm::FileInPath MuonPathAssociator::shift_filename_
private

Definition at line 88 of file MuonPathAssociator.h.

Referenced by MuonPathAssociator().

◆ shiftinfo_

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

Definition at line 89 of file MuonPathAssociator.h.

Referenced by correlateMPaths(), and MuonPathAssociator().

◆ useBX_correlation_

bool MuonPathAssociator::useBX_correlation_
private

Definition at line 79 of file MuonPathAssociator.h.

Referenced by correlateMPaths().