SST tables proposal

GENERAL

1) StarDb/Calibrations

sstChipCorrect.idl  
sstGainCalibWafer.idl 
sstNoise.idl
sstPedStrip.idl  
sstStripCalib.idl
2) StarDb/Geometry
sstConfiguration.idl 
sstDimensions.idl      
sstSlsCtrl.idl  
sstWaferConfiguration.idl
sstWafersPosition.idl     sstClusterControl  

DETAILS

sstChipCorrect.idl : indexed table : 3840 elements
struct sstChipCorrect
{
  octet nLadder;             //0 to 19
  octet nWafer;              //0 to 15
  octet nChip;               //0 to 6 
  octet nSide;               //0,1
  unsigned short nCutPos;    //0 to 1024
  unsigned short nCorrect;   //0 to 1024
};
sstGainCalibWafer.idl : indexed table : 320 elements
struct sstGainCalibWafer { 
  long   nLadder ;
  long   nWafer;  // 1 to 320 
  double nGain ;  // 320 values N over P charge
};
sstNoise.idl : indexed table : 320 elements
struct sstNoise { 
  long id;
  octet rmsp[768]; /*array of noise for strips in a wafer p-side*/
  octet rmsn[768]; /*array of noise for strips in a wafer n-side*/
};
note : this table was a solution to store the rms of each strip (491520). So instead of quering 491520 elements, only 320 queries is done

sstPedStrip.idl : indexed : 491520 elements 
  struct sstPedStrip {
     long      id;          /* Strip Id in the table */
     long      id_strip;    /* Strip identifier  strip*/
     long      pedestal;    /* pedestal in ADC count */
     long      noise;       /* noise in ADC count*/
    };
sstStripCalib.idl : indexed : 491520 elements
struct sstStripCalib {
  long id;         /* 10000*(10*id_strip+id_side)+id_wafer */
  octet pedestals;  /* 0-255*/
  octet rms;        /* 0-255*/
};
sstConfiguration.idl : not indexed
struct sstConfiguration { 
  long nMaxSectors;         /* 4 */
  long nMaxLadders;         /* 20*/
  long nMaxWafers;          /* 320*/
  long ladderIsPresent[20]; /* 1 means present, 0 means no present*/
};  
sstDimensions.idl : not indexed
struct sstDimensions {
  long   wafersPerLadder;    /* 16         */
  long   a128PerSide;        /* 6          */
  long   stripPerSide;       /* 768        */
  double stripPitch;         /* 0.0095 cm  */
  double stereoAngle;        /* 0.0175 rad */
  double waferHalfLength;    /* 3.75 cm    */  
  double waferHalfWidth;     /* 2.1  cm    */
  double waferHalfThickness; /* 0.015 cm   */
  double waferHalfActLength; /* 3.65 cm    */
  double waferHalfActWidth;  /* 2. cm      */
 }; 
sstSlsCtrl.idl : not indexed
struct sstSlsCtrl { 
  long nElectronInAMip;          /*      22500 in electron unit */
  long adcDynamic;          /*         20 in mip unit */
  long a128Dynamic;          /*         12 in mip unit */
  long nbitEncoding;          /*         10 number of adc bit for encoding */
  long nstripInACluster;         /*          4 */
  long daqCutValue;          /*          3 */
  long rmsToNoise;                /*         16 */
  double pairCreationEnergy;  /*    3.6e-09 energy to create a e+e-pair(GeV) */
  double parDiffP;          /*    0.00123 */
  double parDiffN;          /*    0.00094 */
  double parIndRightP;           /*      0.021 */
  double parIndRightN;          /*      0.026 */
  double parIndLeftP;          /*      0.013 */
  double parIndLeftN;          /*       0.01 */
};
sstWaferConfiguration.idl : indexed : 320 elements
struct sstWaferConfiguration { 
  long   nLadder ;   // 0 to 19
  long   nWafer  ;   // 0 to 15 
  long   nStatus ;   // 320 values 
}; 
sstWafersPositions.idl : indexed : 320 elements 
struct sstWafersPosition { 
  long    id;                      /* Identifier: 7000+wafer(from 1 to 16)*100+ladder (from 1 to 20)*/
  long    id_shape;                /* Wafer shape id index   */
  long    ladder;                  /* Ladder number wafer is on  */
  long    layer;                   /* Layer number wafer is on.   */
  long    num_chip;                /* Chip number within ladder  */
  double  driftDirection[3];       /* Drift direction  */
  double  normalDirection[3];      /* Coordinates of unit vector normal to wafer */
  double  transverseDirection[3];  /* t=nxd, transverse to drift and normal direction    */
  double  centerPosition[3];       /* coordinates of the wafer center in the Star syst  */
 }; 
sstClusterControl.idl : not indexed
struct sstClusterControl { 
  double highCut;       /* 5.0 in sn unit*/
  double testTolerance; /* set to 20% */
  long   clusterTreat;  /* 13 */
  double adcTolerance;  /* set to 20% */
  double matchMean;     /* 0. */
  double matchSigma;    /* 8. */
};

