CMS 3D CMS Logo

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

#include <GoldenPatternResult.h>

Public Member Functions

void finalise0 ()
 
void finalise1 ()
 
void finalise10 ()
 
void finalise11 ()
 
void finalise2 ()
 
void finalise3 ()
 
void finalise5 ()
 
void finalise6 ()
 
void finalise7 ()
 
void finalise8 ()
 
void finalise9 ()
 
int getEta () const
 
unsigned int getFiredLayerBits () const
 
unsigned int getFiredLayerCnt () const
 
double getGpProbability1 () const
 
double getGpProbability2 () const
 
PdfValueType getPdfSum () const
 
PdfValueType getPdfSumUnconstr () const
 
int getPhi () const
 
int getRefHitPhi () const
 
int getRefLayer () const
 
const StubResultsgetStubResults () const
 
 GoldenPatternResult ()
 
 GoldenPatternResult (const OMTFConfiguration *omtfConfig)
 
void init (const OMTFConfiguration *omtfConfig)
 
bool isLayerFired (unsigned int iLayer) const
 
bool isValid () const
 
void reset ()
 
void set (int refLayer, int phi, int eta, int refHitPhi)
 
void setEta (int eta)
 
void setFiredLayerBits (unsigned int firedLayerBits)
 
void setFiredLayerCnt (unsigned int firedLayerCnt)
 
void setGpProbability1 (double probability1=0)
 
void setGpProbability2 (double probability2=0)
 
void setPhi (int phi)
 
void setRefHitPhi (int refHitPhi)
 
void setRefLayer (int refLayer)
 
void setStubResult (float pdfVal, bool valid, int pdfBin, int layer, MuonStubPtr stub)
 
void setStubResult (int layer, StubResult &stubResult)
 
void setValid (bool valid)
 

Public Attributes

std::function< void()> finalise
 

Private Attributes

int eta = 0
 eta at the 2nd muon station More...
 
int finalizeFunction = 0
 
unsigned int firedLayerBits = 0
 bits representing fired logicLayers (including bending layers), More...
 
unsigned int firedLayerCnt = 0
 Number of fired layers. More...
 
double gpProbability1 = 0
 
double gpProbability2 = 0
 
const OMTFConfigurationomtfConfig = nullptr
 
double pdfSum = 0
 Sum of pdfValues. More...
 
double pdfSumUnconstr = 0
 
int phi = 0
 phi at the 2nd muon station (propagated refHitPhi) More...
 
int refHitPhi = 0
 phi of the reference hits More...
 
int refLayer = 0
 
StubResults stubResults
 
bool valid = false
 

Friends

std::ostream & operator<< (std::ostream &out, const GoldenPatternResult &aResult)
 

Detailed Description

Definition at line 11 of file GoldenPatternResult.h.

Constructor & Destructor Documentation

◆ GoldenPatternResult() [1/2]

GoldenPatternResult::GoldenPatternResult ( )
inline

Definition at line 101 of file GoldenPatternResult.h.

101 {};

◆ GoldenPatternResult() [2/2]

GoldenPatternResult::GoldenPatternResult ( const OMTFConfiguration omtfConfig)

Definition at line 16 of file GoldenPatternResult.cc.

References finalise0().

17  : finalise([this]() { finalise0(); }), omtfConfig(omtfConfig) {
18  if (omtfConfig)
20 }
const OMTFConfiguration * omtfConfig
std::function< void()> finalise
void init(const OMTFConfiguration *omtfConfig)

Member Function Documentation

◆ finalise0()

void GoldenPatternResult::finalise0 ( )

Definition at line 112 of file GoldenPatternResult.cc.

References firedLayerBits, firedLayerCnt, OMTFConfiguration::fwVersion(), OMTFConfiguration::getBendingLayers(), OMTFConfiguration::getLogicToLogic(), omtfConfig, pdfSum, stubResults, and valid.

Referenced by GoldenPatternResult(), and init().

112  {
113  for (unsigned int iLogicLayer = 0; iLogicLayer < stubResults.size(); ++iLogicLayer) {
114  unsigned int connectedLayer = omtfConfig->getLogicToLogic().at(iLogicLayer);
115  //here we require that in case of the DT layers, both phi and phiB is fired
116  if (firedLayerBits & (1 << connectedLayer)) {
117  if (firedLayerBits & (1 << iLogicLayer)) {
118  //now in the GoldenPattern::process1Layer1RefLayer the pdf bin 0 is returned when the layer is not fired, so this is 'if' is to assured that this pdf val is not added here
119  pdfSum += stubResults[iLogicLayer].getPdfVal();
120 
121  if (omtfConfig->fwVersion() <= 4) {
122  if (!omtfConfig->getBendingLayers().count(iLogicLayer))
123  //in DT case, the phi and phiB layers are threaded as one, so the firedLayerCnt is increased only for the phi layer
124  firedLayerCnt++;
125  } else
126  firedLayerCnt++;
127  }
128  } else {
129  firedLayerBits &= ~(1 << iLogicLayer);
130  }
131  }
132 
133  valid = true;
134  //by default result becomes valid here, but can be overwritten later
135 }
unsigned int firedLayerBits
bits representing fired logicLayers (including bending layers),
const OMTFConfiguration * omtfConfig
unsigned int fwVersion() const
const std::map< int, int > & getLogicToLogic() const
const std::set< int > & getBendingLayers() const
double pdfSum
Sum of pdfValues.
unsigned int firedLayerCnt
Number of fired layers.

