CMS 3D CMS Logo

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

#include <MuonPathAnalyzerInChamber.h>

Inheritance diagram for MuonPathAnalyzerInChamber:
MuonPathAnalyzer

Public Member Functions

int bxTolerance (void)
 
void finish () override
 
bool hasPosRF (int wh, int sec)
 
void initialise (const edm::EventSetup &iEventSetup) override
 
int minHits4Fit (void)
 
cmsdt::MP_QUALITY minQuality (void)
 
 MuonPathAnalyzerInChamber (const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
 
void run (edm::Event &iEvent, const edm::EventSetup &iEventSetup, MuonPathPtrs &inMpath, MuonPathPtrs &outMPath) override
 
void run (edm::Event &iEvent, const edm::EventSetup &iEventSetup, MuonPathPtrs &inMpath, std::vector< cmsdt::metaPrimitive > &metaPrimitives) override
 
void setBxTolerance (int t)
 
void setChiSquareThreshold (float ch2Thr)
 
void setMinHits4Fit (int h)
 
void setMinimumQuality (cmsdt::MP_QUALITY q)
 
 ~MuonPathAnalyzerInChamber () override
 
- Public Member Functions inherited from MuonPathAnalyzer
 MuonPathAnalyzer (const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
 
virtual ~MuonPathAnalyzer ()
 

Public Attributes

const DTGeometrydtGeo_
 
edm::ESGetToken< DTGeometry, MuonGeometryRecorddtGeomH
 
std::map< int, float > shiftinfo_
 

Private Member Functions

void analyze (MuonPathPtr &inMPath, MuonPathPtrs &outMPaths)
 
void buildLateralities (MuonPathPtr &mpath)
 
void calculateFitParameters (MuonPathPtr &mpath, TLateralities lat, int present_layer[NLayers])
 
void evaluateQuality (MuonPathPtr &mPath)
 
void setCellLayout (MuonPathPtr &mpath)
 
void setLateralitiesInMP (MuonPathPtr &mpath, TLateralities lat)
 
void setWirePosAndTimeInMP (MuonPathPtr &mpath)
 

Private Attributes

int bxTolerance_
 
int cellLayout_ [NLayers]
 
double chi2Th_
 
float chiSquareThreshold_
 
bool debug_
 
std::vector< TLateralities > lateralities_
 
std::vector< cmsdt::LATQ_TYPElatQuality_
 
short minHits4Fit_
 
cmsdt::MP_QUALITY minQuality_
 
edm::FileInPath shift_filename_
 
int totalNumValLateralities_
 

Detailed Description

Definition at line 17 of file MuonPathAnalyzerInChamber.h.

Constructor & Destructor Documentation

◆ MuonPathAnalyzerInChamber()

MuonPathAnalyzerInChamber::MuonPathAnalyzerInChamber ( const edm::ParameterSet pset,
edm::ConsumesCollector iC 
)

Definition at line 11 of file MuonPathAnalyzerInChamber.cc.

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),
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 }

References edm::BeginRun, chi2Th_, debug_, dtGeomH, edm::ConsumesCollector::esConsumes(), Exception, edm::FileInPath::fullPath(), LogDebug, setChiSquareThreshold(), edm::shift, shift_filename_, and shiftinfo_.

◆ ~MuonPathAnalyzerInChamber()

MuonPathAnalyzerInChamber::~MuonPathAnalyzerInChamber ( )
override

Definition at line 43 of file MuonPathAnalyzerInChamber.cc.

43  {
44  if (debug_)
45  LogDebug("MuonPathAnalyzerInChamber") << "MuonPathAnalyzer: destructor";
46 }

References debug_, and LogDebug.

Member Function Documentation

◆ analyze()

void MuonPathAnalyzerInChamber::analyze ( MuonPathPtr inMPath,
MuonPathPtrs outMPaths 
)
private

Definition at line 80 of file MuonPathAnalyzerInChamber.cc.

80  {
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 }

