Changeset 2389 for trunk/MagicSoft/Simulation/Detector/Camera
- Timestamp:
- 10/17/03 20:38:31 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx
r2362 r2389 21 21 // 22 22 // $RCSfile: camera.cxx,v $ 23 // $Revision: 1.6 2$23 // $Revision: 1.63 $ 24 24 // $Author: blanch $ 25 // $Date: 2003- 09-26 11:25:07$25 // $Date: 2003-10-17 19:38:31 $ 26 26 // 27 27 //////////////////////////////////////////////////////////////////////// … … 207 207 static float FADC_resp_fwhm_out = MFADC_RESPONSE_FWHM; 208 208 static float FADC_noise = 2.0; 209 static float DIGITAL_noise = 2.0; 210 static float FADC_high2low = HIGH2LOWGAIN; 209 211 210 212 //@: Trigger conditions for a single trigger mode … … 358 360 float l2, m2, n2; //@< auxiliary variables 359 361 float num, den; //@< auxiliary variables 362 float factorqe_NSB[100]; //@< factor on the NSB depending of QE 360 363 361 364 int nshow=0; //@< partial number of shower in a given run … … 390 393 Float_t fadc_elecnoise[CAMERA_PIXELS]; //@< Electronic niose for each pixel 391 394 Float_t fadc_pedestals[CAMERA_PIXELS]; //@< array for fadc pedestals values 395 Float_t fadc_sigma[CAMERA_PIXELS]; //@< array for fadc pedestals sigma 396 Float_t fadc_sigma_low[CAMERA_PIXELS]; //@< array for fadc pedestals sigma 392 397 393 398 float ext[iNUMWAVEBANDS] = { //@< average atmospheric extinction in each waveband … … 567 572 TriggerPixels[i]=TRIGGER_PIXELS_9; 568 573 break; 569 default: camgeom[i]=new MGeomCamMagic; 570 TriggerPixels[i]=TRIGGER_PIXELS_1; 574 default: 575 error( SIGNATURE, "Camera geometry %i is not defined. Stoping camera program ...", GeometryCamera[i]); 576 exit(1); 571 577 break; 572 578 } … … 590 596 read_QE(qe_filename,ict); 591 597 } 598 592 599 read_WC(); 593 600 … … 614 621 get_FADC_properties( &FADC_response_ampl, &FADC_response_fwhm, 615 622 &FADC_resp_ampl_out, &FADC_resp_fwhm_out); 623 FADC_high2low=get_High_to_Low(); 616 624 617 625 // FIXME --- tirgger properties may depend on the Camrea geometry … … 658 666 // get different parameters of the simulation 659 667 660 addElecNoise = add_elec_noise(&FADC_noise, & Trigger_noise);668 addElecNoise = add_elec_noise(&FADC_noise, &DIGITAL_noise, &Trigger_noise); 661 669 simulateNSB = get_nsb( &meanNSB, &nphe2NSB ); 670 662 671 663 672 // get selections on the parameters … … 677 686 strcpy( qe_filename, get_qe_filename(ict)); 678 687 688 // Look to factor for NSB respect to emi_coat PMTs 689 if(!strcmp(qe_filename,"../Data/qe-emi-coat.RFL.dat")) 690 factorqe_NSB[ict]=EMICOAT_NSB; 691 else if(!strcmp(qe_filename,"../Data/qe-emi.RFL.dat")) 692 factorqe_NSB[ict]=EMI_NSB; 693 else if(!strcmp(qe_filename, "../Data/qe-intevac_hpd.RFL.dat")) 694 factorqe_NSB[ict]=HPD_NSB; 695 else{ 696 log(SIGNATURE,"WARNING : the factor for the diffuse NSB for this QE file (%s) is not known. The number of phe(ns stated in the inputcard will be used.\n",qe_filename); 697 factorqe_NSB[ict]=1.0; 698 } 679 699 log(SIGNATURE, 680 700 "%s:\n\t%20s:\t%s\n\t%20s:\t%s\n\t%20s\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", … … 689 709 ); 690 710 711 // log parameters information 712 713 log(SIGNATURE, 714 "%s:\n\t%20s: %f: %s\n\t%20s: %f\n\t%20s: %f\n", 715 "Parameters", 716 "NSB (phes/ ns 0.1*0.1 deg^2 239 m^2)", meanNSB*factorqe_NSB[ict], ONoff(simulateNSB), 717 "Pedestals = ", get_FADC_pedestal(), 718 "High to Low gain = ", FADC_high2low 719 ); 720 691 721 // log Trigger information 692 722 … … 741 771 "Write_RawEvt", ONoff(Write_RawEvt)); 742 772 743 // log parameters information744 745 log(SIGNATURE,746 "%s:\n\t%20s: %f: %s\n\t%20s: %f\n",747 "Parameters",748 "NSB (phes/pixel)", meanNSB, ONoff(simulateNSB),749 "Pedestals = ", get_FADC_pedestal()750 );751 752 773 // log selections 753 774 … … 785 806 } 786 807 787 // set all random numbers seeds788 789 setall( get_seeds(0), get_seeds(1) );790 791 808 // get list of showers to evt. skip 792 809 … … 836 853 Trigger_response_ampl, 837 854 Trigger_response_fwhm); //@< A instance of the Class MTrigger 855 Trigger_CT[i]->SetSeed(UInt_t(i+get_seeds(0))); 838 856 } 839 857 … … 849 867 // is active: secureDiskThres*10000+riseDiskThres 850 868 851 if(riseDiskThres>0.0) 852 qThreshold[0][0]=((UInt_t)secureDiskThres*100)*100+riseDiskThres; 853 else 854 qThreshold[0][0]=0.0; 855 869 for (int ict=0; ict<ct_Number;ict++){ 870 if(riseDiskThres>0.0) 871 qThreshold[ict][0]=((UInt_t)secureDiskThres*100)*100+riseDiskThres; 872 else 873 qThreshold[ict][0]=0.0; 874 } 856 875 // Initialise McTrig information class if we want to save trigger informtion 857 876 … … 920 939 921 940 Fadc_CT[ict]->SetPedestals(input_pedestals); 941 Fadc_CT[ict]->SetHigh2LowGain(FADC_high2low); 922 942 923 943 // Generate databse for the Fadc electronic noise 924 if (addElecNoise) 944 if (addElecNoise){ 925 945 Fadc_CT[ict]->SetElecNoise(FADC_noise); 926 } 946 Fadc_CT[ict]->SetDigitalNoise(DIGITAL_noise); 947 } 948 } 949 927 950 // Prepare the raw data output 928 951 … … 997 1020 &HeaderTrig[0]); 998 1021 } 999 if (ct_Number==1) 1022 if (ct_Number==1){ 1000 1023 HeaderTree.Branch("MGeomCam",GeometryName[0], 1001 1024 &camdummy[0]); 1025 HeaderTree.Branch("MMcConfigRunHeader","MMcConfigRunHeader", 1026 &McConfigRunHeader[0]); 1027 } 1002 1028 else{ 1003 1029 char branchname[20]; … … 1010 1036 &camdummy[ict]); 1011 1037 } 1038 for(int i=0;i<numberBranches;i++){ 1039 sprintf(help,"%i",i+1); 1040 strcpy (branchname, "MMcConfigRunHeader;"); 1041 strcat (branchname, & help[0]); 1042 strcat (branchname, "."); 1043 HeaderTree.Branch(branchname,"MMcConfigRunHeader", 1044 &McConfigRunHeader[i]); 1045 } 1046 1012 1047 } 1013 1048 … … 1113 1148 1114 1149 HeaderFadc[0]->SetShape(0.0); 1115 HeaderFadc[0]->SetAmplitud(FADC_response_ampl); 1116 HeaderFadc[0]->SetFwhm(FADC_response_fwhm); 1150 HeaderFadc[0]->SetAmplitud(FADC_response_ampl/ 1151 sqrt(2*M_PI*FADC_response_fwhm 1152 *FADC_response_fwhm), 1153 FADC_resp_ampl_out/ 1154 sqrt(2*M_PI*FADC_resp_fwhm_out 1155 *FADC_resp_fwhm_out)); 1156 HeaderFadc[0]->SetFwhm(FADC_response_fwhm,FADC_resp_fwhm_out); 1157 HeaderFadc[0]->SetLow2High(FADC_high2low); 1117 1158 HeaderFadc[0]->SetPedestal(&fadc_pedestals[0], 1118 1159 ((MGeomCam*)(camgeom.UncheckedAt(0)))->GetNumPixels()); … … 1122 1163 if(!Trigger_Loop && Write_McFADC && ct_Number>1){ 1123 1164 for(int i=0;i<ct_Number;i++){ 1165 Fadc_CT[i]->GetPedestals(&fadc_pedestals[0]); 1124 1166 HeaderFadc[i]->SetShape(0.0); 1125 HeaderFadc[i]->SetAmplitud(FADC_response_ampl); 1126 HeaderFadc[i]->SetFwhm(FADC_response_fwhm); 1167 HeaderFadc[i]->SetAmplitud(FADC_response_ampl/ 1168 sqrt(2*M_PI*FADC_response_fwhm 1169 *FADC_response_fwhm), 1170 FADC_resp_ampl_out/ 1171 sqrt(2*M_PI*FADC_resp_fwhm_out 1172 *FADC_resp_fwhm_out)); 1173 HeaderFadc[i]->SetFwhm(FADC_response_fwhm,FADC_resp_fwhm_out); 1174 HeaderFadc[i]->SetLow2High(FADC_high2low); 1127 1175 HeaderFadc[i]->SetPedestal(&fadc_pedestals[0],((MGeomCam*)(camgeom.UncheckedAt(i)))->GetNumPixels()); 1128 1176 HeaderFadc[i]->SetElecNoise(&fadc_elecnoise[0],((MGeomCam*)(camgeom.UncheckedAt(i)))->GetNumPixels()); … … 1134 1182 for (imulticount=0;imulticount<=Trigger_loop_umult-Trigger_loop_lmult;imulticount++){ 1135 1183 for(itopocount=0;itopocount<=Trigger_loop_utop-Trigger_loop_ltop;itopocount++){ 1184 Fadc_CT[0]->GetPedestals(&fadc_pedestals[0]); 1136 1185 HeaderFadc[iconcount]->SetShape(0.0); 1137 HeaderFadc[iconcount]->SetAmplitud(Trigger_response_ampl); 1138 HeaderFadc[iconcount]->SetFwhm(Trigger_response_fwhm); 1186 HeaderFadc[iconcount]->SetAmplitud(FADC_response_ampl/ 1187 sqrt(2*M_PI*FADC_response_fwhm 1188 *FADC_response_fwhm), 1189 FADC_resp_ampl_out/ 1190 sqrt(2*M_PI*FADC_resp_fwhm_out 1191 *FADC_resp_fwhm_out)); 1192 HeaderFadc[iconcount]->SetFwhm(FADC_response_fwhm, 1193 FADC_resp_fwhm_out); 1194 HeaderFadc[iconcount]->SetLow2High(FADC_high2low); 1139 1195 HeaderFadc[iconcount]->SetPedestal(&fadc_pedestals[0], ct_NPixels); 1140 1196 HeaderFadc[iconcount]->SetElecNoise(&fadc_elecnoise[0], ct_NPixels); … … 1145 1201 } 1146 1202 1203 // UnSet flag in pixel 0 (not used for trigger) that indicates if secure pixel 1204 // is active once it has been stored 1205 1206 for (int ict=0; ict<ct_Number;ict++){ 1207 qThreshold[ict][0]=999999.99; 1208 } 1209 1147 1210 1148 1211 // create a Tree for the Event data stream … … 1157 1220 if(!Trigger_Loop && ct_Number==1){ 1158 1221 1159 HeaderTree.Branch("MMcConfigRunHeader","MMcConfigRunHeader",1160 &McConfigRunHeader[0]);1161 1162 1222 if (Write_RawEvt){ 1163 1223 EvtTree.Branch("MRawEvtHeader","MRawEvtHeader", … … 1173 1233 else{ 1174 1234 1175 if(ct_Number>1)1176 for(char branchname[10],i=0;i<numberBranches;i++){1177 1178 sprintf(help,"%i",i+1);1179 strcpy (branchname, "MMcConfigRunHeader;");1180 strcat (branchname, & help[0]);1181 strcat (branchname, ".");1182 HeaderTree.Branch(branchname,"MMcConfigRunHeader",1183 &McConfigRunHeader[i]);1184 }1185 1186 1235 if (Write_McTrig){ 1187 1236 for(char branchname[10],i=0;i<numberBranches;i++){ … … 1303 1352 const Float_t size= 1304 1353 (*((MGeomCam*)(camgeom.UncheckedAt(ict))))[ui].GetD(); 1305 diffnsb_phepns[ict][ui] = (Int_t(meanNSB*factorNSB_ct*100*size*size+0.5))/(100.0*size*size) * size*size ;1354 diffnsb_phepns[ict][ui] = (Int_t(meanNSB*factorNSB_ct*100*size*size+0.5))/(100.0*size*size) * size*size*factorqe_NSB[ict]; 1306 1355 } 1307 1356 } … … 1321 1370 } 1322 1371 } 1372 } 1373 1374 1375 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1376 // 1377 // Now a empty event with the conditin in which the camera is run 1378 // is simulated. IN this way one gets an estimation of the 1379 // sigma for the pedestal of each FADC channel. 1380 // This sigma computtaion is done assuming any noise taht effects 1381 // the FADC but there is no rotation of the Star Field (otherwise it 1382 // should be done for each event) 1383 // 1384 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1385 1386 for(int ict=0;ict<ct_Number;ict++){ 1387 Fadc_CT[ict]->Reset() ; 1388 if (addElecNoise){ 1389 Fadc_CT[ict]->ElecNoise(FADC_noise) ; 1390 } 1391 if(simulateNSB){ 1392 for(UInt_t ui=0; 1393 ui<((MGeomCam*)(camgeom.UncheckedAt(ict)))->GetNumPixels(); 1394 ui++){ 1395 if(nsb_phepns[ict][ui]>0.0){ 1396 if((*((MGeomCam*)(camgeom.UncheckedAt(ict))))[ui].GetD()>(*((MGeomCam*)(camgeom.UncheckedAt(ict))))[0].GetD()){ 1397 k=lons_outer.GetResponse(nsb_phepns[ict][ui],0.01, 1398 & nsb_trigresp[0], 1399 & nsb_fadcresp[0]); 1400 } 1401 else{ 1402 k=lons.GetResponse(nsb_phepns[ict][ui],0.01, 1403 & nsb_trigresp[0],& nsb_fadcresp[0]); 1404 } 1405 if(k==0){ 1406 cout << "Exiting.\n"; 1407 exit(1); 1408 } 1409 Fadc_CT[ict]->AddSignal(ui,nsb_fadcresp); 1410 } 1411 } 1412 } 1413 Fadc_CT[ict]->Pedestals(); 1414 for(UInt_t ui=0; 1415 ui<((MGeomCam*)(camgeom.UncheckedAt(ict)))->GetNumPixels(); 1416 ui++){ 1417 fadc_sigma[ui]=Fadc_CT[ict]->GetPedestalNoise(ui,1); 1418 fadc_sigma_low[ui]=Fadc_CT[ict]->GetPedestalNoise(ui,0); 1419 } 1420 HeaderFadc[ict]->SetPedestalSigma(&fadc_sigma_low[0],&fadc_sigma[0], 1421 ((MGeomCam*)(camgeom.UncheckedAt(ict))) 1422 ->GetNumPixels()); 1323 1423 } 1324 1424 … … 1873 1973 // fill pixel information 1874 1974 if (Lev1){ 1975 if (addElecNoise) Fadc_CT[0]->DigitalNoise(); 1875 1976 for(UInt_t i=0; 1876 1977 i<((MGeomCam*)(camgeom.UncheckedAt(0))) … … 2047 2148 2048 2149 if ( Lev0MT[ict] > 0 || Write_All_Images) { 2150 2049 2151 Lev1MT[ict]= Trigger_CT[ict]->FirstLevel(); 2050 2152 } … … 2110 2212 2111 2213 if (Lev1MT[ict]){ 2214 if (addElecNoise) Fadc_CT[ict]->DigitalNoise(); 2112 2215 for(UInt_t i=0; 2113 2216 i<((MGeomCam*)(camgeom.UncheckedAt(ict)))->GetNumPixels(); … … 3736 3839 int k, ii; // counters 3737 3840 3738 MTrigger trigger( 397,camgeom,Trigger_gate_length, Trigger_overlaping_time, Trigger_response_ampl, Trigger_response_fwhm);3739 MFadc flashadc ;3841 MTrigger trigger(camgeom->GetNumPixels(),camgeom,Trigger_gate_length, Trigger_overlaping_time, Trigger_response_ampl, Trigger_response_fwhm); 3842 MFadc flashadc(camgeom->GetNumPixels()); 3740 3843 3741 3844 static float wl_nm[iNUMWAVEBANDS + 1] = { WAVEBANDBOUND1, … … 3955 4058 TRandom random; // Random numbers generator 3956 4059 3957 random.SetSeed ((UInt_t) (RandomNumber*1000));4060 random.SetSeed(get_seeds(1)); 3958 4061 3959 4062 ii = *inphe; // avoid dereferencing … … 4054 4157 // 4055 4158 // $Log: not supported by cvs2svn $ 4159 // Revision 1.62 2003/09/26 11:25:07 blanch 4160 // Modification to be able to read MGeomCam branch for any Geometry. 4161 // 4056 4162 // Revision 1.61 2003/09/25 17:09:20 blanch 4057 4163 // Bug on the number of phe from diffuse NSB fixed.
Note:
See TracChangeset
for help on using the changeset viewer.