CMS 3D CMS Logo

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

#include <OMTFinput.h>

Inheritance diagram for OMTFinput:
MuonStubsInput

Public Types

typedef std::vector< int > vector1D
 
typedef std::vector< vector1Dvector2D
 

Public Member Functions

bool addLayerHit (unsigned int iLayer, unsigned int iInput, int iPhi, int iEta, bool allowOverwrite=true)
 
void clear ()
 Reset vectors with data. More...
 
const int getHitEta (unsigned int iLayer, unsigned int iInput) const
 
const OMTFinput::vector1DgetLayerData (unsigned int iLayer, bool giveEta=false) const
 
const MuonStubPtr getMuonStub (unsigned int iLayer, unsigned int iInput) const
 
int getPhiHw (unsigned int iLayer, unsigned int iInput) const override
 
std::bitset< 128 > getRefHits (unsigned int iProcessor) const
 
std::bitset< 128 > getRefHits (unsigned int iProcessor) const
 
void mergeData (const OMTFinput *aInput)
 
void mergeData (const OMTFinput *aInput)
 
 OMTFinput (const OMTFConfiguration *)
 
 OMTFinput (const OMTFConfiguration *)
 
OMTFinputoperator+= (const OMTFinput &iInput)
 
void readData (XMLConfigReader *aReader, unsigned int iEvent=0, unsigned int iProcessor=0)
 Read data from a XML file. More...
 
void readData (XMLConfigReader *aReader, unsigned int iEvent=0, unsigned int iProcessor=0)
 Read data from a XML file. More...
 
void shiftMyPhi (int phiShift)
 Apply shift to all data. More...
 
void shiftMyPhi (int phiShift)
 Apply shift to all data. More...
 
 ~OMTFinput () override
 
- Public Member Functions inherited from MuonStubsInput
virtual void addStub (unsigned int iLayer, const MuonStubPtr &stub)
 
virtual MuonStubPtrs2DgetMuonStubs ()
 
virtual const MuonStubPtrs2DgetMuonStubs () const
 
 MuonStubsInput (const ProcConfigurationBase *config)
 
virtual ~MuonStubsInput ()
 

Private Attributes

vector2D measurementsEta
 
vector2D measurementsPhi
 
const OMTFConfigurationmyOmtfConfig = nullptr
 
vector1D refHitsEta
 RefHitsEta. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const OMTFinput &aInput)
 
std::ostream & operator<< (std::ostream &out, const OMTFinput &aInput)
 

Additional Inherited Members

- Protected Attributes inherited from MuonStubsInput
const ProcConfigurationBaseconfig = nullptr
 
MuonStubPtrs2D muonStubsInLayers
 

Detailed Description

Definition at line 11 of file OMTFinput.h.

Member Typedef Documentation

◆ vector1D

typedef std::vector<int> OMTFinput::vector1D

Definition at line 13 of file OMTFinput.h.

◆ vector2D

typedef std::vector<vector1D> OMTFinput::vector2D

Definition at line 14 of file OMTFinput.h.

Constructor & Destructor Documentation

◆ OMTFinput() [1/2]

OMTFinput::OMTFinput ( const OMTFConfiguration omtfConfig)

Definition at line 11 of file OMTFinput.cc.

References clear(), and myOmtfConfig.

11  {
12  myOmtfConfig = omtfConfig;
13  clear();
14 }
void clear()
Reset vectors with data.
Definition: OMTFinput.cc:91
const OMTFConfiguration * myOmtfConfig
Definition: OMTFinput.h:60

◆ OMTFinput() [2/2]

OMTFinput::OMTFinput ( const OMTFConfiguration )

◆ ~OMTFinput()

OMTFinput::~OMTFinput ( )
inlineoverride

Definition at line 18 of file OMTFinput.h.

18 {}

Member Function Documentation

◆ addLayerHit()

bool OMTFinput::addLayerHit ( unsigned int  iLayer,
unsigned int  iInput,
int  iPhi,
int  iEta,
bool  allowOverwrite = true 
)

