CMS 3D CMS Logo

OMTFConfigMaker.cc
Go to the documentation of this file.
1 #include <iostream>
2 
8 
10 
13 OMTFConfigMaker::OMTFConfigMaker(OMTFConfiguration * omtfConfig) : myOmtfConfig(omtfConfig) {
14 
15  std::vector<int> refPhi1D(myOmtfConfig->nLogicRegions(),2*myOmtfConfig->nPhiBins());
16  minRefPhi2D.assign(myOmtfConfig->nRefLayers(),refPhi1D);
17 
18  refPhi1D = std::vector<int>(myOmtfConfig->nLogicRegions(),-2*myOmtfConfig->nPhiBins());
19  maxRefPhi2D.assign(myOmtfConfig->nRefLayers(),refPhi1D);
20 }
26 void OMTFConfigMaker::fillCounts(unsigned int iProcessor,
27  const OMTFinput & aInput){
28 
29 }
32 void OMTFConfigMaker::fillPhiMaps(unsigned int iProcessor,
33  const OMTFinput & aInput){
34 
36  for(unsigned int iRefLayer=0;iRefLayer<myOmtfConfig->nRefLayers();++iRefLayer){
37  const OMTFinput::vector1D & refLayerHits = aInput.getLayerData(myOmtfConfig->getRefToLogicNumber()[iRefLayer]);
38  if(!refLayerHits.size()) continue;
39  for(unsigned int iInput=0;iInput<myOmtfConfig->nInputs();++iInput){
40  int phiRef = refLayerHits[iInput];
41  unsigned int iRegion = myOmtfConfig->getRegionNumberFromMap(iInput,iRefLayer,phiRef);
42  if(phiRef>=(int)myOmtfConfig->nPhiBins()) continue;
43  if(phiRef<minRefPhi2D[iRefLayer][iRegion]) minRefPhi2D[iRefLayer][iRegion] = phiRef;
44  if(phiRef>maxRefPhi2D[iRefLayer][iRegion]) maxRefPhi2D[iRefLayer][iRegion] = phiRef;
45  }
46  }
47 }
50 void OMTFConfigMaker::printPhiMap(std::ostream & out){
51 
52  out<<"min Phi in each logicRegion (X) in each ref Layer (Y): "<<std::endl;
53  for(unsigned int iRefLayer=0;iRefLayer<myOmtfConfig->nRefLayers();++iRefLayer){
54  for(unsigned int iLogicRegion=0;iLogicRegion<myOmtfConfig->nLogicRegions();++iLogicRegion){
55  out<<" "<<minRefPhi2D[iRefLayer][iLogicRegion]<<"\t";
56  }
57  out<<std::endl;
58  }
59  out<<std::endl;
60 
61  out<<"max Phi in each logicRegion (X) in each ref Layer (Y): "<<std::endl;
62  for(unsigned int iRefLayer=0;iRefLayer<myOmtfConfig->nRefLayers();++iRefLayer){
63  for(unsigned int iLogicRegion=0;iLogicRegion<myOmtfConfig->nLogicRegions();++iLogicRegion){
64  out<<" "<<maxRefPhi2D[iRefLayer][iLogicRegion]<<"\t";
65  }
66  out<<std::endl;
67  }
68  out<<std::endl;
69 
70 }
73 void OMTFConfigMaker::makeConnetionsMap(unsigned int iProcessor,
74  const OMTFinput & aInput){
75 
76  fillPhiMaps(iProcessor,aInput);
77 
78  for(unsigned int iRefLayer=0;iRefLayer<myOmtfConfig->nRefLayers();++iRefLayer){
79  const OMTFinput::vector1D & refLayerHits = aInput.getLayerData(myOmtfConfig->getRefToLogicNumber()[iRefLayer]);
80  if(!refLayerHits.size()) continue;
82  for(unsigned int iInput=0;iInput<refLayerHits.size();++iInput){
83  int phiRef = refLayerHits[iInput];
84  unsigned int iRegion = myOmtfConfig->getRegionNumberFromMap(iInput,iRefLayer,phiRef);
85  if(iRegion>=myOmtfConfig->nLogicRegions()) continue;
86  fillInputRange(iProcessor,iRegion,aInput);
87  fillInputRange(iProcessor,iRegion,iRefLayer,iInput);
91  if(iInput%2==0) fillInputRange(iProcessor,iRegion,iRefLayer,iInput+1);
92  }
93  }
94 }
97 void OMTFConfigMaker::fillInputRange(unsigned int iProcessor,
98  unsigned int iRegion,
99  const OMTFinput & aInput){
100 
101  for(unsigned int iLogicLayer=0;iLogicLayer<myOmtfConfig->nLayers();++iLogicLayer){
102  for(unsigned int iInput=0;iInput<14;++iInput){
103  bool isHit = aInput.getLayerData(iLogicLayer)[iInput]<(int)myOmtfConfig->nPhiBins();
104  myOmtfConfig->getMeasurements4D()[iProcessor][iRegion][iLogicLayer][iInput]+=isHit;
105  }
106  }
107 }
110 void OMTFConfigMaker::fillInputRange(unsigned int iProcessor,
111  unsigned int iRegion,
112  unsigned int iRefLayer,
113  unsigned int iInput){
114 
115  ++myOmtfConfig->getMeasurements4Dref()[iProcessor][iRegion][iRefLayer][iInput];
116 
117 }
121  unsigned int iProcessor,
122  unsigned int iRegion){
123 
124  out<<"iProcessor: "<<iProcessor
125  <<" iRegion: "<<iRegion
126  <<std::endl;
127 
128  out<<"Ref hits"<<std::endl;
129  for(unsigned int iLogicLayer=0;iLogicLayer<myOmtfConfig->nLayers();++iLogicLayer){
130  out<<"Logic layer: "<<iLogicLayer<<" Hits: ";
131  for(unsigned int iInput=0;iInput<myOmtfConfig->nInputs();++iInput){
132  out<<myOmtfConfig->getMeasurements4Dref()[iProcessor][iRegion][iLogicLayer][iInput]<<"\t";
133  }
134  out<<std::endl;
135  }
136  /*
137  out<<"Measurement hits"<<std::endl;
138  for(unsigned int iLogicLayer=0;iLogicLayer<myOmtfConfig->nLayers();++iLogicLayer){
139  out<<"Logic layer: "<<iLogicLayer<<" Hits: ";
140  for(unsigned int iInput=0;iInput<14;++iInput){
141  out<<myOmtfConfig->getMeasurements4D()[iProcessor][iRegion][iLogicLayer][iInput]<<"\t";
142  }
143  out<<std::endl;
144  }
145  */
146  out<<std::endl;
147 }
unsigned int nRefLayers() const
void fillPhiMaps(unsigned int iProcessor, const OMTFinput &aInput)
void makeConnetionsMap(unsigned int iProcessor, const OMTFinput &aInput)
unsigned int nLayers() const
unsigned int nPhiBins() const
std::vector< int > vector1D
Definition: OMTFinput.h:15
const OMTFinput::vector1D & getLayerData(unsigned int iLayer, bool giveEta=false) const
Definition: OMTFinput.cc:19
unsigned int getRegionNumberFromMap(unsigned int iInput, unsigned int iRefLayer, int iPhi) const
void printConnections(std::ostream &out, unsigned int iProcessor, unsigned int iCone)
unsigned int nInputs() const
void fillCounts(unsigned int iProcessor, const OMTFinput &aInput)
std::vector< std::vector< int > > minRefPhi2D
OMTFConfigMaker(OMTFConfiguration *omtf_config)
void printPhiMap(std::ostream &out)
const std::vector< int > & getRefToLogicNumber() const
OMTFConfiguration * myOmtfConfig
unsigned int nLogicRegions() const
vector4D & getMeasurements4Dref()
void fillInputRange(unsigned int iConfigMaker, unsigned int iCone, const OMTFinput &aInput)
std::vector< std::vector< int > > maxRefPhi2D
vector4D & getMeasurements4D()