◆ finalise1()

void GoldenPatternResult::finalise1 ( )

Definition at line 140 of file GoldenPatternResult.cc.

References firedLayerBits, firedLayerCnt, pdfSum, stubResults, and valid.

Referenced by init().

140  {
141  for (unsigned int iLogicLayer = 0; iLogicLayer < stubResults.size(); ++iLogicLayer) {
142  //in this version we do not require that both phi and phiB is fired (non-zero), we thread them just independent
143  //watch out that then the number of fired layers is bigger, and the cut on the minimal number of fired layers does not work in the same way as when the dt chamber is counted as one layer
144  //TODO check if it affects performance
145  pdfSum += stubResults[iLogicLayer].getPdfVal();
146  firedLayerCnt += ((firedLayerBits & (1 << iLogicLayer)) != 0);
147  }
148 
149  valid = true;
150  //by default result becomes valid here, but can be overwritten later
151 }
unsigned int firedLayerBits
bits representing fired logicLayers (including bending layers),
double pdfSum
Sum of pdfValues.
unsigned int firedLayerCnt
Number of fired layers.

◆ finalise10()

void GoldenPatternResult::finalise10 ( )

Definition at line 321 of file GoldenPatternResult.cc.

References firedLayerBits, firedLayerCnt, OMTFConfiguration::getLogicToLogic(), OMTFConfiguration::getRefToLogicNumber(), OMTFConfiguration::isBendingLayer(), omtfConfig, pdfSum, pdfSumUnconstr, refLayer, stubResults, OMTFConfiguration::usePhiBExtrapolationMB1(), OMTFConfiguration::usePhiBExtrapolationMB2(), and valid.

Referenced by init().

321  {
322  for (unsigned int iLogicLayer = 0; iLogicLayer < stubResults.size(); ++iLogicLayer) {
323  unsigned int connectedLayer = omtfConfig->getLogicToLogic().at(iLogicLayer);
324 
325  if (omtfConfig->isBendingLayer(iLogicLayer)) { //the DT phiB layer is counted only when the phi layer is fired
326  if (firedLayerBits & (1 << iLogicLayer)) {
327  if (firedLayerBits & (1 << connectedLayer)) {
328  firedLayerCnt++;
329  pdfSum += stubResults[iLogicLayer].getPdfVal();
330  } else {
331  firedLayerBits &= ~(1 << iLogicLayer);
332  stubResults[iLogicLayer].setValid(false);
333  //there is no sense to apply the penalty in this case,
334  //because as the layer is fired, the stubResults[iLogicLayer].getPdfVal() cannot be 0
335  //so in this case simply pdfSum += 0;
336  }
337  } else {
338  //the penalty is not applied here when the phiB does not fit to the pdf
339  //because when extrapolation from the ref layer using the phiB is applied
340  //it "normal" for the displaced muons to not fit to the pdf
341  pdfSum += stubResults[iLogicLayer].getPdfVal();
342  }
343  } else {
344  if (iLogicLayer < 10 && stubResults[iLogicLayer].getPdfVal() == 0)
345  pdfSum -= 32; // penaly
346  else
347  pdfSum += stubResults[iLogicLayer].getPdfVal();
348  if (firedLayerBits & (1 << iLogicLayer)) { //pdfSum is counted always
349  firedLayerCnt++;
350  }
351  }
352  }
353 
354  if ((omtfConfig->usePhiBExtrapolationMB1() && refLayer == 0) ||
356  auto refLayerLogicNumber = omtfConfig->getRefToLogicNumber()[refLayer];
357  //Unconstrained pt is obtained by not including the pdfValue from the phiB of the refHit
358  //TODO get logic layer from connectedLayer
359  pdfSumUnconstr = pdfSum - stubResults[refLayerLogicNumber + 1].getPdfVal();
360  //here there is an issue with the firedLayerBits and quality assignment:
361  //in case if the displaced muon the phiB layer of the ref hit might not be fired (pdfVal might be 0)
362  //which in principle has no sense, because by the displaced algorithm construction it is fired
363  //an effect of that is that some fraction of displaced muons get the quality 8 assigned
364  //the efficiency difference between quality 8 and 12 seems to be at a level of 1-2%
365  //but in the uGT menu e.g. the L1_DoubleMu0_Upt6_IP_Min1_Upt4 uses quality >= 0, so should be OK
366 
367  //hard cut - the phiB of the refHit must fit to the pdfS
368  //but this cut has sometimes side effect: there can be a muon which has has pdfSum = 0 for every pattern,
369  //then in the OMTFSorter<GoldenPatternType>::sortRefHitResults the first pattern that has FiredLayerCnt >= 3 is chosen
370  //and not the one with highest pdfSum as it should be
371  //TODO what should be done is to set the pt of such a muons to 0, but after the sorter.
372  //Or maybe not - if the pt is 0, then the muon is not valid. So the displaced muon will be lost.
373  //So the way it is done now actually is good. Such a muon will have some low constrained pt probably.
374  //what can be done is to assign to it the hwPt = 1 , but not 0
375  //TODO modify this condition to use the firedLayerBits and not getPdfVal
376  //as it would be much easier for the firmware
377  if (stubResults[refLayerLogicNumber + 1].getPdfVal() == 0)
378  pdfSum = 0;
379  } else
380  pdfSumUnconstr = 0;
381 
382  valid = true;
383  //by default result becomes valid here, but can be overwritten later
384 }
unsigned int firedLayerBits
bits representing fired logicLayers (including bending layers),
bool usePhiBExtrapolationMB2() const
bool usePhiBExtrapolationMB1() const
const OMTFConfiguration * omtfConfig
const std::vector< int > & getRefToLogicNumber() const
const std::map< int, int > & getLogicToLogic() const
double pdfSum
Sum of pdfValues.
unsigned int firedLayerCnt
Number of fired layers.
bool isBendingLayer(unsigned int iLayer) const override

