Changeset 60
Legend:
- Unmodified
- Added
- Removed
-
tools/ddd/Functions.cpp
r59 r60 110 110 Zoomer->setZoomBase(Signal->boundingRect()); 111 111 112 double z[6][6]; 113 114 for(unsigned int i=0; i<RD->RHeader->NBoards; i++){ 115 for(unsigned int j=0; j<RD->RHeader->NChips; j++){ 116 for(unsigned int k=0; k<RD->RHeader->NChannels; k++) { 117 118 //only interested in M0 data 119 if( ( (i==0 || i==1) && (j<=1) && (k<=7) ) || ( (i==2) && (j==0) && (k<=3) ) ) { 120 121 std::string pixelname = PixMap->DRS_to_Pixel(i,j,k); 122 char pixelname_copy[256]; 123 memset(pixelname_copy,'\0',256); 124 pixelname.copy(pixelname_copy, 256); 125 126 //printf("\nboard %d, chip %d, channel %d, pixel %s:\t", i,j,k,pixelname_copy); 127 128 char delim[] = "-"; 129 char *buffer = NULL; 130 int module = -1; 131 int superpixel = -1; 132 int pixel = -1; 133 134 //buffer = strtok(const_cast<char*>(pixelname.c_str()), delim); 135 buffer = strtok(pixelname_copy, delim); 136 module = atoi(buffer); 137 buffer = strtok(NULL, delim); 138 superpixel = atoi(buffer); 139 buffer = strtok(NULL, delim); 140 pixel = atoi(buffer); 141 142 //printf("%d,%d,%d:\t", module, superpixel, pixel); 143 //printf("%d:\t", (int((superpixel-1)/3)*2)); 144 //printf("%d:\t", int((pixel%4)+1) ); 145 //printf("%d:\t", int((pixel%4)/2) ); 146 //printf("%d:\t", (superpixel-1)%3 ); 147 148 int binx = 5-(int((superpixel-1)/3)*2)-(int((pixel%4)/2)); 149 int biny = 5-(((superpixel-1)%3)*2)-(int((pixel-1)/2)); 150 151 //printf("%d, %d:\t",binx,biny); 152 153 int StartBin = 100; 154 int StopBin = 120; 155 156 for(int l=StartBin; l<(StopBin+1); l++){ 157 158 float sample = RD->Data[i*RD->RHeader->NChips*RD->RHeader->NChannels*RD->RHeader->Samples+ 159 j*RD->RHeader->NChannels*RD->RHeader->Samples+ 160 k*RD->RHeader->Samples+ 161 l]*RD->BStruct[i].ScaleFactor; 162 163 //printf("%.1f ",sample); 164 165 if (sample > z[binx][biny]) { 166 z[binx][biny]=sample; 167 } 168 169 }//sample loop 112 //Get data for M0 display (event based) 113 114 double z[6][6];//36 pixels 115 116 for(unsigned int i=0; i<RD->RHeader->NBoards; i++) {//board loop 117 for(unsigned int j=0; j<RD->RHeader->NChips; j++) {//chip loop 118 for(unsigned int k=0; k<RD->RHeader->NChannels; k++) {//channel loop 119 120 //only interested in M0 data 121 if( ( (i==0 || i==1) && (j<=1) && (k<=7) ) || ( (i==2) && (j==0) && (k<=3) ) ) { 122 123 //get module, superpixel and pixel number from pixel name 124 125 std::string pixelname = PixMap->DRS_to_Pixel(i,j,k); 126 char pixelname_copy[256]; 127 memset(pixelname_copy,'\0',256); 128 pixelname.copy(pixelname_copy, 256); 129 130 char delim[] = "-"; 131 char *buffer = NULL; 132 int module = -1; 133 int superpixel = -1; 134 int pixel = -1; 135 136 buffer = strtok(pixelname_copy, delim); 137 module = atoi(buffer); 138 buffer = strtok(NULL, delim); 139 superpixel = atoi(buffer); 140 buffer = strtok(NULL, delim); 141 pixel = atoi(buffer); 142 143 int binx = 5-(int((superpixel-1)/3)*2)-(int((pixel%4)/2)); 144 int biny = 5-(((superpixel-1)%3)*2)-(int((pixel-1)/2)); 145 146 //search maximum sample amplitude within following window -> should not be hardcoded! 147 int StartBin = 100; 148 int StopBin = 120; 149 150 for(int l=StartBin; l<(StopBin+1); l++){ 151 152 float sample = RD->Data[i*RD->RHeader->NChips*RD->RHeader->NChannels*RD->RHeader->Samples+ 153 j*RD->RHeader->NChannels*RD->RHeader->Samples+ 154 k*RD->RHeader->Samples+ 155 l]*RD->BStruct[i].ScaleFactor; 156 157 if (sample > z[binx][biny]) { 158 z[binx][biny]=sample; 159 } 160 161 }//sample loop 162 163 }//only M0 data 164 165 }//channel loop 166 }//chip loop 167 }//board loop 170 168 171 }//only M0 data 172 173 }//channel loop 174 }//chip loop 175 }//board loop 176 177 /* 178 for (int i=0; i<6; i++){ 179 for (int j=0; j<6; j++){ 180 z[i][j]=i; 181 } 182 } 183 */ 184 169 //fill data to M0 display (event based) 185 170 Signal2D->setData(SpectrogramDataM0(z)); 186 171 Graph2D->axisWidget(QwtPlot::yRight)->setColorMap(Signal2D->data().range(),Signal2D->colorMap()); -
tools/ddd/GUI.cpp
r59 r60 230 230 Signal2D->attach(Graph2D); 231 231 232 //initialize raster 232 //initialize raster data of M0 display 233 233 double z[6][6]; 234 234 for (int i=0; i<6; i++){ … … 239 239 Signal2D->setData(SpectrogramDataM0(z)); 240 240 241 //color (z-) axis of M0 display 241 242 colorMap = QwtLinearColorMap(Qt::yellow, Qt::red); 242 243 Signal2D->setColorMap(colorMap); 243 244 244 //Graph2D->axisWidget(QwtPlot::yRight)->setTitle("Yo!");245 Graph2D->axisWidget(QwtPlot::yRight)->setTitle("Maximum Sample Amplitude (mV)"); 245 246 Graph2D->axisWidget(QwtPlot::yRight)->setColorBarEnabled(true); 246 247 Graph2D->axisWidget(QwtPlot::yRight)->setColorMap(Signal2D->data().range(),Signal2D->colorMap()); -
tools/ddd/GUI.h
r59 r60 79 79 }; 80 80 81 // class for 2D spectrogram data81 //Data class for 2D spectrogram (MO display specific) 82 82 class SpectrogramDataM0: public QwtRasterData { 83 83
Note:
See TracChangeset
for help on using the changeset viewer.