FACT++  1.0
void RawDataViewer::ApplyCalibration ( )

Definition at line 847 of file RawEventsViewer.cc.

References DrsCalibration::Apply(), PixelMapEntry::board(), PixelMapEntry::crate(), eventData, fDrsCalib, fIsDrsCalibration, BasicGlCamera::fPixelMap, DrsCalibrate::GetPixelStats(), PixelMapEntry::hw(), i, PixelMap::index(), Maxvalues, Meanvalues, nRoi, nRoiTM, PixelMapEntry::patch(), PixelMapEntry::pixel(), PosOfMaxvalues, rawEventData, DrsCalibrate::RemoveSpikes(), RMSvalues, and startPix.

Referenced by eventStepping().

848 {
849  for (int i=0;i<1440*nRoi + 160*nRoiTM;i++)//(1440+160)*nRoi;i++)
850  eventData[i] = (float)rawEventData[i];
851 
852  if (fIsDrsCalibration)
853  {
856  //TODO apply calibration to the Time markers
857  }
858 
859  //hide the time markers
860  int nSlicesToRemove = 60;
861  float* backupData = 0;
862  if (nRoiTM == 0) //they are written into the regular channel
863  {
864  backupData = new float[nSlicesToRemove*160];
865  for (int i=0;i<1440;i++)
866  {
867  const PixelMapEntry& mapEntry = fPixelMap.index(i);
868  const int pixelIdInPatch = mapEntry.pixel();
869  const int patchId = mapEntry.patch();
870  const int boardId = mapEntry.board();
871  const int crateId = mapEntry.crate();
872 
873  const int hw = mapEntry.hw();
874  if (pixelIdInPatch == 8)
875  {
876  for (int j=0;j<nSlicesToRemove;j++)
877  {
878  backupData[(40*crateId + 4*boardId + patchId)*nSlicesToRemove+j] = eventData[(hw*nRoi) + (nRoi-nSlicesToRemove) + j];
879  eventData[(hw*nRoi) + (nRoi-nSlicesToRemove) + j] = eventData[hw*nRoi + (nRoi-nSlicesToRemove) - 1];
880  }
881  }
882  }
883  }
884 
885  vector<float> pixelStatsData(1440*4);
886  DrsCalibrate::GetPixelStats(pixelStatsData.data(), eventData, nRoi);
887 
888  for (vector<PixelMapEntry>::const_iterator it=fPixelMap.begin(); it!=fPixelMap.end(); it++)
889  {
890  Meanvalues[it->index] = pixelStatsData[0*1440+it->hw()];
891  RMSvalues[it->index] = pixelStatsData[1*1440+it->hw()];
892  Maxvalues[it->index] = pixelStatsData[2*1440+it->hw()];
893  PosOfMaxvalues[it->index] = pixelStatsData[3*1440+it->hw()];
894  }
895  if (nRoiTM == 0)//move back the data back in place
896  {
897  for (int i=0;i<1440;i++)
898  {
899  const PixelMapEntry& mapEntry = fPixelMap.index(i);
900  const int pixelIdInPatch = mapEntry.pixel();
901  const int patchId = mapEntry.patch();
902  const int boardId = mapEntry.board();
903  const int crateId = mapEntry.crate();
904  if (patchId > 160)
905  cout << "Voila mon probleme: " << patchId << endl;
906  const int hw = mapEntry.hw();
907  if (pixelIdInPatch == 8)
908  {
909  // cout << "|" << crateId << " " << boardId << " " << patchId << " " << hw << "| ";
910  for (int j=0;j<nSlicesToRemove;j++)
911  {
912  eventData[(hw*nRoi) + (nRoi - nSlicesToRemove) + j] = backupData[(40*crateId + 4*boardId + patchId)*nSlicesToRemove+j];
913  }
914  }
915  }
916  delete[] backupData;
917  }
918  if (isVisible())
919  updateGL();
920 }
int16_t * rawEventData
int crate() const
Bias supply channel.
Definition: PixelMap.h:35
valarray< double > RMSvalues
int patch() const
Definition: PixelMap.h:37
valarray< double > Maxvalues
valarray< double > PosOfMaxvalues
int i
Definition: db_dim_client.c:21
bool Apply(float *vec, const int16_t *val, const int16_t *start, uint32_t roi)
Definition: DrsCalib.h:1608
static void RemoveSpikes(float *p, uint32_t roi)
Definition: DrsCalib.h:567
int pixel() const
Definition: PixelMap.h:38
int board() const
Definition: PixelMap.h:36
DrsCalibration fDrsCalib
const PixelMapEntry & index(int idx) const
Definition: PixelMap.h:107
int16_t startPix[NPIX]
static PixelMap fPixelMap
Definition: BasicGlCamera.h:60
valarray< double > Meanvalues
static double GetPixelStats(float *ptr, const float *data, uint16_t roi, uint16_t begskip=0, uint16_t endskip=0)
Definition: DrsCalib.h:855
int hw() const
Definition: PixelMap.h:39

+ Here is the call graph for this function:

+ Here is the caller graph for this function: