Ignore:
Timestamp:
10/29/03 19:13:11 (21 years ago)
Author:
blanch
Message:
New constructor needed to decouple StarResponse from MARS.
File:
1 edited

Legend:

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

    r2393 r2443  
    552552    fclose (unit) ;
    553553  }
     554
     555  //
     556  //
     557  //  set all the booleans used to FALSE, indicating that the pixel is not
     558  //  used in this event.
     559  //
     560 
     561  for ( i =0 ; i <pixnum ; i++ ) {
     562    used [i] = FALSE ;
     563    dknt [i] = FALSE ;
     564
     565    nphotshow[i] = 0 ;
     566    nphotnsb [i] = 0 ;
     567    nphotstar[i] = 0 ;
     568
     569    baseline[i] = 0 ;
     570  }
     571
     572  for ( ii=0 ; ii<TRIGGER_TIME_SLICES; ii++ ) {
     573    sum_d_sig[ii] = 0. ; 
     574  }
     575 
     576  //
     577  //   set the information about the Different Level Triggers to zero
     578  //
     579
     580  nZero = nFirst = nSecond = 0 ;
     581
     582  for (ii=0 ; ii<TRIGGER_TIME_SLICES; ii++ ) {
     583    SlicesZero[ii] = FALSE;
     584  }
     585 
     586  for ( i = 0 ; i < 5 ; i++) {
     587    SlicesFirst[i]  = -50 ;
     588    SlicesSecond[i] = -50 ;
     589    PixelsFirst[i]  = -1;
     590    PixelsSecond[i] = -1;
     591  }
     592  cout << " end of MTrigger::MTrigger()" << endl ;
     593}
     594MTrigger::MTrigger(Int_t pix,
     595                   float gate, float overt, float ampl, float fwhm) {
     596  // ============================================================
     597  //
     598  //  constructor
     599  // 
     600  //  The procedure is the following:
     601  //
     602  //  1. Allocation of some memory needed
     603  //  2. some parameters of the trigger are set.   
     604  //  3. Then the all signals are set to zero
     605
     606  Int_t  i, ii ;
     607
     608  Float_t threshold ;
     609 
     610  // Number of pixels in the trigger region
     611  pixnum=pix;
     612 
     613  //
     614  //   allocate the memory for the 2dim arrays (a_sig, d_sig )
     615  //
     616
     617  used = new Bool_t[pix];
     618  nphotshow = new Int_t[pix];
     619  nphotnsb = new Int_t[pix];
     620  nphotstar = new Int_t[pix];
     621  a_sig = new Float_t * [pix];
     622  d_sig = new Float_t * [pix];
     623  baseline = new Float_t[pix];
     624  dknt = new Bool_t[pix];
     625  noise = new Float_t[TRIGGER_TIME_SLICES*1001];
     626  chan_thres = new Float_t[pix];
     627  for(Int_t j=0;j<6;j++)
     628    NN[j] = new Int_t[pix];
     629  for(Int_t j=0;j<TRIGGER_CELLS;j++)
     630    TC[j] = new Int_t[pix];
     631
     632  for( Int_t j=0; j<pix; j++ ) {
     633
     634    a_sig[j] = new Float_t[TRIGGER_TIME_SLICES] ;
     635
     636    d_sig[j] = new Float_t[TRIGGER_TIME_SLICES] ;
     637  }
     638
     639  //
     640  //   set the values for the standard response pulse
     641  //
     642
     643  fwhm_resp = fwhm       ;
     644  ampl_resp = ampl  ;
     645
     646  overlaping_time = overt;
     647
     648   
     649  threshold = CHANNEL_THRESHOLD  ;
     650 
     651
     652  gate_leng        = gate       ;
     653  trigger_multi    = TRIGGER_MULTI      ;
     654  trigger_geometry = TRIGGER_GEOM ;
     655
     656  cout << endl
     657       << "[MTrigger]  Setting up the MTrigger with this values "<< endl ;
     658  cout << "[MTrigger]    Gate Length:        " << gate_leng  << " ns"
     659       << endl ;
     660  cout << "[MTrigger]    Overlaping time:    " << overlaping_time << " ns"
     661       << endl ;
     662  cout << "[MTrigger]    Response FWHM:      " << fwhm_resp  << " ns"
     663       << endl ;
     664  cout << "[MTrigger]    Response Amplitude: " << ampl_resp  << " mV"
     665       << endl ;
     666  cout << endl ;
     667
     668  for (Int_t k=0; k<pixnum; k++ ) {
     669    chan_thres[k] = threshold ;
     670  }
     671 
     672  //
     673  //    set up the response shape
     674  //
     675     
     676  Float_t   sigma ;
     677  Float_t   x, x0 ;
     678
     679  sigma = fwhm_resp / 2.35 ;
     680  x0 = 3*sigma ;
     681 
     682  for (i=0; i< RESPONSE_SLICES ; i++ ) { 
     683
     684    x = i * (1./((Float_t)SLICES_PER_NSEC))
     685      + (1./( 2 * (Float_t)SLICES_PER_NSEC ))  ;
     686   
     687    sing_resp[i] =
     688      ampl_resp * expf(-0.5 * (x-x0)*(x-x0) / (sigma*sigma) ) ;
     689 
     690  }
     691
     692  //
     693  //    look for the time between start of response function and the
     694  //    maximum value of the response function. This is needed by the
     695  //    member functions FillNSB() and FillStar()
     696  // 
     697
     698  Int_t imax  = 0  ;
     699  Float_t max = 0. ;
     700  for (i=0; i< RESPONSE_SLICES ; i++ ) { 
     701    if ( sing_resp[i] > max ) {
     702      imax = i ;
     703      max  = sing_resp[i] ;
     704    }
     705  }
     706 
     707  peak_time = ( (Float_t) imax )  / ( (Float_t) SLICES_PER_NSEC ) ;
     708 
     709  //
     710  //   the amplitude of one single photo electron is not a constant.
     711  //   There exists a measured distribution from Razmik. This distribution
     712  //   is used to simulate the noise of the amplitude.
     713  //   For this a histogramm (histPmt) is created and filled with the
     714  //   values.
     715  //
     716
     717  histPmt = new TH1F ("histPmt","Noise of PMT", 40, 0., 40.) ;
     718 
     719  Stat_t ValRazmik[41] = { 0., 2.14, 2.06, 2.05, 2.05, 2.06, 2.07, 2.08,  2.15,
     720                           2.27, 2.40, 2.48, 2.55, 2.50, 2.35, 2.20,  2.10,
     721                           1.90, 1.65, 1.40, 1.25, 1.00, 0.80, 0.65,  0.50,
     722                           0.35, 0.27, 0.20, 0.18, 0.16, 0.14, 0.12,  0.10,
     723                           0.08, 0.06, 0.04, 0.02, 0.01, 0.005,0.003, 0.001} ;
     724
     725  histMean =  histPmt->GetMean() ;   
     726 
     727  for (i=0;i<41;i++){
     728    histPmt->SetBinContent(i,ValRazmik[i]);
     729  }
     730
     731  histMean =  histPmt->GetMean() ;
     732
     733  //
     734  //   create the random generator for the Electronic Noise
     735  //
     736
     737  GenElec = new TRandom() ;
    554738
    555739  //
     
    12921476    }
    12931477  }
     1478
    12941479
    12951480  //
Note: See TracChangeset for help on using the changeset viewer.