Ignore:
Timestamp:
01/30/04 09:51:18 (21 years ago)
Author:
blanch
Message:
[Changes mainly done by A. Moralejo]

Several minnor changes have been done. For instance, some name of the
variables have been modified to a more self-explained name and
modifications while reading the asciis files at the end of the reflector file
has been introduced.

The possibilty to unlarge the point spread function has been introduced
in order to be able to simualte the current data.

All pixels are always written.
File:
1 edited

Legend:

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

    r2453 r2962  
    1 //!/////////////////////////////////////////////////////////////////////
     1////!/////////////////////////////////////////////////////////////////////
    22//
    33// camera               
     
    2121//
    2222// $RCSfile: camera.cxx,v $
    23 // $Revision: 1.66 $
     23// $Revision: 1.67 $
    2424// $Author: blanch $
    25 // $Date: 2003-11-03 12:58:40 $
     25// $Date: 2004-01-30 09:51:18 $
    2626//
    2727////////////////////////////////////////////////////////////////////////
     
    199199
    200200//@: Properties of the FADC
    201 static float FADC_response_ampl = MFADC_RESPONSE_AMPLITUDE;
     201static float FADC_response_ampl = MFADC_RESPONSE_INTEGRAL;
    202202static float FADC_response_fwhm = MFADC_RESPONSE_FWHM;
    203 static float FADC_resp_ampl_out = MFADC_RESPONSE_AMPLITUDE;
     203static float FADC_resp_ampl_out = MFADC_RESPONSE_INTEGRAL;
    204204static float FADC_resp_fwhm_out = MFADC_RESPONSE_FWHM;
    205205static float FADC_noise = 2.0;
     
    330330  char GeometryName[100][50];            //@< Name of MGeomCam for each CT
    331331  int GeometryCamera[100];           //@< Identification of MGeomCam for each CT
    332   int TriggerPixels[100];           //@< Numeber of pixels in the trigger region for each CT
     332  int TriggerPixels[100];           //@< Number of pixels in the trigger region for each CT
    333333
    334334  int reflector_file_version=0;  //@< vrsion of he reflector file
     
    682682
    683683    // Look to factor for NSB respect to emi_coat PMTs
    684     if(!strcmp(qe_filename,"../Data/qe-emi-coat.RFL.dat"))
     684    if(strstr(qe_filename,"qe-emi-coat.RFL.dat") != 0)
    685685      factorqe_NSB[ict]=EMICOAT_NSB;
    686     else if(!strcmp(qe_filename,"../Data/qe-emi.RFL.dat"))
     686    else if(strstr(qe_filename,"qe-emi.RFL.dat") != 0)
    687687      factorqe_NSB[ict]=EMI_NSB;
    688     else if(!strcmp(qe_filename, "../Data/qe-intevac_hpd.RFL.dat"))
     688    else if(strstr(qe_filename, "qe-intevac_hpd.RFL.dat") != 0)
    689689      factorqe_NSB[ict]=HPD_NSB;
    690690    else{
     
    852852
    853853  for (int ict=0; ict<ct_Number;ict++){
    854   // Generate databse for trigger electronic noise
     854  // Generate database for trigger electronic noise
    855855    if (addElecNoise)   
    856856      Trigger_CT[ict]->SetElecNoise(Trigger_noise) ;
     
    912912      new  MFadc(((MGeomCam*)(camgeom.UncheckedAt(i)))->GetNumPixels(),
    913913                 FADC_response_ampl,FADC_response_fwhm,
    914                  FADC_resp_ampl_out,FADC_resp_fwhm_out) ; //@< A instance of the Class MFadc
     914                 FADC_resp_ampl_out,FADC_resp_fwhm_out,
     915                 get_trig_delay()
     916          ) ; //@< A instance of the Class MFadc
    915917
    916918
     
    936938    Fadc_CT[ict]->SetHigh2LowGain(FADC_high2low);
    937939   
    938     // Generate databse for the Fadc electronic noise
     940    // Generate database for the Fadc electronic noise
    939941    if (addElecNoise){       
    940942      Fadc_CT[ict]->SetElecNoise(FADC_noise);
     
    15891591       
    15901592        ++nshow;
    1591         if((nshow+ntshow)%100 == 1)
     1593        if((nshow+ntshow+1)%100 == 1)
    15921594          log(SIGNATURE, "Event %d(+%d)\n", nshow, ntshow);
    15931595       
     
    18041806            rho = rho*180/3.14159;
    18051807
    1806             // Rottion of the NSB
     1808            // Rotation of the NSB
    18071809            // FIXME --- We should rotate for all cameras. Is it always the same rho?   
    18081810            for(int ict=0;ict<ct_Number;ict++){     
     
    18471849          }
    18481850          ntcph[ict]+=ncph[ict];
    1849           if ((nshow+ntshow)%100 == 1){
     1851          if ((nshow+ntshow+1)%100 == 1){
    18501852            log(SIGNATURE, "End of this event: %d cphs(+%d). . .\n",
    18511853                ncph[ict], ntcph[ict]);
     
    20252027                            i<((MGeomCam*)(camgeom.UncheckedAt(0)))
    20262028                              ->GetNumPixels();i++){
    2027                           if(!Fadc_CT[0]->IsPixelUsed(i)) continue;
     2029//
     2030// AM 15 01 2004: commented out "continue" statement, so that also pixels
     2031// with no C-photons will be written to the output in case the camera
     2032// is run with no noise.                   
     2033//                        if(!Fadc_CT[0]->IsPixelUsed(i)) continue;
     2034//
    20282035                          for (j=0;j<FADC_SLICES;j++){
    20292036                            fadcValues->AddAt(Fadc_CT[0]->GetFadcSignal(i,j),j);
     
    22642271                      i<((MGeomCam*)(camgeom.UncheckedAt(ict)))->GetNumPixels();
    22652272                      i++){
    2266                     if(!Fadc_CT[ict]->IsPixelUsed(i)) continue;
     2273//
     2274// AM 15 01 2004 Commented out "continue" statement, so that also pixels
     2275// containing no C-photons will be written to the output in case of running
     2276// camera with no noise added to the signal.         
     2277//                  if(!Fadc_CT[ict]->IsPixelUsed(i)) continue;
     2278//
    22672279                    for (j=0;j<FADC_SLICES;j++){
    22682280                      fadcValues->AddAt(Fadc_CT[ict]->GetFadcSignal(i,j),j);
     
    24572469          for(int ict=0;ict<ct_Number;ict++){
    24582470            read_ascii(inputfile[ict], McConfigRunHeader[ict]);
     2471
     2472            if (get_sigma_xy_cm_spot() > 0.)
     2473            {
     2474                Float_t spotsigma = McConfigRunHeader[ict]->GetPointSpread();
     2475                Float_t newsigma = sqrt(spotsigma * spotsigma +
     2476                    get_sigma_xy_cm_spot() * get_sigma_xy_cm_spot());
     2477                McConfigRunHeader[ict]->SetPointSpread(newsigma);
     2478            }
    24592479          }
    24602480          if ((! Data_From_STDIN) && ( !feof(inputfile[0]) )){
     
    30773097  Float_t radius = -1.0;
    30783098  Float_t focal = -1.0;
    3079   Float_t stdfocal = -1.0;
    30803099  Float_t point = -1.0;
    3081   Float_t stdpoint = -1.0;
    3082   Float_t adjust = -1.0;
    30833100  Float_t spot = -1.0;
    30843101  Float_t camwidth = -1.0;
     
    30973114    if((flag=fgetc(sp))==EOF)
    30983115      break;
     3116    if (flag == '\n')    // skip empty lines
     3117      continue;
     3118
    30993119    fgets(&line[1],500,sp);
    31003120    line[0]=flag;
    3101     if (line[0]== '#' && line[2]=='n' && line[3]=='u' && line[4]=='m' &&
    3102         line[5]== 'b' && line[12]=='d' && line[13]=='a' && line[14]=='t'){
     3121
     3122    if ( strstr(line, "# reflectivity file") == line ) {
     3123      while (strstr(line, "# number of datapoints") != line)
     3124        fgets(line,500,sp);
     3125
    31033126      fgets(line,500,sp);
    31043127      sscanf(line,"%i",&numref);
     3128
    31053129      TArrayF wavarray(numref);
    31063130      TArrayF refarray(numref);
    3107       fgets(line,500,sp);
     3131
     3132      while (strstr(line, "# datapoints") != line)
     3133        fgets(line,500,sp);
     3134
    31083135      for(int i=0; i<numref;i++){
    31093136        fgets(line,500,sp);
     3137        if (line[0] == '#')
     3138          {
     3139            i--;
     3140            continue;
     3141          }
    31103142        sscanf(line,"%f %f",&wav,&ref);
    31113143        wavarray[i]=wav;
     
    31133145      }
    31143146      for (int j=0; j<nummir;j++){
     3147
    31153148        MGeomMirror &mirror = config->GetMirror(j);
    31163149        mirror.SetArraySize(numref);
     
    31273160      continue;
    31283161    }
    3129     if (strstr(line, "focal_std") == line){
    3130       sscanf(line,"%s %f",token,&stdfocal);
    3131       continue;
    3132     }
    31333162    if (strstr(line, "point_spread") == line){
    31343163      sscanf(line,"%s %f",token,&point);
    31353164      continue;
    31363165    }
    3137     if (strstr(line, "point_std") == line){
    3138       sscanf(line,"%s %f",token,&stdpoint);
    3139       continue;
    3140     }
    3141     if (strstr(line, "adjustment_dev") == line){
    3142       sscanf(line,"%s %f",token,&adjust);
    3143       continue;
    3144     }
    31453166    if (strstr(line, "black_spot") == line){
    31463167      sscanf(line,"%s %f",token,&spot);
     
    31513172      continue;
    31523173    }
     3174    //
     3175    // Skip obsolete magic.def entries:
     3176    //
    31533177    if (strstr(line, "n_pixels") == line)
    31543178      continue;
     
    31593183    if (strstr(line, "n_gappixels") == line)
    31603184      continue;
     3185
    31613186    if (strstr(line, "n_mirrors") == line){
    31623187      sscanf(line,"%s %i",token,&nummir);
     
    31783203      }
    31793204      fgets(line,500,sp);
    3180       while(line[2]!='w' || line[3]!='i' || line[4]!='t' || line[5]!='h'){
     3205
     3206      while ( ! strstr(line, "axis deviation"))
    31813207        fgets(line,500,sp);
    3182       }
    3183       fgets(line,500,sp);
     3208
    31843209      for(int i=0;i<nummir;i++){
    3185       fgets(line,500,sp);
     3210        fgets(line,500,sp);
     3211        if (line[0] == '#')
     3212          {
     3213            i--;
     3214            continue;
     3215          }
    31863216        sscanf(line,"%f %f",&dx,&dy);
    31873217        MGeomMirror &mirror = config->GetMirror(i);
     
    31913221    }
    31923222  }
    3193   config->SetMagicDef(radius, focal, stdfocal, point,
    3194                       stdpoint, adjust, spot, camwidth);
     3223  config->SetMagicDef(radius, focal, point, spot, camwidth);
    31953224}
    31963225
     
    37083737                  int *itotnphe, // total number of produced photoelectrons
    37093738                  float nphe[iMAXNUMPIX], // number of photoelectrons in each pixel
    3710                   int *incph,    // total number of cph read
     3739                  int *incph,       // total number of cph within camera
    37113740                  float *tmin_ns,   // minimum arrival time of all phes
    37123741                  float *tmax_ns,    // maximum arrival time of all phes
     
    37353764  radius_mm = camgeom->GetMaxRadius();
    37363765
     3766  TRandom random;
     3767  random.SetSeed((Int_t)(get_seeds(0)*get_seeds(1)));
     3768
     3769  float spotsigma = get_sigma_xy_cm_spot();
    37373770
    37383771  //- - - - - - - - - - - - - - - - - - - - - - - - -
     
    37613794         
    37623795
    3763     // increase number of photons
    3764          
    3765     (*incph)++;
    3766 
    3767     //  Chceck if photon is inside trigger time range
     3796    //  Check if photon is inside trigger time range
    37683797
    37693798    t = photon.get_t() ;
     
    37803809    cy = photon.get_y();
    37813810
     3811
     3812    if (spotsigma > 0.)
     3813    {
     3814        cx += random.Gaus(0.,spotsigma);
     3815        cy += random.Gaus(0.,spotsigma);
     3816    }
     3817
    37823818    // get wavelength
    37833819         
     
    38003836        continue;
    38013837    }
     3838
     3839    // AM changed meaning of incph: before it was all photons read from
     3840    // reflector file, now only those within a valid pixel:
     3841    //
     3842    // increase number of photons
     3843    (*incph)++;
    38023844
    38033845    //+++
     
    42304272// The seeds in the input card are used to initilize the random numbers.
    42314273// The Amplitud stored in the MMcFadcHeader is the amplitud of the sphe reponse.
    4232 // The Pedestal rms is simualted in a artificail empty event.
     4274// The Pedestal rms is simulated in an artificial empty event.
    42334275//
    42344276// Revision 1.62  2003/09/26 11:25:07  blanch
Note: See TracChangeset for help on using the changeset viewer.