Changeset 2286
- Timestamp:
- 07/17/03 19:02:46 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx
r2201 r2286 21 21 // 22 22 // $RCSfile: camera.cxx,v $ 23 // $Revision: 1.5 6$23 // $Revision: 1.57 $ 24 24 // $Author: blanch $ 25 // $Date: 2003-0 6-18 17:13:35$25 // $Date: 2003-07-17 18:02:46 $ 26 26 // 27 27 //////////////////////////////////////////////////////////////////////// … … 240 240 static float FADC_response_ampl = MFADC_RESPONSE_AMPLITUDE; 241 241 static float FADC_response_fwhm = MFADC_RESPONSE_FWHM; 242 static float FADC_resp_ampl_out = MFADC_RESPONSE_AMPLITUDE; 243 static float FADC_resp_fwhm_out = MFADC_RESPONSE_FWHM; 242 244 static float FADC_noise = 2.0; 243 245 … … 398 400 char inname[256]; //@< input file name 399 401 char starfieldname[256]; //@< starfield input file name 402 char qe_filename[256]; //@< qe input file name 400 403 401 404 char datname[256]; //@< data (ASCII) output file name … … 407 410 408 411 char nsbpathname[256]; //@< directory with the dataabse for th NSB 412 char nsbpath_outer[256]; //@< directory with the dataabse for outer pixels 409 413 410 414 char flag[SIZE_OF_FLAGS + 1]; //@< flags in the .rfl file 411 char flag_new[ 4]; //@< New flag for the run header in the .rfl file415 char flag_new[SIZE_OF_FLAGS + 1]; //@< New flag for the run header in the .rfl file 412 416 413 417 int reflector_file_version; //@< vrsion of he reflector file … … 480 484 int flagstoring = 0; 481 485 482 float fCorrection; //@< Factor to apply to pixel values (def. 1.)483 484 486 int ntrigger = 0; //@< number of triggers in the whole file 485 487 int btrigger = 0; //@< trigger flag … … 493 495 float fpixelthres[CAMERA_PIXELS]; //@< Threshold values 494 496 495 TArrayC *fadcValues; //@< the analog Fadc signal for pixels 496 497 float degTriggerZone; //@< trigger area in the camera (radius, in deg.) 497 TArrayC *fadcValues; //@< the analog Fadc High gain signal for pixels 498 TArrayC *fadcValuesLow; //@< the analog Fadc Low gain signal for pixels 498 499 499 500 int still_in_loop = FALSE; … … 524 525 525 526 ct_NPixels=camgeom.GetNumPixels(); 526 read_QE();527 read_WC();528 527 529 528 //!@' @#### Definition of variables for |getopt()|. … … 598 597 Data_From_STDIN = get_data_from_stdin(); 599 598 599 // read WC and QE files 600 601 strcpy( qe_filename, get_qe_filename()); 602 603 read_QE(qe_filename); 604 read_WC(); 605 600 606 // write all images, even those without trigger? 601 607 … … 618 624 get_secure_threhold(&riseDiskThres,&secureDiskThres); 619 625 620 get_FADC_properties( &FADC_response_ampl, &FADC_response_fwhm); 626 get_FADC_properties( &FADC_response_ampl, &FADC_response_fwhm, 627 &FADC_resp_ampl_out, &FADC_resp_fwhm_out); 621 628 622 629 get_Trigger_properties( &Trigger_gate_length, &Trigger_overlaping_time, &Trigger_response_ampl, &Trigger_response_fwhm); … … 639 646 640 647 strcpy( inname, get_input_filename() ); 648 641 649 strcpy( starfieldname, get_starfield_filename() ); 642 650 strcpy( datname, get_data_filename() ); … … 645 653 strcpy( ct_filename, get_ct_filename() ); 646 654 strcpy( nsbpathname, get_nsb_directory() ); 655 strcpy( nsbpath_outer, get_nsb_directory_outer() ); 647 656 648 657 // get different parameters of the simulation … … 657 666 //Parameters for starfield rotation 658 667 659 get_teles_axis(&zenith, &azimutal);660 668 Starfield_rotate = get_starfield_rotate(); 661 669 log(SIGNATURE, … … 668 676 669 677 log(SIGNATURE, 670 "%s:\n\t%20s:\t%s\n\t%20s:\t%s\n\t%20s:\t%s\n\t%20s:\t%s\n\t%20s:\t%s\n\t%20s:\t%s\n ",678 "%s:\n\t%20s:\t%s\n\t%20s:\t%s\n\t%20s:\t%s\n\t%20s:\t%s\n\t%20s:\t%s\n\t%20s:\t%s\n\t%20s:\t%s\n", 671 679 "Filenames", 672 680 "In", inname, 673 681 "Stars", starfieldname, 674 "NSB database", nsbpathname, 682 "NSB database (inner pixels)", nsbpathname, 683 "NSB database (outer pixels)", nsbpath_outer, 675 684 "CT", ct_filename, 676 685 "Data", datname, … … 790 799 Int_t Lev0, Lev1; 791 800 792 fadcValues = new TArrayC(FADC_SLICES); 801 fadcValues = new TArrayC(FADC_SLICES); 802 fadcValuesLow = new TArrayC(FADC_SLICES); 793 803 794 804 // number of pixels for parameters … … 813 823 Trigger_response_fwhm); //@< A instance of the Class MTrigger 814 824 825 // Generate databse for trigger electronic noise 826 Trigger.SetElecNoise(Trigger_noise) ; 827 815 828 // Set Right Discriminator threshold, taking into account trigger pixels 816 817 818 829 Trigger.CheckThreshold(&qThreshold[0]); 819 830 … … 857 868 } 858 869 859 MFadc fadc(FADC_response_ampl,FADC_response_fwhm) ; //@< A instance of the Class MFadc 870 MFadc fadc(FADC_response_ampl,FADC_response_fwhm, 871 FADC_resp_ampl_out,FADC_resp_fwhm_out) ; //@< A instance of the Class MFadc 860 872 861 873 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! … … 874 886 875 887 for(i=0;i<CAMERA_PIXELS;i++) 876 input_pedestals[i]= 10.5;877 888 input_pedestals[i]=get_FADC_pedestal(); 889 878 890 fadc.SetPedestals(input_pedestals); 891 892 // Generate databse for the Fadc electronic noise 893 894 fadc.SetElecNoise(FADC_noise); 879 895 880 896 // Prepare the raw data output … … 987 1003 988 1004 // Fill branches for MMcTrigHeader 989 1005 990 1006 if(!Trigger_Loop && Write_McTrig){ 991 1007 … … 1134 1150 } 1135 1151 1136 // set trigger area (deg)1137 1138 if ( ! get_trigger_radius( °TriggerZone ) )1139 degTriggerZone = ( ct_Type == 0 ) ? (5.0) : (5.0);1140 1141 if ( ! get_correction( &fCorrection ) )1142 fCorrection = 1.0;1143 1152 1144 1153 // prepare the NSB simulation … … 1146 1155 // Instance of the Mlons class 1147 1156 MLons lons(Trigger_response_ampl, Trigger_response_fwhm, 1148 MFADC_RESPONSE_AMPLITUDE, MFADC_RESPONSE_FWHM);1157 FADC_response_ampl,FADC_response_fwhm); 1149 1158 1150 1159 lons.SetPath(nsbpathname); 1160 1161 // Instance of the Mlons class 1162 MLons lons_outer(Trigger_response_ampl, Trigger_response_fwhm, 1163 FADC_resp_ampl_out,FADC_resp_fwhm_out); 1164 1165 lons_outer.SetPath(nsbpath_outer); 1151 1166 1152 1167 if( simulateNSB ){ … … 1226 1241 1227 1242 strcpy( flag, " \0" ); 1243 strcpy( flag_new, " \0" ); 1228 1244 1229 1245 // allocate space for PMTs numbers of pixels … … 1264 1280 1265 1281 // We break the main loop 1266 cout<<"Warning: Expected start of run header flag, but found:"<<flag <<endl;1282 cout<<"Warning: Expected start of run header flag, but found:"<<flag_new<<endl; 1267 1283 cout<<" We break the main loop"<<endl; 1268 1284 break; … … 1277 1293 1278 1294 fread( flag, SIZE_OF_FLAGS, 1, inputfile ); 1279 1280 1295 while( isA( flag, FLAG_START_OF_EVENT )){ // while there is a next event 1281 1296 fread( flag_new, 4, 1, inputfile ); … … 1284 1299 1285 1300 // We break while events loop 1286 cout<<"Warning: Expected start of event header flag, but found:"<<flag <<endl;1301 cout<<"Warning: Expected start of event header flag, but found:"<<flag_new<<endl; 1287 1302 cout<<" We break the while events loop"<<endl; 1288 1303 break; … … 1512 1527 for(UInt_t ui=0;ui<camgeom.GetNumPixels();ui++) 1513 1528 if(nsb_phepns_rotated[ui]>0.0){ 1514 k=lons.GetResponse(nsb_phepns_rotated[ui],0.1, 1515 & nsb_trigresp[0],& nsb_fadcresp[0]); 1529 if(camgeom[ui].GetR()>camgeom[0].GetR()){ 1530 k=lons_outer.GetResponse(nsb_phepns_rotated[ui],0.1, 1531 & nsb_trigresp[0],& nsb_fadcresp[0]); 1532 } 1533 else{ 1534 k=lons.GetResponse(nsb_phepns_rotated[ui],0.1, 1535 & nsb_trigresp[0],& nsb_fadcresp[0]); 1536 } 1516 1537 if(k==0){ 1517 1538 cout << "Exiting.\n"; … … 1528 1549 } 1529 1550 1551 ntcph+=ncph; 1530 1552 if ((nshow+ntshow)%100 == 1){ 1531 1553 log(SIGNATURE, "End of this event: %d cphs(+%d). . .\n", … … 1535 1557 cout<<inumphensb<<endl; 1536 1558 } 1537 ntcph += ncph;1538 1559 1539 1560 // skip it ? … … 1567 1588 // TRIGGER HERE 1568 1589 1569 //1570 // now the noise of the electronic1571 // (preamps, optical transmission,..) is introduced.1572 // This is done inside the class MTrigger by the method ElecNoise.1573 //1574 if (addElecNoise){1575 Trigger.ElecNoise(Trigger_noise) ;1576 1577 fadc.ElecNoise(FADC_noise) ;1578 }1579 1580 1590 // We should simulate the AC coupling behaviour: 1581 1591 // For the FADC it is only done for the NSB while producinr … … 1583 1593 // For the trigger is done in the Trigger.Diskriminate(), which 1584 1594 // is called later (it should be seperated to speed up the program 1595 // 1596 1597 // now the noise of the electronic 1598 // (preamps, optical transmission,..) is introduced. 1599 // This is done inside the class MTrigger by the method ElecNoise. 1600 // 1601 1602 if (addElecNoise && nphe2NSB<=inumphe){ 1603 Trigger.ElecNoise(Trigger_noise) ; 1604 1605 fadc.ElecNoise(FADC_noise) ; 1606 } 1585 1607 1586 1608 // now a shift in the fadc signal due to the pedestlas is … … 1693 1715 for (j=0;j<FADC_SLICES;j++){ 1694 1716 fadcValues->AddAt(fadc.GetFadcSignal(i,j),j); 1717 fadcValuesLow->AddAt(fadc.GetFadcLowGainSignal(i,j),j); 1695 1718 } 1696 1719 EvtData[iconcount]->AddPixel(i,fadcValues,0); 1720 EvtData[iconcount]->AddPixel(i,fadcValuesLow,kTRUE); 1697 1721 } 1698 1722 } … … 1725 1749 if (reflector_file_version<6){ 1726 1750 mcevth.get_times(&ftime, <ime); 1727 McEvt->Fill( -1.0,1751 McEvt->Fill( 0, 1728 1752 (UShort_t) mcevth.get_primary() , 1729 1753 mcevth.get_energy(), … … 1750 1774 (UInt_t)mcevth.get_CORSIKA(), 1751 1775 (UInt_t)mcevth.get_AtmAbs(), 1752 (UInt_t) mcevth.get_MirrAbs()+mcevth.get_OutOfMirr()+mcevth.get_BlackSpot(),1776 (UInt_t)(mcevth.get_MirrAbs()+mcevth.get_OutOfMirr()+mcevth.get_BlackSpot()), 1753 1777 (UInt_t) ncph, 1754 1778 (UInt_t) inumphe, … … 1762 1786 mcevth_2.get_times(&ftime, <ime); 1763 1787 chi2=mcevth_2.get_NKGfit(&Nmax, &t0, &tmax, &a, &b, &c); 1764 McEvt->Fill( mcevth_2.get_evt_number(),1788 McEvt->Fill((UInt_t) mcevth_2.get_evt_number(), 1765 1789 (UShort_t) mcevth_2.get_primary() , 1766 1790 mcevth_2.get_energy(), … … 1787 1811 (UInt_t)mcevth_2.get_CORSIKA(), 1788 1812 (UInt_t)mcevth_2.get_AtmAbs(), 1789 (UInt_t) mcevth_2.get_MirrAbs()+mcevth_2.get_OutOfMirr()+mcevth_2.get_BlackSpot(),1813 (UInt_t)(mcevth_2.get_MirrAbs()+mcevth_2.get_OutOfMirr()+mcevth_2.get_BlackSpot()), 1790 1814 (UInt_t) ncph, 1791 1815 (UInt_t) inumphe, … … 1898 1922 for (j=0;j<FADC_SLICES;j++){ 1899 1923 fadcValues->AddAt(fadc.GetFadcSignal(i,j),j); 1924 fadcValuesLow->AddAt(fadc.GetFadcLowGainSignal(i,j),j); 1900 1925 } 1901 1926 EvtData[0]->AddPixel(i,fadcValues,0); 1927 EvtData[0]->AddPixel(i,fadcValuesLow,kTRUE); 1902 1928 } 1903 1929 } … … 1911 1937 if (reflector_file_version<6){ 1912 1938 mcevth.get_times(&ftime, <ime); 1913 McEvt->Fill( -1.0,1939 McEvt->Fill( 0, 1914 1940 (UShort_t) mcevth.get_primary() , 1915 1941 mcevth.get_energy(), … … 1936 1962 (UInt_t)mcevth.get_CORSIKA(), 1937 1963 (UInt_t)mcevth.get_AtmAbs(), 1938 (UInt_t) mcevth.get_MirrAbs()+mcevth.get_OutOfMirr()+mcevth.get_BlackSpot(),1964 (UInt_t)(mcevth.get_MirrAbs()+mcevth.get_OutOfMirr()+mcevth.get_BlackSpot()), 1939 1965 (UInt_t) ncph, 1940 1966 (UInt_t) inumphe, … … 1948 1974 mcevth_2.get_times(&ftime, <ime); 1949 1975 chi2=mcevth_2.get_NKGfit(&Nmax, &t0, &tmax, &a, &b, &c); 1950 McEvt->Fill( mcevth_2.get_evt_number(),1976 McEvt->Fill( (UInt_t) mcevth_2.get_evt_number(), 1951 1977 (UShort_t) mcevth_2.get_primary() , 1952 1978 mcevth_2.get_energy(), … … 1973 1999 (UInt_t)mcevth_2.get_CORSIKA(), 1974 2000 (UInt_t)mcevth_2.get_AtmAbs(), 1975 (UInt_t) mcevth_2.get_MirrAbs()+mcevth_2.get_OutOfMirr()+mcevth_2.get_BlackSpot(),2001 (UInt_t) (mcevth_2.get_MirrAbs()+mcevth_2.get_OutOfMirr()+mcevth_2.get_BlackSpot()), 1976 2002 (UInt_t) ncph, 1977 2003 (UInt_t) inumphe, … … 2088 2114 } // end if found end of file 2089 2115 } // end if found end of run 2090 2116 2091 2117 } // end if else found start of run 2092 2118 } // end big while loop … … 2101 2127 get_starfield_center(&sfRaH,&sfRaM,&sfRaS,&sfDeD,&sfDeM,&sfDeS); 2102 2128 if (reflector_file_version<6){ 2103 get_teles_axis(&telestheta,&telesphi); 2129 telestheta=-10.0; 2130 telesphi=-10.0; 2104 2131 mcevth.get_theta_range(&shthetamin, &shthetamax); 2105 2132 mcevth.get_phi_range(&shphimin,&shphimax); … … 2713 2740 //!@{ 2714 2741 void 2715 read_QE( void){2742 read_QE(char fname[256]){ 2716 2743 ifstream qefile; 2717 2744 char line[LINE_MAX_LENGTH]; … … 2724 2751 // try to open the file 2725 2752 2726 log("read_QE", "Opening the file \"%s\" . . .\n", QE_FILE);2727 2728 qefile.open( QE_FILE);2753 log("read_QE", "Opening the file \"%s\" . . .\n", fname); 2754 2755 qefile.open( fname ); 2729 2756 2730 2757 // if it is wrong or does not exist, exit 2731 2758 2732 2759 if ( qefile.bad() ) 2733 error( "read_QE", "Cannot open \"%s\". Exiting.\n", QE_FILE);2760 error( "read_QE", "Cannot open \"%s\". Exiting.\n", fname ); 2734 2761 2735 2762 // read file … … 2846 2873 // try to open the file 2847 2874 2848 log("read_ QE", "Opening the file \"%s\" . . .\n", WC_FILE);2875 log("read_WC", "Opening the file \"%s\" . . .\n", WC_FILE); 2849 2876 2850 2877 wcfile.open( WC_FILE ); … … 3894 3921 // store the new photoelectron 3895 3922 3896 fadc->Fill(ipixnum,(t-*tmin_ns) , trigger->FillShow(ipixnum,t-*tmin_ns)); 3923 fadc->Fill(ipixnum,(t-*tmin_ns) , 3924 trigger->FillShow(ipixnum,t-*tmin_ns), 3925 !((*camgeom)[ipixnum].GetR()>(*camgeom)[0].GetR())); 3897 3926 3898 3927 *itotnphe += 1;
Note:
See TracChangeset
for help on using the changeset viewer.