CMS 3D CMS Logo

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 (const OMTFinput *aInput)
 
 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 shiftMyPhi (int phiShift)
 Apply shift to all data. More...
 

Private Attributes

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

Friends

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

Detailed Description

Definition at line 11 of file OMTFinput.h.

Member Typedef Documentation

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

Definition at line 15 of file OMTFinput.h.

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

Definition at line 16 of file OMTFinput.h.

Constructor & Destructor Documentation

OMTFinput::OMTFinput ( const OMTFConfiguration omtfConfig)

Definition at line 11 of file OMTFinput.cc.

References clear(), and myOmtfConfig.

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

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 46 of file OMTFinput.cc.

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

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

48  {
49 
50  bool overwrite = false;
51  assert(iLayer<myOmtfConfig->nLayers());
52  assert(iInput<14);
53 
54  if(iPhi>=(int)myOmtfConfig->nPhiBins()) return true;
55 // unsigned int origInput = iInput;
56 
57  if (measurementsPhi[iLayer][iInput]==iPhi && measurementsEta[iLayer][iInput]==iEta) return true;
58 
59  if(measurementsPhi[iLayer][iInput]!=(int)myOmtfConfig->nPhiBins()) ++iInput;
60  if(measurementsPhi[iLayer][iInput]!=(int)myOmtfConfig->nPhiBins()) overwrite = true;
61 
62 // std::cout <<" addLayerHit :"<<iLayer<<" input orig :"<<inputorig<<" now: "<< iInput <<" phi: "<<iPhi<< std::endl;
63 
64  if(iInput>13) return false;
65 
66  measurementsPhi[iLayer][iInput] = iPhi;
67  measurementsEta[iLayer][iInput] = iEta;
68 
69 // return (origInput==iInput);
70  return (!overwrite);
71 }
vector2D measurementsEta
Definition: OMTFinput.h:59
const OMTFConfiguration * myOmtfConfig
Definition: OMTFinput.h:64
unsigned int nPhiBins() const
vector2D measurementsPhi
Definition: OMTFinput.h:54
void OMTFinput::clear ( void  )

Reset vectors with data.

Definition at line 99 of file OMTFinput.cc.

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

Referenced by OMTFinput().

99  {
100 
101  vector1D aLayer1D(14,myOmtfConfig->nPhiBins());
102  measurementsPhi.assign(myOmtfConfig->nLayers(),aLayer1D);
103  measurementsEta.assign(myOmtfConfig->nLayers(),aLayer1D);
104  refHitsEta.assign(128,myOmtfConfig->nPhiBins());
105 
106 }
vector2D measurementsEta
Definition: OMTFinput.h:59
const OMTFConfiguration * myOmtfConfig
Definition: OMTFinput.h:64
unsigned int nLayers() const
unsigned int nPhiBins() const
std::vector< int > vector1D
Definition: OMTFinput.h:15
vector1D refHitsEta
RefHitsEta.
Definition: OMTFinput.h:62
vector2D measurementsPhi
Definition: OMTFinput.h:54
const OMTFinput::vector1D & OMTFinput::getLayerData ( unsigned int  iLayer,
bool  giveEta = false 
) const

Definition at line 19 of file OMTFinput.cc.

References measurementsEta, and measurementsPhi.

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

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

Definition at line 27 of file OMTFinput.cc.

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

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

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

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

Definition at line 84 of file OMTFinput.cc.

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

Referenced by operator+=().

84  {
85 
86  for(unsigned int iLayer=0;iLayer<myOmtfConfig->nLayers();++iLayer){
87  const OMTFinput::vector1D & aPhiVec = aInput->getLayerData(iLayer,false);
88  const OMTFinput::vector1D & aEtaVec = aInput->getLayerData(iLayer,true);
89  if(aPhiVec.empty()) continue;
90 
91  OMTFinput::vector1D layerData = getLayerData(iLayer, false);
92  for(unsigned int iInput=0;iInput<14;++iInput){
93  addLayerHit(iLayer,iInput,aPhiVec[iInput],aEtaVec[iInput]);
94  }
95  }
96 }
const OMTFConfiguration * myOmtfConfig
Definition: OMTFinput.h:64
unsigned int nLayers() const
std::vector< int > vector1D
Definition: OMTFinput.h:15
const OMTFinput::vector1D & getLayerData(unsigned int iLayer, bool giveEta=false) const
Definition: OMTFinput.cc:19
bool addLayerHit(unsigned int iLayer, unsigned int iInput, int iPhi, int iEta)
Definition: OMTFinput.cc:46
OMTFinput& OMTFinput::operator+= ( const OMTFinput iInput)
inline

Definition at line 47 of file OMTFinput.h.

References mergeData().

47 { mergeData(&iInput); return *this; }
void mergeData(const OMTFinput *aInput)
Definition: OMTFinput.cc:84
void OMTFinput::readData ( XMLConfigReader aReader,
unsigned int  iEvent = 0,
unsigned int  iProcessor = 0 
)

Read data from a XML file.

Definition at line 74 of file OMTFinput.cc.

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

76  {
77 
78  measurementsPhi = aReader->readEvent(iEvent, iProcessor);
79  measurementsEta = aReader->readEvent(iEvent, iProcessor, true);
80 
81 }
vector2D measurementsEta
Definition: OMTFinput.h:59
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:54
void OMTFinput::shiftMyPhi ( int  phiShift)

Apply shift to all data.

Definition at line 109 of file OMTFinput.cc.

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

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

Friends And Related Function Documentation

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

Definition at line 130 of file OMTFinput.cc.

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

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 59 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 54 of file OMTFinput.h.

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

const OMTFConfiguration* OMTFinput::myOmtfConfig
private

Definition at line 64 of file OMTFinput.h.

Referenced by addLayerHit(), clear(), getRefHits(), mergeData(), OMTFinput(), and shiftMyPhi().

vector1D OMTFinput::refHitsEta
mutableprivate

RefHitsEta.

Definition at line 62 of file OMTFinput.h.

Referenced by clear(), and getRefHits().