CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OMTFConfigMaker.cc
Go to the documentation of this file.
1 #include <iostream>
2 
8 
10 
14  std::vector<int> refPhi1D(myOmtfConfig->nLogicRegions(), 2 * myOmtfConfig->nPhiBins());
15  minRefPhi2D.assign(myOmtfConfig->nRefLayers(), refPhi1D);
16 
17  refPhi1D = std::vector<int>(myOmtfConfig->nLogicRegions(), -2 * myOmtfConfig->nPhiBins());
18  maxRefPhi2D.assign(myOmtfConfig->nRefLayers(), refPhi1D);
19 }
25 void OMTFConfigMaker::fillCounts(unsigned int iProcessor, const OMTFinput& aInput) {}
28 void OMTFConfigMaker::fillPhiMaps(unsigned int iProcessor, const OMTFinput& aInput) {
30  for (unsigned int iRefLayer = 0; iRefLayer < myOmtfConfig->nRefLayers(); ++iRefLayer) {
31  const OMTFinput::vector1D& refLayerHits = aInput.getLayerData(myOmtfConfig->getRefToLogicNumber()[iRefLayer]);
32  if (refLayerHits.empty())
33  continue;
34  for (unsigned int iInput = 0; iInput < myOmtfConfig->nInputs(); ++iInput) {
35  int phiRef = refLayerHits[iInput];
36  unsigned int iRegion = myOmtfConfig->getRegionNumberFromMap(iInput, iRefLayer, phiRef);
37  if (phiRef >= (int)myOmtfConfig->nPhiBins())
38  continue;
39  if (phiRef < minRefPhi2D[iRefLayer][iRegion])
40  minRefPhi2D[iRefLayer][iRegion] = phiRef;
41  if (phiRef > maxRefPhi2D[iRefLayer][iRegion])
42  maxRefPhi2D[iRefLayer][iRegion] = phiRef;
43  }
44  }
45 }
48 void OMTFConfigMaker::printPhiMap(std::ostream& out) {
49  out << "min Phi in each logicRegion (X) in each ref Layer (Y): " << std::endl;
50  for (unsigned int iRefLayer = 0; iRefLayer < myOmtfConfig->nRefLayers(); ++iRefLayer) {
51  for (unsigned int iLogicRegion = 0; iLogicRegion < myOmtfConfig->nLogicRegions(); ++iLogicRegion) {
52  out << " " << minRefPhi2D[iRefLayer][iLogicRegion] << "\t";
53  }
54  out << std::endl;
55  }
56  out << std::endl;
57 
58  out << "max Phi in each logicRegion (X) in each ref Layer (Y): " << std::endl;
59  for (unsigned int iRefLayer = 0; iRefLayer < myOmtfConfig->nRefLayers(); ++iRefLayer) {
60  for (unsigned int iLogicRegion = 0; iLogicRegion < myOmtfConfig->nLogicRegions(); ++iLogicRegion) {
61  out << " " << maxRefPhi2D[iRefLayer][iLogicRegion] << "\t";
62  }
63  out << std::endl;
64  }
65  out << std::endl;
66 }
69 void OMTFConfigMaker::makeConnetionsMap(unsigned int iProcessor, const OMTFinput& aInput) {
70  fillPhiMaps(iProcessor, aInput);
71 
72  for (unsigned int iRefLayer = 0; iRefLayer < myOmtfConfig->nRefLayers(); ++iRefLayer) {
73  const OMTFinput::vector1D& refLayerHits = aInput.getLayerData(myOmtfConfig->getRefToLogicNumber()[iRefLayer]);
74  if (refLayerHits.empty())
75  continue;
77  for (unsigned int iInput = 0; iInput < refLayerHits.size(); ++iInput) {
78  int phiRef = refLayerHits[iInput];
79  unsigned int iRegion = myOmtfConfig->getRegionNumberFromMap(iInput, iRefLayer, phiRef);
80  if (iRegion >= myOmtfConfig->nLogicRegions())
81  continue;
82  fillInputRange(iProcessor, iRegion, aInput);
83  fillInputRange(iProcessor, iRegion, iRefLayer, iInput);
87  if (iInput % 2 == 0)
88  fillInputRange(iProcessor, iRegion, iRefLayer, iInput + 1);
89  }
90  }
91 }
94 void OMTFConfigMaker::fillInputRange(unsigned int iProcessor, unsigned int iRegion, const OMTFinput& aInput) {
95  for (unsigned int iLogicLayer = 0; iLogicLayer < myOmtfConfig->nLayers(); ++iLogicLayer) {
96  for (unsigned int iInput = 0; iInput < 14; ++iInput) {
97  bool isHit = aInput.getLayerData(iLogicLayer)[iInput] < (int)myOmtfConfig->nPhiBins();
98  myOmtfConfig->getMeasurements4D()[iProcessor][iRegion][iLogicLayer][iInput] += isHit;
99  }
100  }
101 }
104 void OMTFConfigMaker::fillInputRange(unsigned int iProcessor,
105  unsigned int iRegion,
106  unsigned int iRefLayer,
107  unsigned int iInput) {
108  ++myOmtfConfig->getMeasurements4Dref()[iProcessor][iRegion][iRefLayer][iInput];
109 }
112 void OMTFConfigMaker::printConnections(std::ostream& out, unsigned int iProcessor, unsigned int iRegion) {
113  out << "iProcessor: " << iProcessor << " iRegion: " << iRegion << std::endl;
114 
115  out << "Ref hits" << std::endl;
116  for (unsigned int iLogicLayer = 0; iLogicLayer < myOmtfConfig->nLayers(); ++iLogicLayer) {
117  out << "Logic layer: " << iLogicLayer << " Hits: ";
118  for (unsigned int iInput = 0; iInput < myOmtfConfig->nInputs(); ++iInput) {
119  out << myOmtfConfig->getMeasurements4Dref()[iProcessor][iRegion][iLogicLayer][iInput] << "\t";
120  }
121  out << std::endl;
122  }
123  /*
124  out<<"Measurement hits"<<std::endl;
125  for(unsigned int iLogicLayer=0;iLogicLayer<myOmtfConfig->nLayers();++iLogicLayer){
126  out<<"Logic layer: "<<iLogicLayer<<" Hits: ";
127  for(unsigned int iInput=0;iInput<14;++iInput){
128  out<<myOmtfConfig->getMeasurements4D()[iProcessor][iRegion][iLogicLayer][iInput]<<"\t";
129  }
130  out<<std::endl;
131  }
132  */
133  out << std::endl;
134 }
unsigned int nRefLayers() const
std::vector< std::vector< int > > maxRefPhi2D
void fillPhiMaps(unsigned int iProcessor, const OMTFinput &aInput)
OMTFConfiguration * myOmtfConfig
void makeConnetionsMap(unsigned int iProcessor, const OMTFinput &aInput)
unsigned int nLayers() const
unsigned int nPhiBins() const
omtfConfig(omtfConfig)
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 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
unsigned int nLogicRegions() const
vector4D & getMeasurements4Dref()
void fillInputRange(unsigned int iConfigMaker, unsigned int iCone, const OMTFinput &aInput)
vector4D & getMeasurements4D()