CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes | Friends
OMTFinput Class Reference

#include <OMTFinput.h>

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)
 
void clear ()
 Reset vectors with data. More...
 
const OMTFinput::vector1DgetLayerData (unsigned int iLayer, bool giveEta=false) const
 
std::bitset< 128 > getRefHits (unsigned int iProcessor) const
 
void mergeData (OMTFinput *aInput)
 
 OMTFinput ()
 
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...
 

Private Attributes

vector2D measurementsEta
 
vector2D measurementsPhi
 
vector1D refHitsEta
 RefHitsEta. More...
 

Friends

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

Detailed Description

Definition at line 10 of file OMTFinput.h.

Member Typedef Documentation

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

Definition at line 14 of file OMTFinput.h.

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

Definition at line 15 of file OMTFinput.h.

Constructor & Destructor Documentation

OMTFinput::OMTFinput ( )

Definition at line 11 of file OMTFinput.cc.

References clear().

11  {
12 
13  clear();
14 
15 }
void clear()
Reset vectors with data.
Definition: OMTFinput.cc:95

Member Function Documentation

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

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

Definition at line 45 of file OMTFinput.cc.

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

Referenced by mergeData(), OMTFinputMaker::processCSC(), OMTFinputMaker::processDT(), and OMTFinputMaker::processRPC().

47  {
48 
50  assert(iInput<14);
51 
52  if(iPhi>=(int)OMTFConfiguration::nPhiBins) return true;
53 
54  if(measurementsPhi[iLayer][iInput]!=(int)OMTFConfiguration::nPhiBins) ++iInput;
55 
56  if(iInput>13) return false;
57 
58  measurementsPhi[iLayer][iInput] = iPhi;
59  measurementsEta[iLayer][iInput] = iEta;
60 
61  return true;
62 }
static unsigned int nLayers
vector2D measurementsEta
Definition: OMTFinput.h:56
assert(m_qm.get())
static unsigned int nPhiBins
vector2D measurementsPhi
Definition: OMTFinput.h:51
void OMTFinput::clear ( void  )

Reset vectors with data.

Definition at line 95 of file OMTFinput.cc.

References measurementsEta, measurementsPhi, OMTFConfiguration::nLayers, OMTFConfiguration::nPhiBins, and refHitsEta.

Referenced by OMTFinputMaker::buildInputForProcessor(), and OMTFinput().

95  {
96 
101 
102 }
static unsigned int nLayers
vector2D measurementsEta
Definition: OMTFinput.h:56
std::vector< int > vector1D
Definition: OMTFinput.h:14
vector1D refHitsEta
RefHitsEta.
Definition: OMTFinput.h:59
static unsigned int nPhiBins
vector2D measurementsPhi
Definition: OMTFinput.h:51
const OMTFinput::vector1D & OMTFinput::getLayerData ( unsigned int  iLayer,
bool  giveEta = false 
) const

Definition at line 18 of file OMTFinput.cc.

References assert(), measurementsEta, and measurementsPhi.

Referenced by OMTFProcessor::fillCounts(), OMTFConfigMaker::fillInputRange(), OMTFConfigMaker::fillPhiMaps(), getRefHits(), OMTFConfigMaker::makeConnetionsMap(), mergeData(), OMTFProcessor::processInput(), and XMLConfigWriter::writeEventData().

18  {
19  assert(iLayer<measurementsPhi.size());
20 
21  if(giveEta) return measurementsEta[iLayer];
22  return measurementsPhi[iLayer];
23 }
vector2D measurementsEta
Definition: OMTFinput.h:56
assert(m_qm.get())
vector2D measurementsPhi
Definition: OMTFinput.h:51
std::bitset< 128 > OMTFinput::getRefHits ( unsigned int  iProcessor) const

Definition at line 26 of file OMTFinput.cc.

References getLayerData(), OMTFConfiguration::nPhiBins, OMTFConfiguration::refHitsDefs, refHitsEta, and OMTFConfiguration::refToLogicNumber.

Referenced by OMTFProcessor::fillCounts(), and OMTFProcessor::processInput().

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

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

Definition at line 75 of file OMTFinput.cc.

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

