Changeset 5269
- Timestamp:
- 10/13/04 18:05:05 (20 years ago)
- Location:
- trunk/MagicSoft/Simulation/Detector/Camera
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx
r5268 r5269 21 21 // 22 22 // $RCSfile: camera.cxx,v $ 23 // $Revision: 1.7 3$23 // $Revision: 1.74 $ 24 24 // $Author: moralejo $ 25 // $Date: 2004-10-13 1 4:28:59$25 // $Date: 2004-10-13 17:05:05 $ 26 26 // 27 27 //////////////////////////////////////////////////////////////////////// … … 238 238 static float Spot_y=0.0; 239 239 static float Spotsigma=0.0; 240 241 static int CalibrationRun = 0;242 240 243 241 … … 717 715 // get filenames 718 716 719 CalibrationRun = 1; 720 if (! CalibrationRun) 717 if (! is_calibration_run()) 721 718 for(int ict=0;ict<ct_Number;ict++) 722 719 { … … 1682 1679 1683 1680 1684 if ( CalibrationRun)1681 if (is_calibration_run()) 1685 1682 { 1686 1683 DoCalibration(Fadc_CT, Trigger_CT, camgeom, nsb_trigresp, nsb_fadcresp, … … 4455 4452 { 4456 4453 4457 int ntshow = 0; 4454 int nevent = 0; 4455 int maxevents; 4458 4456 int lons_return; 4459 4457 … … 4464 4462 float timefirst = 0.; 4465 4463 float timelast = 0.; 4464 4465 float lambda, sigma_lambda, phot_per_pix, sigma_time; 4466 UInt_t *first_pixel, *last_pixel; 4467 int selected_pixel; 4468 4469 // Get parameters of the calibration: 4470 4471 get_calibration_properties( &lambda, &sigma_lambda, &phot_per_pix, 4472 &sigma_time, &maxevents, &selected_pixel); 4473 4474 first_pixel = new UInt_t[ct_Number]; 4475 last_pixel = new UInt_t[ct_Number]; 4476 4477 for (int ict = 0; ict < ct_Number; ict++) 4478 { 4479 if (selected_pixel < 0) 4480 { 4481 first_pixel[ict] = 0; 4482 last_pixel[ict] = ((MGeomCam*)(camgeom.UncheckedAt(ict)))->GetNumPixels()-1; 4483 } 4484 else 4485 first_pixel[ict] = last_pixel[ict] = selected_pixel; 4486 } 4487 4466 4488 4467 4489 TArrayC *fadcValues; //@< the analog Fadc High gain signal for pixels … … 4476 4498 float *pheinpix = new float [ct_NPixels]; 4477 4499 4478 for (int calevent = 0; calevent < 1; calevent++)4500 for (int calevent = 0; calevent < maxevents; calevent++) 4479 4501 { 4480 4502 // … … 4493 4515 } 4494 4516 4495 n tshow++;4496 4497 if((n tshow+1)%100 == 1)4498 log(SIGNATURE, "Event %d\n", n tshow);4517 nevent++; 4518 4519 if((nevent+1)%100 == 1) 4520 log(SIGNATURE, "Event %d\n", nevent); 4499 4521 4500 4522 // Produce the photoelectrons 4501 float phot_per_pix = 100.;4502 4523 for(int ict = 0; ict < ct_Number; ict++) 4503 4524 produce_calib_phes( (MGeomCam*)(camgeom.UncheckedAt(ict)), 4504 phot_per_pix,4505 4525 Trigger_CT[ict], 4506 4526 Fadc_CT[ict], … … 4508 4528 pheinpix, 4509 4529 &(ntotphot[ict]), 4510 ict); 4530 ict, 4531 lambda, 4532 sigma_lambda, 4533 phot_per_pix, 4534 sigma_time, 4535 selected_pixel 4536 ); 4511 4537 4512 4538 // NSB simulation … … 4518 4544 for (int ict = 0; ict < ct_Number; ict++) 4519 4545 { 4520 for (UInt_t ui = 0; 4521 ui < ((MGeomCam*)(camgeom.UncheckedAt(ict)))->GetNumPixels(); 4522 ui++) 4546 for (UInt_t ui = first_pixel[ict]; ui <= last_pixel[ict]; ui++) 4523 4547 { 4524 4548 nphe_from_nsb[ict] += nsb_phepns[ict][ui]; … … 4593 4617 // Fill the FADC information 4594 4618 // 4595 for(UInt_t ui=0; 4596 ui<((MGeomCam*)(camgeom.UncheckedAt(ict)))->GetNumPixels(); 4597 ui++) 4619 for(UInt_t ui = first_pixel[ict]; ui <= last_pixel[ict]; ui++) 4598 4620 { 4599 4621 for (int jslice = 0; jslice < FADC_slices_written; jslice++) … … 4628 4650 //------------------------------------------------------------ 4629 4651 4630 int produce_calib_phes( MGeomCam *camgeom, // The camera layout 4631 float phot_per_pix, // Average number of photons per inner pixel 4652 int produce_calib_phes( MGeomCam *camgeom, // The camera layout 4632 4653 MTrigger *trigger, 4633 4654 MFadc *fadc, 4634 int *itotnphe, // total number of produced photoelectrons 4635 float *nphe, // number of photoelectrons in each pixel 4636 int *nphot, // total number of photons in all pixels 4637 int ict // Telescope that is being analised to get the right QE. 4655 int *itotnphe, // total number of produced photoelectrons 4656 float *nphe, // number of photoelectrons in each pixel 4657 int *nphot, // total number of photons in all pixels 4658 int ict, // Telescope that is being analised to get the right QE. 4659 float lambda, // Mean wavelength of light in nm 4660 float sigma_lambda, // Sigma of wavelengtgaussian spread 4661 float phot_per_pix, // Average # of photons per inner pixel 4662 float sigma_time, // Sigma of time spread of photons 4663 int selected_pixel // if >= 0, only this pixel is used! 4638 4664 ) 4639 4665 { … … 4643 4669 float **qept; 4644 4670 float radius_mm, focal_dist_mm; 4671 int total_photons; 4645 4672 4646 4673 // reset variables … … 4671 4698 4672 4699 // Calculate total number of photons to be produced. 4673 int total_photons = (int) (phot_per_pix * 3.14159265 * radius_mm * radius_mm / 4674 (*camgeom)[0].GetA()); 4700 if (selected_pixel < 0) 4701 total_photons = (int) (phot_per_pix * 3.14159265 * radius_mm * radius_mm / 4702 (*camgeom)[0].GetA()); 4703 else 4704 total_photons = (int) (phot_per_pix * 4705 (*camgeom)[selected_pixel].GetA() / (*camgeom)[0].GetA()); 4675 4706 4676 4707 // loop over the photons … … 4679 4710 { 4680 4711 4681 time = 0.; 4682 4683 // Obtain photon coordinates on the camera. We assume a point source of light placed 4684 // in the center of the mirror dish. 4685 4686 // polar angle 4687 float psi = RandomNumber * 2 * 3.14159265; 4688 // angle between the telescope axis and the photon trajectory. 4689 float epsilon = acos(1.-RandomNumber*(1.-cos_epsilon_max)); 4690 float tanepsilon = tan(epsilon); 4691 4692 cx = focal_dist_mm*tanepsilon*cos(psi); // mm 4693 cy = focal_dist_mm*tanepsilon*sin(psi); // mm 4694 4695 // Angle between photon trajectory and camera plane: 4696 phi = 3.14159265/2.-epsilon; // rad 4712 // time 4713 time = random.Gaus(4.*sigma_time, sigma_time); 4714 4715 cout << "### " << time << endl << endl; 4697 4716 4698 4717 // wavelength 4699 4700 wl = 500.; // nm 4701 4702 4703 if( (wl > WAVEBANDBOUND6) || (wl < WAVEBANDBOUND1) || 4704 (sqrt(cx*cx + cy*cy) > radius_mm ) ) 4718 wl = lambda; 4719 4720 if( (wl > WAVEBANDBOUND6) || (wl < WAVEBANDBOUND1)) 4705 4721 continue; 4706 4722 4707 // 4708 // Pixelization 4709 // 4710 ipixnum = bpoint_is_in_pix(cx, cy, camgeom); 4711 4712 // -1 = the photon is in none of the pixels 4713 // 0 = the phton is in the central pixel, which is not used 4714 if (ipixnum==-1 || ipixnum==0) 4715 continue; 4723 if (selected_pixel < 0) 4724 { 4725 // Obtain photon coordinates on the camera. We assume a point source of light placed 4726 // in the center of the mirror dish. 4727 4728 // polar angle 4729 float psi = RandomNumber * 2 * 3.14159265; 4730 // angle between the telescope axis and the photon trajectory. 4731 float epsilon = acos(1.-RandomNumber*(1.-cos_epsilon_max)); 4732 float tanepsilon = tan(epsilon); 4733 4734 cx = focal_dist_mm*tanepsilon*cos(psi); // mm 4735 cy = focal_dist_mm*tanepsilon*sin(psi); // mm 4736 4737 if (sqrt(cx*cx + cy*cy) > radius_mm ) 4738 continue; 4739 4740 // Angle between photon trajectory and camera plane: 4741 phi = 3.14159265/2.-epsilon; // rad 4742 4743 // 4744 // Pixelization 4745 // 4746 ipixnum = bpoint_is_in_pix(cx, cy, camgeom); 4747 4748 // -1 = the photon is in none of the pixels 4749 // 0 = the phton is in the central pixel, which is not used 4750 if (ipixnum==-1 || ipixnum==0) 4751 continue; 4752 } 4753 else 4754 { 4755 // Angle between photon trajectory and camera plane: 4756 phi = atan2( focal_dist_mm, 4757 sqrt( (*camgeom)[selected_pixel].GetX()*(*camgeom)[selected_pixel].GetX()+ 4758 (*camgeom)[selected_pixel].GetY()*(*camgeom)[selected_pixel].GetY())); 4759 4760 ipixnum = selected_pixel; 4761 } 4762 4716 4763 4717 4764 // increase number of photons within pixels … … 4793 4840 *itotnphe += 1; 4794 4841 } 4795 4842 cout << "$$" << endl; 4796 4843 return(0); 4797 4844 -
trunk/MagicSoft/Simulation/Detector/Camera/camera.h
r5103 r5269 19 19 //= 20 20 //= $RCSfile: camera.h,v $ 21 //= $Revision: 1.2 2$21 //= $Revision: 1.23 $ 22 22 //= $Author: moralejo $ 23 //= $Date: 2004- 09-17 14:48:21$23 //= $Date: 2004-10-13 17:05:05 $ 24 24 //= 25 25 //=////////////////////////////////////////////////////////////////////// … … 70 70 #include "MParContainer.h" 71 71 #include "MArray.h" 72 72 73 73 74 // command line options available … … 341 342 float ro); 342 343 344 345 int DoCalibration( class MFadc **Fadc_CT, class MTrigger **Trigger_CT, 346 class TObjArray camgeom, 347 float* nsb_trigresp, float *nsb_fadcresp, 348 class MLons *lons, class MLons *lons_outer, 349 float **diffnsb_phepns, int addElecNoise, 350 class TTree *EvtTree, class MRawEvtHeader **EvtHeader, 351 class MMcEvt **McEvt, class MRawEvtData **EvtData); 352 353 354 int produce_calib_phes( class MGeomCam *camgeom, class MTrigger *trigger, 355 class MFadc *fadc, int *itotnphe, float *nphe, 356 int *nphot, int ict, float lambda, float sigma_lambda, 357 float phot_per_pix, float sigma_time, int selected_pixel); 358 359 343 360 //!@} 344 361 … … 350 367 /* 351 368 *$Log: not supported by cvs2svn $ 369 *Revision 1.22 2004/09/17 14:48:21 moralejo 370 * 371 *Changes to adapt headers to c++ style. 372 * 352 373 *Revision 1.21 2004/09/16 15:24:53 moralejo 353 374 *Updated on CVS after long time... -
trunk/MagicSoft/Simulation/Detector/Camera/creadparam.cxx
r5245 r5269 19 19 //= 20 20 //= $RCSfile: creadparam.cxx,v $ 21 //= $Revision: 1.3 0$21 //= $Revision: 1.31 $ 22 22 //= $Author: moralejo $ 23 //= $Date: 2004-10-1 2 13:32:02$23 //= $Date: 2004-10-13 17:05:05 $ 24 24 //= 25 25 //=////////////////////////////////////////////////////////////////////// … … 110 110 static float m_fraction[MAX_NUMBER_OF_CTS]; 111 111 112 static int CalibrationRun = 0; // > 0 if a calibration run has been chosen 113 static float lambda = 0.; // Mean wavelength for photons of calibration pulses. 114 static float sigma_lambda = 0.; // Sigma of wavelength distribution for calibration. 115 static float phot_per_pix = 0.; // Average number of photons per inner pixel for calibration. 116 static float sigma_time = 0.; // Time spread (sigma of gaussian) of calibration photons. 117 static int nevents = 0; // Number of events in calibration run. 118 static int selected_pixel = -1; // Selected pixel: if >= 0 ==> only this pixel is filled! 119 120 112 121 // Coordinates of CT locations, in centimeters, in the Corsika system. 113 122 … … 599 608 case mirror_fraction: 600 609 601 602 610 sscanf(line, "%s %d %f", token, &j, &aux); 611 m_fraction[j] = aux; 603 612 604 break; 613 break; 614 615 case calibration_run: 616 617 sscanf(line, "%s %f %f %f %f %i %i", token, &lambda, &sigma_lambda, &phot_per_pix, 618 &sigma_time, &nevents, &selected_pixel); 619 620 CalibrationRun = 1; 621 622 break; 605 623 606 624 case end_file: //@< end of the parameters file … … 1367 1385 } 1368 1386 1387 int is_calibration_run(){ 1388 return CalibrationRun; 1389 } 1390 1391 void get_calibration_properties(float *a, float *b, float *c, float *d, int *e, int *f) 1392 { 1393 *a = lambda; 1394 *b = sigma_lambda; 1395 *c = phot_per_pix; 1396 *d = sigma_time; 1397 *e = nevents; 1398 *f = selected_pixel; 1399 } 1400 1401 1369 1402 //=------------------------------------------------------------ 1370 1403 //!@subsection Log of this file. … … 1373 1406 // 1374 1407 // $Log: not supported by cvs2svn $ 1408 // Revision 1.30 2004/10/12 13:32:02 moralejo 1409 // *** empty log message *** 1410 // 1375 1411 // Revision 1.29 2004/09/17 14:48:21 moralejo 1376 1412 // -
trunk/MagicSoft/Simulation/Detector/Camera/creadparam.h
r5245 r5269 19 19 //= 20 20 //= $RCSfile: creadparam.h,v $ 21 //= $Revision: 1.2 7$21 //= $Revision: 1.28 $ 22 22 //= $Author: moralejo $ 23 //= $Date: 2004-10-1 2 13:32:02$23 //= $Date: 2004-10-13 17:05:05 $ 24 24 //= 25 25 //=////////////////////////////////////////////////////////////////////// … … 110 110 T(sigma_x_cm_spot), /* Additional gaussian spread of mirror in x axis spot on camera */ \ 111 111 T(sigma_y_cm_spot), /* Additional gaussian spread of mirror in y axis spot on camera */ \ 112 T(misspoint_deg), /* Additional misspointing of Telescope direction*/ \113 T(trigger_delay), /* Delay in ns between beginning of FADC114 time window and the trigger instant.*/ \112 T(misspoint_deg), /* Additional misspointing of Telescope direction*/ \ 113 T(trigger_delay), /* Delay in ns between beginning of FADC 114 time window and the trigger instant.*/ \ 115 115 T(telescope_location_cm), /* Telescope coordinates in Corsika system */ \ 116 116 T(mirror_fraction), /* Fraction of dish mirror really operative */ \ 117 T(calibration_run), /* option to produce a calibration file */ \ 117 118 T(end_file) /* end of the parameters file */ 118 119 … … 190 191 float get_telescope_location_cm(int j, int icoor); 191 192 float get_mirror_fraction(int j); 193 194 int is_calibration_run(); 195 void get_calibration_properties(float *lambda, float *sigma_lambda, float *phot_per_pix, 196 float *sigma_time, int *nevents, int *selected_pixel); 192 197 //!@} 193 198 … … 205 210 /* 206 211 * $Log: not supported by cvs2svn $ 212 * Revision 1.27 2004/10/12 13:32:02 moralejo 213 * *** empty log message *** 214 * 207 215 * Revision 1.26 2004/09/17 14:48:21 moralejo 208 216 * -
trunk/MagicSoft/Simulation/Detector/Camera/input.card
r5255 r5269 5 5 ct_geom 1 6 6 # Quantum efficiency file: 7 qe_file 0 /home/magic/ MagicProgs/Simulation/Detector/Data/qe-emi-coat.RFL.dat7 qe_file 0 /home/magic/CAMERA_NEW/MagicSoft/Simulation/Detector/Data/qe-emi-coat.RFL.dat 8 8 # Input file (one per telescope): 9 input_file 0 /data1/magic/reflex/Gamma_zbin0_0_7_1000to1009_w0.rfl 9 # input_file 0 /data1/magic/reflex/Gamma_zbin0_0_7_1000to1009_w0.rfl 10 # Perform calibration run: lambda sigma_lambda phot_per_pixel time_sigma n_events [selected_pixel] 11 calibration_run 400. 30. 100. 5. 100 90 10 12 # Ascii output file name: 11 data_file ./Gamma_zbin0_0_7_1000to1009_w0.dat 13 #data_file ./Gamma_zbin0_0_7_1000to1009_w0.dat 14 data_file ./prueba.dat 12 15 # root output file name: 13 root_file ./Gamma_zbin0_0_7_1000to1009_w0.root 16 #root_file ./Gamma_zbin0_0_7_1000to1009_w0.root 17 root_file ./prueba.root 14 18 # Trigger characteristics: gate length (ns), min. overlapping time (ns), 15 19 # amplitude and FWHM of (gaussian) single phe response for trigger: … … 18 22 trigger_single 0 4 4 2 19 23 # Switch on NSB: 20 nsb_on 24 #nsb_on 25 nsb_off 21 26 # Number of photons from the diffuse NSB (nphe / ns 0.1*0.1 deg^2 239 m^2) and 22 27 # minimum number of phe from shower required to simulate NSB: 23 28 nsb_mean 0.13 10 24 29 # Starfield (see Starfieldadder program) 25 # starfield_file /home/magic/ MagicProgs/Simulation/Detector/Starfield/starfield.rfl30 # starfield_file /home/magic/CAMERA_NEW/MagicSoft/Simulation/Detector/Starfield/starfield.rfl 26 31 # Electronic noise in FADC (sigma in ADC counts): Inner pixels, outer pixels, digital noise: 27 32 fadc_noise 1.48 2.1 0. … … 35 40 seeds 66767 45069 36 41 # Directory where NSB database can be found for inner and outer pixels: 37 nsb_directory /home/magic/ MagicProgs/Simulation/Detector/StarLight/inner/38 nsb_dir_outer /home/magic/ MagicProgs/Simulation/Detector/StarLight/outer/42 nsb_directory /home/magic/CAMERA_NEW/MagicSoft/Simulation/Detector/StarLight/inner/ 43 nsb_dir_outer /home/magic/CAMERA_NEW/MagicSoft/Simulation/Detector/StarLight/outer/ 39 44 # 40 45 # FADC properties: shape of single phe response (1 means realistic one, from 41 46 # Pulpo setup), integral in FADC counts for 1 phe. (3rd argument is ignored 42 47 # unless gaussian shape - 1st argument=0 - was chosen) : 43 fadc_prop 1 7.8 5.048 #fadc_prop 1 7.8 5.0 44 49 # Same as above for outer pixels: 45 fadc_outer 1 3.2 5.050 #fadc_outer 1 3.2 5.0 46 51 # 47 52 # tentative values for future fast (2 GHz) FADC: 48 53 # 49 #fadc_prop 0 40. 3.50 #fadc_outer 0 15. 3.54 fadc_prop 0 40. 3. 55 fadc_outer 0 15. 3. 51 56 # FADC sampling frequency and number of FADC slices: 52 #fadc_GHz 2. 10057 fadc_GHz 2. 100 53 58 # 54 59 # Write to output trigger information:
Note:
See TracChangeset
for help on using the changeset viewer.