Add hit to given layer. iInput marks input number (max 14 per layer)

Definition at line 44 of file OMTFinput.cc.

References cms::cuda::assert(), L1TowerCalibrationProducer_cfi::iEta, measurementsEta, measurementsPhi, myOmtfConfig, MuonTCMETValueMapProducer_cff::nLayers, and OMTFConfiguration::nPhiBins().

Referenced by mergeData().

44  {
45  bool overwrite = false;
46  assert(iLayer < myOmtfConfig->nLayers());
47  assert(iInput < 14);
48 
49  if (iPhi >= (int)myOmtfConfig->nPhiBins())
50  return true;
51 
52  if (allowOverwrite && measurementsPhi[iLayer][iInput] == iPhi && measurementsEta[iLayer][iInput] == iEta)
53  return true;
54 
55  if (measurementsPhi[iLayer][iInput] != (int)myOmtfConfig->nPhiBins())
56  ++iInput;
57  if (measurementsPhi[iLayer][iInput] != (int)myOmtfConfig->nPhiBins())
58  overwrite = true;
59 
60  if (iInput > 13)
61  return true;
62 
63  measurementsPhi[iLayer][iInput] = iPhi;
64  measurementsEta[iLayer][iInput] = iEta;
65 
66  return overwrite;
67 }
vector2D measurementsEta
Definition: OMTFinput.h:55
assert(be >=bs)
unsigned int nPhiBins() const
const OMTFConfiguration * myOmtfConfig
Definition: OMTFinput.h:60
vector2D measurementsPhi
Definition: OMTFinput.h:50

◆ clear()

void OMTFinput::clear ( void  )

Reset vectors with data.

Definition at line 91 of file OMTFinput.cc.

References measurementsEta, measurementsPhi, myOmtfConfig, OMTFConfiguration::nLayers(), OMTFConfiguration::nPhiBins(), and refHitsEta.

Referenced by OMTFinput().

91  {
92  vector1D aLayer1D(14, myOmtfConfig->nPhiBins());
93  measurementsPhi.assign(myOmtfConfig->nLayers(), aLayer1D);
94  measurementsEta.assign(myOmtfConfig->nLayers(), aLayer1D);
95  refHitsEta.assign(128, myOmtfConfig->nPhiBins());
96 }
vector2D measurementsEta
Definition: OMTFinput.h:55
std::vector< int > vector1D
Definition: OMTFinput.h:13
vector1D refHitsEta
RefHitsEta.
Definition: OMTFinput.h:58
unsigned int nPhiBins() const
unsigned int nLayers() const
const OMTFConfiguration * myOmtfConfig
Definition: OMTFinput.h:60
vector2D measurementsPhi
Definition: OMTFinput.h:50

◆ getHitEta()

const int OMTFinput::getHitEta ( unsigned int  iLayer,
unsigned int  iInput 
) const

Definition at line 34 of file OMTFinput.cc.

References getMuonStub(), OMTFConfiguration::isBendingLayer(), myOmtfConfig, and OMTFConfiguration::nPhiBins().

34  {
35  /* assert(iLayer < muonStubsInLayers.size());
36  assert(iInput < muonStubsInLayers[iLayer].size());*/
37  if (this->myOmtfConfig->isBendingLayer(iLayer)) {
38  MuonStubPtr stub = getMuonStub(iLayer - 1, iInput);
39  if (stub)
40  return stub->etaHw;
41  }
42 
43  MuonStubPtr stub = getMuonStub(iLayer, iInput);
44  if (stub)
45  return stub->etaHw;
46 
47  return myOmtfConfig->nPhiBins();
48 }
const MuonStubPtr getMuonStub(unsigned int iLayer, unsigned int iInput) const
Definition: OMTFinput.h:30
unsigned int nPhiBins() const
std::shared_ptr< MuonStub > MuonStubPtr
Definition: MuonStub.h:65
const OMTFConfiguration * myOmtfConfig
Definition: OMTFinput.h:60
bool isBendingLayer(unsigned int iLayer) const override

