Changeset 10642


Ignore:
Timestamp:
May 10, 2011, 1:11:19 PM (9 years ago)
Author:
ogrimm
Message:
FADctrl publishes amplitude calibration information as DIM service
Location:
fact
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • fact/FADctrl/FAD.cc

    r10617 r10642  
    653653        }
    654654       
    655         PrintMessage("\nLast trigger: ID %d    Type %d   CRC %d     Run number %d\n", S.TriggerID, S.TriggerType, S.TriggerCRC, S.Runnumber);
     655        PrintMessage("\nTrigger ID: Num %d    Type %d   CRC %d     Run number %d\n", S.TriggerNum, S.TriggerType, S.TriggerCRC, S.Runnumber);
    656656  } // for()
    657657}
     
    786786  // Open calibration data file
    787787  string Filename = string(getenv("HOME"))+"/FAD_ACal";
    788   FILE *File = fopen(Filename.c_str(), "ab");
     788  FILE *File = fopen(Filename.c_str(), "wb");
    789789
    790790  if (File == NULL) {
     
    806806  if (fclose(File) != 0) PrintMessage("Could not close calibration file '%s'\n", Filename.c_str());
    807807 
    808   PrintMessage("Appended amplitude calibration to file '%s'\n", Filename.c_str());
     808  PrintMessage("Wrote amplitude calibration to file '%s'\n", Filename.c_str());
    809809}
    810810
     
    952952
    953953          // Update event header with ID and Type of current board
    954           EHeader->EventNumber = S.TriggerID;
     954          EHeader->EventNumber = S.TriggerNum;
    955955          EHeader->TriggerType = S.TriggerType;
    956956
    957957          // Register event number for data writing below
    958           EventNumbers[Brd] = S.TriggerID;
     958          EventNumbers[Brd] = S.TriggerNum;
    959959
    960960          // Write trigger cells
  • fact/FADctrl/FADBoard.cc

    r10504 r10642  
    5454  DIM_Rate = new DimService((ID.str()+"RateHz").c_str(), Status.Rate);
    5555  DIM_Frequency = new DimService((ID.str()+"Frequency").c_str(), Status.Frequency);
     56  DIM_TriggerNum = new DimService((ID.str()+"TriggerNum").c_str(), (char *) "I", &Status.TriggerNum, sizeof(Status.TriggerNum));
    5657  DIM_Temp = new DimService((ID.str()+"Temperature").c_str(), (char *) "F", NULL, 0);
    5758  DIM_DAC = new DimService((ID.str()+"DAC").c_str(), (char *) "S", NULL, 0);
    5859  DIM_ROI = new DimService((ID.str()+"ROI").c_str(), (char *) "S", NULL, 0);
     60  DIM_ACalData = new DimService((ID.str()+"ACalData").c_str(), (char *) "F", NULL, 0);
    5961
    6062  // Create thread that connects and receives data
     
    99101  delete DIM_Rate;
    100102  delete DIM_Frequency;
     103  delete DIM_TriggerNum;
    101104  delete DIM_Temp;
    102105  delete DIM_DAC;
    103   delete DIM_ROI; 
     106  delete DIM_ROI;
     107  delete DIM_ACalData; 
    104108  delete[] Name;
    105109}
     
    334338        Send(DACCmd, sizeof(DACCmd));
    335339       
     340        // Update DIM service with calibration information
     341        for (unsigned int i=0; i<NChips; i++) {
     342          for (unsigned int j=0; j<NChannels; j++) {
     343                for (unsigned int k=0; k<NBins; k++) {
     344                  ACalData[0][i][j][k] = ACalib.Baseline[i][j][k];
     345                  ACalData[1][i][j][k] = ACalib.Gain[i][j][k];
     346                  ACalData[2][i][j][k] = ACalib.Secondary[i][j][k];
     347                }
     348          }
     349        }
     350        DIM_ACalData->updateService(ACalData, 3*NChips*NChannels*NBins*sizeof(float));
     351
    336352        State = wait;
    337353        break;
     
    456472          Status.BoardTime = ntohl(Header->time);
    457473          Status.EventCounter = ntohl(Header->fad_evt_counter);
    458           Status.TriggerID = ntohl(Header->trigger_id);
     474          Status.TriggerNum = ntohl(Header->trigger_id);
    459475          Status.Runnumber = ntohl(Header->runnumber);
    460476          Status.TriggerType = ntohs(Header->trigger_type);
     
    521537
    522538                if (PrevStatus.Frequency != Status.Frequency) DIM_Frequency->updateService();
    523 
     539                if (PrevStatus.TriggerNum != Status.TriggerNum) DIM_TriggerNum->updateService();
    524540                if (PrevStatus.Rate != Status.Rate) DIM_Rate->updateService();
    525541               
  • fact/FADctrl/FADBoard.h

    r10504 r10642  
    2828        int Socket;
    2929        pthread_mutex_t Mutex;
    30         DimService *DIM_Name, *DIM_Status, *DIM_ID, *DIM_Frequency;
    31         DimService *DIM_Rate, *DIM_Temp, *DIM_ROI, *DIM_DAC;
     30        DimService *DIM_Name, *DIM_Status, *DIM_ID, *DIM_Frequency, *DIM_TriggerNum;
     31        DimService *DIM_Rate, *DIM_Temp, *DIM_ROI, *DIM_DAC, *DIM_ACalData;
    3232
    3333        void ReadLoop();
     
    5151          float Rate;
    5252
    53           uint32_t TriggerID;
     53          uint32_t TriggerNum;
    5454          uint32_t Runnumber;
    5555          uint16_t TriggerType;
     
    8585        } ACalib;
    8686
     87    float ACalData[3][NChips][NChannels][NBins]; // for DIM service
     88       
    8789        void Send(const void *, size_t);
    8890        void Send(unsigned short);
  • fact/tools/Edd/Edd.cc

    r10290 r10642  
    1212#include "Edd.h"
    1313
    14 QString DRSBoard = "drsdaq";
     14QString DRSBoard = "FADctrl";
    1515std::string PixelMapText;
    1616
     
    477477        }
    478478
    479         for (int j=0; j<8; j++) {
    480       Line = new EddLineDisplay(Board+"DAC", j);
    481           Line->setMinimumWidth(40);
    482       Button[i/20]->Layout()->addWidget(Line, i+7, 7+j, 1, 1);
    483         }
     479    Line = new EddLineDisplay(Board+"TriggerNum");
     480        Line->setMinimumWidth(40);
     481    Button[i/20]->Layout()->addWidget(Line, i+7, 7, 1, 1);
    484482
    485483        Line = new EddLineDisplay(Board+"RateHz");
     
    796794  TabWidget->setTabsClosable(true);
    797795  connect(TabWidget, SIGNAL(tabCloseRequested(int)), SLOT(DetachTab(int)));
    798   TabWidget->addTab(new TP_DAQ, "Event scope " + DRSBoard);
     796  TabWidget->addTab(new TP_DAQ, "Event scope");
    799797  TabWidget->addTab(new TP_FADctrl, "FADctrl");
    800798  TabWidget->addTab(new TP_Bias, "Bias");
     
    960958int main(int argc, char *argv[]) {
    961959
    962   if (argc > 1) DRSBoard = "FADctrl";
     960  if (argc>1 && strcmp(argv[1],"drsdaq")==0) DRSBoard = "drsdaq";
    963961
    964962  // Make RPC to get pixelmap
Note: See TracChangeset for help on using the changeset viewer.