- Timestamp:
- 10/13/11 10:21:03 (13 years ago)
- Location:
- trunk/FACT++/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/BasicGlCamera.cc
r12159 r12180 1 #include "BasicGlCamera.h" 1 2 #include "BasicGlCamera.h" 2 3 #include <math.h> … … 22 23 int BasicGlCamera::pixelsPatch[NPIX]; 23 24 int BasicGlCamera::softwareMapping[NPIX]; 24 int BasicGlCamera::patches[160][9];25 25 26 26 //Coordinates of an hexagon of radius 1 and center 0 … … 276 276 { 277 277 fPixelMap = map; 278 for (auto i=fPixelMap.begin();i!=fPixelMap.end(); i++) 279 { 280 hardwareMapping[i->index] = i->hw(); 281 softwareMapping[i->hw()] = i->index; 282 } 283 } 284 void BasicGlCamera::assignTriggerPatchesMap(const vector<int>& pa) 285 { 286 vector<vector<int> > intervec; 287 intervec.resize(160); 288 int i=0; 289 for (auto it=pa.begin(); it != pa.end(); it++) 290 { 291 intervec[*it].push_back(hardwareMapping[i]); 292 i++; 293 } 294 for (i=0;i<160;i++) 295 { 278 279 for (auto it=fPixelMap.begin(); it!=fPixelMap.end(); it++) 280 { 281 hardwareMapping[it->index] = it->hw(); 282 softwareMapping[it->hw()] = it->index; 283 } 284 285 //now construct the correspondance between pixels and patches 286 for (int i=0;i<NTMARK;i++) 296 287 for (int j=0;j<9;j++) 297 { 298 patches[i][j] = intervec[i][j]; 299 } 300 } 301 302 //now construct the correspondance between pixels and patches 303 for (i=0;i<NTMARK;i++) 304 for (int j=0;j<9;j++) 305 pixelsPatch[softwareMapping[patches[i][j]]] = i; 306 307 for (i=0;i<1440;i++) 288 pixelsPatch[softwareMapping[i*9+j]] = i; 289 290 for (int i=0;i<1440;i++) 308 291 updateNeighbors(i); 309 292 310 293 buildPatchesIndices(); 294 311 295 } 312 296 void BasicGlCamera::setPatchColor(int id, float color[3]) … … 314 298 for (int i=0;i<9;i++) 315 299 for (int j=0;j<3;j++) 316 pixelsColor[softwareMapping[ patches[id][i]]][j] = color[j];300 pixelsColor[softwareMapping[id*9+i]][j] = color[j]; 317 301 } 318 302 void BasicGlCamera::setUnits(const string& units) … … 1121 1105 for (int j=0;j<9;j++)//for all cells of the current patch 1122 1106 { 1123 if (softwareMapping[ patches[i][j]] >= ACTUAL_NUM_PIXELS)1107 if (softwareMapping[i*9+j] >= ACTUAL_NUM_PIXELS) 1124 1108 continue; 1125 1109 for (int k=0;k<6;k++)//for all sides of the current cell … … 1132 1116 for (it=(patchesIndices[i]).begin(); it != (patchesIndices[i]).end(); it++)//check if this side is here already or not 1133 1117 { 1134 if (((*it).first == verticesIndices[softwareMapping[patches[i][j]]][first] && 1135 (*it).second == verticesIndices[softwareMapping[patches[i][j]]][second]) || 1136 ((*it).first == verticesIndices[softwareMapping[patches[i][j]]][second] && 1137 (*it).second == verticesIndices[softwareMapping[patches[i][j]]][first])) 1118 const int idx = i*9+j; 1119 1120 if ((it->first == verticesIndices[softwareMapping[idx]][first] && 1121 it->second == verticesIndices[softwareMapping[idx]][second]) || 1122 (it->first == verticesIndices[softwareMapping[idx]][second] && 1123 it->second == verticesIndices[softwareMapping[idx]][first])) 1138 1124 { 1139 1125 patchesIndices[i].erase(it); … … 1145 1131 { 1146 1132 edge temp; 1147 temp.first = verticesIndices[softwareMapping[ patches[i][j]]][first];1148 temp.second = verticesIndices[softwareMapping[ patches[i][j]]][second];1133 temp.first = verticesIndices[softwareMapping[i*9+j]][first]; 1134 temp.second = verticesIndices[softwareMapping[i*9+j]][second]; 1149 1135 patchesIndices[i].push_back(temp); 1150 1136 } -
trunk/FACT++/gui/BasicGlCamera.h
r12071 r12180 84 84 void updateCamera(); 85 85 void assignPixelMap(const PixelMap& ); 86 void assignTriggerPatchesMap(const std::vector<int>& );87 86 88 87 float ss[5];// = {0.00, 0.25, 0.5, 0.75, 1.00}; … … 140 139 static int pixelsPatch[NPIX]; 141 140 static int softwareMapping[NPIX]; 142 static int patches[160][9];143 141 float shownSizex; 144 142 float shownSizey; -
trunk/FACT++/gui/FactGui.h
r12179 r12180 379 379 //vector<int> fPixelMapHW; // Software -> Hardware 380 380 vector<int> fPatchMapHW; // Software -> Hardware 381 vector<int> fPatchHW; // Maps the software(!) pixel id to the hardware(!) patch id382 381 383 382 bool fInChoosePatchTH; // FIXME. Find a better solution … … 2000 1999 for (int i=0; i<1440; i++) 2001 2000 { 2002 const int ihw = fPatchHW[i]; 2003 // const int isw = fPatch[i]; 2004 // const int ihw = fPatchMapHW[isw]; 2001 const int ihw = fPixelMap.index(i).hw()/9; 2005 2002 dat[i] = sdata.fPatchRate[ihw]; 2006 2003 … … 3444 3441 int ii = 0; 3445 3442 for (; ii<160; ii++) 3446 if (fP atchHW[isw]==fPatchMapHW[ii])3443 if (fPixelMap.index(isw).hw()/9==fPatchMapHW[ii]) 3447 3444 break; 3448 3445 … … 3689 3686 FactGui(Configuration &conf) : 3690 3687 fFtuStatus(40), 3691 /*fPixelMapHW(1440),*/ fPatchMapHW(160), fPatchHW(1440),3688 /*fPixelMapHW(1440),*/ fPatchMapHW(160), 3692 3689 fInChoosePatchTH(false), 3693 3690 fInChooseBiasHv(false), fInChooseBiasCam(false), … … 3805 3802 // -------------------------------------------------------------------------- 3806 3803 3804 /* 3807 3805 ifstream fin1("Trigger-Patches.txt"); 3808 3806 … … 3832 3830 if (l!=160) 3833 3831 cerr << "WARNING - Problems reading Trigger-Patches.txt" << endl; 3834 3832 */ 3835 3833 // -------------------------------------------------------------------------- 3836 3834 … … 3869 3867 ifstream fin3("PatchList.txt"); 3870 3868 3871 l = 0; 3872 3869 string buf; 3870 3871 int l = 0; 3873 3872 while (getline(fin3, buf, '\n')) 3874 3873 { … … 4028 4027 // -------------------------------------------------------------------------- 4029 4028 fFeedbackDevCam->assignPixelMap(fPixelMap); 4030 fFeedbackDevCam->assignTriggerPatchesMap(fPatchHW);4031 4029 fFeedbackDevCam->setAutoscaleLowerLimit((fFeedbackDevMin->minimum()+0.5*fFeedbackDevMin->singleStep())); 4032 4030 fFeedbackDevCam->SetMin(fFeedbackDevMin->value()); … … 4035 4033 4036 4034 fFeedbackCmdCam->assignPixelMap(fPixelMap); 4037 fFeedbackCmdCam->assignTriggerPatchesMap(fPatchHW);4038 4035 fFeedbackCmdCam->setAutoscaleLowerLimit((fFeedbackCmdMin->minimum()+0.5*fFeedbackCmdMin->singleStep())); 4039 4036 fFeedbackCmdCam->SetMin(fFeedbackCmdMin->value()); … … 4044 4041 4045 4042 fBiasCamV->assignPixelMap(fPixelMap); 4046 fBiasCamV->assignTriggerPatchesMap(fPatchHW);4047 4043 fBiasCamV->setAutoscaleLowerLimit((fBiasVoltMin->minimum()+0.5*fBiasVoltMin->singleStep())); 4048 4044 fBiasCamV->SetMin(fBiasVoltMin->value()); … … 4059 4055 4060 4056 fRatesCanv->assignPixelMap(fPixelMap); 4061 fRatesCanv->assignTriggerPatchesMap(fPatchHW);4062 4057 fRatesCanv->setAutoscaleLowerLimit((fRatesMin->minimum()+0.5*fRatesMin->singleStep())*0.001); 4063 4058 fRatesCanv->SetMin(fRatesMin->value()); -
trunk/FACT++/gui/QCameraWidget.cc
r12133 r12180 422 422 for (int i=0;i<9;i++) 423 423 for (int j=0;j<3;j++) 424 averagePatchColour[j] += pixelsColor[softwareMapping[ patches[fWhitePatch][i]]][j];424 averagePatchColour[j] += pixelsColor[softwareMapping[fWhitePatch*9+i]][j]; 425 425 for (int j=0;j<3;j++) 426 426 averagePatchColour[j] /= 9;
Note:
See TracChangeset
for help on using the changeset viewer.