◆ finalise11()

void GoldenPatternResult::finalise11 ( )

Definition at line 389 of file GoldenPatternResult.cc.

References firedLayerBits, firedLayerCnt, OMTFConfiguration::getLogicToLogic(), OMTFConfiguration::getRefToLogicNumber(), OMTFConfiguration::isBendingLayer(), omtfConfig, pdfSum, pdfSumUnconstr, refLayer, stubResults, OMTFConfiguration::usePhiBExtrapolationMB1(), OMTFConfiguration::usePhiBExtrapolationMB2(), and valid.

Referenced by init().

389  {
390  for (unsigned int iLogicLayer = 0; iLogicLayer < stubResults.size(); ++iLogicLayer) {
391  unsigned int connectedLayer = omtfConfig->getLogicToLogic().at(iLogicLayer);
392 
393  if (omtfConfig->isBendingLayer(iLogicLayer)) { //the DT phiB layer is counted only when the phi layer is fired
394  if (firedLayerBits & (1 << iLogicLayer)) {
395  if (firedLayerBits & (1 << connectedLayer)) {
396  firedLayerCnt++;
397  pdfSum += stubResults[iLogicLayer].getPdfVal();
398  } else {
399  firedLayerBits &= ~(1 << iLogicLayer);
400  stubResults[iLogicLayer].setValid(false);
401  //there is no sense to apply the penalty in this case,
402  //because as the layer is fired, the stubResults[iLogicLayer].getPdfVal() cannot be 0
403  //so in this case simply pdfSum += 0;
404  }
405  } else {
406  //bending layer fired, but not fits to the pdf, N.B works only with the patterns having "no hit value" and with noHitValueInPdf = True
407  if (stubResults[iLogicLayer].getPdfVal() == 0) {
408  //high penalty, we set the pdf value in the stubResults[iLogicLayer], so that this penalty is removed from pdfSumUnconstr
409  pdfSum -= 63;
410  stubResults[iLogicLayer].setPdfVal(-63);
411  } else
412  pdfSum += stubResults[iLogicLayer].getPdfVal(); //bending layer not fired at all
413  }
414  } else {
415  if (iLogicLayer < 10 && stubResults[iLogicLayer].getPdfVal() == 0)
416  pdfSum -= 32; // penaly
417  else
418  pdfSum += stubResults[iLogicLayer].getPdfVal();
419  if (firedLayerBits & (1 << iLogicLayer)) { //pdfSum is counted always
420  firedLayerCnt++;
421  }
422  }
423  }
424 
425  if ((omtfConfig->usePhiBExtrapolationMB1() && refLayer == 0) ||
427  auto refLayerLogicNumber = omtfConfig->getRefToLogicNumber()[refLayer];
428  //Unconstrained pt is obtained by not including the pdfValue from the phiB of the refHit
429  //TODO get logic layer from connectedLayer
430  pdfSumUnconstr = pdfSum - stubResults[refLayerLogicNumber + 1].getPdfVal();
431 
432  } else
433  pdfSumUnconstr = 0;
434 
435  valid = true;
436  //by default result becomes valid here, but can be overwritten later
437 }
unsigned int firedLayerBits
bits representing fired logicLayers (including bending layers),
bool usePhiBExtrapolationMB2() const
bool usePhiBExtrapolationMB1() const
const OMTFConfiguration * omtfConfig
const std::vector< int > & getRefToLogicNumber() const
const std::map< int, int > & getLogicToLogic() const
double pdfSum
Sum of pdfValues.
unsigned int firedLayerCnt
Number of fired layers.
bool isBendingLayer(unsigned int iLayer) const override

◆ finalise2()

void GoldenPatternResult::finalise2 ( )

Definition at line 156 of file GoldenPatternResult.cc.

References firedLayerBits, firedLayerCnt, OMTFConfiguration::getBendingLayers(), OMTFConfiguration::getLogicToLogic(), omtfConfig, pdfSum, stubResults, and valid.

Referenced by init().

156  {
157  pdfSum = 1.;
158  firedLayerCnt = 0;
159  for (unsigned int iLogicLayer = 0; iLogicLayer < stubResults.size(); ++iLogicLayer) {
160  unsigned int connectedLayer = omtfConfig->getLogicToLogic().at(iLogicLayer);
161  //here we require that in case of the DT layers, both phi and phiB is fired
162  if (firedLayerBits & (1 << connectedLayer)) {
163  //now in the GoldenPattern::process1Layer1RefLayer the pdf bin 0 is returned when the layer is not fired, so this is 'if' is to assured that this pdf val is not added here
164  if (firedLayerBits & (1 << iLogicLayer)) {
165  pdfSum *= stubResults[iLogicLayer].getPdfVal();
166  //in DT case, the phi and phiB layers are threaded as one, so the firedLayerCnt is increased only for the phi layer
167  if (!omtfConfig->getBendingLayers().count(iLogicLayer))
168  firedLayerCnt++;
169  }
170  } else {
171  firedLayerBits &= ~(1 << iLogicLayer);
172  }
173  }
174 
175  if (firedLayerCnt < 3)
176  pdfSum = 0;
177 
178  valid = true;
179  //by default result becomes valid here, but can be overwritten later
180 }
unsigned int firedLayerBits
bits representing fired logicLayers (including bending layers),
const OMTFConfiguration * omtfConfig
const std::map< int, int > & getLogicToLogic() const
const std::set< int > & getBendingLayers() const
double pdfSum
Sum of pdfValues.
unsigned int firedLayerCnt
Number of fired layers.

