Ignore:
Timestamp:
02/18/05 10:24:51 (20 years ago)
Author:
moralejo
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Simulation/Detector/include-MFadc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.cxx

    r5319 r6584  
    2323             Int_t shapeout, Float_t integralout, Float_t fwhmout,
    2424             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) {
    2627  //
    2728  //  Constructor overloaded II
     
    5253  fFadcSlicesPerNanosec = fadc_slices_per_ns;
    5354  fFadcSlices = fadc_slices_written;
     55  fGainSwitchAmp = gainswitchamp;
     56  fShiftFromSwitch2LowGain = shiftfromswitch2lowgain;
    5457
    5558  fSlices_mFadc = (Int_t)(TOTAL_TRIGGER_TIME*fFadcSlicesPerNanosec);
     
    102105 
    103106  //
    104   //    set up the response shape
     107  // set up the response shape
    105108  //
    106109
     
    701704  //    adds the noise due to optronics and electronics
    702705  //    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.
    704708  //
    705709  UInt_t startslice;
     
    872876//===========================================================================
    873877//
    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.
    877886//
    878887Float_t MFadc::AddNoiseInSlices( Int_t pix, Int_t ishigh, Int_t n_slices) {
     
    888897  // If we deal with low gain, we have to scale the values in sig[][] by
    889898  // 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)
    891900  //
    892901  factor=(ishigh?1.0:high2low_gain);
     
    949958          for ( Int_t i=0 ; i < fFadcSlices ; i++ )
    950959            {
    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];
    953962            }
    954963          continue;
    955964        }
    956965
     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:
    957990      i=0;
    958991      for ( Int_t is = iFirstSlice; is < (iFirstSlice+fFadcSlices); is++ )
     
    960993          if (is < (Int_t)fSlices_mFadc)
    961994            {
    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.
    9661005            }
     1006
    9671007          else // We are beyond the simulated signal history in sig[][]! Put just mean pedestal!
    9681008            {
    969               output[ip][i] = pedestal[ip];
    9701009              output_lowgain[ip][i]= pedestal[ip];
    9711010            }
    9721011          i++;
    9731012        }
     1013
    9741014    }
    9751015}
  • trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.hxx

    r5248 r6584  
    2222#include "MFadcDefine.h"
    2323
    24 class MMcEvt  ;
     24class MMcEvt;
    2525
    2626//==========
     
    107107  Float_t *sing_resp_outer; // the shape of the phe_response function
    108108
    109 
    110   //
    111   //   RandomGenerator for the Electonic Noise
     109  Int_t fGainSwitchAmp; // Height of the high gain signal (in ADC counts) at which we decide
     110                        // to fill the low gain with a scaled down version of the pulse in the
     111                        // high gain. Else we put in the continuation of the high gain.
     112
     113  Int_t fShiftFromSwitch2LowGain;
     114  // Distance in FADC slices from the slice in which the amplitude
     115  // fGainSwitchAmp is reached to were the switch to low gain will happen.
     116
     117  //
     118  //   RandomGenerator for the Electronic Noise
    112119  //
    113120
     
    129136        Float_t trig_delay = 0.,
    130137        Float_t fadc_slices_per_ns = FADC_SLICES_PER_NSEC,
    131         Int_t   fadc_slices_written = FADC_SLICES);
    132  
     138        Int_t   fadc_slices_written = FADC_SLICES,
     139        Int_t   gainswitchamp = 120,
     140        Int_t   shiftfromswitch2lowgain = 13);
     141
    133142  void SetSeed(UInt_t seed)  {GenElec->SetSeed(seed);}
    134143
Note: See TracChangeset for help on using the changeset viewer.