ACTION ITEMS

Indexed tables are changed to 1-D array

sstGainCalibWafer.idl
/* sstGainCalibWafer.idl
 *
 * Table: sstGainCalibWafer
 *
 * description: gain per wafer
 *
 */
struct sstGainCalibWafer {
  float nGain[320]; /* ladder[0-19]*16 + wafer[0-15]*/
};
values saved are float ;
example nGain[16] = 1.01; means the gain for ladder 1, wafer 0 is 1.01. 


sstWaferConfiguration.idl
/*    sstWaferConfiguration.idl
*
*  Table: sstWaferConfiguration
*
*  description:  SST wafer status : 1 = wafer active, 0 = wafer inactive 
*/ 
struct sstWaferConfiguration { 
  octet nStatus[320];/* ladder[0-19]*16 + wafer[0-15]*/
};  
values saved are 0 or 1 ;
example nStatus[16] = 0; means the status for ladder 1, wafer 0 is 0, thus this wafer should not be used in the reconstruction (masking wafer) 


sstChipCorrect.idl
/*sstChipCorrect.idl 
* 
* Table: sstChipCorrect 
* 
* Description: sst chip correction factor.once per run 
chip coding is : side[0-1]*1920 + ladder[0-19]*96 + wafer[0-15]*6 + chip[0-5] 
*/  
struct sstChipCorrect
{ 
  unsigned short nCutPos[3840];  // 0 to 1024 
  unsigned short nCorrect[3840]; // 0 to 1024 
};

sstPedStrip.idl
/*   sstPedStrip_st.idl
 *   Module:
 *   Specific output of the pedestal/noise data for reconstruction software 
 *   Table of strips with noise and pedestal signals
 */
   struct sstPedStrip {
     short pedestal[491520];/* pedestal in ADC count */
     octet noise[491520];   /* noise in ADC count */
    };
comments
  1. previous indexed tables were coding the id of strip as :  id_strip=10000*(10*strip_number+id_side)+id_wafer , with 1≤strip_number768
  2. with arrays of fixed size, this is not possible anymore. Coding as to be something like pedestal[id] = val; where 1≤strip_number≤491520
  3. it also means that some internal SST decoding will have to change
To code all strips : 20 [ladders] * 16 [wafers] * 768 * 2 = 491520, I propose the following
id = (491520)*side[0-1]/2 + ladder[0-19]*12288 + wafer[0-15]*768 + strip[0-767]
(Numbers in bracket indicate the range of the value)
With this coding, strips on P-side go from 0≤id≤245759 and strips on N-side go from 245760≤id491519

sstStripCalib.idl
/*  sstStripCalib.idl
*  Table: sstStripCalib
*
* description: sstStripCalib
* tables containing the pedestal, rms of each ssd strip.
*/ 
struct sstStripCalib {
  short pedestals[491520];  /* 0-1024*/
  octet rms[491520];        /* 0-255*/
};
 
sstNoise.idl
/*    sstNoise.idl
*
*  Table: sstNoise
*
*  description:  SST noise (new table)
*/ 
struct sstNoise { 
  octet rms[491520]; /*array of noise for strips*/
}; 

blah blah


DEFAULT ENTRY for the TABLES ALREADY IN CVS (StarDb/Geometry/sst)

I will test the SST code with these new tables before inserting them to DB

sstDimensions.C
TDataSet *CreateTable() { 
  if (!gROOT->GetClass("St_sstDimensions")) return 0;
  sstDimensions_st row;
  St_sstDimensions *tableSet = new St_sstDimensions("sstDimensions",1);
  memset(&row,0,tableSet->GetRowSize());
  row.stripPitch         = 0.0095;
  row.stereoAngle        = 0.0175;
  row.waferHalfLength    = 3.75;  
  row.waferHalfWidth     = 2.1;
  row.waferHalfThickness = 0.015;
  row.waferHalfActLength = 3.65;
  row.waferHalfActWidth  = 2.;
  row.wafersPerLadder    = 16;
  row.a128PerSide        = 6;
  row.stripPerSide       = 768;
  tableSet->AddAt(&row,0);
  // ----------------- end of code ---------------
  return (TDataSet *)tableSet;
}