75  {
76 
77  for(unsigned int iLayer=0;iLayer<OMTFConfiguration::nLayers;++iLayer){
78  const OMTFinput::vector1D & aPhiVec = aInput->getLayerData(iLayer,false);
79  const OMTFinput::vector1D & aEtaVec = aInput->getLayerData(iLayer,true);
80  if(!aPhiVec.size()) continue;
81 
82  OMTFinput::vector1D layerData = getLayerData(iLayer, false);
83 
84  for(unsigned int iInput=0;iInput<14;++iInput){
85 
86  //if(aPhiVec[iInput]==layerData[iInput] &&
87  // aPhiVec[iInput]!=(int)OMTFConfiguration::nPhiBins) std::cout<<"Same HIT!"<<std::endl;
88 
89  addLayerHit(iLayer,iInput,aPhiVec[iInput],aEtaVec[iInput]);
90  }
91  }
92 }
static unsigned int nLayers
std::vector< int > vector1D
Definition: OMTFinput.h:14
const OMTFinput::vector1D & getLayerData(unsigned int iLayer, bool giveEta=false) const
Definition: OMTFinput.cc:18
bool addLayerHit(unsigned int iLayer, unsigned int iInput, int iPhi, int iEta)
Definition: OMTFinput.cc:45
void OMTFinput::readData ( XMLConfigReader aReader,
unsigned int  iEvent = 0,
unsigned int  iProcessor = 0 
)

Read data from a XML file.

Definition at line 65 of file OMTFinput.cc.

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

67  {
68 
69  measurementsPhi = aReader->readEvent(iEvent, iProcessor);
70  measurementsEta = aReader->readEvent(iEvent, iProcessor, true);
71 
72 }
vector2D measurementsEta
Definition: OMTFinput.h:56
std::vector< std::vector< int > > readEvent(unsigned int iEvent=0, unsigned int iProcessor=0, bool readEta=false)
int iEvent
Definition: GenABIO.cc:230
vector2D measurementsPhi
Definition: OMTFinput.h:51
void OMTFinput::shiftMyPhi ( int  phiShift)

Apply shift to all data.

Definition at line 105 of file OMTFinput.cc.

References OMTFConfiguration::bendingLayers, KineDebug3::count(), measurementsPhi, OMTFConfiguration::nPhiBins, OMTFConfiguration::nPhiBits, and funct::pow().

Referenced by OMTFProcessor::shiftInput().

105  {
106 
107 
108  int lowScaleEnd = std::pow(2,OMTFConfiguration::nPhiBits-1);
109  int highScaleEnd = lowScaleEnd-1;
110 
111 for(unsigned int iLogicLayer=0;iLogicLayer<measurementsPhi.size();++iLogicLayer){
112  for(unsigned int iHit=0;iHit<measurementsPhi[iLogicLayer].size();++iHit){
113  if(!OMTFConfiguration::bendingLayers.count(iLogicLayer) &&
114  measurementsPhi[iLogicLayer][iHit]<(int)OMTFConfiguration::nPhiBins){
115  if(measurementsPhi[iLogicLayer][iHit]<0) measurementsPhi[iLogicLayer][iHit]+=OMTFConfiguration::nPhiBins;
116  measurementsPhi[iLogicLayer][iHit]-=phiShift;
117  if(measurementsPhi[iLogicLayer][iHit]<0) measurementsPhi[iLogicLayer][iHit]+=OMTFConfiguration::nPhiBins;
118  measurementsPhi[iLogicLayer][iHit]+=-lowScaleEnd;
119  if(measurementsPhi[iLogicLayer][iHit]<-lowScaleEnd ||
120  measurementsPhi[iLogicLayer][iHit]>highScaleEnd) measurementsPhi[iLogicLayer][iHit] = (int)OMTFConfiguration::nPhiBins;
121  }
122  }
123  }
124 }
static unsigned int nPhiBins
static unsigned int nPhiBits
static std::set< int > bendingLayers
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
vector2D measurementsPhi
Definition: OMTFinput.h:51

Friends And Related Function Documentation

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

Definition at line 127 of file OMTFinput.cc.

127  {
128 
129 for(unsigned int iLogicLayer=0;iLogicLayer<aInput.measurementsPhi.size();++iLogicLayer){
130  out<<"Logic layer: "<<iLogicLayer<<" Hits: ";
131  for(unsigned int iHit=0;iHit<aInput.measurementsPhi[iLogicLayer].size();++iHit){
132  out<<aInput.measurementsPhi[iLogicLayer][iHit]<<"\t";
133  }
134  out<<std::endl;
135  }
136  return out;
137 
138 
139 }
vector2D measurementsPhi
Definition: OMTFinput.h:51

Member Data Documentation

vector2D OMTFinput::measurementsEta
private

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

Definition at line 56 of file OMTFinput.h.

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

vector2D OMTFinput::measurementsPhi
private

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

Definition at line 51 of file OMTFinput.h.

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

vector1D OMTFinput::refHitsEta
mutableprivate

RefHitsEta.

Definition at line 59 of file OMTFinput.h.

Referenced by clear(), and getRefHits().