◆ getLayerData()

const OMTFinput::vector1D & OMTFinput::getLayerData ( unsigned int  iLayer,
bool  giveEta = false 
) const

◆ getMuonStub()

const MuonStubPtr OMTFinput::getMuonStub ( unsigned int  iLayer,
unsigned int  iInput 
) const
inline

Definition at line 30 of file OMTFinput.h.

References MuonStubsInput::muonStubsInLayers.

Referenced by getHitEta(), getPhiHw(), and OMTFProcessor< GoldenPatternType >::processInput().

30  {
31  return muonStubsInLayers.at(iLayer).at(iInput);
32  }
MuonStubPtrs2D muonStubsInLayers

◆ getPhiHw()

int OMTFinput::getPhiHw ( unsigned int  iLayer,
unsigned int  iInput 
) const
overridevirtual

Reimplemented from MuonStubsInput.

Definition at line 18 of file OMTFinput.cc.

References getMuonStub(), OMTFConfiguration::isBendingLayer(), myOmtfConfig, and OMTFConfiguration::nPhiBins().

Referenced by operator<<().

18  {
19  /* assert(iLayer < muonStubsInLayers.size());
20  assert(iInput < muonStubsInLayers[iLayer].size());*/
21  if (this->myOmtfConfig->isBendingLayer(iLayer)) {
22  MuonStubPtr stub = getMuonStub(iLayer - 1, iInput);
23  if (stub)
24  return stub->phiBHw;
25  }
26 
27  MuonStubPtr stub = getMuonStub(iLayer, iInput);
28  if (stub)
29  return stub->phiHw;
30 
31  return myOmtfConfig->nPhiBins();
32 }
const MuonStubPtr getMuonStub(unsigned int iLayer, unsigned int iInput) const
Definition: OMTFinput.h:30
unsigned int nPhiBins() const
std::shared_ptr< MuonStub > MuonStubPtr
Definition: MuonStub.h:65
const OMTFConfiguration * myOmtfConfig
Definition: OMTFinput.h:60
bool isBendingLayer(unsigned int iLayer) const override

◆ getRefHits() [1/2]

std::bitset< 128 > OMTFinput::getRefHits ( unsigned int  iProcessor) const

Definition at line 26 of file OMTFinput.cc.

References getLayerData(), OMTFConfiguration::getRefHitsDefs(), OMTFConfiguration::getRefToLogicNumber(), L1TowerCalibrationProducer_cfi::iEta, if(), myOmtfConfig, OMTFConfiguration::nPhiBins(), and refHitsEta.

Referenced by OMTFProcessor< GoldenPatternType >::fillCounts(), and OMTFProcessor< GoldenPatternType >::processInput().

26  {
27  std::bitset<128> refHits;
28 
29  unsigned int iRefHit = 0;
30  for (auto iRefHitDef : myOmtfConfig->getRefHitsDefs()[iProcessor]) {
31  int iPhi = getLayerData(myOmtfConfig->getRefToLogicNumber()[iRefHitDef.iRefLayer])[iRefHitDef.iInput];
32  int iEta = getLayerData(myOmtfConfig->getRefToLogicNumber()[iRefHitDef.iRefLayer], true)[iRefHitDef.iInput];
33  if (iPhi < (int)myOmtfConfig->nPhiBins()) {
34  refHits.set(iRefHit, iRefHitDef.fitsRange(iPhi));
35  refHitsEta[iRefHit] = iEta;
36  }
37  iRefHit++;
38  }
39 
40  return refHits;
41 }
const std::vector< std::vector< RefHitDef > > & getRefHitsDefs() const
vector1D refHitsEta
RefHitsEta.
Definition: OMTFinput.h:58
const OMTFinput::vector1D & getLayerData(unsigned int iLayer, bool giveEta=false) const
Definition: OMTFinput.cc:17
unsigned int nPhiBins() const
const std::vector< int > & getRefToLogicNumber() const
const OMTFConfiguration * myOmtfConfig
Definition: OMTFinput.h:60

