Ignore:
Timestamp:
03/01/05 20:06:47 (20 years ago)
Author:
moralejo
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Simulation/Detector
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Simulation/Detector/Camera/TOBEDONE

    r6613 r6692  
    11
    2 - Change shape of low gain pulse, to look like in data.
     2- Change shape of low gain pulse, to look like in data. --> Done; Add some comments
    33
    44- Introduce correlations in the electronic noise
  • trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx

    r6588 r6692  
    1 ////!/////////////////////////////////////////////////////////////////////
     1////!////////////////////////////////////////////////////////////////////
    22//
    33// camera               
     
    50615061//
    50625062// $Log: not supported by cvs2svn $
     5063// Revision 1.92  2005/02/18 12:19:32  moralejo
     5064//
     5065//  Changes in MFadc. Added possibility to set a shift (for the moment an
     5066//  integer number of FADC slices) between the signal peak in the high gain
     5067//  and in the low gain.
     5068//
    50635069// Revision 1.91  2005/02/18 10:24:51  moralejo
    50645070//
  • trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.cxx

    r6588 r6692  
    6060
    6161  for (Int_t i = 0; i < CAMERA_PIXELS; i++)
    62     sig[i] = new Float_t[fSlices_mFadc];
     62    {
     63      sig[i] = new Float_t[fSlices_mFadc];
     64      sig_LG[i] = new Float_t[fSlices_mFadc];
     65    }
    6366
    6467  noise = new Float_t[fSlices_mFadc*1001];
     
    125128  sing_resp_outer = new Float_t[fResponseSlicesFadc];
    126129
     130  sing_resp_lowgain = new Float_t[fResponseSlicesFadc];
     131  sing_resp_outer_lowgain = new Float_t[fResponseSlicesFadc];
     132
     133
     134  // Parameters for real pulse shaped as measured with the Pulpo device:
     135  fPulseParameters[0] = 2.066;
     136  fPulseParameters[1] = 1.568;
     137  fPulseParameters[2] = 3;     // This will set the peak of the pulse at x ~ 3*3.3 = 10 ns
     138                               // It is just a safe value so that the pulse is well contained.
     139  fPulseParameters[3] = 0.00282;
     140  fPulseParameters[4] = 0.04093;
     141  fPulseParameters[5] = 0.2411;
     142  fPulseParameters[6] = -0.009442;
     143
     144  // Now for the low gain:
     145  fPulseParametersLG[0] = 0.7;
     146  fPulseParametersLG[1] = 0.88;
     147  fPulseParametersLG[2] = 3.4;
     148  fPulseParametersLG[3] = 0.00282;
     149  fPulseParametersLG[4] = 0.04093;
     150  fPulseParametersLG[5] = 0.2411;
     151  fPulseParametersLG[6] = -0.009442;
     152
    127153  Int_t  i ;
    128154 
     
    132158
    133159  Float_t   response_sum_inner, response_sum_outer;
     160  Float_t   response_sum_inner_LG, response_sum_outer_LG;
     161
    134162  response_sum_inner = 0.;
    135163  response_sum_outer = 0.;
     164  response_sum_inner_LG = 0.;
     165  response_sum_outer_LG = 0.;
    136166
    137167  dX  = 1. / fFadcSlicesPerNanosec / SUBBINS ;   // Units: ns
     
    144174    x0 = 3*sigma;
    145175    fadc_time_offset = trigger_delay-x0; // ns
    146  
     176
    147177    for (i = 0; i < fResponseSlicesFadc ; i++ )
    148178      { 
     
    150180     
    151181        sing_resp[i] = (Float_t)(expf(-0.5*(x-x0)*(x-x0)/(sigma*sigma)));
    152 
     182        sing_resp_lowgain[i] = sing_resp[i];
     183
     184        // Use the same pulse for high and low gain in case of gaussian shape
     185        // FIXME: it would be nice to be able to choose a different shape for
     186        // high and low gain:
    153187        response_sum_inner += sing_resp[i];
     188        response_sum_inner_LG += sing_resp_lowgain[i];
    154189      }
    155190
    156191    break;
    157192  case 1:
    158     float p1,p2,p3,p4,p5,p6,p7;
     193    float p0,p1,p2,p3,p4,p5,p6;
    159194    float d;
    160195    float zed_slices;
     
    162197    // gaussian electronic pulse passed through the whole chain from
    163198    // transmitter boards to FADC.
    164     p1 = 2.066;
    165     p2 = 1.568;
    166     p3 = 3; // This will set the peak of the pulse at x ~ 3*3.3 = 10 ns
    167             // It is just a safe value so that the pulse is well contained.
    168     p4 = 0.00282;
    169     p5 = 0.04093;
    170     p6 = 0.2411;
    171     p7 = -0.009442;
     199    p0 = fPulseParameters[0];
     200    p1 = fPulseParameters[1];
     201    p2 = fPulseParameters[2];
     202    p3 = fPulseParameters[3];
     203    p4 = fPulseParameters[4];
     204    p5 = fPulseParameters[5];
     205    p6 = fPulseParameters[6];
     206
     207    float p0_LG, p1_LG, p2_LG, p3_LG, p4_LG, p5_LG, p6_LG;
     208    p0_LG = fPulseParametersLG[0];
     209    p1_LG = fPulseParametersLG[1];
     210    p2_LG = fPulseParametersLG[2];
     211    p3_LG = fPulseParametersLG[3];
     212    p4_LG = fPulseParametersLG[4];
     213    p5_LG = fPulseParametersLG[5];
     214    p6_LG = fPulseParametersLG[6];
     215
    172216
    173217    // Now define the time before trigger to read FADC signal when it
     
    181225    // frequency we are simulating!
    182226
    183     fadc_time_offset = trigger_delay - p3 / FADC_SLICES_PER_NSEC; // ns
     227    fadc_time_offset = trigger_delay - p2 / FADC_SLICES_PER_NSEC; // ns
    184228
    185229    for (i=0; i< fResponseSlicesFadc ; i++ )
     
    191235        // are using another sampling frequency!):
    192236        //
    193         zed_slices = x * FADC_SLICES_PER_NSEC - p3;
    194         d=(zed_slices>0)?0.5:-0.5;
    195 
    196         sing_resp[i] =  (Float_t) (p1*exp(-p2*(exp(-p2*zed_slices)+zed_slices))+
    197                                    p4+p5*exp(-p2*(exp(-p2*zed_slices)+
    198                                                   p6*zed_slices))+p7*d);
     237        zed_slices = x * FADC_SLICES_PER_NSEC - p2;
     238        d = (zed_slices>0)? 0.5 : -0.5;
     239
     240        sing_resp[i] =  (Float_t) (p0*exp(-p1*(exp(-p1*zed_slices)+zed_slices))+
     241                                   p3+p4*exp(-p1*(exp(-p1*zed_slices)+
     242                                                  p5*zed_slices))+p6*d);
     243
     244        zed_slices = x * FADC_SLICES_PER_NSEC - p2_LG;
     245        d = (zed_slices>0)? 0.5 : -0.5;
     246        sing_resp_lowgain[i] =  (Float_t) (p0_LG*exp(-p1_LG*(exp(-p1_LG*zed_slices)+zed_slices))+
     247                                           p3+p4*exp(-p1_LG*(exp(-p1_LG*zed_slices)+
     248                                                          p5*zed_slices))+p6*d);
    199249
    200250        response_sum_inner += sing_resp[i];
     251        response_sum_inner_LG += sing_resp_lowgain[i];
    201252      }
    202253
     
    234285    break;
    235286  case 1:
    236     float p1,p2,p3,p4,p5,p6,p7;
     287    float p0,p1,p2,p3,p4,p5,p6;
    237288    float d;
    238289    float zed_slices;
     
    240291    // gaussian electronic pulse passed through the whole chain from
    241292    // transmitter boards to FADC.
    242     p1 = 2.066;
    243     p2 = 1.568;
    244     p3 = 3; // This sets the peak of the pulse at x ~ 3*3.3 = 10 nanosec
    245             // It is just a safe value so that the pulse is well contained.
    246     p4 = 0.00282;
    247     p5 = 0.04093;
    248     p6 = 0.2411;
    249     p7 = -0.009442;
     293
     294    p0 = fPulseParameters[0];
     295    p1 = fPulseParameters[1];
     296    p2 = fPulseParameters[2];
     297    p3 = fPulseParameters[3];
     298    p4 = fPulseParameters[4];
     299    p5 = fPulseParameters[5];
     300    p6 = fPulseParameters[6];
     301
     302    float p0_LG, p1_LG, p2_LG, p3_LG, p4_LG, p5_LG, p6_LG;
     303    p0_LG = fPulseParametersLG[0];
     304    p1_LG = fPulseParametersLG[1];
     305    p2_LG = fPulseParametersLG[2];
     306    p3_LG = fPulseParametersLG[3];
     307    p4_LG = fPulseParametersLG[4];
     308    p5_LG = fPulseParametersLG[5];
     309    p6_LG = fPulseParametersLG[6];
    250310
    251311    // Now define the time before trigger to read FADC signal when it
     
    259319    // frequency we are simulating!
    260320
    261     fadc_time_offset = trigger_delay - p3 / FADC_SLICES_PER_NSEC; // ns
     321    fadc_time_offset = trigger_delay - p2 / FADC_SLICES_PER_NSEC; // ns
    262322
    263323    for (i=0; i< fResponseSlicesFadc ; i++ )
     
    269329        // are using another sampling frequency!):
    270330        //
    271         zed_slices = x * FADC_SLICES_PER_NSEC - p3;
    272         d=(zed_slices>0)?0.5:-0.5;
    273 
    274         sing_resp_outer[i] = (Float_t) (p1*exp(-p2*(exp(-p2*zed_slices)+
    275                                                     zed_slices))+p4+
    276                                         p5*exp(-p2*(exp(-p2*zed_slices)+
    277                                                     p6*zed_slices))+p7*d);
     331        zed_slices = x * FADC_SLICES_PER_NSEC - p2;
     332        d = (zed_slices>0)? 0.5 : -0.5;
     333
     334        sing_resp_outer[i] = (Float_t) (p0*exp(-p1*(exp(-p1*zed_slices)+
     335                                                    zed_slices))+p3+
     336                                        p4*exp(-p1*(exp(-p1*zed_slices)+
     337                                                    p5*zed_slices))+p6*d);
     338
     339        zed_slices = x * FADC_SLICES_PER_NSEC - p2_LG;
     340        d = (zed_slices>0)? 0.5 : -0.5;
     341        sing_resp_outer_lowgain[i] =  (Float_t) (p0_LG*exp(-p1_LG*(exp(-p1_LG*zed_slices)+zed_slices))+
     342                                                 p3+p4*exp(-p1_LG*(exp(-p1_LG*zed_slices)+
     343                                                                   p5*zed_slices))+p6*d);
     344
    278345        response_sum_outer += sing_resp_outer[i];
     346        response_sum_outer_LG += sing_resp_outer_lowgain[i];
    279347      }
    280348    break;
     
    288356
    289357  //   
    290   // Normalize responses to values set trhough input card: (= set gain of electronic chain)
     358  // Normalize responses to values set through input card: (= set gain of electronic chain)
    291359  // Take into account that only 1 of every SUBBINS bins of sing_resp[] will be "sampled" by
    292360  // the FADC, so we have to correct for this to get the right "FADC integral" (=integ_resp)
     
    294362  //
    295363
    296   for (i=0; i< fResponseSlicesFadc ; i++ )
     364  for (i = 0; i < fResponseSlicesFadc ; i++ )
    297365    { 
    298366      sing_resp[i] *= integ_resp / response_sum_inner * SUBBINS;
    299367      sing_resp_outer[i] *= integ_resp_outer / response_sum_outer * SUBBINS;
    300     }
    301 
    302   //
    303   //    init the Random Generator for Electonic Noise
     368
     369      // The low gain will be further scaled down later; for now we normalize it with to same
     370      // integral as the high gain.
     371      sing_resp_lowgain[i] *= integ_resp / response_sum_inner_LG * SUBBINS;
     372      sing_resp_outer_lowgain[i] *= integ_resp_outer / response_sum_outer_LG * SUBBINS;
     373    }
     374
     375  //
     376  // init the Random Generator for Electronic Noise
    304377  //
    305378
     
    333406
    334407    //
    335     // Added 15 01 2004, AM:
     408   
    336409    //
    337410    for (Int_t i = 0; i < CAMERA_PIXELS; i++)
    338       memset(sig[i], 0, (Int_t)(fSlices_mFadc*sizeof(Float_t)));
     411      {
     412        memset(sig[i], 0, (Int_t)(fSlices_mFadc*sizeof(Float_t)));    // Added 15 01 2004, AM
     413        memset(sig_LG[i], 0, (Int_t)(fSlices_mFadc*sizeof(Float_t))); // Added 01 03 2005, AM
     414      }
    339415}
    340416void MFadc::Fill( Int_t iPix, Float_t time,
     
    385461      used [iPix] = TRUE;
    386462   
    387       for (i=0; i < (Int_t) fSlices_mFadc; i++ )
    388         sig[iPix][i] = 0.;
     463      for (i=0; i < (Int_t) fSlices_mFadc; i++ )
     464        {
     465          sig[iPix][i] = 0.;
     466          sig_LG[iPix][i] = 0.;
     467        }
    389468    }
    390469
     
    429508
    430509        //
    431         // fSlices_mFadc is by default 48. sig[][] is not the true FADC, which
    432         // is filled (from sig[][]) in MFadc::TriggeredFadc()
     510        // fSlices_mFadc is by default 48. sig[][] is not the final FADC output; that
     511        // will be later filled (from sig[][]) in MFadc::TriggeredFadc()
    433512        //
    434         if ( (ichanfadc) < (Int_t) fSlices_mFadc ) 
    435           sig[iPix][ichanfadc] += (amplitude * sing_resp[i] );
     513        if ( (ichanfadc) < (Int_t) fSlices_mFadc )
     514          {
     515            sig[iPix][ichanfadc] += (amplitude * sing_resp[i] );
     516            sig_LG[iPix][ichanfadc] += (amplitude * sing_resp_lowgain[i] );
     517          }
    436518      }
    437 
    438519  }
    439520  else
     
    466547   
    467548      for (i=0; i < (Int_t) fSlices_mFadc; i++)
    468         sig[iPix][i] = 0.;
     549        {
     550          sig[iPix][i] = 0.;
     551          sig_LG[iPix][i] = 0.;
     552        }
    469553    }
    470554
     
    485569
    486570        if ( (ichanfadc) < (Int_t)fSlices_mFadc )
    487           sig[iPix][ichanfadc] += (amplitude * sing_resp_outer[i] );
     571          {
     572            sig[iPix][ichanfadc] += (amplitude * sing_resp_outer[i] );
     573            sig_LG[iPix][ichanfadc] += (amplitude * sing_resp_outer_lowgain[i] );
     574          }
     575
    488576      }
    489577   
     
    496584}
    497585
    498 void MFadc::Set( Int_t iPix, Float_t *resp) {
    499  
    500   //
    501   // Sets the information about fadc reponse from a given array
    502   //
    503   // parameter is the number of the pixel and the values to be set
    504   //
     586void MFadc::AddSignal( Int_t iPix, Float_t *resp) {
     587 
     588  //
     589  // Adds signals to the fadc reponse from a given array
     590  // Parameters are the number of the pixel and the values to be added
     591  // With add the signal equally to the high and low gain branch. The low
     592  // gain branch is not yet scaled down!!
    505593  //
    506594
     
    511599  //   if this is the first use, reset all signal for that pixels
    512600  //
    513   if ( iPix > numpix ) {
    514     cout << " WARNING:  MFadc::Fill() :  iPix greater than CAMERA_PIXELS"
    515          << endl ;
    516     exit(987) ;
    517   }
    518 
    519   if ( used[iPix] == FALSE ) {
    520     used [iPix] = TRUE ;
     601  if ( iPix > numpix )
     602    {
     603      cout << " WARNING:  MFadc::Fill() :  iPix greater than CAMERA_PIXELS"
     604           << endl ;
     605      exit(987) ;
     606    }
     607
     608  if ( used[iPix] == FALSE )
     609    {
     610      used [iPix] = TRUE ;
    521611   
    522     for (i=0; i < (Int_t)fSlices_mFadc; i++ ) {
    523       sig[iPix][i] = 0. ;
    524     }
    525   }
    526   for ( i = 0 ; i<(Int_t)fSlices_mFadc; i++ ) {
    527     sig[iPix][i] = resp[i] ;
    528   }
    529 
    530 }
    531 
    532 void MFadc::AddSignal( Int_t iPix, Float_t *resp) {
    533  
    534   //
    535   // Adds signals to the fadc reponse from a given array
    536   //
    537   // parameters are the number of the pixel and the values to be added
    538   //
    539   //
    540 
    541   Int_t i ;
    542  
    543   //
    544   //   first we have to check if the pixel iPix is used or not until now
    545   //   if this is the first use, reset all signal for that pixels
    546   //
    547   if ( iPix > numpix ) {
    548     cout << " WARNING:  MFadc::Fill() :  iPix greater than CAMERA_PIXELS"
    549          << endl ;
    550     exit(987) ;
    551   }
    552 
    553   if ( used[iPix] == FALSE ) {
    554     used [iPix] = TRUE ;
    555    
    556     for (i=0; i < (Int_t)fSlices_mFadc; i++ ) {
    557       sig[iPix][i] = 0. ;
    558     }
    559   }
    560   for ( i = 0 ; i<(Int_t)fSlices_mFadc; i++ ) {
    561     sig[iPix][i] += resp[i] ;
    562   }
     612      for (i=0; i < (Int_t)fSlices_mFadc; i++ )
     613        {
     614          sig[iPix][i] = 0. ;
     615          sig_LG[iPix][i] = 0. ;
     616        }
     617    }
     618  for ( i = 0 ; i<(Int_t)fSlices_mFadc; i++ )
     619    {
     620      sig[iPix][i] += resp[i] ;
     621      sig_LG[iPix][i] += resp[i] ;
     622    }
    563623
    564624}
     
    584644  }
    585645}
    586  
    587 
    588 void MFadc::Baseline(){
    589   // 
    590   //  It simulates the AC behaviour
    591 
    592   int i,j;
    593   Float_t baseline;
    594 
    595   for(j=0;j<numpix;j++){
    596     baseline=0.0;
    597     for(i=0;i<(Int_t) fSlices_mFadc;i++){
    598       baseline+=sig[j][i];
    599     }
    600     baseline=baseline/fSlices_mFadc;
    601     for(i=0;i<(Int_t) fSlices_mFadc;i++){
    602       sig[j][i]=-baseline;
    603     }
    604   }
    605 }
     646
    606647
    607648void MFadc::Pedestals(){
     
    616657  for(i=0;i<numpix;i++)
    617658    for(j=0;j<(Int_t)fSlices_mFadc;j++)
    618         sig[i][j]+=pedestal[i];
     659      {
     660        sig[i][j] += pedestal[i];
     661        sig_LG[i][j] += pedestal[i];
     662      }
     663
    619664  //
    620665  // AM 15 01 2003: Formerly the above operation was performed only
     
    625670}
    626671
    627 void MFadc::Offset(Float_t offset, Int_t pixel){
    628   //
    629   //  It puts an offset in the FADC signal
    630   //
    631 
    632   int i,j;
    633   float fdum;
    634   TRandom *GenOff = new TRandom () ;
    635 
    636   if (offset<0) {
    637     //  It cannot be, so the program assumes that
    638     //  it should generate random values for the offset.
    639 
    640     if (pixel<0) {
    641       // It does not exist, so all pixels will have the same offset
    642 
    643       for(i=0;i<numpix;i++){
    644         if (used[i]){
    645           fdum=(10*GenOff->Rndm());
    646           for(j=0;j<(Int_t) fSlices_mFadc;j++)
    647             sig[i][j]+=fdum;
    648         }
    649       }
    650     } else {
    651       // The program will put the specifies offset to the pixel "pixel".
    652 
    653       if (used[pixel]){
    654         fdum=(10*GenOff->Rndm());
    655         for(j=0;j<(Int_t) fSlices_mFadc;j++)
    656           sig[pixel][j]+=fdum;
    657         }
    658 
    659     }
    660   }else {
    661     //  The "offset" will be the offset for the FADC
    662 
    663     if (pixel<0) {
    664       // It does not exist, so all pixels will have the same offset
    665 
    666       for(i=0;i<numpix;i++){
    667         if (used[i]){
    668           for(j=0;j<(Int_t) fSlices_mFadc;j++)
    669             sig[i][j]+=offset;
    670         }
    671       }
    672     } else {
    673       // The program will put the specifies offset to the pixel "pixel".
    674 
    675       if (used[pixel]){
    676         for(j=0;j<(Int_t) fSlices_mFadc;j++)
    677           sig[pixel][j]+=offset;
    678       }
    679     }
    680   }
    681   delete GenOff;
    682 }
    683672
    684673void MFadc::SetElecNoise(Float_t value1, Float_t value2, UInt_t n_in_pix){
     
    716705    //
    717706
    718     startslice=GenElec->Integer(((Int_t)fSlices_mFadc)*1000);
     707    startslice = GenElec->Integer(((Int_t)fSlices_mFadc)*1000);
    719708
    720709    if ( used[i] == FALSE )
     
    722711        used [i] = TRUE ;
    723712        if (i < fInnerPixelsNum)
     713          {
    724714            memcpy( (Float_t*)&sig[i][0],
    725715                    (Float_t*)&noise[startslice],
    726716                    ((Int_t) fSlices_mFadc)*sizeof(Float_t));
     717            memcpy( (Float_t*)&sig_LG[i][0],
     718                    (Float_t*)&noise[startslice],
     719                    ((Int_t) fSlices_mFadc)*sizeof(Float_t));
     720          }
     721
    727722        else
     723          {
    728724            memcpy( (Float_t*)&sig[i][0],
    729725                    (Float_t*)&noise_outer[startslice],
    730726                    ((Int_t) fSlices_mFadc)*sizeof(Float_t));
     727            memcpy( (Float_t*)&sig_LG[i][0],
     728                    (Float_t*)&noise_outer[startslice],
     729                    ((Int_t) fSlices_mFadc)*sizeof(Float_t));
     730          }
    731731    }
    732732
     
    737737    {
    738738        if (i < fInnerPixelsNum)
    739             for ( Int_t is=0 ; is< (Int_t)fSlices_mFadc ; is++ )
     739            for ( Int_t is = 0 ; is < (Int_t)fSlices_mFadc ; is++ )
     740              {
    740741                sig[i][is] += noise[startslice+is];
     742                sig_LG[i][is] += noise[startslice+is];
     743              }
    741744        else
    742             for ( Int_t is=0 ; is< (Int_t)fSlices_mFadc ; is++ )
     745            for ( Int_t is = 0 ; is < (Int_t)fSlices_mFadc ; is++ )
     746              {
    743747                sig[i][is] += noise_outer[startslice+is];
     748                sig_LG[i][is] += noise_outer[startslice+is];
     749              }
    744750    }
    745751  }
     
    888894Float_t MFadc::AddNoiseInSlices( Int_t pix, Int_t ishigh, Int_t n_slices) {
    889895
    890   Float_t sum=0;
     896  Float_t sum = 0;
    891897  Float_t fvalue = 0.;
    892   UChar_t value=0;
    893  
    894   Float_t factor;
     898  UChar_t value = 0;
    895899  UInt_t startslice;
    896900
    897901  //
    898   // If we deal with low gain, we have to scale the values in sig[][] by
    899   // the gain ratio (high2low_gain), since "sig" contains here the noise
    900   // produced before the receiver boards (for instance NSB noise)
    901   //
    902   factor=(ishigh?1.0:high2low_gain);
    903 
    904   //
    905902  // Get at random a point in the FADC presimulated digital noise:
    906903  //
     
    909906  for ( Int_t is=0; is < n_slices ; is++ )
    910907    {
    911         fvalue = pedestal[pix]+(sig[pix][is]-pedestal[pix])/factor;
    912         fvalue += digital_noise[startslice+is];
    913 
    914         fvalue = fvalue < 0? fvalue-0.5 : fvalue+0.5;
    915 
    916         value = fvalue < 0.? (UChar_t) 0 :
    917           (fvalue > 255.? 255 : (UChar_t) fvalue);
    918 
     908      if (ishigh)
     909        fvalue = sig[pix][is];
     910      else
     911        // If we deal with low gain, we have to scale the values in sig_LG[][] by
     912        // the gain ratio (high2low_gain), since "sig_LG" contains at this point the
     913        // noise produced before the receiver boards (for instance NSB noise).
     914        //
     915        fvalue = pedestal[pix]+(sig_LG[pix][is]-pedestal[pix]) / high2low_gain;
     916
     917      fvalue += digital_noise[startslice+is]; // We add the noise intrinsic to FADC
     918
     919      fvalue = fvalue < 0? fvalue-0.5 : fvalue+0.5;
     920
     921      value = fvalue < 0.? (UChar_t) 0 :
     922        (fvalue > 255.? 255 : (UChar_t) fvalue);
    919923
    920924      // Add up slices:
     
    933937  // is NOT done here (it is already done in MFadc::Fill). This procedure only
    934938  // selects which FADC slices to write out, out of those contained in the sig[][]
    935   // array.
     939  // and sig_LG[][] arrays.
    936940  //
    937941
     
    9981002              if (switch_i > 0 && (i+fFadcSlices) >= switch_i)
    9991003                output_lowgain[ip][i] = pedestal[ip] +
    1000                   (sig[ip][is-(fHi2LoGainPeak-fFadcSlices)]-pedestal[ip])/high2low_gain;
     1004                  (sig_LG[ip][is-(fHi2LoGainPeak-fFadcSlices)]-pedestal[ip])/high2low_gain;
    10011005              // Once the shift occurs, low gain is filled with the high
    10021006              // gain signal scaled down by the factor high2low_gain
     
    10101014          else // We are beyond the simulated signal history in sig[][]! Put just mean pedestal!
    10111015            {
    1012               output_lowgain[ip][i]= pedestal[ip];
     1016              output_lowgain[ip][i] = pedestal[ip];
    10131017            }
    10141018          i++;
  • trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.hxx

    r6588 r6692  
    6969  //
    7070  Float_t *sig[CAMERA_PIXELS];
     71  Float_t *sig_LG[CAMERA_PIXELS];
    7172
    7273  Float_t *noise;
     
    9091  Float_t integ_resp;    // area below curve of the phe_response function (in counts * ns)
    9192  Float_t *sing_resp;    // the shape of the phe_response function
     93  Float_t *sing_resp_lowgain; // phe response for the low gain
    9294
    9395  Float_t fFadcSlicesPerNanosec; // Number of FADC slices per nanosecond, that is, the
     
    106108  Float_t integ_resp_outer; // area below curve of the phe_response function (in counts * ns)
    107109  Float_t *sing_resp_outer; // the shape of the phe_response function
     110  Float_t *sing_resp_outer_lowgain; // phe response for the low gain
    108111
    109112  Int_t fGainSwitchAmp; // Height of the high gain signal (in ADC counts) at which we decide
     
    130133                            // and the peak position in the FADC of the signal
    131134                            // in the trigger pixels.
     135
     136  Float_t fPulseParameters[7];    // Parameters for the parametrization of the real pulse shape
     137  Float_t fPulseParametersLG[7];  // The same for low gain
    132138
    133139public:
     
    157163  void FillOuter( Int_t, Float_t, Float_t  ) ; 
    158164
    159   void Set( Int_t iPix, Float_t *res);
    160165  void AddSignal( Int_t iPix, Float_t *res);
    161166
     
    185190  }
    186191
    187   void Baseline();
    188192
    189193  void Pedestals();
    190 
    191   void Offset( Float_t, Int_t );
    192194
    193195  void SetElecNoise(Float_t value1=2.0, Float_t value2=2.0, UInt_t ninpix=CAMERA_PIXELS);
Note: See TracChangeset for help on using the changeset viewer.