◆ finalise3()

void GoldenPatternResult::finalise3 ( )

Definition at line 185 of file GoldenPatternResult.cc.

References firedLayerCnt, pdfSum, stubResults, and valid.

Referenced by init().

185  {
186  firedLayerCnt = 0;
187  for (unsigned int iLogicLayer = 0; iLogicLayer < stubResults.size(); ++iLogicLayer) {
188  //in this version we do not require that both phi and phiB is fired (non-zero), we thread them just independent
189  //watch out that then the number of fired layers is bigger, and the cut on the minimal number of fired layers dies not work in the same way as when the dt chamber is counted as one layer
190  //TODO check if it affects performance
191  pdfSum += stubResults[iLogicLayer].getPdfVal();
192 
193  if (stubResults[iLogicLayer].getMuonStub())
194  firedLayerCnt++;
195  }
196 
197  valid = true;
198  //by default result becomes valid here, but can be overwritten later
199 }
double pdfSum
Sum of pdfValues.
unsigned int firedLayerCnt
Number of fired layers.

◆ finalise5()

void GoldenPatternResult::finalise5 ( )

Definition at line 201 of file GoldenPatternResult.cc.

References firedLayerBits, firedLayerCnt, OMTFConfiguration::getLogicToLogic(), OMTFConfiguration::isBendingLayer(), omtfConfig, pdfSum, stubResults, and valid.

Referenced by init().

201  {
202  for (unsigned int iLogicLayer = 0; iLogicLayer < stubResults.size(); ++iLogicLayer) {
203  unsigned int connectedLayer = omtfConfig->getLogicToLogic().at(iLogicLayer);
204 
205  if (omtfConfig->isBendingLayer(iLogicLayer)) { //the DT phiB layer is counted only when the phi layer is fired
206  if ((firedLayerBits & (1 << iLogicLayer)) && (firedLayerBits & (1 << connectedLayer))) {
207  pdfSum += stubResults[iLogicLayer].getPdfVal();
208  firedLayerCnt++;
209  } else {
210  firedLayerBits &= ~(1 << iLogicLayer);
211  stubResults[iLogicLayer].setValid(false);
212  //in principle the stun should be also removed from the stubResults[iLogicLayer], on the other hand ini this way can be used e.g. for debug
213  }
214  } else if (firedLayerBits & (1 << iLogicLayer)) {
215  pdfSum += stubResults[iLogicLayer].getPdfVal();
216  firedLayerCnt++;
217  }
218  }
219 
220  valid = true;
221  //by default result becomes valid here, but can be overwritten later
222 }
unsigned int firedLayerBits
bits representing fired logicLayers (including bending layers),
const OMTFConfiguration * omtfConfig
const std::map< int, int > & getLogicToLogic() const
double pdfSum
Sum of pdfValues.
unsigned int firedLayerCnt
Number of fired layers.
bool isBendingLayer(unsigned int iLayer) const override

◆ finalise6()

void GoldenPatternResult::finalise6 ( )

Definition at line 224 of file GoldenPatternResult.cc.

References firedLayerBits, firedLayerCnt, OMTFConfiguration::getLogicToLogic(), OMTFConfiguration::isBendingLayer(), omtfConfig, pdfSum, stubResults, and valid.

Referenced by init().

224  {
225  for (unsigned int iLogicLayer = 0; iLogicLayer < stubResults.size(); ++iLogicLayer) {
226  unsigned int connectedLayer = omtfConfig->getLogicToLogic().at(iLogicLayer);
227 
228  if (omtfConfig->isBendingLayer(iLogicLayer)) { //the DT phiB layer is counted only when the phi layer is fired
229  if ((firedLayerBits & (1 << iLogicLayer)) && (firedLayerBits & (1 << connectedLayer)) &&
230  (stubResults[iLogicLayer].getMuonStub()->qualityHw >= 4)) {
231  pdfSum += stubResults[iLogicLayer].getPdfVal();
232  firedLayerCnt++;
233  } else {
234  firedLayerBits &= ~(1 << iLogicLayer);
235  stubResults[iLogicLayer].setValid(false);
236  //in principle the stun should be also removed from the stubResults[iLogicLayer], on the other hand ini this way can be used e.g. for debug
237  }
238  } else if (firedLayerBits & (1 << iLogicLayer)) {
239  pdfSum += stubResults[iLogicLayer].getPdfVal();
240  firedLayerCnt++;
241  }
242  }
243 
244  valid = true;
245  //by default result becomes valid here, but can be overwritten later
246 }
unsigned int firedLayerBits
bits representing fired logicLayers (including bending layers),
const OMTFConfiguration * omtfConfig
const std::map< int, int > & getLogicToLogic() const
double pdfSum
Sum of pdfValues.
unsigned int firedLayerCnt
Number of fired layers.
bool isBendingLayer(unsigned int iLayer) const override

◆ finalise7()

void GoldenPatternResult::finalise7 ( )

Definition at line 248 of file GoldenPatternResult.cc.

References firedLayerBits, firedLayerCnt, pdfSum, stubResults, and valid.

Referenced by init().

248  {
249  for (unsigned int iLogicLayer = 0; iLogicLayer < stubResults.size(); ++iLogicLayer) {
250  pdfSum += stubResults[iLogicLayer].getPdfVal();
251  if (firedLayerBits & (1 << iLogicLayer)) {
252  firedLayerCnt++;
253  }
254  }
255 
256  valid = true;
257  //by default result becomes valid here, but can be overwritten later
258 }
unsigned int firedLayerBits
bits representing fired logicLayers (including bending layers),
double pdfSum
Sum of pdfValues.
unsigned int firedLayerCnt
Number of fired layers.

◆ finalise8()

void GoldenPatternResult::finalise8 ( )

Definition at line 260 of file GoldenPatternResult.cc.

References firedLayerBits, firedLayerCnt, OMTFConfiguration::getLogicToLogic(), OMTFConfiguration::isBendingLayer(), omtfConfig, pdfSum, stubResults, and valid.

Referenced by init().

260  {
261  for (unsigned int iLogicLayer = 0; iLogicLayer < stubResults.size(); ++iLogicLayer) {
262  pdfSum += stubResults[iLogicLayer].getPdfVal(); //pdfSum is counted always
263 
264  unsigned int connectedLayer = omtfConfig->getLogicToLogic().at(iLogicLayer);
265  if (omtfConfig->isBendingLayer(iLogicLayer)) { //the DT phiB layer is counted only when the phi layer is fired
266  if ((firedLayerBits & (1 << iLogicLayer)) && (firedLayerBits & (1 << connectedLayer))) {
267  firedLayerCnt++;
268  } else {
269  firedLayerBits &= ~(1 << iLogicLayer);
270  stubResults[iLogicLayer].setValid(false);
271  //in principle the stub should be also removed from the stubResults[iLogicLayer], on the other hand in this way can be used e.g. for debug
272  }
273  } else if (firedLayerBits & (1 << iLogicLayer)) {
274  firedLayerCnt++;
275  }
276  }
277 
278  valid = true;
279  //by default result becomes valid here, but can be overwritten later
280 }
unsigned int firedLayerBits
bits representing fired logicLayers (including bending layers),
const OMTFConfiguration * omtfConfig
const std::map< int, int > & getLogicToLogic() const
double pdfSum
Sum of pdfValues.
unsigned int firedLayerCnt
Number of fired layers.
bool isBendingLayer(unsigned int iLayer) const override

◆ finalise9()

void GoldenPatternResult::finalise9 ( )

Definition at line 282 of file GoldenPatternResult.cc.

References firedLayerBits, firedLayerCnt, OMTFConfiguration::getLogicToLogic(), OMTFConfiguration::isBendingLayer(), omtfConfig, pdfSum, stubResults, and valid.

Referenced by init().

282  {
283  for (unsigned int iLogicLayer = 0; iLogicLayer < stubResults.size(); ++iLogicLayer) {
284  unsigned int connectedLayer = omtfConfig->getLogicToLogic().at(iLogicLayer);
285 
286  if (omtfConfig->isBendingLayer(iLogicLayer)) { //the DT phiB layer is counted only when the phi layer is fired
287  if (firedLayerBits & (1 << iLogicLayer)) {
288  if (firedLayerBits & (1 << connectedLayer)) {
289  firedLayerCnt++;
290  pdfSum += stubResults[iLogicLayer].getPdfVal();
291  } else {
292  firedLayerBits &= ~(1 << iLogicLayer);
293  stubResults[iLogicLayer].setValid(false);
294  //there was hit, but it did not fit to the pdf - this is not possible here, since the bending layer is fired here
295  //therefore there is no sense to apply the penalty when the stubResults[iLogicLayer].getPdfVal() == 0
296  //so in this case simply pdfSum += 0;
297  }
298  } else {
299  if (stubResults[iLogicLayer].getPdfVal() == 0)
300  //there is a hit, but does not fit to the pdf (therefore in firedLayerBits is 0, but getPdfVal() is not 0), so apply the penalty (-32)
301  //N.B it is possible only with the patterns having "no hit value" and with noHitValueInPdf = True
302  pdfSum -= 32; // penaly
303  else
304  pdfSum += stubResults[iLogicLayer].getPdfVal(); //bending layer not fired at all
305  }
306  } else {
307  if (iLogicLayer < 10 && stubResults[iLogicLayer].getPdfVal() == 0)
308  pdfSum -= 32; // penaly
309  else
310  pdfSum += stubResults[iLogicLayer].getPdfVal();
311  if (firedLayerBits & (1 << iLogicLayer)) { //pdfSum is counted always
312  firedLayerCnt++;
313  }
314  }
315  }
316 
317  valid = true;
318  //by default result becomes valid here, but can be overwritten later
319 }
unsigned int firedLayerBits
bits representing fired logicLayers (including bending layers),
const OMTFConfiguration * omtfConfig
const std::map< int, int > & getLogicToLogic() const
double pdfSum
Sum of pdfValues.
unsigned int firedLayerCnt
Number of fired layers.
bool isBendingLayer(unsigned int iLayer) const override

◆ getEta()

int GoldenPatternResult::getEta ( ) const
inline

Definition at line 69 of file GoldenPatternResult.h.

References eta.

