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 
9 
11 
15 
16  std::vector<int> minRefPhi1D(6,2*OMTFConfiguration::nPhiBins);
17  minRefPhi2D.assign(OMTFConfiguration::nRefLayers,minRefPhi1D);
18 
19 }
25 void OMTFConfigMaker::fillCounts(unsigned int iProcessor,
26  const OMTFinput & aInput){
27 
28 }
31 void OMTFConfigMaker::fillPhiMaps(unsigned int iProcessor,
32  const OMTFinput & aInput){
33 
35  for(unsigned int iRefLayer=0;iRefLayer<OMTFConfiguration::nRefLayers;++iRefLayer){
36  const OMTFinput::vector1D & refLayerHits = aInput.getLayerData(OMTFConfiguration::refToLogicNumber[iRefLayer]);
37  if(!refLayerHits.size()) continue;
38  for(auto itRefHit: refLayerHits){
39  int phiRef = itRefHit;
40  if(phiRef>=(int)OMTFConfiguration::nPhiBins) continue;
41  if(phiRef<0) phiRef+=OMTFConfiguration::nPhiBins;
42  if(minRefPhi2D[iRefLayer][iProcessor]<0) minRefPhi2D[iRefLayer][iProcessor]+=OMTFConfiguration::nPhiBins;
43 
44  if(iProcessor==0 || iProcessor==5){
46  minRefPhi2D[iRefLayer][iProcessor]+=OMTFConfiguration::nPhiBins/4;
47 
49  if(minRefPhi2D[iRefLayer][iProcessor]>=(int)OMTFConfiguration::nPhiBins)minRefPhi2D[iRefLayer][iProcessor]-=OMTFConfiguration::nPhiBins;
50 
51  }
52 
53  if(phiRef<minRefPhi2D[iRefLayer][iProcessor]) minRefPhi2D[iRefLayer][iProcessor] = phiRef;
54 
55  if( (iProcessor==0 || iProcessor==5) &&
56  minRefPhi2D[iRefLayer][iProcessor]<(int)OMTFConfiguration::nPhiBins) minRefPhi2D[iRefLayer][iProcessor]-=OMTFConfiguration::nPhiBins/4;
57  if(minRefPhi2D[iRefLayer][iProcessor]<0) minRefPhi2D[iRefLayer][iProcessor]+=OMTFConfiguration::nPhiBins;
58 
59  if(minRefPhi2D[iRefLayer][iProcessor]>(int)OMTFConfiguration::nPhiBins/2) minRefPhi2D[iRefLayer][iProcessor]-=OMTFConfiguration::nPhiBins;
60  }
61  }
62 }
65 void OMTFConfigMaker::printPhiMap(std::ostream & out){
66 
67  for(unsigned int iRefLayer=0;iRefLayer<OMTFConfiguration::nRefLayers;++iRefLayer){
68  for(unsigned int iProcessor=0;iProcessor<6;++iProcessor){
69  out<<" "<<minRefPhi2D[iRefLayer][iProcessor]<<"\t";
70 
71  OMTFConfiguration::processorPhiVsRefLayer[iProcessor][iRefLayer] = minRefPhi2D[iRefLayer][iProcessor];
72 
73  }
74  out<<std::endl;
75  }
76  out<<std::endl;
77 }
80 void OMTFConfigMaker::makeConnetionsMap(unsigned int iProcessor,
81  const OMTFinput & aInput){
82 
83  fillPhiMaps(iProcessor,aInput);
84 
85  for(unsigned int iRefLayer=0;iRefLayer<OMTFConfiguration::nRefLayers;++iRefLayer){
86  const OMTFinput::vector1D & refLayerHits = aInput.getLayerData(OMTFConfiguration::refToLogicNumber[iRefLayer]);
87  if(!refLayerHits.size()) continue;
89  for(unsigned int iInput=0;iInput<refLayerHits.size();++iInput){
90  int phiRef = refLayerHits[iInput];
91  unsigned int iRegion = OMTFConfiguration::getRegionNumber(iProcessor,iRefLayer,phiRef);
92 
93  //if(iRegion==0) std::cout<<aInput<<std::endl;
94 
95  if(iRegion>5) continue;
96  fillInputRange(iProcessor,iRegion,aInput);
97  fillInputRange(iProcessor,iRegion,iRefLayer,iInput);
101  if(iInput%2==0) fillInputRange(iProcessor,iRegion,iRefLayer,iInput+1);
102  }
103  }
104 }
107 void OMTFConfigMaker::fillInputRange(unsigned int iProcessor,
108  unsigned int iRegion,
109  const OMTFinput & aInput){
110 
111  for(unsigned int iLogicLayer=0;iLogicLayer<OMTFConfiguration::nLayers;++iLogicLayer){
112  for(unsigned int iHit=0;iHit<14;++iHit){
113  bool isHit = aInput.getLayerData(iLogicLayer)[iHit]<(int)OMTFConfiguration::nPhiBins;
114  OMTFConfiguration::measurements4D[iProcessor][iRegion][iLogicLayer][iHit]+=isHit;
115  }
116  }
117 }
120 void OMTFConfigMaker::fillInputRange(unsigned int iProcessor,
121  unsigned int iRegion,
122  unsigned int iRefLayer,
123  unsigned int iHit){
124 
125  ++OMTFConfiguration::measurements4Dref[iProcessor][iRegion][iRefLayer][iHit];
126 
127 }
131  unsigned int iProcessor,
132  unsigned int iRegion){
133 
134  out<<"iProcessor: "<<iProcessor
135  <<" iRegion: "<<iRegion
136  <<std::endl;
137 
138  out<<"Ref hits"<<std::endl;
139  for(unsigned int iLogicLayer=0;iLogicLayer<OMTFConfiguration::nLayers;++iLogicLayer){
140  out<<"Logic layer: "<<iLogicLayer<<" Hits: ";
141  for(unsigned int iInput=0;iInput<14;++iInput){
142  out<<OMTFConfiguration::measurements4Dref[iProcessor][iRegion][iLogicLayer][iInput]<<"\t";
143  }
144  out<<std::endl;
145  }
146  /*
147  out<<"Measurement hits"<<std::endl;
148  for(unsigned int iLogicLayer=0;iLogicLayer<OMTFConfiguration::nLayers;++iLogicLayer){
149  out<<"Logic layer: "<<iLogicLayer<<" Hits: ";
150  for(unsigned int iInput=0;iInput<14;++iInput){
151  out<<OMTFConfiguration::measurements4D[iProcessor][iRegion][iLogicLayer][iInput]<<"\t";
152  }
153  out<<std::endl;
154  }
155  */
156  out<<std::endl;
157 }
static unsigned int getRegionNumber(unsigned int iProcessor, unsigned int iRefLayer, int iPhi)
static unsigned int nLayers
static vector4D measurements4D
void fillPhiMaps(unsigned int iProcessor, const OMTFinput &aInput)
void makeConnetionsMap(unsigned int iProcessor, const OMTFinput &aInput)
std::vector< int > vector1D
Definition: OMTFinput.h:14
static vector4D measurements4Dref
const OMTFinput::vector1D & getLayerData(unsigned int iLayer, bool giveEta=false) const
Definition: OMTFinput.cc:18
OMTFConfigMaker(const edm::ParameterSet &cfg)
void printConnections(std::ostream &out, unsigned int iProcessor, unsigned int iCone)
static std::vector< std::vector< int > > processorPhiVsRefLayer
void fillCounts(unsigned int iProcessor, const OMTFinput &aInput)
static unsigned int nPhiBins
std::vector< std::vector< int > > minRefPhi2D
static std::vector< int > refToLogicNumber
static unsigned int nRefLayers
void printPhiMap(std::ostream &out)
void fillInputRange(unsigned int iConfigMaker, unsigned int iCone, const OMTFinput &aInput)