- Timestamp:
- 02/18/05 10:24:51 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.cxx
r5319 r6584 23 23 Int_t shapeout, Float_t integralout, Float_t fwhmout, 24 24 Float_t trigger_delay, Float_t fadc_slices_per_ns, 25 Int_t fadc_slices_written) { 25 Int_t fadc_slices_written, Int_t gainswitchamp, 26 Int_t shiftfromswitch2lowgain) { 26 27 // 27 28 // Constructor overloaded II … … 52 53 fFadcSlicesPerNanosec = fadc_slices_per_ns; 53 54 fFadcSlices = fadc_slices_written; 55 fGainSwitchAmp = gainswitchamp; 56 fShiftFromSwitch2LowGain = shiftfromswitch2lowgain; 54 57 55 58 fSlices_mFadc = (Int_t)(TOTAL_TRIGGER_TIME*fFadcSlicesPerNanosec); … … 102 105 103 106 // 104 // 107 // set up the response shape 105 108 // 106 109 … … 701 704 // adds the noise due to optronics and electronics 702 705 // to the signal. This is noise which comes before the FADC, 703 // so it will be later scaled down in the low gain branch. 706 // so it will be later scaled down in the low gain branch, if 707 // the switch to low gain occurs. 704 708 // 705 709 UInt_t startslice; … … 872 876 //=========================================================================== 873 877 // 874 // Next function generates one pure noise event for pixel "pix", then adds 875 // up the readouts of a number n_slices of its FADC slices, this being the 876 // return value. 878 // Next function adds up the noise in pixel "pix", scaling down the part 879 // of it which comes from before the receivers in the case we are dealing with 880 // low gain (ishigh=0). The output is the sum of the readouts of a number 881 // n_slices of FADC slices. For the case of low gain, the FADC contents we add 882 // are not what we would have in a real pedestal event, but nevertheless this 883 // is useful in the camera simulation to obtain what the pedestal fluctuations 884 // are for the low gain. This will be written to the camera output, in the 885 // MMcFadcHeader. 877 886 // 878 887 Float_t MFadc::AddNoiseInSlices( Int_t pix, Int_t ishigh, Int_t n_slices) { … … 888 897 // If we deal with low gain, we have to scale the values in sig[][] by 889 898 // the gain ratio (high2low_gain), since "sig" contains here the noise 890 // produce before the receiver boards (for instance NSB noise)899 // produced before the receiver boards (for instance NSB noise) 891 900 // 892 901 factor=(ishigh?1.0:high2low_gain); … … 949 958 for ( Int_t i=0 ; i < fFadcSlices ; i++ ) 950 959 { 951 output[ip][i] = pedestal[ip];952 output_lowgain[ip][i] = pedestal[ip];960 output[ip][i] = pedestal[ip]; 961 output_lowgain[ip][i] = pedestal[ip]; 953 962 } 954 963 continue; 955 964 } 956 965 966 967 // First put the high gain in the output slices: 968 i = 0; 969 Int_t switch_i = 0; 970 for ( Int_t is = iFirstSlice; is < (iFirstSlice+fFadcSlices); is++ ) 971 { 972 if (is < (Int_t)fSlices_mFadc) 973 { 974 output[ip][i] = sig[ip][is]; 975 976 if (switch_i == 0) // Hi gain limit not yet surpassed before. 977 { 978 if (output[ip][i] > fGainSwitchAmp) 979 switch_i = i + fShiftFromSwitch2LowGain; 980 } 981 } 982 983 else // We are beyond the simulated signal history in sig[][]! Put just mean pedestal! 984 output[ip][i] = pedestal[ip]; 985 986 i++; 987 } 988 989 // Now put the low gain: 957 990 i=0; 958 991 for ( Int_t is = iFirstSlice; is < (iFirstSlice+fFadcSlices); is++ ) … … 960 993 if (is < (Int_t)fSlices_mFadc) 961 994 { 962 output[ip][i] = sig[ip][is]; 963 964 // Low gain is scaled down by the factor high2low_gain: 965 output_lowgain[ip][i]= pedestal[ip] + (sig[ip][is]-pedestal[ip])/high2low_gain; 995 if (switch_i > 0 && (i+fFadcSlices) >= switch_i) 996 output_lowgain[ip][i] = pedestal[ip] + 997 (sig[ip][is]-pedestal[ip])/high2low_gain; 998 // Once the shift occurs, low gain is filled with the high 999 // gain signal scaled down by the factor high2low_gain 1000 1001 else 1002 output_lowgain[ip][i] = sig[ip][is+fFadcSlices]; 1003 // Write out high gain into low gain slices if there was no 1004 // switch, or before the switch occurs. 966 1005 } 1006 967 1007 else // We are beyond the simulated signal history in sig[][]! Put just mean pedestal! 968 1008 { 969 output[ip][i] = pedestal[ip];970 1009 output_lowgain[ip][i]= pedestal[ip]; 971 1010 } 972 1011 i++; 973 1012 } 1013 974 1014 } 975 1015 }
Note:
See TracChangeset
for help on using the changeset viewer.