Changeset 5318 for trunk/MagicSoft


Ignore:
Timestamp:
10/26/04 15:02:32 (20 years ago)
Author:
moralejo
Message:
Added option to switch off gain fluctuations (gain_fluctuations_off)
For calibration file, added writing of fadc_jitter value to the root
output file, in MMcEvt.fTimeFirst, useful for signal extraction tests.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx

    r5305 r5318  
    2121//
    2222// $RCSfile: camera.cxx,v $
    23 // $Revision: 1.78 $
     23// $Revision: 1.79 $
    2424// $Author: moralejo $
    25 // $Date: 2004-10-21 17:44:07 $
     25// $Date: 2004-10-26 14:02:32 $
    2626//
    2727////////////////////////////////////////////////////////////////////////
     
    827827 
    828828  log(SIGNATURE,
    829       "%s:\n\t%20s: %s\n\t%20s: %s\n\t%20s: %s\n\t%20s: %s %3.2f, %s %3.2f (%s), %3.2f (%s) + %3.2f (%s) %s\n",
     829      "%s:\n\t%20s: %s\n\t%20s: %s\n\t%20s: %s\n\t%20s: %s\n\t\t %s %3.2f,\n\t\t %s %3.2f (%s), %3.2f (%s) \n\t\t + %3.2f (%s)\n\n",
    830830      "Flags",
    831831      "Data_From_STDIN",   ONoff(Data_From_STDIN), 
    832832      "Write_All_Events",  ONoff(Write_All_Images),
    833833      "Rotate Starfield",  ONoff(Starfield_rotate),
    834       "Electronic Noise",  "trigger (rel. noise): ", Trigger_noise,
    835       "FADC (ADC counts): ", FADC_noise_inner, "inner pixels",
    836       FADC_noise_outer, "outer pixels",
    837       DIGITAL_noise, "added digital noise at FADC", ONoff(addElecNoise)
     834      "Electronic Noise",  ONoff(addElecNoise),
     835      "Trigger noise (amplitude relative to that of single phe): ",
     836      Trigger_noise,
     837      "FADC noise (ADC counts): ", FADC_noise_inner, "inner p.",
     838      FADC_noise_outer, "outer p.",
     839      DIGITAL_noise, "added digital noise at FADC"
    838840      );
     841
     842  if (! apply_gain_fluctuations())
     843    log(SIGNATURE, "PMT gain fluctuations have been switched OFF in the input card.\n\n");
    839844
    840845  // log flags information
     
    931936                    Trigger_response_fwhm, i);  //@< A instance of the Class MTrigger
    932937    Trigger_CT[i]->SetSeed(UInt_t(i+get_seeds(0)));
     938
     939    if ( ! apply_gain_fluctuations())
     940      Trigger_CT[i]->SetGainFluctuations(kFALSE);
    933941  }
    934942
     
    40334041  // totally equivalent to having made  +- 1 FADC slice
    40344042
    4035   float fadc_jitter = (1./fadc->GetFadcSlicesPerNanosec()) * random.Uniform(0., 1.);
     4043  float fadc_jitter = (1./fadc->GetFadcSlicesPerNanosec()) * random.Uniform(0., 1.); //ns
    40364044
    40374045  //- - - - - - - - - - - - - - - - - - - - - - - - -
     
    44714479  int *ntotphot = new int[ct_Number];
    44724480  float *nphe_from_nsb = new float[ct_Number];
    4473 
    4474   float timefirst = 0.;
    4475   float timelast = 0.;
     4481  float *pulsetime = new float[ct_Number];
    44764482 
    44774483  float lambda, sigma_lambda, phot_per_pix, sigma_time;
    44784484  UInt_t *first_pixel, *last_pixel;
    44794485  int selected_pixel;
     4486
     4487  TRandom random;
     4488  random.SetSeed((UInt_t)(get_seeds(0)*get_seeds(0)));
     4489
     4490  for (int ict = 0; ict < ct_Number; ict++)
     4491    pulsetime[ict] = 0.;
    44804492
    44814493  // Get parameters of the calibration:
     
    45344546      // Produce the photoelectrons
    45354547      for(int ict = 0; ict < ct_Number; ict++)
    4536         produce_calib_phes( (MGeomCam*)(camgeom.UncheckedAt(ict)),
    4537                             Trigger_CT[ict],
    4538                             Fadc_CT[ict],
    4539                             &(ntotphe[ict]),
    4540                             pheinpix,
    4541                             &(ntotphot[ict]),
    4542                             ict,
    4543                             lambda,
    4544                             sigma_lambda,
    4545                             phot_per_pix,
    4546                             sigma_time,
    4547                             selected_pixel
    4548                             );
     4548        {
     4549          // Obtain the FADC jitter of 1 FADC slice. This is a time to be added to the
     4550          // time of all photons in an event, before digitalization of the signal. It is
     4551          // therefore the same time shift for all pixels in a CT.
     4552
     4553          float fadc_jitter =
     4554            (1./Fadc_CT[ict]->GetFadcSlicesPerNanosec()) * random.Uniform(0., 1.); //ns
     4555
     4556
     4557          produce_calib_phes( (MGeomCam*)(camgeom.UncheckedAt(ict)),
     4558                              Trigger_CT[ict],
     4559                              Fadc_CT[ict],
     4560                              &(ntotphe[ict]),
     4561                              pheinpix,
     4562                              &(ntotphot[ict]),
     4563                              ict,
     4564                              lambda,
     4565                              sigma_lambda,
     4566                              phot_per_pix,
     4567                              sigma_time,
     4568                              selected_pixel,
     4569                              fadc_jitter
     4570                              );
     4571
     4572          pulsetime[ict] = fadc_jitter; // Keep value for writing it to output.
     4573        }
    45494574
    45504575      // NSB simulation
     
    46124637          // The additional value 3*sigma_time makes that the pulse maximum is, in
    46134638          // average, in the same position no matter of the time width of the pulse
    4614           // (see in produce_calib_phes(...) that in order to avoid negative times
     4639          // (see that, in produce_calib_phes(...), in order to avoid negative times
    46154640          // we shift the time of the photons by this same amount!)
    46164641
    46174642          Fadc_CT[ict]->TriggeredFadc(3.+3*sigma_time);
     4643
     4644          // Add the "digital noise": electronic noise intrinsic to the FADC and which
     4645          // therefore is not scaled down in the low gain slices!
     4646
     4647          Fadc_CT[ict]->DigitalNoise();
    46184648
    46194649          //
     
    46234653
    46244654          McEvt[ict]->Fill( 0, 0, 0., -1.0, -1.0, -1.0, 0., 0., 0., 0., 0.,
    4625                             0., 0., 0., timefirst, timelast, 0., 0., 0.,
     4655                            0., 0., 0., pulsetime[ict], 0., 0., 0., 0.,
    46264656                            0., 0., 0., 0., 0, 0, 0,
    46274657                            (UInt_t) ntotphot[ict],
     
    46774707                        float     phot_per_pix,  // Average # of photons per inner pixel
    46784708                        float     sigma_time,    // Sigma of time spread of photons
    4679                         int       selected_pixel // if >= 0, only this pixel is used!
     4709                        int       selected_pixel,// if >= 0, only this pixel is used!
     4710                        float     fadc_jitter    // Random shift (max 1 slice) of pulses in
     4711                                                 // FADC, to simulate FADC clock noise.
    46804712                        )
    46814713{
     
    46984730  TRandom random;
    46994731  random.SetSeed(seed);
    4700 
    4701   // Introduce the FADC jitter of 1 FADC slice. This is a time to be added to the
    4702   // time of all photons in an event, before digitalization of the signal. We use
    4703   // a positive value between 0 and 1 slice for technical reasons, but it is
    4704   // totally equivalent to having made  +- 1 FADC slice
    4705 
    4706   float fadc_jitter = (1./fadc->GetFadcSlicesPerNanosec()) * random.Uniform(0., 1.);
    47074732
    47084733  //
     
    47334758  for (int iph = 0; iph < total_photons; iph++)
    47344759    {
    4735 
    4736       // time
     4760      //
     4761      // Simulate arrival times of photons to camera plane. We do not simulate the small
     4762      // delays between pixels due to the different distances to the pulser.
     4763      //
    47374764      // We do not want negative times, so center the gaussian at 3 sigma
    47384765      // and reject negative values:
     
    48834910//
    48844911// $Log: not supported by cvs2svn $
     4912// Revision 1.78  2004/10/21 17:44:07  moralejo
     4913//
     4914//  Fixed error recently introduced in MLons::GetResponse. The NSB database
     4915//  was not correclt ycopied to the FADC when the randomly selected time was
     4916//  too close to the end of the database. This happened about 2% of times and
     4917//  produced some repetitive noise peaks in the FADC.
     4918//  Changed in camera.cxx the arguments of lons.SetSeed y lons_outer.SetSeed
     4919//
    48854920// Revision 1.77  2004/10/19 10:35:05  moralejo
    48864921// *** empty log message ***
Note: See TracChangeset for help on using the changeset viewer.