References buildLateralities(), calculateFitParameters(), DTGeometry::chamber(), chiSquareThreshold_, debug_, dtGeo_, evaluateQuality(), hasPosRF(), mps_fire::i, cuy::ii, lateralities_, LogDebug, minHits4Fit_, minQuality_, eostools::move(), cmsdt::NUM_LAYERS_2SL, phi, cmsdt::PHI_CONV, DTChamberId::sector(), setWirePosAndTimeInMP(), DTChamberId::station(), DTSuperLayerId::superLayer(), GeomDet::toGlobal(), totalNumValLateralities_, DTChamberId::wheel(), z, and cmsdt::Z_SHIFT_MB4.

Referenced by run().

◆ buildLateralities()

void MuonPathAnalyzerInChamber::buildLateralities ( MuonPathPtr mpath)
private

For a combination of up to 8 cells, build all the lateralities to be tested,

Definition at line 210 of file MuonPathAnalyzerInChamber.cc.

210  {
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 }

References filterCSVwithJSON::copy, debug_, createfilelist::int, lateralities_, latQuality_, cmsdt::LEFT, LogDebug, NONE, cmsdt::RIGHT, and totalNumValLateralities_.

Referenced by analyze().

◆ bxTolerance()

int MuonPathAnalyzerInChamber::bxTolerance ( void  )
inline

Definition at line 45 of file MuonPathAnalyzerInChamber.h.

45 { return bxTolerance_; };

References bxTolerance_.

◆ calculateFitParameters()

void MuonPathAnalyzerInChamber::calculateFitParameters ( MuonPathPtr mpath,
TLateralities  lat,
int  present_layer[NLayers] 
)
private

Definition at line 336 of file MuonPathAnalyzerInChamber.cc.

338  {
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 }

References funct::abs(), b, debug_, cmsdt::DRIFT_SPEED, mps_fire::i, LogDebug, cmsdt::NUM_LAYERS_2SL, and setLateralitiesInMP().

Referenced by analyze().

◆ evaluateQuality()

void MuonPathAnalyzerInChamber::evaluateQuality ( MuonPathPtr mPath)
private

Definition at line 529 of file MuonPathAnalyzerInChamber.cc.

529  {
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 }

References cmsdt::CHIGHQ, cmsdt::CLOWQ, cmsdt::HIGHHIGHQ, cmsdt::HIGHLOWQ, cmsdt::HIGHQ, cmsdt::LOWLOWQ, cmsdt::LOWQ, and cmsdt::NOPATH.

Referenced by analyze().

◆ finish()

void MuonPathAnalyzerInChamber::finish ( )
overridevirtual

Reimplemented from MuonPathAnalyzer.

Definition at line 72 of file MuonPathAnalyzerInChamber.cc.

72  {
73  if (debug_)
74  LogDebug("MuonPathAnalyzerInChamber") << "MuonPathAnalyzer: finish";
75 };

References debug_, and LogDebug.

Referenced by progressbar.ProgressBar::__next__().

◆ hasPosRF()

bool MuonPathAnalyzerInChamber::hasPosRF ( int  wh,
int  sec 
)
inline

Definition at line 49 of file MuonPathAnalyzerInChamber.h.

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

References fileinputsource_cfi::sec.

Referenced by analyze().

◆ initialise()

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

Reimplemented from MuonPathAnalyzer.

Definition at line 51 of file MuonPathAnalyzerInChamber.cc.

51  {
52  if (debug_)
53  LogDebug("MuonPathAnalyzerInChamber") << "MuonPathAnalyzerInChamber::initialiase";
54 
55  const MuonGeometryRecord &geom = iEventSetup.get<MuonGeometryRecord>();
56  dtGeo_ = &geom.get(dtGeomH);
57 }

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

◆ minHits4Fit()

int MuonPathAnalyzerInChamber::minHits4Fit ( void  )
inline

Definition at line 46 of file MuonPathAnalyzerInChamber.h.

46 { return minHits4Fit_; };

References minHits4Fit_.

◆ minQuality()

cmsdt::MP_QUALITY MuonPathAnalyzerInChamber::minQuality ( void  )
inline

