9 #include "CalibratedHk.h" 21 float calSlopeAnita3[3][40]=
23 {1,1,100,1,1,1,1,1,1,1,1,100,1,1,1,100,100,100,100,100,1,1,1,1,100,1,1,1,100,1,1,1,1,1,1,100,100,100,100,100},
24 {2,1,2,-3.0075,4.02,2,2,1,1,1,
25 1,1,1,8,8,30,30,20,1,1,
26 0.8,8,-2,0.8,60,20,0.8,1,1,1,
27 1,1,1,4.02,2,2,10.1,19.25,100,400},
28 {100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100}
31 float calInterceptAnita3[3][40]=
33 {0,0,-273.15,0,0,0,0,0,0,0,0,-273.15,0,0,0,-273.15,-273.15,-273.15,-273.15,-273.15,0,0,0,0,-273.15,0,0,0,-273.15,0,0,0,0,0,0,-273.15,-273.15,-273.15,-273.15,-273.15},
34 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-273.15,0},
35 {-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15}
38 int calSchemeAnita3[3][40]=
40 {0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1},
41 {1,1,1,1,1,1,1,2,3,2,4,5,0,1,1,1,1,1,0,0,1,1,1,1,1,1,1,6,7,8,9,10,0,1,1,0,1,1,1,1},
42 {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
46 float calSlope[3][40]=
48 {1,1,100,1,1,1,1,1,1,1,1,100,1,1,1,100,100,100,100,100,1,1,1,1,100,1,1,1,100,1,1,1,1,1,1,100,100,100,100,100},
49 {2,1,2,-3.0075,4.02,2,2,1,1,1,
50 1,1,1,8,8,30,30,20,1,1,
51 0.8,8,-2,0.8,60,20,0.8,1,1,1,
52 1,1,1,2,3,2,10.1,19.25,100,400},
53 {100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100}
56 float calIntercept[3][40]=
58 {0,0,-273.15,0,0,0,0,0,0,0,0,-273.15,0,0,0,-273.15,-273.15,-273.15,-273.15,-273.15,0,0,0,0,-273.15,0,0,0,-273.15,0,0,0,0,0,0,-273.15,-273.15,-273.15,-273.15,-273.15},
59 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-273.15,0},
60 {-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15,-273.15}
65 {0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1},
66 {1,1,1,1,1,1,1,2,3,2,4,5,0,1,1,1,1,1,0,0,1,1,1,1,1,1,1,6,7,8,9,10,0,1,1,0,1,1,1,1},
67 {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
80 int ssXInds[4][2]={{20,0},{3,22},{7,26},{29,9}};
81 int ssYInds[4][2]={{21,1},{4,23},{8,27},{30,10}};
82 int ssTemp[4]={2,24,28,11};
87 float ssOffset[4][2]={{0.08,-0.1572},{-0.32940,-0.17477},
88 {0.05541,-0.08458},{-0.23773,-0.50356}};
89 float ssGain[4][2]={{5.0288,5.0},{4.8515,5.0},{5.0599,5.0},{5.0288,5.0}};
90 float ssSep[4]={3.704391,3.618574,3.512025,3.554451};
91 float ssAzRel[4]={45,-45,-135,+135};
92 float ssGammaFactor[4]={0.4,0.2,0.3,0.5};
93 const float globalGamma=67;
114 this->gHdr_verId=hkPtr->gHdr_verId;
139 for(
int board=0;board<3;board++) {
140 for(
int chan=0;chan<40;chan++) {
147 float slope=4.9/(cal-avz);
148 float intercept=-1*slope*avz;
157 for(
int board=0;board<3;board++) {
158 for(
int chan=0;chan<40;chan++) {
159 switch(calScheme[board][chan]) {
166 useful[board][chan]=(calSlope[board][chan]*
voltage[board][chan])+
167 calIntercept[board][chan];
171 useful[board][chan]=44.4*((
voltage[board][chan]*(5./vs)-1.375));
175 useful[board][chan]=(1./0.844)*((
voltage[board][chan]*(5./vs)-2.523));
179 useful[board][chan]=(1./0.839)*((
voltage[board][chan]*(5./vs)-2.512));
185 useful[board][chan]*=68.046e-3;
189 useful[board][chan]=(1./0.843)*((
voltage[board][chan]*(5./vs)-2.523));
193 useful[board][chan]=(1./0.827)*((
voltage[board][chan]*(5./vs)-2.523));
197 useful[board][chan]=(1./0.842)*((
voltage[board][chan]*(5./vs)-2.506));
201 useful[board][chan]=(1./0.830)*((
voltage[board][chan]*(5./vs)-2.493));
206 useful[board][chan]*=1.3158e-3;
221 int internalTempChans[NUM_INT_TEMPS]={80,100,81,101,82,102,83,103,84,104,85,105,86,106,87};
224 if(index>=0 && index<NUM_INT_TEMPS)
225 return useful[internalTempChans[index]/40][internalTempChans[index]%40];
231 int externalTempChans[NUM_EXT_TEMPS]={112,93,113,94,114,95,115,96,116,97,117,98,118,99,119};
233 if(index>=0 && index<NUM_EXT_TEMPS)
234 return useful[externalTempChans[index]/40][externalTempChans[index]%40];
240 Int_t sbsMagicAdd[NUM_SBS_TEMPS]={0,0,0};
241 if(index>=0 && index<NUM_SBS_TEMPS)
242 return (0.1*
sbsTemp[index]) + sbsMagicAdd[index];
249 if(index==0)
return (0.01*
ntuTemp[index]);
250 if(index==1)
return ntuTemp[1];
251 if(index==2)
return ntuTemp[2];
259 const char *voltageNames[NUM_VOLTAGES]={
"12V GPS",
"5.3V IP",
"+12_PCI",
"+24",
"PV",
"+5_PCI",
"+5M",
"+3.3_PCI",
"+1.5",
"-12_PCI",
"-5"};
260 if(index>=0 && index<NUM_VOLTAGES)
261 return voltageNames[index];
267 int powerVoltChans[NUM_VOLTAGES]={74,73,44,76,77,46,42,45,41,43,62};
268 if(index>=0 && index<NUM_VOLTAGES) {
269 return useful[powerVoltChans[index]/40][powerVoltChans[index]%40];
275 int powerAmpChans[NUM_CURRENTS]={56,57,61,64,63,65,55};
276 if(index>=0 && index<NUM_CURRENTS) {
277 return useful[powerAmpChans[index]/40][powerAmpChans[index]%40];
285 const char *currentNames[NUM_CURRENTS]={
"+24",
"PV",
"+5_M",
"+3.3_PCI",
"+12_PCI",
"+5_PCI",
"Batt"};
286 if(index>=0 && index<NUM_CURRENTS)
287 return currentNames[index];
297 case 0:
return "SS-1";
298 case 1:
return "SS-3";
299 case 2:
return "SS-5";
300 case 3:
return "SS-7";
309 const char *powerNames[NUM_POWERS]={
"+24",
"PV",
"+5M",
"Batt",
"Crate"};
310 if(index>=0 && index<NUM_POWERS)
311 return powerNames[index];
316 int powerWattChans[NUM_POWERS-1][2]={{76,56},{77,57},{42,61},{76,55}};
317 if(index>=0 && index<NUM_POWERS-1) {
318 float volts=
useful[powerWattChans[index][0]/40][powerWattChans[index][0]%40];
319 float amps=
useful[powerWattChans[index][1]/40][powerWattChans[index][1]%40];
322 else if(index==NUM_POWERS-1){
323 int crateWattChans[3][2]={{45,64},{46,63},{44,65}};
325 for(
int i=0;i<3;i++) {
326 float volts=
useful[crateWattChans[i][0]/40][crateWattChans[i][0]%40];
327 float amps=
useful[crateWattChans[i][1]/40][crateWattChans[i][1]%40];
336 int attitudeChans[10]={70,50,69,49,68,48,67,47,51,71};
337 if(index>=0 && index<10) {
338 return useful[attitudeChans[index]/40][attitudeChans[index]%40];
351 const char *attChanNames[NUM_ATTITUDE]={
"Ac1-X",
"Ac1-Y",
"Ac1-Z",
"Ac1-T",
"Ac2-X",
"Ac2-Y",
"Ac2-Z",
"Ac2-T",
"Pres",
"Pres",
"Mag-X",
"Mag-Y",
"Mag-Z"};
352 if(index>=0 && index<NUM_ATTITUDE)
353 return attChanNames[index];
365 const char *extTempNames[NUM_EXT_TEMPS]={
"Radiator Plate",
"Lid Center",
"Battery Box (Aft Starboard)",
"AMPA 01TH",
"AMPA 05TH",
"AMPA 09TH",
"AMPA 13TH",
"AMPA 01MH",
"AMPA 05MH",
"AMPA 09MH",
"AMPA 13MH",
"PV1",
"PV3",
"PV5",
"PV7"};
366 if(index>=0 && index<NUM_EXT_TEMPS)
367 return extTempNames[index];
378 const char *intTempNames[NUM_INT_TEMPS]={
"Lid near SHORT 20 PHI 09",
"Radiator plate above DC-DC Box",
"IRFCM 0",
"Bottom side of CPU crate",
"NTU SSD array Box top",
"DC-DC Box middle",
"Top of IP Box",
"Lid near SHORT 01 PHI 16",
"Top of CPCI crate CPU side",
"Top Front edge of CPCI crate near SURF8",
"IRFCM 3",
"Cover plate near TURFIO",
"Back of He Drive mounting plate (Drive 2)",
"Back of He Drive mounting plate (Drive 1)",
"Radiator plate below DC-DC Box"};
380 if(index>=0 && index<NUM_INT_TEMPS)
381 return intTempNames[index];
387 const char *sbsTempNames[NUM_SBS_TEMPS]={
"CPU",
"Core1",
"Core2"};
388 if(index>=0 && index<NUM_SBS_TEMPS)
389 return sbsTempNames[index];
396 const char *ntuTempNames[NUM_NTU_TEMPS]={
"CPU",
"Disk0",
"Disk1"};
397 if(index>=0 && index<NUM_NTU_TEMPS)
398 return ntuTempNames[index];
406 if(ssInd<0 || ssInd>4)
return;
409 TMath::Abs(this->
useful[0][ssXInds[ssInd][0]])+
410 TMath::Abs(this->
useful[0][ssXInds[ssInd][1]])+
411 TMath::Abs(this->
useful[0][ssYInds[ssInd][0]])+
412 TMath::Abs(this->
useful[0][ssYInds[ssInd][1]]);
414 *
magX=TMath::Abs(this->
useful[0][ssXInds[ssInd][0]]+this->
useful[0][ssXInds[ssInd][1]]);
415 *
magY=TMath::Abs(this->
useful[0][ssYInds[ssInd][0]]+this->
useful[0][ssYInds[ssInd][1]]);
421 if(ssInd<0 || ssInd>4)
return -1;
422 return this->
useful[0][ssTemp[ssInd]];
428 *xRatio=(this->
useful[0][ssXInds[ssInd][1]]-this->
useful[0][ssXInds[ssInd][0]]);
429 Float_t xDenom=(this->
useful[0][ssXInds[ssInd][1]]+this->
useful[0][ssXInds[ssInd][0]]);
430 if(TMath::Abs(xDenom)>0.1*TMath::Abs(*xRatio)) {
443 *yRatio=(this->
useful[0][ssYInds[ssInd][1]]-this->
useful[0][ssYInds[ssInd][0]]);
444 Float_t yDenom=(this->
useful[0][ssYInds[ssInd][1]]+this->
useful[0][ssYInds[ssInd][0]]);
445 if(TMath::Abs(yDenom)>0.1*TMath::Abs(*yRatio)) {
458 Float_t *elevation, Float_t *relAzimuth) {
467 x0*=ssGain[ssInd][0];
468 x0-=ssOffset[ssInd][0];
475 y0*=ssGain[ssInd][1];
476 y0-=ssOffset[ssInd][1];
484 x0=-1*ssOffset[ssInd][0];
490 y0=-1*ssOffset[ssInd][1];
493 Float_t gamma=(globalGamma-ssGammaFactor[ssInd])*TMath::DegToRad();
494 pos[0]=(-1*x0*TMath::Cos(gamma))-(TMath::Sin(gamma)*ssSep[ssInd]);
496 pos[2]=ssSep[ssInd]*TMath::Cos(gamma)-x0*TMath::Sin(gamma);
498 *azimuth=TMath::ATan2(pos[1],-1*pos[0])*TMath::RadToDeg();
499 Float_t posXY2=TMath::Sqrt(pos[0]*pos[0] + pos[1]*pos[1]);
500 *elevation=TMath::ATan2(pos[2],posXY2)*TMath::RadToDeg();
501 *relAzimuth=(*azimuth)+ssAzRel[ssInd];
502 if((*relAzimuth)<0) (*relAzimuth)+=360;
510 int presChans[2]={51,71};
511 if(index>=0 && index<2) {
512 return useful[presChans[index]/40][presChans[index]%40];
519 int accelChans[2][4]={{70,50,69,49},{68,58,67,57}};
520 if((acInd>=0 && acInd<2) && (type>=0 && type<4)) {
521 return useful[accelChans[acInd][type]/40][accelChans[acInd][type]%40];
529 if((ssInd>=0 && ssInd<4) && (type>=0 && type<5)) {
532 return useful[ssXInds[ssInd][0]/40][ssXInds[ssInd][0]%40];
534 return useful[ssXInds[ssInd][1]/40][ssXInds[ssInd][1]%40];
536 return useful[ssYInds[ssInd][0]/40][ssYInds[ssInd][0]%40];
538 return useful[ssYInds[ssInd][1]/40][ssYInds[ssInd][1]%40];
540 return useful[ssTemp[ssInd]/40][ssTemp[ssInd]%40];
550 Float_t CalibratedHk::getSSAzimuth(
int ssInd)
552 Float_t azimuth,elevation,relAzimuth;
554 getFancySS(ssInd,pos,&azimuth,&elevation,&relAzimuth);
559 Float_t CalibratedHk::getSSAzimuthAdu5(
int ssInd)
561 Float_t azimuth,elevation,relAzimuth;
563 getFancySS(ssInd,pos,&azimuth,&elevation,&relAzimuth);
567 Float_t CalibratedHk::getSSElevation(
int ssInd)
570 Float_t azimuth,elevation,relAzimuth;
572 getFancySS(ssInd,pos,&azimuth,&elevation,&relAzimuth);
static const char * getAttitudeName(int index)
Return char string name of attitude sensor.
Float_t getVoltage(int index)
Returns voltage (0:10)
UInt_t realTime
Time in unixTime.
Short_t ntuTemp[3]
NTU temperatures in some crazy scheme.
UInt_t payloadTimeUs
Subsecond timing.
Int_t getFancySS(int ssInd, Float_t pos[3], Float_t *azimuth, Float_t *elevation, Float_t *relAzimuth)
Convert sunsensor data to elevation and azimuth.
void getSSMagnitude(int ssInd, Float_t *magnitude, Float_t *magX, Float_t *magY)
Get sunsensor magnitude.
Float_t getExternalTemp(int index)
Returns external temperature in degrees (0:24)
UInt_t payloadTime
Time in unixTime.
Float_t voltage[3][40]
Array of voltages.
UShort_t acromagData[3][40]
The array of ADC values.
Float_t getNTUTemp(int index)
Returns NTU temperature in degrees (0:3)
static const char * getSBSTempName(int index)
Return char string name of SBS temperature sensor.
static const char * getSSName(int index)
Return string name of sun-sensor.
Float_t getAccelerometer(int acInd, int type)
Returns accelerometer stuff.
Float_t getSSTemp(int ssInd)
Get sunsensor temperature.
Float_t magZ
Magnetometer z value.
UInt_t payloadTimeUs
Sub second time in us.
static const char * getExternalTempName(int index)
Return char string name of external temperature sensor.
Float_t getPower(int index)
Returns power (0:5)
Short_t ntuTemp[3]
The 7 (packed) NTU temperature sensors.
Float_t magY
Magnetometer y direction.
Float_t getRawSunsensor(int ssInd, int type)
Returns raw sunsensor stuff, here type goes x1,x2,y1,y2,T.
Float_t getPressure(int index)
Returns pressure (0:1)
Float_t getInternalTemp(int index)
Returns internal temperature in degrees (0:14)
RawHk – The Raw ANITA Housekeeping.
static const char * getVoltageName(int index)
Return char string name of voltage.
Float_t magY
Magnetometer y value.
Int_t getSSXRatio(int ssInd, Float_t *xRatio)
Get sunsensor x-ratio.
~CalibratedHk()
Default destructor.
UInt_t payloadTime
Time in unixTime.
CalibratedHk – The calibrated housekeeping data.
Int_t run
Run number, assigned offline.
Float_t useful[3][40]
Array of calibrated temperatures, currents, etc.
Float_t magZ
Magnetometer z direction.
static const char * getNTUTempName(int index)
Return char string name of SBS temperature sensor.
Float_t magX
Magnetometer x value.
Float_t magX
Magnetometer x direction.
Float_t getCurrent(int index)
Returns current (0:11)
Float_t getSBSTemp(int index)
Returns SBS temperature in degrees (0:3)
Short_t sbsTemp[3]
The three onboard temperature sensors.
Int_t run
Assigned offline.
Short_t sbsTemp[3]
SBS temperatures multiplied by 10.
Float_t getAttitude(int index)
Returns attitude (0:12)
static const char * getPowerName(int index)
Return char string name of power.
Int_t getSSYRatio(int ssInd, Float_t *yRatio)
Get sunsensor y-ratio.
static const char * getInternalTempName(int index)
Return char string name of internal temperature sensor.
CalibratedHk()
Default constructor.
static const char * getCurrentName(int index)
Return char string name of current.
UInt_t realTime
Time in unixTime.