Beispiel #1
0
 /** */
 function CalcBeamPolar($doNorm = false)
 {
     //{{{
     global $POLARIMETER_ID;
     foreach (range(0, 3) as $polId) {
         $ringId = GetRingId($polId);
         //$this->fNorm = $doNorm ? $this->fGlobResult->fNormHJ2PCPolars[$polId]->first : 1.;
         //$this->fNorm[$polId] = $doNorm ? getHJPCNorm($this->fRunPeriod, $this->fBeamEnergy, $POLARIMETER_ID[$polId]) : new pair(1, -1);
         $this->fNorm[$polId] = $doNorm ? getHJPCNorm($this->fRunPeriod, $this->fBeamEnergy, $POLARIMETER_ID[$polId], $this->fTargetOrients[$polId], $this->fTargetIds[$polId]) : new pair(1, -1);
         //$this->fNorm = new pair(1, -1);
         $pcPolar = $this->fPCPolars[$polId]->ClonePair();
         if ($pcPolar->second >= 0) {
             $pcPolar->first *= $this->fNorm[$polId]->first;
             $pcPolar->second *= $this->fNorm[$polId]->first;
             $this->fBeamPolars[$ringId] = calcWeigtedAvrgErrPairs($this->fBeamPolars[$ringId], $pcPolar);
         }
         $pcPolarP0 = $this->fPCPolarP0s[$polId]->ClonePair();
         if ($pcPolarP0->second >= 0) {
             $pcPolarP0->first *= $this->fNorm[$polId]->first;
             $pcPolarP0->second *= $this->fNorm[$polId]->first;
             $this->fBeamPolarP0s[$ringId] = calcWeigtedAvrgErrPairs($this->fBeamPolarP0s[$ringId], $pcPolarP0);
         }
         $pcPolarSlope = $this->fPCPolarSlopes[$polId]->ClonePair();
         if ($pcPolarSlope->second >= 0) {
             $pcPolarSlope->first *= $this->fNorm[$polId]->first;
             $pcPolarSlope->second *= $this->fNorm[$polId]->first;
             $this->fBeamPolarSlopes[$ringId] = calcWeigtedAvrgErrPairs($this->fBeamPolarSlopes[$ringId], $pcPolarSlope);
         }
         //print "<pre>\n";
         //print "fNorm: ".$this->fNorm;
         //print_r($this->fBeamPolars[$ringId]);
         //print "</pre>\n";
     }
 }
Beispiel #2
0
 /** */
 function Process()
 {
     $beamProfRSet = array();
     $beamProfR0Set = array();
     $beamProfRSlopeSet = array();
     foreach ($this->fFillResults as $fillResult) {
         // Process results by polarimeter
         foreach (range(0, 3) as $polId) {
             $ringId = GetRingId($polId);
             $pcPolar = $fillResult->fPCPolars[$polId];
             //if ($pcPolar->second < 0) continue;
             $this->fAvrgPCPolars[$polId] = calcWeigtedAvrgErrPairs($this->fAvrgPCPolars[$polId], $pcPolar);
             $hjPolar = $fillResult->fHJPolars[$ringId];
             //if ($hjPolar->second < 0) continue;
             $this->fAvrgPCnHJPolars[$polId] = calcWeigtedAvrgErrPairs($this->fAvrgPCnHJPolars[$polId], $pcPolar);
             $this->fAvrgHJnPCPolars[$polId] = calcWeigtedAvrgErrPairs($this->fAvrgHJnPCPolars[$polId], $hjPolar);
             // Now we can calculate the ratio of HJ to PC polar
             $norm = calcDivision($hjPolar, $pcPolar);
             $this->fNormHJ2PCPolars[$polId] = calcWeigtedAvrgErrPairs($this->fNormHJ2PCPolars[$polId], $norm);
         }
         // Process results by ring
         foreach (range(1, 2) as $ringId) {
             $hjPolar = $fillResult->fHJPolars[$ringId];
             //if ($hjPolar->second < 0) continue;
             $this->fAvrgHJPolars[$ringId] = calcWeigtedAvrgErrPairs($this->fAvrgHJPolars[$ringId], $hjPolar);
             foreach (range(0, 1) as $tgtOrient) {
                 $beamProfR = $fillResult->fBeamProfRs[$ringId][$tgtOrient];
                 $beamEnergy = $fillResult->fBeamEnergy;
                 if ($beamProfR->second >= 0) {
                     $beamProfRSet[$ringId][$tgtOrient][$beamEnergy][] = $beamProfR;
                     $beamProfR0Set[$ringId][$tgtOrient][$beamEnergy][] = $fillResult->fBeamProfR0s[$ringId][$tgtOrient];
                     $beamProfRSlopeSet[$ringId][$tgtOrient][$beamEnergy][] = $fillResult->fBeamProfRSlopes[$ringId][$tgtOrient];
                 }
                 $this->fAvrgBeamProfRs[$ringId][$tgtOrient] = calcWeigtedAvrgErrPairs($this->fAvrgBeamProfRs[$ringId][$tgtOrient], $beamProfR);
             }
         }
     }
     //print "<pre>\n";
     //print_r($beamProfRSet);
     //print "</pre>\n";
     // calculate profile R value for missing measurements
     foreach (range(1, 2) as $ringId) {
         foreach (range(0, 1) as $tgtOrient) {
             //$ve = new pair(calcWeigtedAvrgErr($beamProfRSet[$ringId][$tgtOrient]), calcWeigtedStdDev( $beamProfRSet[$ringId][$tgtOrient]));
             //$this->fMissingBeamProfRs[$ringId][$tgtOrient] = $ve;
             $beamProfRSetByRingByTgt = $beamProfRSet[$ringId][$tgtOrient];
             foreach ($beamProfRSetByRingByTgt as $beamEnergy => $beamProfRSetByBeamEnergy) {
                 $v = calcWeigtedAvrgErr($beamProfRSetByBeamEnergy)->first;
                 $e = calcWeigtedStdDev($beamProfRSetByBeamEnergy)->first;
                 $this->fMissingBeamProfRs[$ringId][$tgtOrient][$beamEnergy] = new pair($v, $e);
                 $v = calcWeigtedAvrgErr($beamProfR0Set[$ringId][$tgtOrient][$beamEnergy])->first;
                 $e = calcWeigtedStdDev($beamProfR0Set[$ringId][$tgtOrient][$beamEnergy])->first;
                 $this->fMissingBeamProfR0s[$ringId][$tgtOrient][$beamEnergy] = new pair($v, $e);
                 $v = calcWeigtedAvrgErr($beamProfRSlopeSet[$ringId][$tgtOrient][$beamEnergy])->first;
                 $e = calcWeigtedStdDev($beamProfRSlopeSet[$ringId][$tgtOrient][$beamEnergy])->first;
                 $this->fMissingBeamProfRSlopes[$ringId][$tgtOrient][$beamEnergy] = new pair($v, $e);
                 //print "<pre>\n";
                 //print_r($this->fMissingBeamProfRs[$ringId][$tgtOrient]);
                 //print "</pre>\n";
             }
         }
     }
 }