sstConfiguration.C
TDataSet *CreateTable() { 
  if (!gROOT->GetClass("St_sstConfiguration")) return 0;
  sstConfiguration_st row;
  St_sstConfiguration *tableSet = new St_sstConfiguration("sstConfiguration",1);
  memset(&row,0,tableSet->GetRowSize());
  row.nMaxSectors = 4;
  row.nMaxLadders = 20;
  row.nMaxWafers  = 320;
  row.ladderIsPresent[0]=1;
  row.ladderIsPresent[1]=1;
  row.ladderIsPresent[2]=1;
  row.ladderIsPresent[3]=1;
  row.ladderIsPresent[4]=1;
  row.ladderIsPresent[5]=1;
  row.ladderIsPresent[6]=1;
  row.ladderIsPresent[7]=1;
  row.ladderIsPresent[8]=1;
  row.ladderIsPresent[9]=1;
  row.ladderIsPresent[10]=1;
  row.ladderIsPresent[11]=1;
  row.ladderIsPresent[12]=1;
  row.ladderIsPresent[13]=1;
  row.ladderIsPresent[14]=1;
  row.ladderIsPresent[15]=1;
  row.ladderIsPresent[16]=1;
  row.ladderIsPresent[17]=1;
  row.ladderIsPresent[18]=1;
  row.ladderIsPresent[19]=1;
  /* 
   should work too ?
   for(int kk=0;kk<20;++kk){
   row.ladderIsPresent[kk] =1;}
  */
  tableSet->AddAt(&row,0);
  // ----------------- end of code ---------------
  return (TDataSet *)tableSet;
}

sstSlsCtrl.C
TDataSet *CreateTable() { 
  if (!gROOT->GetClass("St_sstSlsCtrl")) return 0;
  sstSlsCtrl_st row;
  St_sstSlsCtrl *tableSet = new St_sstSlsCtrl("sstSlsCtrl",1);
  memset(&row,0,tableSet->GetRowSize());
  row.pairCreationEnergy = 3.6e-09;
  row.parDiffP           = 0.00123 ;
  row.parDiffN          = 0.00094 ;
  row.parIndRightP       = 0.021 ;
  row.parIndRightN       = 0.026 ;
  row.parIndLeftP        = 0.013 ;
  row.parIndLeftN        = 0.01 ;
  row.nElectronInAMip    = 22500;
  row.adcDynamic         = 20;
  row.a128Dynamic        = 12;
  row.nbitEncoding       = 10;
  row.nstripInACluster   = 4 ;
  row.daqCutValue        = 3 ;
  row.rmsToNoise         = 16 ;
  tableSet->AddAt(&row,0);
  // ----------------- end of code ---------------
  return (TDataSet *)tableSet;
}

sstClusterControl.C

TDataSet *CreateTable() { 
  if (!gROOT->GetClass("St_sstClusterControl")) return 0;
  sstClusterControl_st row;
  St_sstClusterControl *tableSet = new St_sstClusterControl("sstClusterControl",1);
  memset(&row,0,tableSet->GetRowSize());
  row.highCut       = 5.0 ;
  row.testTolerance = 0.02;
  row.adcTolerance  = 0.02;
  row.matchMean     = 0. ;
  row.matchSigma    = 8. 
  row.clusterTreat  = 13 ;
  tableSet->AddAt(&row,0);
  // ----------------- end of code ---------------
  return (TDataSet *)tableSet;
}

Action Items  -part 2-

sstWafersPosition.idl
/*    sstWafersPosition.idl
*
*  Table: sstWafersPosition
*  description: SST Wafers position

*  For example, coding is :
*    driftDirection[0] = d[0] for wafer 0
*    driftDirection[1] = d[1] for wafer 0
*    driftDirection[2] = d[2] for wafer 0

*    driftDirection[3] = d[0] for wafer 1
*    driftDirection[4] = d[1] for wafer 1
*    driftDirection[5] = d[2] for wafer 1

*  wafer coding is ladder[0-19]*16 + wafer[0-15]  
*
*/ 

struct sstWafersPosition { 
  double  driftDirection[3*320];       /* Drift direction  */
  double  normalDirection[3*320];      /* Coordinates of unit vector normal to wafer */
  double  transverseDirection[3*320];  /* t=nxd, transverse to drift and normal direction    */
  double  centerPosition[3*320];       /* coordinates of the wafer center in the Star syst  */ 

};  
comparison/check in StSstDbMaker between the 2 methods

Merging of sstPedStrip.idl and ssdStripCalib.idl

sstStripCalib.idl
/*  sstStripCalib.idl
*
*  Table: sstStripCalib
* description: sstStripCalib
* tables containing the pedestal, rms of each ssd strip.
* mode is "0" for reading pedestal&rms and "1" for writing pedestal and rms to root file 
*
*/ 
struct sstStripCalib {
  octet mode;
  short pedestals[491520];  /* 0-1024*/
  octet rms[491520];        /* 0-255*/
};

DECISION AFTER SST WORKSHOP

sstStripCalib
/*  sstStripCalib.idl
*
*  Table: sstStripCalib
* description: sstStripCalib
* tables containing the pedestal, rms of each ssd strip.
* mode is "0" for reading pedestal&rms and "1" for writing pedestal and rms to root file 
*
*/ 
struct sstStripCalib {
  short pedestals[491520];  /* 0-1024*/
  octet rms[491520];        /* 0-255*/
};

sstMaskChip.idl
/* sstMaskChip.idl 
 * 
 * Table: sstMaskChip 
 * 
 * description:  chip masking table ; id of chip is stored 
 * 
 */ 
struct sstMaskChip{ 
  unsigned short chip[3840]; /* side*2000 + ladder[0-19]*96 wafer[0-15]*6 + chip[1-6]*/ 
}; 



blah blah