CMS 3D CMS Logo

OMTFResult.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <ostream>
3 #include <cmath>
4 
7 
10 void OMTFResult::configure(const OMTFConfiguration *omtfConfig) {
11  myOmtfConfig = omtfConfig;
12 
13  clear();
14 }
17 
18 void OMTFResult::setRefPhiRHits(unsigned int iRefLayer, int iRefPhiRHit) { refPhiRHit1D[iRefLayer] = iRefPhiRHit; }
21 
22 void OMTFResult::addResult(unsigned int iRefLayer, unsigned int iLayer, unsigned int val, int iRefPhi, int iRefEta) {
23  refPhi1D[iRefLayer] = iRefPhi;
24  refEta1D[iRefLayer] = iRefEta;
25  results[iLayer][iRefLayer] = val;
26 }
30  results1D.assign(myOmtfConfig->nRefLayers(), 0);
31  hits1D.assign(myOmtfConfig->nRefLayers(), 0);
33  refPhi1D.assign(myOmtfConfig->nRefLayers(), 1024);
34  refEta1D.assign(myOmtfConfig->nRefLayers(), 1024);
35  hitsBits.assign(myOmtfConfig->nRefLayers(), 0);
36  refPhiRHit1D.assign(myOmtfConfig->nRefLayers(), 1024);
37 }
41  for (unsigned int iLogicLayer = 0; iLogicLayer < results.size(); ++iLogicLayer) {
42  unsigned int connectedLayer = myOmtfConfig->getLogicToLogic().at(iLogicLayer);
43  for (unsigned int iRefLayer = 0; iRefLayer < results[iLogicLayer].size(); ++iRefLayer) {
45  unsigned int val = results[connectedLayer][iRefLayer] > 0 ? results[iLogicLayer][iRefLayer] : 0;
46  results1D[iRefLayer] += val;
47  hitsBits[iRefLayer] += (val > 0) * std::pow(2, iLogicLayer);
48 
49  if (myOmtfConfig->fwVersion() <= 4) {
51  if (!myOmtfConfig->getBendingLayers().count(iLogicLayer))
52  hits1D[iRefLayer] += (val > 0);
53  } else {
54  hits1D[iRefLayer] += (val > 0);
55  }
56  }
57  }
58 }
61 bool OMTFResult::empty() const {
62  unsigned int nHits = 0;
63  for (unsigned int iRefLayer = 0; iRefLayer < myOmtfConfig->nRefLayers(); ++iRefLayer) {
64  nHits += hits1D[iRefLayer];
65  }
66  return (nHits == 0);
67 }
70 std::ostream &operator<<(std::ostream &out, const OMTFResult &aResult) {
71  for (unsigned int iLogicLayer = 0; iLogicLayer < aResult.results.size(); ++iLogicLayer) {
72  out << "Logic layer: " << iLogicLayer << " results: ";
73  for (unsigned int iRefLayer = 0; iRefLayer < aResult.results[iLogicLayer].size(); ++iRefLayer) {
74  out << aResult.results[iLogicLayer][iRefLayer] << "\t";
75  }
76  out << std::endl;
77  }
78 
79  out << " Sum over layers: ";
80  for (unsigned int iRefLayer = 0; iRefLayer < aResult.results1D.size(); ++iRefLayer) {
81  out << aResult.results1D[iRefLayer] << "\t";
82  }
83 
84  out << std::endl;
85 
86  out << " Number of hits: ";
87  for (unsigned int iRefLayer = 0; iRefLayer < aResult.hits1D.size(); ++iRefLayer) {
88  out << aResult.hits1D[iRefLayer] << "\t";
89  }
90 
91  return out;
92 }
const OMTFConfiguration * myOmtfConfig
Definition: OMTFResult.h:68
vector2D results
Definition: OMTFResult.h:48
vector1D results1D
Sum of pdf weights for each reference layer.
Definition: OMTFResult.h:57
unsigned int fwVersion() const
vector1D refPhiRHit1D
Reference phi for each reference layer - the input value.
Definition: OMTFResult.h:66
void configure(const OMTFConfiguration *omtfConfig)
Definition: OMTFResult.cc:10
unsigned int nLayers() const
const std::map< int, int > & getLogicToLogic() const
void setRefPhiRHits(unsigned int iRefLayer, int iRefPhiRHit)
Definition: OMTFResult.cc:18
vector1D refPhi1D
Reference phi for each reference layer.
Definition: OMTFResult.h:51
unsigned int nRefLayers() const
std::ostream & operator<<(std::ostream &out, const OMTFResult &aResult)
Definition: OMTFResult.cc:70
const std::set< int > & getBendingLayers() const
void finalise()
Definition: OMTFResult.cc:40
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
vector1D hits1D
Number of hits for each reference layer.
Definition: OMTFResult.h:60
void addResult(unsigned int iRefLayer, unsigned int iLayer, unsigned int val, int iRefPhi, int iRefEta)
Definition: OMTFResult.cc:22
bool empty() const
Definition: OMTFResult.cc:61
vector1D refEta1D
Reference phi for each reference layer.
Definition: OMTFResult.h:54
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
void clear()
Definition: OMTFResult.cc:29
vector1D hitsBits
Words representing nimber of hit layers for each reference layer.
Definition: OMTFResult.h:63