◆ getRefHits() [2/2]

std::bitset<128> OMTFinput::getRefHits ( unsigned int  iProcessor) const

◆ mergeData() [1/2]

void OMTFinput::mergeData ( const OMTFinput aInput)

Merge data of two input objects. Method used in DiMuon studies.

◆ mergeData() [2/2]

void OMTFinput::mergeData ( const OMTFinput aInput)

Merge data of two input objects. Method used in DiMuon studies.

Definition at line 76 of file OMTFinput.cc.

References addLayerHit(), getLayerData(), myOmtfConfig, and OMTFConfiguration::nLayers().

Referenced by operator+=().

76  {
77  for (unsigned int iLayer = 0; iLayer < myOmtfConfig->nLayers(); ++iLayer) {
78  const OMTFinput::vector1D &aPhiVec = aInput->getLayerData(iLayer, false);
79  const OMTFinput::vector1D &aEtaVec = aInput->getLayerData(iLayer, true);
80  if (aPhiVec.empty())
81  continue;
82 
83  OMTFinput::vector1D layerData = getLayerData(iLayer, false);
84  for (unsigned int iInput = 0; iInput < 14; ++iInput) {
85  addLayerHit(iLayer, iInput, aPhiVec[iInput], aEtaVec[iInput]);
86  }
87  }
88 }
bool addLayerHit(unsigned int iLayer, unsigned int iInput, int iPhi, int iEta, bool allowOverwrite=true)
Definition: OMTFinput.cc:44
std::vector< int > vector1D
Definition: OMTFinput.h:13
const OMTFinput::vector1D & getLayerData(unsigned int iLayer, bool giveEta=false) const
Definition: OMTFinput.cc:17
unsigned int nLayers() const
const OMTFConfiguration * myOmtfConfig
Definition: OMTFinput.h:60

◆ operator+=()

OMTFinput& OMTFinput::operator+= ( const OMTFinput iInput)
inline

Definition at line 41 of file OMTFinput.h.

References mergeData().

41  {
42  mergeData(&iInput);
43  return *this;
44  }
void mergeData(const OMTFinput *aInput)
Definition: OMTFinput.cc:76

◆ readData() [1/2]

void OMTFinput::readData ( XMLConfigReader aReader,
unsigned int  iEvent = 0,
unsigned int  iProcessor = 0 
)

Read data from a XML file.

◆ readData() [2/2]

void OMTFinput::readData ( XMLConfigReader aReader,
unsigned int  iEvent = 0,
unsigned int  iProcessor = 0 
)

Read data from a XML file.

Definition at line 70 of file OMTFinput.cc.

References iEvent, measurementsEta, measurementsPhi, and XMLConfigReader::readEvent().

70  {
71  measurementsPhi = aReader->readEvent(iEvent, iProcessor);
72  measurementsEta = aReader->readEvent(iEvent, iProcessor, true);
73 }
vector2D measurementsEta
Definition: OMTFinput.h:55
std::vector< std::vector< int > > readEvent(unsigned int iEvent=0, unsigned int iProcessor=0, bool readEta=false)
int iEvent
Definition: GenABIO.cc:224
vector2D measurementsPhi
Definition: OMTFinput.h:50

◆ shiftMyPhi() [1/2]

void OMTFinput::shiftMyPhi ( int  phiShift)

Apply shift to all data.

◆ shiftMyPhi() [2/2]

void OMTFinput::shiftMyPhi ( int  phiShift)

Apply shift to all data.

Definition at line 99 of file OMTFinput.cc.

References OMTFConfiguration::getBendingLayers(), createfilelist::int, measurementsPhi, myOmtfConfig, OMTFConfiguration::nPhiBins(), OMTFConfiguration::nPhiBits(), and funct::pow().

