Ignore:
Timestamp:
07/17/03 19:09:15 (21 years ago)
Author:
blanch
Message:
Fater ElecNoise simulation
File:
1 edited

Legend:

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

    r1250 r2292  
    337337    PixelsSecond[i] = -1;
    338338  }
     339
    339340  cout << " end of MTrigger::MTrigger()" << endl ;
    340341}
     
    852853}
    853854
     855void MTrigger::SetElecNoise(Float_t factor){
     856
     857  UInt_t i;
     858  Float_t rausch ;
     859
     860  rausch = RESPONSE_AMPLITUDE * factor ;
     861 
     862  cout<<"MTrigger::SetElecNoise ... generating database for electroni noise."
     863      <<endl;
     864
     865  for (i=0;i<TRIGGER_PIXELS*TRIGGER_TIME_SLICES*101;i++){
     866    noise[i]=GenElec->Gaus(0., rausch  );
     867      }
     868
     869  cout<<"MTrigger::SetElecNoise ... done"<<endl;
     870
     871}
     872
    854873void MTrigger::ElecNoise(Float_t factor) {
    855874  // ============================================================
     
    861880
    862881  rausch = RESPONSE_AMPLITUDE * factor ;
     882
     883  UInt_t startslice;
     884
     885  startslice=GenElec->Integer(TRIGGER_PIXELS*TRIGGER_TIME_SLICES*100);
     886
     887
    863888 
    864889  for ( Int_t i=0 ; i < TRIGGER_PIXELS; i++  ) {
     
    867892      //  hitted the first time
    868893      //
     894
     895    if ( used[i] == FALSE ) {
     896        used [i] = TRUE ;
     897       
     898        memcpy( (Float_t*)a_sig[i],
     899                (Float_t*)&noise[startslice+TRIGGER_TIME_SLICES*i],
     900                TRIGGER_TIME_SLICES*sizeof(Float_t));
     901        memset( (Float_t*)d_sig[i],
     902                0,
     903                TRIGGER_TIME_SLICES*sizeof(Float_t));
     904       
     905    }
     906    //     
     907    //  Then the noise is introduced for each time slice
     908    //
     909    else
     910      for ( Int_t ii=1 ; ii<TRIGGER_TIME_SLICES; ii++ ) {
    869911     
    870       if ( used[i] == FALSE ) {
    871           used [i] = TRUE ;
    872          
    873           for (Int_t ii=0; ii < TRIGGER_TIME_SLICES; ii++ ) {
    874               a_sig[i][ii] = 0. ;
    875               d_sig[i][ii] = 0. ;
    876           }
    877       }
    878       //     
    879       //  Then the noise is introduced for each time slice
    880       //
    881       for ( Int_t ii=1 ; ii<TRIGGER_TIME_SLICES; ii++ ) {
    882          
    883           a_sig [i][ii] +=  GenElec->Gaus(0., rausch  ) ;
    884          
    885       }
     912        a_sig [i][ii] +=  noise[startslice+TRIGGER_TIME_SLICES*i+ii] ;
     913       
     914      }
     915   
    886916  }
    887917}
Note: See TracChangeset for help on using the changeset viewer.