CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OMTFConfigMaker.cc
Go to the documentation of this file.
1 #include <iostream>
2 
8 
10 
13 OMTFConfigMaker::OMTFConfigMaker(const edm::ParameterSet & theConfig, OMTFConfiguration * omtf_config) : m_omtf_config(omtf_config) {
14 
15  std::vector<int> refPhi1D(OMTFConfiguration::instance()->nLogicRegions,2*OMTFConfiguration::instance()->nPhiBins);
16  minRefPhi2D.assign(OMTFConfiguration::instance()->nRefLayers,refPhi1D);
17 
19  maxRefPhi2D.assign(OMTFConfiguration::instance()->nRefLayers,refPhi1D);
20 
21 }
27 void OMTFConfigMaker::fillCounts(unsigned int iProcessor,
28  const OMTFinput & aInput){
29 
30 }
33 void OMTFConfigMaker::fillPhiMaps(unsigned int iProcessor,
34  const OMTFinput & aInput){
35 
37  for(unsigned int iRefLayer=0;iRefLayer<OMTFConfiguration::instance()->nRefLayers;++iRefLayer){
38  const OMTFinput::vector1D & refLayerHits = aInput.getLayerData(OMTFConfiguration::instance()->refToLogicNumber[iRefLayer]);
39  if(!refLayerHits.size()) continue;
40  for(unsigned int iInput=0;iInput<OMTFConfiguration::instance()->nInputs;++iInput){
41  int phiRef = refLayerHits[iInput];
42  unsigned int iRegion = OMTFConfiguration::instance()->getRegionNumberFromMap(iInput,iRefLayer,phiRef);
43  if(phiRef>=(int)OMTFConfiguration::instance()->nPhiBins) continue;
44  if(phiRef<minRefPhi2D[iRefLayer][iRegion]) minRefPhi2D[iRefLayer][iRegion] = phiRef;
45  if(phiRef>maxRefPhi2D[iRefLayer][iRegion]) maxRefPhi2D[iRefLayer][iRegion] = phiRef;
46  }
47  }
48 }
51 void OMTFConfigMaker::printPhiMap(std::ostream & out){
52 
53  out<<"min Phi in each logicRegion (X) in each ref Layer (Y): "<<std::endl;
54  for(unsigned int iRefLayer=0;iRefLayer<OMTFConfiguration::instance()->nRefLayers;++iRefLayer){
55  for(unsigned int iLogicRegion=0;iLogicRegion<OMTFConfiguration::instance()->nLogicRegions;++iLogicRegion){
56  out<<" "<<minRefPhi2D[iRefLayer][iLogicRegion]<<"\t";
57  }
58  out<<std::endl;
59  }
60  out<<std::endl;
61 
62  out<<"max Phi in each logicRegion (X) in each ref Layer (Y): "<<std::endl;
63  for(unsigned int iRefLayer=0;iRefLayer<OMTFConfiguration::instance()->nRefLayers;++iRefLayer){
64  for(unsigned int iLogicRegion=0;iLogicRegion<OMTFConfiguration::instance()->nLogicRegions;++iLogicRegion){
65  out<<" "<<maxRefPhi2D[iRefLayer][iLogicRegion]<<"\t";
66  }
67  out<<std::endl;
68  }
69  out<<std::endl;
70 
71 }
74 void OMTFConfigMaker::makeConnetionsMap(unsigned int iProcessor,
75  const OMTFinput & aInput){
76 
77  fillPhiMaps(iProcessor,aInput);
78 
79  for(unsigned int iRefLayer=0;iRefLayer<OMTFConfiguration::instance()->nRefLayers;++iRefLayer){
80  const OMTFinput::vector1D & refLayerHits = aInput.getLayerData(OMTFConfiguration::instance()->refToLogicNumber[iRefLayer]);
81  if(!refLayerHits.size()) continue;
83  for(unsigned int iInput=0;iInput<refLayerHits.size();++iInput){
84  int phiRef = refLayerHits[iInput];
85  unsigned int iRegion = OMTFConfiguration::instance()->getRegionNumberFromMap(iInput,iRefLayer,phiRef);
86  if(iRegion>=OMTFConfiguration::instance()->nLogicRegions) continue;
87  fillInputRange(iProcessor,iRegion,aInput);
88  fillInputRange(iProcessor,iRegion,iRefLayer,iInput);
92  if(iInput%2==0) fillInputRange(iProcessor,iRegion,iRefLayer,iInput+1);
93  }
94  }
95 }
98 void OMTFConfigMaker::fillInputRange(unsigned int iProcessor,
99  unsigned int iRegion,
100  const OMTFinput & aInput){
101 
102  for(unsigned int iLogicLayer=0;iLogicLayer<OMTFConfiguration::instance()->nLayers;++iLogicLayer){
103 
104  for(unsigned int iInput=0;iInput<14;++iInput){
105  bool isHit = aInput.getLayerData(iLogicLayer)[iInput]<(int)OMTFConfiguration::instance()->nPhiBins;
106  m_omtf_config->measurements4D[iProcessor][iRegion][iLogicLayer][iInput]+=isHit;
107  }
108  }
109 }
112 void OMTFConfigMaker::fillInputRange(unsigned int iProcessor,
113  unsigned int iRegion,
114  unsigned int iRefLayer,
115  unsigned int iInput){
116 
117  ++m_omtf_config->measurements4Dref[iProcessor][iRegion][iRefLayer][iInput];
118 
119 }
123  unsigned int iProcessor,
124  unsigned int iRegion){
125 
126  out<<"iProcessor: "<<iProcessor
127  <<" iRegion: "<<iRegion
128  <<std::endl;
129 
130  out<<"Ref hits"<<std::endl;
131  for(unsigned int iLogicLayer=0;iLogicLayer<OMTFConfiguration::instance()->nLayers;++iLogicLayer){
132  out<<"Logic layer: "<<iLogicLayer<<" Hits: ";
133  for(unsigned int iInput=0;iInput<14;++iInput){
134  out<<OMTFConfiguration::instance()->measurements4Dref[iProcessor][iRegion][iLogicLayer][iInput]<<"\t";
135  }
136  out<<std::endl;
137  }
138  /*
139  out<<"Measurement hits"<<std::endl;
140  for(unsigned int iLogicLayer=0;iLogicLayer<OMTFConfiguration::instance()->nLayers;++iLogicLayer){
141  out<<"Logic layer: "<<iLogicLayer<<" Hits: ";
142  for(unsigned int iInput=0;iInput<14;++iInput){
143  out<<OMTFConfiguration::instance()->measurements4D[iProcessor][iRegion][iLogicLayer][iInput]<<"\t";
144  }
145  out<<std::endl;
146  }
147  */
148  out<<std::endl;
149 }
unsigned int nLayers
unsigned int nInputs
void fillPhiMaps(unsigned int iProcessor, const OMTFinput &aInput)
void makeConnetionsMap(unsigned int iProcessor, const OMTFinput &aInput)
std::vector< int > vector1D
Definition: OMTFinput.h:14
unsigned int nLogicRegions
const OMTFinput::vector1D & getLayerData(unsigned int iLayer, bool giveEta=false) const
Definition: OMTFinput.cc:18
OMTFConfigMaker(const edm::ParameterSet &cfg, OMTFConfiguration *omtf_config)
unsigned int getRegionNumberFromMap(unsigned int iInput, unsigned int iRefLayer, int iPhi) const
void printConnections(std::ostream &out, unsigned int iProcessor, unsigned int iCone)
void fillCounts(unsigned int iProcessor, const OMTFinput &aInput)
unsigned int nPhiBins
std::vector< std::vector< int > > minRefPhi2D
OMTFConfiguration * m_omtf_config
unsigned int nRefLayers
void printPhiMap(std::ostream &out)
void fillInputRange(unsigned int iConfigMaker, unsigned int iCone, const OMTFinput &aInput)
static const OMTFConfiguration * instance()
std::vector< std::vector< int > > maxRefPhi2D