99  {
100  int lowScaleEnd = std::pow(2, myOmtfConfig->nPhiBits() - 1);
101  int highScaleEnd = lowScaleEnd - 1;
102 
103  for (unsigned int iLogicLayer = 0; iLogicLayer < measurementsPhi.size(); ++iLogicLayer) {
104  for (unsigned int iHit = 0; iHit < measurementsPhi[iLogicLayer].size(); ++iHit) {
105  if (!myOmtfConfig->getBendingLayers().count(iLogicLayer) &&
106  measurementsPhi[iLogicLayer][iHit] < (int)myOmtfConfig->nPhiBins()) {
107  if (measurementsPhi[iLogicLayer][iHit] < 0)
108  measurementsPhi[iLogicLayer][iHit] += myOmtfConfig->nPhiBins();
109  measurementsPhi[iLogicLayer][iHit] -= phiShift;
110  if (measurementsPhi[iLogicLayer][iHit] < 0)
111  measurementsPhi[iLogicLayer][iHit] += myOmtfConfig->nPhiBins();
112  measurementsPhi[iLogicLayer][iHit] += -lowScaleEnd;
113  if (measurementsPhi[iLogicLayer][iHit] < -lowScaleEnd || measurementsPhi[iLogicLayer][iHit] > highScaleEnd)
114  measurementsPhi[iLogicLayer][iHit] = (int)myOmtfConfig->nPhiBins();
115  }
116  }
117  }
118 }
unsigned int nPhiBins() const
unsigned int nPhiBits() const
const std::set< int > & getBendingLayers() const
const OMTFConfiguration * myOmtfConfig
Definition: OMTFinput.h:60
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
vector2D measurementsPhi
Definition: OMTFinput.h:50

Friends And Related Function Documentation

◆ operator<< [1/2]

std::ostream& operator<< ( std::ostream &  out,
const OMTFinput aInput 
)
friend

Definition at line 121 of file OMTFinput.cc.

121  {
122  for (unsigned int iLogicLayer = 0; iLogicLayer < aInput.measurementsPhi.size(); ++iLogicLayer) {
123  out << "Logic layer: " << iLogicLayer << " Hits: ";
124  for (unsigned int iHit = 0; iHit < aInput.measurementsPhi[iLogicLayer].size(); ++iHit) {
125  out << aInput.measurementsPhi[iLogicLayer][iHit] << "\t";
126  }
127  out << std::endl;
128  }
129  return out;
130 }
vector2D measurementsPhi
Definition: OMTFinput.h:50

◆ operator<< [2/2]

std::ostream& operator<< ( std::ostream &  out,
const OMTFinput aInput 
)
friend

Definition at line 121 of file OMTFinput.cc.

121  {
122  for (unsigned int iLogicLayer = 0; iLogicLayer < aInput.measurementsPhi.size(); ++iLogicLayer) {
123  out << "Logic layer: " << iLogicLayer << " Hits: ";
124  for (unsigned int iHit = 0; iHit < aInput.measurementsPhi[iLogicLayer].size(); ++iHit) {
125  out << aInput.measurementsPhi[iLogicLayer][iHit] << "\t";
126  }
127  out << std::endl;
128  }
129  return out;
130 }
vector2D measurementsPhi
Definition: OMTFinput.h:50

Member Data Documentation

◆ measurementsEta

vector2D OMTFinput::measurementsEta
private

Eta measurements in logic layers First index: layer number Second index: measurement number within layer

Definition at line 55 of file OMTFinput.h.

Referenced by addLayerHit(), clear(), getLayerData(), and readData().

◆ measurementsPhi

vector2D OMTFinput::measurementsPhi
private

Phi measurements in logic layers First index: layer number Second index: measurement number within layer

Definition at line 50 of file OMTFinput.h.

Referenced by addLayerHit(), clear(), getLayerData(), operator<<(), readData(), and shiftMyPhi().

◆ myOmtfConfig

const OMTFConfiguration * OMTFinput::myOmtfConfig = nullptr
private

◆ refHitsEta

vector1D OMTFinput::refHitsEta
mutableprivate

RefHitsEta.

Definition at line 58 of file OMTFinput.h.

Referenced by clear(), and getRefHits().