Changeset 637 for trunk/MagicSoft


Ignore:
Timestamp:
02/23/01 10:43:46 (24 years ago)
Author:
magicsol
Message:
Two member functions for the pedestal simualtion have been implemented. One
allows to set given values and the other assign random values. There is also
a new memeber function that adds the pedestal values to the FADC siganl.
Functions like the constructors have been modified to take into account
pedestals which are a new member.
A function to add the NSB signal from the database has been added.
File:
1 edited

Legend:

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

    r579 r637  
    7474
    7575  //
     76  //  set all pedestals to 0
     77  //
     78 
     79  for ( i =0 ; i <CAMERA_PIXELS ; i++ ) {
     80    pedestal[i] = 0 ;
     81  }
     82
     83  //
    7684  //  set tha values of FADC slices that would be read after trigger to zero
    7785  //
     
    105113  }
    106114}
    107 
    108115
    109116void MFadc::Fill( Int_t iPix, Float_t time, Float_t amplitude ) {
     
    171178}
    172179
     180void MFadc::Set( Int_t iPix, Float_t resp[(Int_t) SLICES_MFADC]) {
     181 
     182  //
     183  // Sets the information about fadc reponse from a given array
     184  //
     185  // parameter is the number of the pixel and the values to be set
     186  //
     187  //
     188
     189  Int_t i ;
     190 
     191  //
     192  //   first we have to check if the pixel iPix is used or not until now
     193  //   if this is the first use, reset all signal for that pixels
     194  //
     195  if ( iPix > CAMERA_PIXELS ) {
     196    cout << " WARNING:  MFadc::Fill() :  iPix greater than CAMERA_PIXELS"
     197         << endl ;
     198    exit(987) ;
     199  }
     200
     201  if ( used[iPix] == FALSE ) {
     202    used [iPix] = TRUE ;
     203   
     204    for (i=0; i < SLICES_MFADC; i++ ) {
     205      sig[iPix][i] = 0. ;
     206    }
     207  }
     208  for ( i = 0 ; i<SLICES_MFADC; i++ ) {
     209    sig[iPix][i] = resp[i] ;
     210  }
     211
     212}
     213
     214void MFadc::SetPedestals( Int_t ped) {
     215  //  It sets pedestal for each pixel flat randomly dstributed between 0 and ped
     216  //  It uses the instance of TRandom GenElec.
     217
     218  Int_t i;
     219
     220  for(i=0;i<CAMERA_PIXELS;i++){
     221    pedestal[i]= (UChar_t)(ped* GenElec->Rndm());
     222  }
     223}
     224
     225void MFadc::SetPedestals(  UChar_t ped[CAMERA_PIXELS]) {
     226  //  It sets pedestal for each pixel from ped array
     227
     228  Int_t i;
     229
     230  for(i=0;i<CAMERA_PIXELS;i++){
     231    pedestal[i]= ped[i];
     232  }
     233}
     234 
     235
    173236void MFadc::Baseline(){
    174237  // 
     
    188251    }
    189252  }
     253}
     254
     255void MFadc::Pedestals(){
     256  //
     257  //  It shifts the FADC contents their pedestal values
     258  //  It shifts the values in the analog signal,
     259  //  therefore it has to be done before getting FADC output
     260  //
     261
     262  Int_t i, j;
     263
     264  for(i=0;i<CAMERA_PIXELS;i++)
     265    for(j=0;j<SLICES_MFADC;j++)
     266      sig[i][j]+=pedestal[i];
    190267}
    191268
     
    368445      i=0;
    369446      for ( Int_t is=iFirstSlice ; is < (iFirstSlice+FADC_SLICES) ; is++ ) {
    370         if (is< SLICES_MFADC)
     447        if (is< SLICES_MFADC && sig[ip][is]>0.0)
    371448          output[ip][i++]=(UChar_t) sig[ip][is];
    372449        else
     
    451528}
    452529
    453 Float_t MFadc::GetFadcSignal(Int_t pixel, Int_t slice){
     530UChar_t MFadc::GetFadcSignal(Int_t pixel, Int_t slice){
    454531
    455532  //  It returns the analog signal for a given pixel and a given FADC
Note: See TracChangeset for help on using the changeset viewer.