//Read a line and fill parameter void ExperimentalPoint::ReadLineAndTreat(int MagnetQuadrant, TString Grid, int Location, int Level, double Bx, double By, double Bz){ fMagnetQuadrant = MagnetQuadrant ; fLocation = Location ; fLevel = Level; fGrid = Grid ; TString key = Grid + Form("%d%d",MagnetQuadrant,Level); CheckList(Grid, MagnetQuadrant, Level); if(fSetBackground) SubtractBackground(Grid, Location, Bx,By,Bz); CalculateCentralPosition() ; //Correct for probe rotation if (Grid=="B" && Location>=4 && Location<=7) { // when the probe is tilted in the B grid, the sensorX receives most of the magnetic field in contrast to sensorY // to keep things in order, the sensorX value could be split into (x-component an y-component) fBField.SetXYZ(Bx/10.,0,-Bz/10.); //ignore By, it will be filled by rotation fBField.RotateZ(-45*TMath::DegToRad()); TVector3 SensorOffsetX = fSensorOffsetX; // copy the offset and rotate 45 degrees SensorOffsetX.RotateZ(-45*TMath::DegToRad()); fSensorPositionX = fPosition + SensorOffsetX; fSensorPositionY = fPosition + SensorOffsetX; // yes it is X! fSensorPositionZ = fPosition + fSensorOffsetZ; } else if (Grid=="D" && Location>=5 && Location<=7) { // when the probe is tilted in the D grid, the sensorY receives most of the magnetic field in contrast to sensorX // again, the sensorY value could be split into (x-component an y-component) fBField.SetXYZ(0.,-By/10.,-Bz/10.); //ignore Bx, it will be filled by rotation fBField.RotateZ(-45*TMath::DegToRad()); TVector3 SensorOffsetY = fSensorOffsetY; // copy the offset and rotate 45 degrees SensorOffsetY.RotateZ(-45*TMath::DegToRad()); fSensorPositionX = fPosition + SensorOffsetY; fSensorPositionY = fPosition + SensorOffsetY; // yes it is Y! fSensorPositionZ = fPosition + fSensorOffsetZ; } else { fBField.SetXYZ(Bx/10.,-By/10.,-Bz/10.); // turn to millitesla, By need to be multiplied by (-) to account for the axis change between simulation/experiment and the way the mapper is set fSensorPositionX = fPosition + fSensorOffsetX; fSensorPositionY = fPosition + fSensorOffsetY; fSensorPositionZ = fPosition + fSensorOffsetZ; } //correct for Lens rotations double angle = CalculateRotationAngle(MagnetQuadrant, Grid); fPosition.RotateZ(angle*TMath::DegToRad()); fSensorPositionX.RotateZ(angle*TMath::DegToRad()); fSensorPositionY.RotateZ(angle*TMath::DegToRad()); fSensorPositionZ.RotateZ(angle*TMath::DegToRad()); fBField.RotateZ(angle*TMath::DegToRad()); //ShowParameters(); //cin.get(); }
Image2D TestSetGenerator::MakeTestSet(int number, Mask2D& rfi, unsigned width, unsigned height, int gaussianNoise) { Image2D image; switch(number) { case 0: // Image of all zero's return Image2D::MakeZeroImage(width, height); case 1: // Image of all ones image = Image2D::MakeUnsetImage(width, height); image.SetAll(1.0); break; case 2: // Noise return MakeNoise(width, height, gaussianNoise); case 3: { // Several broadband lines image = MakeNoise(width, height, gaussianNoise); AddBroadbandToTestSet(image, rfi, 1.0); } break; case 4: { // Several broadband lines image = MakeNoise(width, height, gaussianNoise); AddBroadbandToTestSet(image, rfi, 0.5); } break; case 5: { // Several broadband lines of random length image = MakeNoise(width, height, gaussianNoise); AddVarBroadbandToTestSet(image, rfi); } break; case 6: { // Different broadband lines + low freq background image = MakeNoise(width, height, gaussianNoise); AddVarBroadbandToTestSet(image, rfi); for(unsigned y=0;y<image.Height();++y) { for(unsigned x=0;x<image.Width();++x) { image.AddValue(x, y, sinn(num_t(x)*M_PIn*5.0 / image.Width()) + 0.1); } } } break; case 7: { // Different broadband lines + high freq background image = MakeNoise(width, height, gaussianNoise); for(unsigned y=0;y<image.Height();++y) { for(unsigned x=0;x<image.Width();++x) { image.AddValue(x, y, sinn((long double) (x+y*0.1)*M_PIn*5.0L / image.Width() + 0.1)); image.AddValue(x, y, sinn((long double) (x+pown(y, 1.1))*M_PIn*50.0L / image.Width() + 0.1)); } } AddVarBroadbandToTestSet(image, rfi); for(unsigned y=0;y<image.Height();++y) { for(unsigned x=0;x<image.Width();++x) { image.AddValue(x, y, 1.0); } } } break; case 8: { // Different droadband lines + smoothed&subtracted high freq background image = MakeNoise(width, height, gaussianNoise); for(unsigned y=0;y<image.Height();++y) { for(unsigned x=0;x<image.Width();++x) { image.AddValue(x, y, sinn((num_t) (x+y*0.1)*M_PIn*5.0 / image.Width() + 0.1)); image.AddValue(x, y, sinn((num_t) (x+pown(y, 1.1))*M_PIn*50.0 / image.Width() + 0.1)); } } SubtractBackground(image); AddVarBroadbandToTestSet(image, rfi); } break; case 9: { //FFT of 7 image = MakeTestSet(7, rfi, width, height); Image2D copy(image); FFTTools::CreateHorizontalFFTImage(image, copy, false); for(unsigned y=0;y<rfi.Height();++y) { for(unsigned x=0;x<rfi.Width();++x) { image.SetValue(x, y, image.Value(x, y) / sqrtn(image.Width())); } } } break; case 10: { // Identity matrix image = Image2D::MakeZeroImage(width, height); unsigned min = width < height ? width : height; for(unsigned i=0;i<min;++i) { image.SetValue(i, i, 1.0); rfi.SetValue(i, i, true); } } break; case 11: { // FFT of identity matrix image = MakeTestSet(10, rfi, width, height); Image2D copy(image); FFTTools::CreateHorizontalFFTImage(image, copy, false); for(unsigned y=0;y<rfi.Height();++y) { for(unsigned x=0;x<rfi.Width();++x) { image.SetValue(x, y, image.Value(x, y) / sqrtn(width)); } } } break; case 12: { // Broadband contaminating all channels image = MakeNoise(width, height, gaussianNoise); for(unsigned y=0;y<image.Height();++y) { for(unsigned x=0;x<image.Width();++x) { image.AddValue(x, y, sinn((num_t) (x+y*0.1)*M_PIn*5.0 / image.Width() + 0.1)); image.AddValue(x, y, sinn((num_t) (x+powl(y, 1.1))*M_PIn*50.0 / image.Width() + 0.1)); } } AddBroadbandToTestSet(image, rfi, 1.0); } break; case 13: { // Model of three point sources with broadband RFI SetModelData(image, rfi, 3); Image2D noise = MakeNoise(image.Width(), image.Height(), gaussianNoise); image += noise; AddBroadbandToTestSet(image, rfi, 1.0); } break; case 14: { // Model of five point sources with broadband RFI SetModelData(image, rfi, 5); Image2D noise = MakeNoise(image.Width(), image.Height(), gaussianNoise); image += noise; AddBroadbandToTestSet(image, rfi, 1.0); } break; case 15: { // Model of five point sources with partial broadband RFI SetModelData(image, rfi, 5); Image2D noise = MakeNoise(image.Width(), image.Height(), gaussianNoise); image += noise; AddBroadbandToTestSet(image, rfi, 0.5); } break; case 16: { // Model of five point sources with random broadband RFI SetModelData(image, rfi, 5); Image2D noise = MakeNoise(image.Width(), image.Height(), gaussianNoise); image += noise; AddVarBroadbandToTestSet(image, rfi); } break; case 17: { // Background-fitted model of five point sources with random broadband RFI SetModelData(image, rfi, 5); Image2D noise = MakeNoise(image.Width(), image.Height(), gaussianNoise); image += noise; SubtractBackground(image); AddVarBroadbandToTestSet(image, rfi); } break; case 18: { // Model of three point sources with random RFI SetModelData(image, rfi, 3); Image2D noise = MakeNoise(image.Width(), image.Height(), gaussianNoise); image += noise; AddVarBroadbandToTestSet(image, rfi); } break; case 19: { // Model of three point sources with noise SetModelData(image, rfi, 3); Image2D noise = MakeNoise(image.Width(), image.Height(), gaussianNoise); image += noise; } break; case 20: { // Model of five point sources with noise SetModelData(image, rfi, 5); Image2D noise = MakeNoise(image.Width(), image.Height(), gaussianNoise); image += noise; } break; case 21: { // Model of three point sources SetModelData(image, rfi, 3); } break; case 22: { // Model of five point sources image = Image2D::MakeZeroImage(width, height); SetModelData(image, rfi, 5); } break; case 23: image = MakeNoise(width, height, gaussianNoise); AddBroadbandToTestSet(image, rfi, 0.5, 0.1, true); break; case 24: image = MakeNoise(width, height, gaussianNoise); AddBroadbandToTestSet(image, rfi, 0.5, 10.0, true); break; case 25: image = MakeNoise(width, height, gaussianNoise); AddBroadbandToTestSet(image, rfi, 0.5, 1.0, true); break; case 26: { // Several Gaussian broadband lines image = MakeNoise(width, height, gaussianNoise); AddBroadbandToTestSet(image, rfi, 1.0, 1.0, false, GaussianShape); } break; case 27: { // Several Sinusoidal broadband lines image = MakeNoise(width, height, gaussianNoise); AddBroadbandToTestSet(image, rfi, 1.0, 1.0, false, SinusoidalShape); } break; case 28: { // Several slewed Gaussian broadband lines image = MakeNoise(width, height, gaussianNoise); AddSlewedBroadbandToTestSet(image, rfi, 1.0); } break; case 29: { // Several bursty broadband lines image = MakeNoise(width, height, gaussianNoise); AddBurstBroadbandToTestSet(image, rfi); } break; case 30: { // noise + RFI ^-2 distribution image = sampleRFIDistribution(width, height, 1.0); rfi.SetAll<true>(); } break; case 31: { // noise + RFI ^-2 distribution image = sampleRFIDistribution(width, height, 0.1); rfi.SetAll<true>(); } break; case 32: { // noise + RFI ^-2 distribution image = sampleRFIDistribution(width, height, 0.01); rfi.SetAll<true>(); } break; } return image; }