Referenced by AlgoMuon::getEtaHw().

69 { return eta; }
int eta
eta at the 2nd muon station

◆ getFiredLayerBits()

unsigned int GoldenPatternResult::getFiredLayerBits ( ) const
inline

Definition at line 73 of file GoldenPatternResult.h.

References firedLayerBits.

Referenced by AlgoMuon::getFiredLayerBits().

73 { return firedLayerBits; }
unsigned int firedLayerBits
bits representing fired logicLayers (including bending layers),

◆ getFiredLayerCnt()

unsigned int GoldenPatternResult::getFiredLayerCnt ( ) const
inline

Definition at line 77 of file GoldenPatternResult.h.

References firedLayerCnt.

Referenced by AlgoMuon::getFiredLayerCnt(), AlgoMuon::getFiredLayerCntConstr(), AlgoMuon::getQ(), and operator<<().

77 { return firedLayerCnt; }
unsigned int firedLayerCnt
Number of fired layers.

◆ getGpProbability1()

double GoldenPatternResult::getGpProbability1 ( ) const
inline

Definition at line 137 of file GoldenPatternResult.h.

References gpProbability1.

Referenced by operator<<().

137 { return gpProbability1; }

◆ getGpProbability2()

double GoldenPatternResult::getGpProbability2 ( ) const
inline

Definition at line 141 of file GoldenPatternResult.h.

References gpProbability2.

Referenced by operator<<().

141 { return gpProbability2; }

◆ getPdfSum()

PdfValueType GoldenPatternResult::getPdfSum ( ) const
inline

◆ getPdfSumUnconstr()

PdfValueType GoldenPatternResult::getPdfSumUnconstr ( ) const
inline

◆ getPhi()

int GoldenPatternResult::getPhi ( ) const
inline

Definition at line 91 of file GoldenPatternResult.h.

References phi.

Referenced by AlgoMuon::getPhi().

91 { return phi; }
int phi
phi at the 2nd muon station (propagated refHitPhi)

◆ getRefHitPhi()

int GoldenPatternResult::getRefHitPhi ( ) const
inline

Definition at line 95 of file GoldenPatternResult.h.

References refHitPhi.

Referenced by AlgoMuon::getPhiRHit().

95 { return refHitPhi; }
int refHitPhi
phi of the reference hits

◆ getRefLayer()

int GoldenPatternResult::getRefLayer ( ) const
inline

Definition at line 65 of file GoldenPatternResult.h.

References refLayer.

Referenced by AlgoMuon::getRefLayer(), operator<<(), and XMLConfigWriter::writeResultsData().

65 { return this->refLayer; }

◆ getStubResults()

const StubResults& GoldenPatternResult::getStubResults ( ) const
inline

◆ init()

void GoldenPatternResult::init ( const OMTFConfiguration omtfConfig)

Definition at line 60 of file GoldenPatternResult.cc.

References finalise, finalise0(), finalise1(), finalise10(), finalise11(), finalise2(), finalise3(), finalise5(), finalise6(), finalise7(), finalise8(), finalise9(), finalizeFunction, OMTFConfiguration::getGoldenPatternResultFinalizeFunction(), OMTFConfiguration::nLayers(), omtfConfig, reset(), and stubResults.

60  {
61  this->omtfConfig = omtfConfig;
62 
64 
65  if (finalizeFunction == 1)
66  finalise = [this]() { finalise1(); };
67  else if (finalizeFunction == 2)
68  finalise = [this]() { finalise2(); };
69  else if (finalizeFunction == 3)
70  finalise = [this]() { finalise3(); };
71  else if (finalizeFunction == 5)
72  finalise = [this]() { finalise5(); };
73  else if (finalizeFunction == 6)
74  finalise = [this]() { finalise6(); };
75  else if (finalizeFunction == 7)
76  finalise = [this]() { finalise7(); };
77  else if (finalizeFunction == 8)
78  finalise = [this]() { finalise8(); };
79  else if (finalizeFunction == 9)
80  finalise = [this]() { finalise9(); };
81  else if (finalizeFunction == 10)
82  finalise = [this]() { finalise10(); };
83  else if (finalizeFunction == 11)
84  finalise = [this]() { finalise11(); };
85  else
86  finalise = [this]() { finalise0(); };
87 
89  reset();
90 }
const OMTFConfiguration * omtfConfig
std::function< void()> finalise
int getGoldenPatternResultFinalizeFunction() const
unsigned int nLayers() const

◆ isLayerFired()

bool GoldenPatternResult::isLayerFired ( unsigned int  iLayer) const
inline

Definition at line 99 of file GoldenPatternResult.h.

References firedLayerBits.

Referenced by operator<<().

99 { return firedLayerBits & (1 << iLayer); }
unsigned int firedLayerBits
bits representing fired logicLayers (including bending layers),

◆ isValid()

bool GoldenPatternResult::isValid ( void  ) const
inline

◆ reset()

void GoldenPatternResult::reset ( void  )

Definition at line 92 of file GoldenPatternResult.cc.

References eta, firedLayerBits, firedLayerCnt, gpProbability1, gpProbability2, pdfSum, pdfSumUnconstr, phi, refHitPhi, refLayer, stubResults, and valid.

Referenced by init().