Definition at line 47 of file MuonPathAnalyzerInChamber.h.

47 { return minQuality_; };

References minQuality_.

◆ run() [1/2]

void MuonPathAnalyzerInChamber::run ( edm::Event iEvent,
const edm::EventSetup iEventSetup,
MuonPathPtrs inMpath,
MuonPathPtrs outMPath 
)
overridevirtual

Implements MuonPathAnalyzer.

Definition at line 59 of file MuonPathAnalyzerInChamber.cc.

62  {
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 }

References analyze(), debug_, and LogDebug.

◆ run() [2/2]

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

Implements MuonPathAnalyzer.

Definition at line 25 of file MuonPathAnalyzerInChamber.h.

28  {}

◆ setBxTolerance()

void MuonPathAnalyzerInChamber::setBxTolerance ( int  t)
inline

Definition at line 37 of file MuonPathAnalyzerInChamber.h.

37 { bxTolerance_ = t; };

References bxTolerance_, and OrderedSet::t.

◆ setCellLayout()

void MuonPathAnalyzerInChamber::setCellLayout ( MuonPathPtr mpath)
private

Definition at line 189 of file MuonPathAnalyzerInChamber.cc.

189  {
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 }

References cellLayout_, and mps_fire::i.

◆ setChiSquareThreshold()

void MuonPathAnalyzerInChamber::setChiSquareThreshold ( float  ch2Thr)
inline

Definition at line 39 of file MuonPathAnalyzerInChamber.h.

39 { chiSquareThreshold_ = ch2Thr; };

References chiSquareThreshold_.

Referenced by MuonPathAnalyzerInChamber().

◆ setLateralitiesInMP()

void MuonPathAnalyzerInChamber::setLateralitiesInMP ( MuonPathPtr mpath,
TLateralities  lat 
)
private

Definition at line 279 of file MuonPathAnalyzerInChamber.cc.

279  {
281  for (int i = 0; i < 8; i++)
282  tmp[i] = lat[i];
283 
284  mpath->setLateralComb(tmp);
285 }

References mps_fire::i, cmsdt::NUM_LAYERS_2SL, and createJobs::tmp.

Referenced by calculateFitParameters().

◆ setMinHits4Fit()

void MuonPathAnalyzerInChamber::setMinHits4Fit ( int  h)
inline

Definition at line 38 of file MuonPathAnalyzerInChamber.h.

38 { minHits4Fit_ = h; };

References h, and minHits4Fit_.

◆ setMinimumQuality()

void MuonPathAnalyzerInChamber::setMinimumQuality ( cmsdt::MP_QUALITY  q)
inline

Definition at line 40 of file MuonPathAnalyzerInChamber.h.

40  {
42  minQuality_ = q;
43  };

References cmsdt::LOWQGHOST, minQuality_, and data-class-funcs::q.

◆ setWirePosAndTimeInMP()

void MuonPathAnalyzerInChamber::setWirePosAndTimeInMP ( MuonPathPtr mpath)
private

Definition at line 286 of file MuonPathAnalyzerInChamber.cc.

286  {
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 }

References debug_, dumpMFGeometry_cfg::delta, cmsdt::DRIFT_SPEED, mps_fire::i, LogDebug, cmsdt::NUM_LAYERS_2SL, DetId::rawId(), DTChamberId::sector(), shiftinfo_, DTChamberId::station(), and DTChamberId::wheel().

Referenced by analyze().

Member Data Documentation

◆ bxTolerance_

int MuonPathAnalyzerInChamber::bxTolerance_
private

Definition at line 76 of file MuonPathAnalyzerInChamber.h.

Referenced by bxTolerance(), and setBxTolerance().

◆ cellLayout_

int MuonPathAnalyzerInChamber::cellLayout_[NLayers]
private

Definition at line 80 of file MuonPathAnalyzerInChamber.h.

Referenced by setCellLayout().

◆ chi2Th_

double MuonPathAnalyzerInChamber::chi2Th_
private

