CMS 3D CMS Logo

MuonPathAnalyzerInChamber.cc
Go to the documentation of this file.
2 #include <cmath>
3 #include <memory>
4 
5 using namespace edm;
6 using namespace std;
7 using namespace cmsdt;
8 // ============================================================================
9 // Constructors and destructor
10 // ============================================================================
12  : MuonPathAnalyzer(pset, iC),
13  debug_(pset.getUntrackedParameter<bool>("debug")),
14  chi2Th_(pset.getUntrackedParameter<double>("chi2Th")),
15  shift_filename_(pset.getParameter<edm::FileInPath>("shift_filename")),
16  bxTolerance_(30),
17  minQuality_(LOWQGHOST),
18  chiSquareThreshold_(50),
19  minHits4Fit_(pset.getUntrackedParameter<int>("minHits4Fit")) {
20  // Obtention of parameters
21 
22  if (debug_)
23  LogDebug("MuonPathAnalyzerInChamber") << "MuonPathAnalyzer: constructor";
24 
26 
27  //shift
28  int rawId;
29  std::ifstream ifin3(shift_filename_.fullPath());
30  double shift;
31  if (ifin3.fail()) {
32  throw cms::Exception("Missing Input File")
33  << "MuonPathAnalyzerInChamber::MuonPathAnalyzerInChamber() - Cannot find " << shift_filename_.fullPath();
34  }
35  while (ifin3.good()) {
36  ifin3 >> rawId >> shift;
37  shiftinfo_[rawId] = shift;
38  }
39 
41 }
42 
44  if (debug_)
45  LogDebug("MuonPathAnalyzerInChamber") << "MuonPathAnalyzer: destructor";
46 }
47 
48 // ============================================================================
49 // Main methods (initialise, run, finish)
50 // ============================================================================
52  if (debug_)
53  LogDebug("MuonPathAnalyzerInChamber") << "MuonPathAnalyzerInChamber::initialiase";
54 
55  const MuonGeometryRecord &geom = iEventSetup.get<MuonGeometryRecord>();
56  dtGeo_ = &geom.get(dtGeomH);
57 }
58 
60  const edm::EventSetup &iEventSetup,
61  MuonPathPtrs &muonpaths,
62  MuonPathPtrs &outmuonpaths) {
63  if (debug_)
64  LogDebug("MuonPathAnalyzerInChamber") << "MuonPathAnalyzerInChamber: run";
65 
66  // fit per SL (need to allow for multiple outputs for a single mpath)
67  for (auto muonpath = muonpaths.begin(); muonpath != muonpaths.end(); ++muonpath) {
68  analyze(*muonpath, outmuonpaths);
69  }
70 }
71 
73  if (debug_)
74  LogDebug("MuonPathAnalyzerInChamber") << "MuonPathAnalyzer: finish";
75 };
76 
77 //------------------------------------------------------------------
78 //--- Private method
79 //------------------------------------------------------------------
81  if (debug_)
82  LogDebug("MuonPathAnalyzerInChamber") << "DTp2:analyze \t\t\t\t starts";
83 
84  // Clone the analyzed object
85  if (debug_)
86  LogDebug("MuonPathAnalyzerInChamber") << inMPath->nprimitives();
87  auto mPath = std::make_shared<MuonPath>(inMPath);
88 
89  if (debug_) {
90  LogDebug("MuonPathAnalyzerInChamber") << "DTp2::analyze, looking at mPath: ";
91  for (int i = 0; i < mPath->nprimitives(); i++)
92  LogDebug("MuonPathAnalyzerInChamber")
93  << mPath->primitive(i)->layerId() << " , " << mPath->primitive(i)->superLayerId() << " , "
94  << mPath->primitive(i)->channelId() << " , " << mPath->primitive(i)->laterality();
95  }
96 
97  if (debug_)
98  LogDebug("MuonPathAnalyzerInChamber") << "DTp2:analyze \t\t\t\t\t is Analyzable? ";
99  if (!mPath->isAnalyzable())
100  return;
101  if (debug_)
102  LogDebug("MuonPathAnalyzerInChamber") << "DTp2:analyze \t\t\t\t\t yes it is analyzable " << mPath->isAnalyzable();
103 
104  // first of all, get info from primitives, so we can reduce the number of latereralities:
105  buildLateralities(mPath);
106  setWirePosAndTimeInMP(mPath);
107 
108  std::shared_ptr<MuonPath> mpAux;
109  int bestI = -1;
110  float best_chi2 = 99999.;
111  for (int i = 0; i < totalNumValLateralities_; i++) { // LOOP for all lateralities:
112  if (debug_)
113  LogDebug("MuonPathAnalyzerInChamber") << "DTp2:analyze \t\t\t\t\t Start with combination " << i;
114  int NTotalHits = NUM_LAYERS_2SL;
115  float xwire[NUM_LAYERS_2SL];
116  int present_layer[NUM_LAYERS_2SL];
117  for (int ii = 0; ii < 8; ii++) {
118  xwire[ii] = mPath->xWirePos(ii);
119  if (xwire[ii] == 0) {
120  present_layer[ii] = 0;
121  NTotalHits--;
122  } else {
123  present_layer[ii] = 1;
124  }
125  }
126 
127  while (NTotalHits >= minHits4Fit_) {
128  mPath->setChiSquare(0);
129  calculateFitParameters(mPath, lateralities_[i], present_layer);
130  if (mPath->chiSquare() != 0)
131  break;
132  NTotalHits--;
133  }
134  if (mPath->chiSquare() > chiSquareThreshold_)
135  continue;
136 
137  evaluateQuality(mPath);
138 
139  if (mPath->quality() < minQuality_)
140  continue;
141 
142  double z = 0;
143  double jm_x = (mPath->horizPos());
144  int selected_Id = 0;
145  for (int i = 0; i < mPath->nprimitives(); i++) {
146  if (mPath->primitive(i)->isValidTime()) {
147  selected_Id = mPath->primitive(i)->cameraId();
148  mPath->setRawId(selected_Id);
149  break;
150  }
151  }
152  DTLayerId thisLId(selected_Id);
153  if (thisLId.station() >= 3)
154  z = Z_SHIFT_MB4;
155 
156  DTSuperLayerId MuonPathSLId(thisLId.wheel(), thisLId.station(), thisLId.sector(), thisLId.superLayer());
157  GlobalPoint jm_x_cmssw_global = dtGeo_->chamber(MuonPathSLId)->toGlobal(LocalPoint(jm_x, 0., z));
158  //jm_x is already extrapolated to the middle of the SL
159  int thisec = MuonPathSLId.sector();
160  if (thisec == 13)
161  thisec = 4;
162  if (thisec == 14)
163  thisec = 10;
164  double phi = jm_x_cmssw_global.phi() - PHI_CONV * (thisec - 1);
165  double psi = atan(mPath->tanPhi());
166  mPath->setPhi(jm_x_cmssw_global.phi() - PHI_CONV * (thisec - 1));
167  mPath->setPhiB(hasPosRF(MuonPathSLId.wheel(), MuonPathSLId.sector()) ? psi - phi : -psi - phi);
168 
169  if (mPath->chiSquare() < best_chi2 && mPath->chiSquare() > 0) {
170  mpAux = std::make_shared<MuonPath>(mPath);
171  bestI = i;
172  best_chi2 = mPath->chiSquare();
173  }
174  }
175  if (mpAux != nullptr) {
176  outMPath.push_back(std::move(mpAux));
177  if (debug_)
178  LogDebug("MuonPathAnalyzerInChamber")
179  << "DTp2:analize \t\t\t\t\t Laterality " << bestI << " is the one with smaller chi2";
180  } else {
181  if (debug_)
182  LogDebug("MuonPathAnalyzerInChamber")
183  << "DTp2:analize \t\t\t\t\t No Laterality found with chi2 smaller than threshold";
184  }
185  if (debug_)
186  LogDebug("MuonPathAnalyzerInChamber") << "DTp2:analize \t\t\t\t\t Ended working with this set of lateralities";
187 }
188 
190  for (int i = 0; i <= mpath->nprimitives(); i++) {
191  if (mpath->primitive(i)->isValidTime())
192  cellLayout_[i] = mpath->primitive(i)->channelId();
193  else
194  cellLayout_[i] = -99;
195  }
196 
197  // putting info back into the mpath:
198  mpath->setCellHorizontalLayout(cellLayout_);
199  for (int i = 0; i <= mpath->nprimitives(); i++) {
200  if (cellLayout_[i] >= 0) {
201  mpath->setBaseChannelId(cellLayout_[i]);
202  break;
203  }
204  }
205 }
206 
211  if (debug_)
212  LogDebug("MuonPathAnalyzerInChamber") << "MPAnalyzer::buildLateralities << setLateralitiesFromPrims ";
213  mpath->setLateralCombFromPrimitives();
214 
216  lateralities_.clear();
217  latQuality_.clear();
218 
219  /* We generate all the possible laterality combinations compatible with the built
220  group in the previous step*/
221  lateralities_.push_back(TLateralities());
222  for (int ilat = 0; ilat < NLayers; ilat++) {
223  // Get value from input
224  LATERAL_CASES lr = (mpath->lateralComb())[ilat];
225  if (debug_)
226  LogDebug("MuonPathAnalyzerInChamber") << "[DEBUG_] Input[" << ilat << "]: " << lr;
227 
228  // If left/right fill number
229  if (lr != NONE) {
230  if (debug_)
231  LogDebug("MuonPathAnalyzerInChamber") << "[DEBUG_] - Adding it to " << lateralities_.size() << " lists...";
232  for (unsigned int iall = 0; iall < lateralities_.size(); iall++) {
233  lateralities_[iall][ilat] = lr;
234  }
235  }
236  // both possibilites
237  else {
238  // Get the number of possible options now
239  auto ncurrentoptions = lateralities_.size();
240 
241  // Duplicate them
242  if (debug_)
243  LogDebug("MuonPathAnalyzerInChamber") << "[DEBUG_] - Duplicating " << ncurrentoptions << " lists...";
244  copy(lateralities_.begin(), lateralities_.end(), back_inserter(lateralities_));
245  if (debug_)
246  LogDebug("MuonPathAnalyzerInChamber") << "[DEBUG_] - Now we have " << lateralities_.size() << " lists...";
247 
248  // Asign LEFT to first ncurrentoptions and RIGHT to the last
249  for (unsigned int iall = 0; iall < ncurrentoptions; iall++) {
250  lateralities_[iall][ilat] = LEFT;
251  lateralities_[iall + ncurrentoptions][ilat] = RIGHT;
252  }
253  } // else
254  } // Iterate over input array
255 
257  if (totalNumValLateralities_ > 128) {
258  // ADD PROTECTION!
259  LogDebug("MuonPathAnalyzerInChamber") << "[WARNING]: TOO MANY LATERALITIES TO CHECK !!";
260  LogDebug("MuonPathAnalyzerInChamber") << "[WARNING]: skipping this muon";
261  lateralities_.clear();
262  latQuality_.clear();
264  }
265 
266  // Dump values
267  if (debug_) {
268  for (unsigned int iall = 0; iall < lateralities_.size(); iall++) {
269  LogDebug("MuonPathAnalyzerInChamber") << iall << " -> [";
270  for (int ilat = 0; ilat < NLayers; ilat++) {
271  if (ilat != 0)
272  LogDebug("MuonPathAnalyzerInChamber") << ",";
273  LogDebug("MuonPathAnalyzerInChamber") << lateralities_[iall][ilat];
274  }
275  LogDebug("MuonPathAnalyzerInChamber") << "]";
276  }
277  }
278 }
281  for (int i = 0; i < 8; i++)
282  tmp[i] = lat[i];
283 
284  mpath->setLateralComb(tmp);
285 }
287  int selected_Id = 0;
288  for (int i = 0; i < mpath->nprimitives(); i++) {
289  if (mpath->primitive(i)->isValidTime()) {
290  selected_Id = mpath->primitive(i)->cameraId();
291  mpath->setRawId(selected_Id);
292  break;
293  }
294  }
295  DTLayerId thisLId(selected_Id);
296  DTChamberId chId(thisLId.wheel(), thisLId.station(), thisLId.sector());
297  if (debug_)
298  LogDebug("MuonPathAnalyzerInChamber")
299  << "Id " << chId.rawId() << " Wh " << chId.wheel() << " St " << chId.station() << " Se " << chId.sector();
300  mpath->setRawId(chId.rawId());
301 
302  DTSuperLayerId MuonPathSLId1(thisLId.wheel(), thisLId.station(), thisLId.sector(), 1);
303  DTSuperLayerId MuonPathSLId3(thisLId.wheel(), thisLId.station(), thisLId.sector(), 3);
304  DTWireId wireId1(MuonPathSLId1, 2, 1);
305  DTWireId wireId3(MuonPathSLId3, 2, 1);
306 
307  if (debug_)
308  LogDebug("MuonPathAnalyzerInChamber")
309  << "shift1=" << shiftinfo_[wireId1.rawId()] << " shift3=" << shiftinfo_[wireId3.rawId()];
310 
311  float delta = 42000; //um
312  float zwire[NUM_LAYERS_2SL] = {-13.7, -12.4, -11.1, -9.8002, 9.79999, 11.1, 12.4, 13.7}; // mm
313  for (int i = 0; i < mpath->nprimitives(); i++) {
314  if (mpath->primitive(i)->isValidTime()) {
315  if (i < 4)
316  mpath->setXWirePos(10000 * shiftinfo_[wireId1.rawId()] +
317  (mpath->primitive(i)->channelId() + 0.5 * (double)((i + 1) % 2)) * delta,
318  i);
319  if (i >= 4)
320  mpath->setXWirePos(10000 * shiftinfo_[wireId3.rawId()] +
321  (mpath->primitive(i)->channelId() + 0.5 * (double)((i + 1) % 2)) * delta,
322  i);
323  mpath->setZWirePos(zwire[i] * 1000, i); // in um
324  mpath->setTWireTDC(mpath->primitive(i)->tdcTimeStamp() * DRIFT_SPEED, i);
325  } else {
326  mpath->setXWirePos(0., i);
327  mpath->setZWirePos(0., i);
328  mpath->setTWireTDC(-1 * DRIFT_SPEED, i);
329  }
330  if (debug_)
331  LogDebug("MuonPathAnalyzerInChamber") << mpath->primitive(i)->tdcTimeStamp() << " ";
332  }
333  if (debug_)
334  LogDebug("MuonPathAnalyzerInChamber");
335 }
337  TLateralities laterality,
338  int present_layer[NUM_LAYERS_2SL]) {
339  // First prepare mpath for fit:
340  float xwire[NUM_LAYERS_2SL], zwire[NUM_LAYERS_2SL], tTDCvdrift[NUM_LAYERS_2SL];
341  double b[NUM_LAYERS_2SL];
342  for (int i = 0; i < 8; i++) {
343  xwire[i] = mpath->xWirePos(i);
344  zwire[i] = mpath->zWirePos(i);
345  tTDCvdrift[i] = mpath->tWireTDC(i);
346  b[i] = 1;
347  }
348 
350 
351  // fill hit position
352  float xhit[NUM_LAYERS_2SL];
353  for (int lay = 0; lay < 8; lay++) {
354  if (debug_)
355  LogDebug("MuonPathAnalyzerInChamber") << "In fitPerLat " << lay << " xwire " << xwire[lay] << " zwire "
356  << zwire[lay] << " tTDCvdrift " << tTDCvdrift[lay];
357  xhit[lay] = xwire[lay] + (-1 + 2 * laterality[lay]) * 1000 * tTDCvdrift[lay];
358  if (debug_)
359  LogDebug("MuonPathAnalyzerInChamber") << "In fitPerLat " << lay << " xhit " << xhit[lay];
360  }
361 
362  //Proceed with calculation of fit parameters
363  double cbscal = 0.0;
364  double zbscal = 0.0;
365  double czscal = 0.0;
366  double bbscal = 0.0;
367  double zzscal = 0.0;
368  double ccscal = 0.0;
369 
370  for (int lay = 0; lay < 8; lay++) {
371  if (present_layer[lay] == 0)
372  continue;
373  if (debug_)
374  LogDebug("MuonPathAnalyzerInChamber")
375  << " For layer " << lay + 1 << " xwire[lay] " << xwire[lay] << " zwire " << zwire[lay] << " b " << b[lay];
376  if (debug_)
377  LogDebug("MuonPathAnalyzerInChamber") << " xhit[lat][lay] " << xhit[lay];
378  cbscal = (-1 + 2 * laterality[lay]) * b[lay] + cbscal;
379  zbscal = zwire[lay] * b[lay] + zbscal; //it actually does not depend on laterality
380  czscal = (-1 + 2 * laterality[lay]) * zwire[lay] + czscal;
381 
382  bbscal = b[lay] * b[lay] + bbscal; //it actually does not depend on laterality
383  zzscal = zwire[lay] * zwire[lay] + zzscal; //it actually does not depend on laterality
384  ccscal = (-1 + 2 * laterality[lay]) * (-1 + 2 * laterality[lay]) + ccscal;
385  }
386 
387  double cz = 0.0;
388  double cb = 0.0;
389  double zb = 0.0;
390  double zc = 0.0;
391  double bc = 0.0;
392  double bz = 0.0;
393 
394  cz = (cbscal * zbscal - czscal * bbscal) / (zzscal * bbscal - zbscal * zbscal);
395  cb = (czscal * zbscal - cbscal * zzscal) / (zzscal * bbscal - zbscal * zbscal);
396 
397  zb = (czscal * cbscal - zbscal * ccscal) / (bbscal * ccscal - cbscal * cbscal);
398  zc = (zbscal * cbscal - czscal * bbscal) / (bbscal * ccscal - cbscal * cbscal);
399 
400  bc = (zbscal * czscal - cbscal * zzscal) / (ccscal * zzscal - czscal * czscal);
401  bz = (cbscal * czscal - zbscal * ccscal) / (ccscal * zzscal - czscal * czscal);
402 
403  double c_tilde[NUM_LAYERS_2SL];
404  double z_tilde[NUM_LAYERS_2SL];
405  double b_tilde[NUM_LAYERS_2SL];
406 
407  for (int lay = 0; lay < 8; lay++) {
408  if (present_layer[lay] == 0)
409  continue;
410  if (debug_)
411  LogDebug("MuonPathAnalyzerInChamber")
412  << " For layer " << lay + 1 << " xwire[lay] " << xwire[lay] << " zwire " << zwire[lay] << " b " << b[lay];
413  c_tilde[lay] = (-1 + 2 * laterality[lay]) + cz * zwire[lay] + cb * b[lay];
414  z_tilde[lay] = zwire[lay] + zb * b[lay] + zc * (-1 + 2 * laterality[lay]);
415  b_tilde[lay] = b[lay] + bc * (-1 + 2 * laterality[lay]) + bz * zwire[lay];
416  }
417 
418  //Calculate results per lat
419  double xctilde = 0.0;
420  double xztilde = 0.0;
421  double xbtilde = 0.0;
422  double ctildectilde = 0.0;
423  double ztildeztilde = 0.0;
424  double btildebtilde = 0.0;
425 
426  double rect0vdrift = 0.0;
427  double recslope = 0.0;
428  double recpos = 0.0;
429 
430  for (int lay = 0; lay < 8; lay++) {
431  if (present_layer[lay] == 0)
432  continue;
433  xctilde = xhit[lay] * c_tilde[lay] + xctilde;
434  ctildectilde = c_tilde[lay] * c_tilde[lay] + ctildectilde;
435  xztilde = xhit[lay] * z_tilde[lay] + xztilde;
436  ztildeztilde = z_tilde[lay] * z_tilde[lay] + ztildeztilde;
437  xbtilde = xhit[lay] * b_tilde[lay] + xbtilde;
438  btildebtilde = b_tilde[lay] * b_tilde[lay] + btildebtilde;
439  }
440 
441  //Results for t0vdrift (BX), slope and position per lat
442  rect0vdrift = xctilde / ctildectilde;
443  recslope = xztilde / ztildeztilde;
444  recpos = xbtilde / btildebtilde;
445  if (debug_) {
446  LogDebug("MuonPathAnalyzerInChamber") << " In fitPerLat Reconstructed values per lat "
447  << " rect0vdrift " << rect0vdrift;
448  LogDebug("MuonPathAnalyzerInChamber")
449  << "rect0 " << rect0vdrift / DRIFT_SPEED << " recBX " << rect0vdrift / DRIFT_SPEED / 25 << " recslope "
450  << recslope << " recpos " << recpos;
451  }
452 
453  //Get t*v and residuals per layer, and chi2 per laterality
454  double rectdriftvdrift[NUM_LAYERS_2SL];
455  double recres[NUM_LAYERS_2SL];
456  double recchi2 = 0.0;
457  int sign_tdriftvdrift = {0};
458  int incell_tdriftvdrift = {0};
459  int physical_slope = {0};
460 
461  // Select the worst hit in order to get rid of it
462  double maxDif = -1;
463  int maxInt = -1;
464 
465  for (int lay = 0; lay < 8; lay++) {
466  if (present_layer[lay] == 0)
467  continue;
468  rectdriftvdrift[lay] = tTDCvdrift[lay] - rect0vdrift / 1000;
469  if (debug_)
470  LogDebug("MuonPathAnalyzerInChamber") << rectdriftvdrift[lay];
471  recres[lay] = xhit[lay] - zwire[lay] * recslope - b[lay] * recpos - (-1 + 2 * laterality[lay]) * rect0vdrift;
472  if ((present_layer[lay] == 1) && (rectdriftvdrift[lay] < -0.1)) {
473  sign_tdriftvdrift = -1;
474  if (-0.1 - rectdriftvdrift[lay] > maxDif) {
475  maxDif = -0.1 - rectdriftvdrift[lay];
476  maxInt = lay;
477  }
478  }
479  if ((present_layer[lay] == 1) && (abs(rectdriftvdrift[lay]) > 21.1)) {
480  incell_tdriftvdrift = -1; //Changed to 2.11 to account for resolution effects
481  if (rectdriftvdrift[lay] - 21.1 > maxDif) {
482  maxDif = rectdriftvdrift[lay] - 21.1;
483  maxInt = lay;
484  }
485  }
486  }
487 
488  if (fabs(recslope / 10) > 1.3)
489  physical_slope = -1;
490 
491  if (physical_slope == -1 && debug_)
492  LogDebug("MuonPathAnalyzerInChamber") << "Combination with UNPHYSICAL slope ";
493  if (sign_tdriftvdrift == -1 && debug_)
494  LogDebug("MuonPathAnalyzerInChamber") << "Combination with negative tdrift-vdrift ";
495  if (incell_tdriftvdrift == -1 && debug_)
496  LogDebug("MuonPathAnalyzerInChamber") << "Combination with tdrift-vdrift larger than half cell ";
497 
498  for (int lay = 0; lay < 8; lay++) {
499  if (present_layer[lay] == 0)
500  continue;
501  recchi2 = recres[lay] * recres[lay] + recchi2;
502  }
503  if (debug_)
504  LogDebug("MuonPathAnalyzerInChamber")
505  << "In fitPerLat Chi2 " << recchi2 << " with sign " << sign_tdriftvdrift << " within cell "
506  << incell_tdriftvdrift << " physical_slope " << physical_slope;
507 
508  //LATERALITY IS NOT VALID
509  if (true && maxInt != -1) {
510  present_layer[maxInt] = 0;
511  if (debug_)
512  LogDebug("MuonPathAnalyzerInChamber") << "We get rid of hit in layer " << maxInt;
513  }
514 
515  // LATERALITY IS VALID...
516  if (!(sign_tdriftvdrift == -1) && !(incell_tdriftvdrift == -1) && !(physical_slope == -1)) {
517  mpath->setBxTimeValue((rect0vdrift / DRIFT_SPEED) / 1000);
518  mpath->setTanPhi(-1 * recslope / 10);
519  mpath->setHorizPos(recpos / 10000);
520  mpath->setChiSquare(recchi2 / 100000000);
521  setLateralitiesInMP(mpath, laterality);
522  if (debug_)
523  LogDebug("MuonPathAnalyzerInChamber")
524  << "In fitPerLat "
525  << "t0 " << mpath->bxTimeValue() << " slope " << mpath->tanPhi() << " pos " << mpath->horizPos() << " chi2 "
526  << mpath->chiSquare() << " rawId " << mpath->rawId();
527  }
528 }
530  mPath->setQuality(NOPATH);
531 
532  if (mPath->nprimitivesUp() >= 4 && mPath->nprimitivesDown() >= 4) {
533  mPath->setQuality(HIGHHIGHQ);
534  } else if ((mPath->nprimitivesUp() == 4 && mPath->nprimitivesDown() == 3) ||
535  (mPath->nprimitivesUp() == 3 && mPath->nprimitivesDown() == 4)) {
536  mPath->setQuality(HIGHLOWQ);
537  } else if ((mPath->nprimitivesUp() == 4 && mPath->nprimitivesDown() <= 2 && mPath->nprimitivesDown() > 0) ||
538  (mPath->nprimitivesUp() <= 2 && mPath->nprimitivesUp() > 0 && mPath->nprimitivesDown() == 4)) {
539  mPath->setQuality(CHIGHQ);
540  } else if ((mPath->nprimitivesUp() == 3 && mPath->nprimitivesDown() == 3)) {
541  mPath->setQuality(LOWLOWQ);
542  } else if ((mPath->nprimitivesUp() == 3 && mPath->nprimitivesDown() <= 2 && mPath->nprimitivesDown() > 0) ||
543  (mPath->nprimitivesUp() <= 2 && mPath->nprimitivesUp() > 0 && mPath->nprimitivesDown() == 3) ||
544  (mPath->nprimitivesUp() == 2 && mPath->nprimitivesDown() == 2)) {
545  mPath->setQuality(CLOWQ);
546  } else if (mPath->nprimitivesUp() >= 4 || mPath->nprimitivesDown() >= 4) {
547  mPath->setQuality(HIGHQ);
548  } else if (mPath->nprimitivesUp() == 3 || mPath->nprimitivesDown() == 3) {
549  mPath->setQuality(LOWQ);
550  }
551 }
MuonPathAnalyzerInChamber::latQuality_
std::vector< cmsdt::LATQ_TYPE > latQuality_
Definition: MuonPathAnalyzerInChamber.h:71
DTGeometry
Definition: DTGeometry.h:28
DTSuperLayerId
Definition: DTSuperLayerId.h:12
MuonPathAnalyzerInChamber::MuonPathAnalyzerInChamber
MuonPathAnalyzerInChamber(const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
Definition: MuonPathAnalyzerInChamber.cc:11
electrons_cff.bool
bool
Definition: electrons_cff.py:372
MuonPathAnalyzerInChamber::chi2Th_
double chi2Th_
Definition: MuonPathAnalyzerInChamber.h:74
mps_fire.i
i
Definition: mps_fire.py:355
MuonPathAnalyzerInChamber::setChiSquareThreshold
void setChiSquareThreshold(float ch2Thr)
Definition: MuonPathAnalyzerInChamber.h:39
MuonPathAnalyzerInChamber::calculateFitParameters
void calculateFitParameters(MuonPathPtr &mpath, TLateralities lat, int present_layer[NLayers])
Definition: MuonPathAnalyzerInChamber.cc:336
cmsdt::NOPATH
Definition: constants.h:41
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
MuonPathAnalyzerInChamber::finish
void finish() override
Definition: MuonPathAnalyzerInChamber.cc:72
MuonPathAnalyzerInChamber::chiSquareThreshold_
float chiSquareThreshold_
Definition: MuonPathAnalyzerInChamber.h:78
edm
HLT enums.
Definition: AlignableModifier.h:19
MuonPathAnalyzerInChamber::minHits4Fit_
short minHits4Fit_
Definition: MuonPathAnalyzerInChamber.h:79
MuonPathAnalyzerInChamber::dtGeo_
const DTGeometry * dtGeo_
Definition: MuonPathAnalyzerInChamber.h:49
MuonPathAnalyzerInChamber::debug_
bool debug_
Definition: MuonPathAnalyzerInChamber.h:73
cmsdt::LEFT
Definition: constants.h:44
cmsdt::HIGHQ
Definition: constants.h:41
MuonPathAnalyzerInChamber::run
void run(edm::Event &iEvent, const edm::EventSetup &iEventSetup, MuonPathPtrs &inMpath, std::vector< cmsdt::metaPrimitive > &metaPrimitives) override
Definition: MuonPathAnalyzerInChamber.h:25
DTSuperLayerId::superLayer
int superLayer() const
Return the superlayer number.
Definition: DTSuperLayerId.h:39
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:86
MuonPathPtrs
std::vector< MuonPathPtr > MuonPathPtrs
Definition: MuonPath.h:122
MuonPathAnalyzerInChamber::setLateralitiesInMP
void setLateralitiesInMP(MuonPathPtr &mpath, TLateralities lat)
Definition: MuonPathAnalyzerInChamber.cc:279
cmsdt::CHIGHQ
Definition: constants.h:41
DTGeometry::chamber
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90
cmsdt::LOWQGHOST
Definition: constants.h:41
edm::FileInPath
Definition: FileInPath.h:64
MuonPathAnalyzerInChamber::totalNumValLateralities_
int totalNumValLateralities_
Definition: MuonPathAnalyzerInChamber.h:69
cmsdt
Definition: constants.h:39
cmsdt::LATERAL_CASES
LATERAL_CASES
Definition: constants.h:44
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
MuonPathAnalyzerInChamber::hasPosRF
bool hasPosRF(int wh, int sec)
Definition: MuonPathAnalyzerInChamber.h:49
MuonPathAnalyzerInChamber::initialise
void initialise(const edm::EventSetup &iEventSetup) override
Definition: MuonPathAnalyzerInChamber.cc:51
DTWireId
Definition: DTWireId.h:12
MuonPathAnalyzerInChamber::evaluateQuality
void evaluateQuality(MuonPathPtr &mPath)
Definition: MuonPathAnalyzerInChamber.cc:529
MuonPathAnalyzerInChamber::shift_filename_
edm::FileInPath shift_filename_
Definition: MuonPathAnalyzerInChamber.h:75
DDAxes::z
MuonPathAnalyzerInChamber::setCellLayout
void setCellLayout(MuonPathPtr &mpath)
Definition: MuonPathAnalyzerInChamber.cc:189
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
Point3DBase< float, GlobalTag >
b
double b
Definition: hdecay.h:118
DTLayerId
Definition: DTLayerId.h:12
MuonPathAnalyzerInChamber::shiftinfo_
std::map< int, float > shiftinfo_
Definition: MuonPathAnalyzerInChamber.h:56
cmsdt::PHI_CONV
constexpr double PHI_CONV
Definition: constants.h:240
MuonPathAnalyzerInChamber::cellLayout_
int cellLayout_[NLayers]
Definition: MuonPathAnalyzerInChamber.h:80
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:670
edm::ParameterSet
Definition: ParameterSet.h:36
cmsdt::CLOWQ
Definition: constants.h:41
MuonPathAnalyzerInChamber::minQuality_
cmsdt::MP_QUALITY minQuality_
Definition: MuonPathAnalyzerInChamber.h:77
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
cmsdt::RIGHT
Definition: constants.h:44
MuonPathAnalyzerInChamber::lateralities_
std::vector< TLateralities > lateralities_
Definition: MuonPathAnalyzerInChamber.h:70
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
MuonPathAnalyzerInChamber::~MuonPathAnalyzerInChamber
~MuonPathAnalyzerInChamber() override
Definition: MuonPathAnalyzerInChamber.cc:43
edm::EventSetup
Definition: EventSetup.h:57
cmsdt::HIGHHIGHQ
Definition: constants.h:41
MuonPathAnalyzer
Definition: MuonPathAnalyzer.h:37
MuonPathPtr
std::shared_ptr< MuonPath > MuonPathPtr
Definition: MuonPath.h:121
cmsdt::Z_SHIFT_MB4
constexpr float Z_SHIFT_MB4
Definition: constants.h:243
DDAxes::phi
cmsdt::HIGHLOWQ
Definition: constants.h:41
cmsdt::DRIFT_SPEED
constexpr float DRIFT_SPEED
Definition: constants.h:182
MuonPathAnalyzerInChamber::analyze
void analyze(MuonPathPtr &inMPath, MuonPathPtrs &outMPaths)
Definition: MuonPathAnalyzerInChamber.cc:80
psi
std::map< std::string, int, std::less< std::string > > psi
Definition: CountProcessesAction.h:15
DTChamberId::sector
int sector() const
Definition: DTChamberId.h:49
cmsdt::NUM_LAYERS_2SL
constexpr int NUM_LAYERS_2SL
Definition: constants.h:239
cmsdt::LOWQ
Definition: constants.h:41
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
edm::Transition::BeginRun
Exception
Definition: hltDiff.cc:246
NONE
Definition: TkAlStyle.cc:47
MuonPathAnalyzerInChamber.h
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DTChamberId
Definition: DTChamberId.h:14
cmsdt::LOWLOWQ
Definition: constants.h:41
MuonPathAnalyzerInChamber::setWirePosAndTimeInMP
void setWirePosAndTimeInMP(MuonPathPtr &mpath)
Definition: MuonPathAnalyzerInChamber.cc:286
edm::Event
Definition: Event.h:73
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
DTChamberId::wheel
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
cuy.ii
ii
Definition: cuy.py:590
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
DTChamberId::station
int station() const
Return the station number.
Definition: DTChamberId.h:42
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MuonPathAnalyzerInChamber::dtGeomH
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomH
Definition: MuonPathAnalyzerInChamber.h:53
MuonPathAnalyzerInChamber::buildLateralities
void buildLateralities(MuonPathPtr &mpath)
Definition: MuonPathAnalyzerInChamber.cc:210