92  {
93  for (auto& stubResult : stubResults) {
94  stubResult.reset();
95  }
96  valid = false;
97  refLayer = -1;
98  phi = 0;
99  eta = 0;
100  pdfSum = 0;
101  pdfSumUnconstr = 0;
102  firedLayerCnt = 0;
103  firedLayerBits = 0;
104  refHitPhi = 0;
105  gpProbability1 = 0;
106  gpProbability2 = 0;
107 }
unsigned int firedLayerBits
bits representing fired logicLayers (including bending layers),
int eta
eta at the 2nd muon station
double pdfSum
Sum of pdfValues.
unsigned int firedLayerCnt
Number of fired layers.
int phi
phi at the 2nd muon station (propagated refHitPhi)
int refHitPhi
phi of the reference hits

◆ set()

void GoldenPatternResult::set ( int  refLayer,
int  phi,
int  eta,
int  refHitPhi 
)

Definition at line 25 of file GoldenPatternResult.cc.

References cms::cuda::assert(), gather_cfg::cout, eta, isValid(), phi, refHitPhi, and refLayer.

25  {
26  if (isValid() && this->refLayer != refLayer_) {
27  std::cout << __FUNCTION__ << " " << __LINE__ << " this->refLayer " << this->refLayer << " refLayer_ " << refLayer_
28  << std::endl;
29  }
30  assert(!isValid() || this->refLayer == refLayer_);
31 
32  this->refLayer = refLayer_;
33  this->phi = phi;
34  this->eta = eta;
35  this->refHitPhi = refHitPhi;
36 }
assert(be >=bs)
int eta
eta at the 2nd muon station
int phi
phi at the 2nd muon station (propagated refHitPhi)
int refHitPhi
phi of the reference hits

◆ setEta()

void GoldenPatternResult::setEta ( int  eta)
inline

Definition at line 71 of file GoldenPatternResult.h.

References eta.

Referenced by AlgoMuon::setEta().

71 { this->eta = eta; }
int eta
eta at the 2nd muon station

◆ setFiredLayerBits()

void GoldenPatternResult::setFiredLayerBits ( unsigned int  firedLayerBits)
inline

Definition at line 75 of file GoldenPatternResult.h.

References firedLayerBits.

75 { this->firedLayerBits = firedLayerBits; }
unsigned int firedLayerBits
bits representing fired logicLayers (including bending layers),

◆ setFiredLayerCnt()

void GoldenPatternResult::setFiredLayerCnt ( unsigned int  firedLayerCnt)
inline

Definition at line 79 of file GoldenPatternResult.h.

References firedLayerCnt.

79 { this->firedLayerCnt = firedLayerCnt; }
unsigned int firedLayerCnt
Number of fired layers.

◆ setGpProbability1()

void GoldenPatternResult::setGpProbability1 ( double  probability1 = 0)
inline

Definition at line 139 of file GoldenPatternResult.h.

139 { this->gpProbability1 = probability1; }

◆ setGpProbability2()

void GoldenPatternResult::setGpProbability2 ( double  probability2 = 0)
inline

Definition at line 143 of file GoldenPatternResult.h.

143 { this->gpProbability2 = probability2; }

◆ setPhi()

void GoldenPatternResult::setPhi ( int  phi)
inline

Definition at line 93 of file GoldenPatternResult.h.

References phi.

93 { this->phi = phi; }
int phi
phi at the 2nd muon station (propagated refHitPhi)

◆ setRefHitPhi()

void GoldenPatternResult::setRefHitPhi ( int  refHitPhi)
inline

Definition at line 97 of file GoldenPatternResult.h.

References refHitPhi.

97 { this->refHitPhi = refHitPhi; }
int refHitPhi
phi of the reference hits

◆ setRefLayer()

void GoldenPatternResult::setRefLayer ( int  refLayer)
inline

Definition at line 67 of file GoldenPatternResult.h.

References refLayer.

◆ setStubResult() [1/2]

void GoldenPatternResult::setStubResult ( float  pdfVal,
bool  valid,
int  pdfBin,
int  layer,
MuonStubPtr  stub 
)

Definition at line 38 of file GoldenPatternResult.cc.

References firedLayerBits, nano_mu_digi_cff::layer, stubResults, and valid.

38  {
39  if (valid) {
40  //pdfSum and firedLayerBits is calculated in finaliseX()
41  firedLayerBits |= (1 << layer);
42  }
43  stubResults[layer] = StubResult(pdfVal, valid, pdfBin, layer, stub);
44 
45  //stub result is added even thought it is not valid since this might be needed for debugging or optimization
46 }
unsigned int firedLayerBits
bits representing fired logicLayers (including bending layers),

◆ setStubResult() [2/2]

void GoldenPatternResult::setStubResult ( int  layer,
StubResult stubResult 
)

Definition at line 48 of file GoldenPatternResult.cc.

References firedLayerBits, StubResult::getValid(), nano_mu_digi_cff::layer, and stubResults.

48  {
49  if (stubResult.getValid()) {
50  //pdfSum and firedLayerBits is calculated in finaliseX()
51  firedLayerBits |= (1 << layer);
52  }
53  stubResults[layer] = stubResult;
54 
55  //stub result is added even thought it is not valid since this might be needed for debugging or optimization
56 }
unsigned int firedLayerBits
bits representing fired logicLayers (including bending layers),
bool getValid() const
Definition: StubResult.h:29

◆ setValid()

void GoldenPatternResult::setValid ( bool  valid)
inline

Definition at line 57 of file GoldenPatternResult.h.

References valid.

57 { this->valid = valid; }

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const GoldenPatternResult aResult 
)
friend

Definition at line 441 of file GoldenPatternResult.cc.