Definition at line 74 of file MuonPathAnalyzerInChamber.h.

Referenced by MuonPathAnalyzerInChamber().

◆ chiSquareThreshold_

float MuonPathAnalyzerInChamber::chiSquareThreshold_
private

Definition at line 78 of file MuonPathAnalyzerInChamber.h.

Referenced by analyze(), and setChiSquareThreshold().

◆ debug_

bool MuonPathAnalyzerInChamber::debug_
private

◆ dtGeo_

const DTGeometry* MuonPathAnalyzerInChamber::dtGeo_

Definition at line 49 of file MuonPathAnalyzerInChamber.h.

Referenced by analyze(), and initialise().

◆ dtGeomH

edm::ESGetToken<DTGeometry, MuonGeometryRecord> MuonPathAnalyzerInChamber::dtGeomH

Definition at line 53 of file MuonPathAnalyzerInChamber.h.

Referenced by initialise(), and MuonPathAnalyzerInChamber().

◆ lateralities_

std::vector<TLateralities> MuonPathAnalyzerInChamber::lateralities_
private

Definition at line 70 of file MuonPathAnalyzerInChamber.h.

Referenced by analyze(), and buildLateralities().

◆ latQuality_

std::vector<cmsdt::LATQ_TYPE> MuonPathAnalyzerInChamber::latQuality_
private

Definition at line 71 of file MuonPathAnalyzerInChamber.h.

Referenced by buildLateralities().

◆ minHits4Fit_

short MuonPathAnalyzerInChamber::minHits4Fit_
private

Definition at line 79 of file MuonPathAnalyzerInChamber.h.

Referenced by analyze(), minHits4Fit(), and setMinHits4Fit().

◆ minQuality_

cmsdt::MP_QUALITY MuonPathAnalyzerInChamber::minQuality_
private

Definition at line 77 of file MuonPathAnalyzerInChamber.h.

Referenced by analyze(), minQuality(), and setMinimumQuality().

◆ shift_filename_

edm::FileInPath MuonPathAnalyzerInChamber::shift_filename_
private

Definition at line 75 of file MuonPathAnalyzerInChamber.h.

Referenced by MuonPathAnalyzerInChamber().

◆ shiftinfo_

std::map<int, float> MuonPathAnalyzerInChamber::shiftinfo_

Definition at line 56 of file MuonPathAnalyzerInChamber.h.

Referenced by MuonPathAnalyzerInChamber(), and setWirePosAndTimeInMP().

◆ totalNumValLateralities_

int MuonPathAnalyzerInChamber::totalNumValLateralities_
private

Definition at line 69 of file MuonPathAnalyzerInChamber.h.

Referenced by analyze(), and buildLateralities().

MuonPathAnalyzerInChamber::latQuality_
std::vector< cmsdt::LATQ_TYPE > latQuality_
Definition: MuonPathAnalyzerInChamber.h:71
DTGeometry
Definition: DTGeometry.h:28
DTSuperLayerId
Definition: DTSuperLayerId.h:12
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::chiSquareThreshold_
float chiSquareThreshold_
Definition: MuonPathAnalyzerInChamber.h:78
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
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
data-class-funcs.q
q
Definition: data-class-funcs.py:169
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
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::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
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
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
Point3DBase< float, GlobalTag >
OrderedSet.t
t
Definition: OrderedSet.py:90
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
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
MuonPathAnalyzerInChamber::bxTolerance_
int bxTolerance_
Definition: MuonPathAnalyzerInChamber.h:76
cmsdt::HIGHHIGHQ
Definition: constants.h:41
MuonPathAnalyzer::MuonPathAnalyzer
MuonPathAnalyzer(const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
Definition: MuonPathAnalyzer.cc:9
fileinputsource_cfi.sec
sec
Definition: fileinputsource_cfi.py:87
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
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
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
edm::Transition::BeginRun
Exception
Definition: hltDiff.cc:246
NONE
Definition: TkAlStyle.cc:47
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
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
cuy.ii
ii
Definition: cuy.py:590
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
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