441  {
442  if (gpResult.omtfConfig == nullptr) {
443  out << "empty GoldenPatternResult" << std::endl;
444  return out;
445  }
446  unsigned int refLayerLogicNum = gpResult.omtfConfig->getRefToLogicNumber()[gpResult.getRefLayer()];
447 
448  unsigned int sumOverFiredLayers = 0;
449  for (unsigned int iLogicLayer = 0; iLogicLayer < gpResult.stubResults.size(); ++iLogicLayer) {
450  out << " layer: " << std::setw(2) << iLogicLayer << " hit: ";
451  if (gpResult.stubResults[iLogicLayer].getMuonStub()) {
452  out << std::setw(4)
453  << (gpResult.omtfConfig->isBendingLayer(iLogicLayer)
454  ? gpResult.stubResults[iLogicLayer].getMuonStub()->phiBHw
455  : gpResult.stubResults[iLogicLayer].getMuonStub()->phiHw);
456 
457  out << " pdfBin: " << std::setw(4) << gpResult.stubResults[iLogicLayer].getPdfBin() << " pdfVal: " << std::setw(3)
458  << gpResult.stubResults[iLogicLayer].getPdfVal() << " fired " << gpResult.isLayerFired(iLogicLayer)
459  << (iLogicLayer == refLayerLogicNum ? " <<< refLayer" : "");
460 
461  if (gpResult.isLayerFired(iLogicLayer))
462  sumOverFiredLayers += gpResult.stubResults[iLogicLayer].getPdfVal();
463  } else if (gpResult.stubResults[iLogicLayer].getPdfVal()) {
464  out << " pdfVal: " << std::setw(3) << gpResult.stubResults[iLogicLayer].getPdfVal();
465  }
466  out << std::endl;
467  }
468 
469  out << " refLayer: ";
470  out << gpResult.getRefLayer() << "\t";
471 
472  out << " Sum over layers: ";
473  out << gpResult.getPdfSum() << "\t";
474 
475  out << " sumOverFiredLayers: ";
476  out << sumOverFiredLayers << "\t";
477 
478  out << " Sum over layers unconstr: ";
479  out << gpResult.getPdfSumUnconstr() << "\t";
480 
481  out << " Number of hits: ";
482  out << gpResult.getFiredLayerCnt() << "\t";
483 
484  out << " GpProbability1: ";
485  out << gpResult.getGpProbability1() << "\t";
486 
487  out << " GpProbability2: ";
488  out << gpResult.getGpProbability2() << "\t";
489 
490  out << std::endl;
491 
492  return out;
493 }

Member Data Documentation

◆ eta

int GoldenPatternResult::eta = 0
private

◆ finalise

std::function<void()> GoldenPatternResult::finalise

Definition at line 106 of file GoldenPatternResult.h.

Referenced by init().

◆ finalizeFunction

int GoldenPatternResult::finalizeFunction = 0
private

Definition at line 42 of file GoldenPatternResult.h.

Referenced by init().

◆ firedLayerBits

unsigned int GoldenPatternResult::firedLayerBits = 0
private

bits representing fired logicLayers (including bending layers),

Definition at line 37 of file GoldenPatternResult.h.

Referenced by finalise0(), finalise1(), finalise10(), finalise11(), finalise2(), finalise5(), finalise6(), finalise7(), finalise8(), finalise9(), getFiredLayerBits(), isLayerFired(), reset(), setFiredLayerBits(), and setStubResult().

◆ firedLayerCnt

unsigned int GoldenPatternResult::firedLayerCnt = 0
private

◆ gpProbability1

double GoldenPatternResult::gpProbability1 = 0
private

Definition at line 44 of file GoldenPatternResult.h.

Referenced by getGpProbability1(), and reset().

◆ gpProbability2

double GoldenPatternResult::gpProbability2 = 0
private

Definition at line 46 of file GoldenPatternResult.h.

Referenced by getGpProbability2(), and reset().

◆ omtfConfig

const OMTFConfiguration* GoldenPatternResult::omtfConfig = nullptr
private

◆ pdfSum

double GoldenPatternResult::pdfSum = 0
private

◆ pdfSumUnconstr

double GoldenPatternResult::pdfSumUnconstr = 0
private

Number of fired layers - excluding bending layers Sum of pdfValues without vertex constraint (unconstrained pt)

Definition at line 31 of file GoldenPatternResult.h.

Referenced by finalise10(), finalise11(), getPdfSumUnconstr(), and reset().

◆ phi

int GoldenPatternResult::phi = 0
private

phi at the 2nd muon station (propagated refHitPhi)

Definition at line 20 of file GoldenPatternResult.h.

Referenced by Particle.Particle::__str__(), datamodel.Object::DeltaR(), getPhi(), datamodel.Object::p4(), ntupleDataFormat.Track::phiPull(), reset(), set(), and setPhi().

◆ refHitPhi

int GoldenPatternResult::refHitPhi = 0
private

phi of the reference hits

Definition at line 40 of file GoldenPatternResult.h.

Referenced by getRefHitPhi(), reset(), set(), and setRefHitPhi().

◆ refLayer

int GoldenPatternResult::refLayer = 0
private

Definition at line 17 of file GoldenPatternResult.h.

Referenced by finalise10(), finalise11(), getRefLayer(), reset(), set(), and setRefLayer().

◆ stubResults

StubResults GoldenPatternResult::stubResults
private

◆ valid

bool GoldenPatternResult::valid = false
private