Changeset 2427
- Timestamp:
- 10/26/03 19:43:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Detector/Camera/camera.cxx
r2418 r2427 21 21 // 22 22 // $RCSfile: camera.cxx,v $ 23 // $Revision: 1.6 4$23 // $Revision: 1.65 $ 24 24 // $Author: blanch $ 25 // $Date: 2003-10-2 1 07:42:50 $25 // $Date: 2003-10-26 19:43:00 $ 26 26 // 27 27 //////////////////////////////////////////////////////////////////////// … … 165 165 static int Write_All_Images = FALSE; 166 166 167 //@: flag: TRUE: write all data to output; FALSE: only triggered showers168 static int Write_All_Data = FALSE;169 170 167 static int Write_McEvt = TRUE; 171 168 static int Write_McTrig = TRUE; … … 342 339 343 340 MCRunHeader mcrunh; //@< Run Header class (MC) 344 MCEventHeader mcevth ; //@< Event Header class (MC)345 MCEventHeader_2 mcevth_2 ; //@< Event Header class (MC) for reflector > 0.6341 MCEventHeader mcevth[100]; //@< Event Header class (MC) 342 MCEventHeader_2 mcevth_2[100]; //@< Event Header class (MC) for reflector > 0.6 346 343 MCCphoton cphoton; //@< Cherenkov Photon class (MC) 347 344 348 345 int inumphe; //@< number of photoelectrons in an event from showers 349 346 int inumphe_CT[100]; //@< number of photoelectrons in an event from showers 350 float inumphensb ; //@< number of photoelectrons in an event from nsb347 float inumphensb[100]; //@< number of photoelectrons in an event from nsb 351 348 352 349 float arrtmin_ns; //@ arrival time of the first photoelectron 353 350 float arrtmax_ns; //@ arrival time of the last photoelectron 354 351 355 float thetaCT , phiCT; //@< parameters of a given shower352 float thetaCT[100], phiCT[100]; //@< parameters of a given shower 356 353 float thetashw, phishw; //@< parameters of a given shower 357 354 float coreX, coreY; //@< core position 358 float impactD ; //@< impact parameter355 float impactD[100]; //@< impact parameter 359 356 float l1, m1, n1; //@< auxiliary variables 360 357 float l2, m2, n2; //@< auxiliary variables … … 364 361 int nshow=0; //@< partial number of shower in a given run 365 362 int ntshow=0; //@< total number of showers 366 int ncph=0; //@< partial number of photons in a given run 367 int ncph_system=0; //@< partial number of photons in a given run 368 int ntcph=0; //@< total number of photons 369 370 int i, j, k; //@< simple counters 363 int ncph[100]; //@< partial number of photons in a given run 364 int ntcph[100]; //@< total number of photons 365 366 int ibr, j, k; //@< simple counters 371 367 372 368 int addElecNoise; //@< Will we add ElecNoise? … … 391 387 Byte_t trigger_map[((Int_t)(CAMERA_PIXELS/8))+1]; //@< Pixels on when the 392 388 //@< camera triggers 393 Float_t fadc_elecnoise[CAMERA_PIXELS]; //@< Electronic niose for each pixel 389 Float_t fadc_elecnoise[CAMERA_PIXELS]; //@< Electronic noise for each pixel 390 Float_t fadc_diginoise[CAMERA_PIXELS]; //@< Digital noise for each pixel 394 391 Float_t fadc_pedestals[CAMERA_PIXELS]; //@< array for fadc pedestals values 395 392 Float_t fadc_sigma[CAMERA_PIXELS]; //@< array for fadc pedestals sigma 396 Float_t fadc_sigma_low[CAMERA_PIXELS]; 393 Float_t fadc_sigma_low[CAMERA_PIXELS]; //@< array for fadc pedestals sigma 397 394 398 395 float ext[iNUMWAVEBANDS] = { //@< average atmospheric extinction in each waveband … … 456 453 457 454 qThreshold = new float *[100]; 458 for(i =0;i<100;i++)455 for(int i=0;i<100;i++) 459 456 qThreshold[i] = new float [CAMERA_PIXELS]; 460 457 461 for(i =0;i<iMAXNUMPIX;i++){458 for(int i=0;i<iMAXNUMPIX;i++){ 462 459 for(int ict=0;ict<100;ict++){ 463 460 nsb_phepns[ict][i]=0; … … 467 464 nsbrate_phepns[i][j]=0.0; //@< Starlight rates initialised at 0.0 468 465 } 466 for(int i=0;i<100;i++) 467 ntcph[i]=0; 469 468 /*!@' 470 469 … … 529 528 ct_Geometry=get_ct_geometry(); 530 529 531 for(int i =0;i<ct_Number;i++){532 ntrigger[i ]=0;533 if(ct_Geometry>=i *10){534 GeometryCamera[i ]=int(ct_Geometry/pow(10.0,i))%10;530 for(int ict=0;ict<ct_Number;ict++){ 531 ntrigger[ict]=0; 532 if(ct_Geometry>=ict*10){ 533 GeometryCamera[ict]=int(ct_Geometry/pow(10.0,ict))%10; 535 534 } 536 535 else 537 GeometryCamera[i ]=0;536 GeometryCamera[ict]=0; 538 537 } 539 538 … … 603 602 Write_All_Images = get_write_all_events(); 604 603 605 // write all data (i.e., ph.e.s in pixels)606 607 Write_All_Data = get_write_all_data();608 609 604 Write_McEvt = get_write_McEvt() ; 610 605 Write_McTrig = get_write_McTrig() ; … … 752 747 753 748 log(SIGNATURE, 754 "%s:\n\t%20s: %s\n\t%20s: %s\n\t%20s: %s\n\t%20s: % s\n\t%20s: %3.2f(%s)%3.2f(%s) %s\n",749 "%s:\n\t%20s: %s\n\t%20s: %s\n\t%20s: %s\n\t%20s: %3.2f(%s) %3.2f+%3.2f(%s) %s\n", 755 750 "Flags", 756 751 "Data_From_STDIN", ONoff(Data_From_STDIN), 757 752 "Write_All_Events", ONoff(Write_All_Images), 758 "Write_All_Data", ONoff(Write_All_Data),759 753 "Rotate Starfield", ONoff(Starfield_rotate), 760 "Electronic Noise", Trigger_noise,"trigger", FADC_noise,"fadc",ONoff(addElecNoise) 754 "Electronic Noise", Trigger_noise,"trigger", 755 FADC_noise,DIGITAL_noise,"fadc",ONoff(addElecNoise) 761 756 ); 762 757 … … 815 810 816 811 log(SIGNATURE, "There are some showers to skip:\n"); 817 for (i =0; i<nSkip; ++i)812 for (int i=0; i<nSkip; ++i) 818 813 log(SIGNATURE, "\tshower # %d\n", Skip[i]); 819 814 } … … 890 885 McTrig = new MMcTrig * [numberBranches]; 891 886 892 for (i =0;i<numberBranches;i++) {887 for (int i=0;i<numberBranches;i++) { 893 888 McTrig[i] = new MMcTrig(); 894 889 } … … 896 891 HeaderTrig = new MMcTrigHeader * [numberBranches]; 897 892 898 for (i =0;i<numberBranches;i++) {893 for (int i=0;i<numberBranches;i++) { 899 894 HeaderTrig[i] = new MMcTrigHeader(); 900 895 } … … 905 900 HeaderFadc = new MMcFadcHeader * [numberBranches]; 906 901 907 for (i =0;i<numberBranches;i++) {902 for (int i=0;i<numberBranches;i++) { 908 903 HeaderFadc[i] = new MMcFadcHeader(); 909 904 } … … 934 929 Float_t input_pedestals[ct_NPixels]; 935 930 936 for(i =0;i<ct_NPixels;i++)931 for(int i=0;i<ct_NPixels;i++) 937 932 input_pedestals[i]=get_FADC_pedestal(); 938 933 for (int ict=0; ict<ct_Number;ict++){ … … 961 956 MMcConfigRunHeader **McConfigRunHeader = NULL; 962 957 McConfigRunHeader = new MMcConfigRunHeader * [numberBranches]; 963 for (i =0;i<numberBranches;i++) {958 for (int i=0;i<numberBranches;i++) { 964 959 McConfigRunHeader[i] = new MMcConfigRunHeader(); 965 960 } … … 972 967 EvtHeader = new MRawEvtHeader * [numberBranches]; 973 968 974 for (i =0;i<numberBranches;i++) {969 for (int i=0;i<numberBranches;i++) { 975 970 EvtHeader[i] = new MRawEvtHeader(); 976 971 } … … 984 979 EvtData = new MRawEvtData * [numberBranches]; 985 980 986 for (i =0;i<numberBranches;i++) {981 for (int i=0;i<numberBranches;i++) { 987 982 EvtData[i] = new MRawEvtData(); 988 983 EvtData[i]->Init(RunHeader); // We need thr RunHeader to read … … 991 986 } 992 987 993 MMcEvt *McEvt = new MMcEvt (); 994 988 MMcEvt **McEvt = NULL; 989 990 if (Write_McEvt) { 991 if (ct_Number>1){ 992 McEvt = new MMcEvt *[numberBranches]; 993 for (int i=0;i<numberBranches;i++) 994 McEvt[i]=new MMcEvt(); 995 } 996 else { 997 McEvt = new MMcEvt *[1]; 998 McEvt[0]=new MMcEvt(); 999 } 1000 } 995 1001 // 996 1002 // initalize a temporal ROOT file … … 1048 1054 1049 1055 if ((Trigger_Loop || ct_Number>1) && Write_McTrig){ 1050 for(char branchname[20],i=0;i<numberBranches;i++){ 1056 ibr=0; 1057 for(char branchname[20];ibr<numberBranches;ibr++){ 1051 1058 1052 sprintf(help,"%i",i +1);1059 sprintf(help,"%i",ibr+1); 1053 1060 strcpy (branchname, "MMcTrigHeader;"); 1054 1061 strcat (branchname, & help[0]); 1055 1062 strcat (branchname, "."); 1056 1063 HeaderTree.Branch(branchname,"MMcTrigHeader", 1057 &HeaderTrig[i ]);1064 &HeaderTrig[ibr]); 1058 1065 } 1059 1066 } … … 1065 1072 } 1066 1073 if ((Trigger_Loop || ct_Number>1) && Write_McFADC){ 1067 for(char branchname[20],i=0;i<numberBranches;i++){ 1074 ibr=0; 1075 for(char branchname[20];ibr<numberBranches;ibr++){ 1068 1076 1069 sprintf(help,"%i",i +1);1077 sprintf(help,"%i",ibr+1); 1070 1078 strcpy (branchname, "MMcFadcHeader;"); 1071 1079 strcat (branchname, & help[0]); 1072 1080 strcat (branchname, "."); 1073 1081 HeaderTree.Branch(branchname,"MMcFadcHeader", 1074 &HeaderFadc[i ]);1082 &HeaderFadc[ibr]); 1075 1083 } 1076 1084 } … … 1139 1147 // Fill branches for MMcFadcHeader 1140 1148 1141 for(i =0;i<ct_NPixels;i++){1149 for(int i=0;i<ct_NPixels;i++){ 1142 1150 fadc_elecnoise[i]=FADC_noise; 1151 fadc_diginoise[i]=DIGITAL_noise; 1143 1152 } 1144 1153 … … 1158 1167 HeaderFadc[0]->SetPedestal(&fadc_pedestals[0], 1159 1168 ((MGeomCam*)(camgeom.UncheckedAt(0)))->GetNumPixels()); 1160 HeaderFadc[0]->SetElecNoise(&fadc_elecnoise[0], 1169 HeaderFadc[0]->SetElecNoise(&fadc_elecnoise[0], &fadc_diginoise[0], 1161 1170 ((MGeomCam*)(camgeom.UncheckedAt(0)))->GetNumPixels()); 1162 1171 } … … 1174 1183 HeaderFadc[i]->SetLow2High(FADC_high2low); 1175 1184 HeaderFadc[i]->SetPedestal(&fadc_pedestals[0],((MGeomCam*)(camgeom.UncheckedAt(i)))->GetNumPixels()); 1176 HeaderFadc[i]->SetElecNoise(&fadc_elecnoise[0],((MGeomCam*)(camgeom.UncheckedAt(i)))->GetNumPixels()); 1185 HeaderFadc[i]->SetElecNoise(&fadc_elecnoise[0], &fadc_diginoise[0], 1186 ((MGeomCam*)(camgeom.UncheckedAt(i)))->GetNumPixels()); 1177 1187 } 1178 1188 } … … 1194 1204 HeaderFadc[iconcount]->SetLow2High(FADC_high2low); 1195 1205 HeaderFadc[iconcount]->SetPedestal(&fadc_pedestals[0], ct_NPixels); 1196 HeaderFadc[iconcount]->SetElecNoise(&fadc_elecnoise[0], ct_NPixels); 1206 HeaderFadc[iconcount]->SetElecNoise(&fadc_elecnoise[0], 1207 &fadc_diginoise[0],ct_NPixels); 1197 1208 iconcount++; 1198 1209 } … … 1212 1223 TTree EvtTree("Events","Normal Triggered Events"); 1213 1224 1214 if (Write_McEvt ){1225 if (Write_McEvt && ct_Number==1){ 1215 1226 1216 1227 EvtTree.Branch("MMcEvt","MMcEvt", 1217 &McEvt); 1228 &McEvt[0]); 1229 } 1230 1231 if (Write_McEvt && ct_Number!=1){ 1232 ibr=0; 1233 for(char branchname[10];ibr<numberBranches;ibr++){ 1234 1235 sprintf(help,"%i",ibr+1); 1236 strcpy (branchname, "MMcEvt;"); 1237 strcat (branchname, & help[0]); 1238 strcat (branchname, "."); 1239 EvtTree.Branch(branchname,"MMcEvt", 1240 &McEvt[ibr]); 1241 } 1218 1242 } 1219 1243 … … 1234 1258 1235 1259 if (Write_McTrig){ 1236 for(char branchname[10],i=0;i<numberBranches;i++){ 1260 ibr=0; 1261 for(char branchname[10];ibr<numberBranches;ibr++){ 1237 1262 1238 sprintf(help,"%i",i +1);1263 sprintf(help,"%i",ibr+1); 1239 1264 strcpy (branchname, "MMcTrig;"); 1240 1265 strcat (branchname, & help[0]); 1241 1266 strcat (branchname, "."); 1242 1267 EvtTree.Branch(branchname,"MMcTrig", 1243 &McTrig[i ]);1268 &McTrig[ibr]); 1244 1269 } 1245 1270 } … … 1247 1272 1248 1273 if ((Trigger_Loop || ct_Number>1) && Write_RawEvt){ 1249 for(char branchname[15],i=0;i<numberBranches;i++){ 1274 ibr=0; 1275 for(char branchname[15];ibr<numberBranches;ibr++){ 1250 1276 1251 sprintf(help,"%i",i +1);1277 sprintf(help,"%i",ibr+1); 1252 1278 strcpy (branchname, "MRawEvtHeader;"); 1253 1279 strcat (branchname, & help[0]); 1254 1280 strcat (branchname, "."); 1255 1281 EvtTree.Branch(branchname,"MRawEvtHeader", 1256 &EvtHeader[i]); 1257 } 1258 for(char branchname[15],i=0;i<numberBranches;i++){ 1282 &EvtHeader[ibr]); 1283 } 1284 ibr=0; 1285 for(char branchname[15];ibr<numberBranches;ibr++){ 1259 1286 1260 sprintf(help,"%i",i +1);1287 sprintf(help,"%i",ibr+1); 1261 1288 strcpy (branchname, "MRawEvtData;"); 1262 1289 strcat (branchname, & help[0]); 1263 1290 strcat (branchname, "."); 1264 1291 EvtTree.Branch(branchname,"MRawEvtData", 1265 &EvtData[i ]);1292 &EvtData[ibr]); 1266 1293 } 1267 1294 } … … 1307 1334 1308 1335 // FIXME --- star NSB different for each camera? 1336 log(SIGNATURE,"Produce NSB rates from Star Field"); 1337 1309 1338 k = produce_nsbrates( starfieldname, 1310 1339 ((MGeomCam*)(camgeom.UncheckedAt(0))), … … 1352 1381 const Float_t size= 1353 1382 (*((MGeomCam*)(camgeom.UncheckedAt(ict))))[ui].GetD(); 1354 diffnsb_phepns[ict][ui] = (Int_t(meanNSB*factorNSB_ct*100*size*size+0.5))/(100.0 *size*size) * size*size*factorqe_NSB[ict];1383 diffnsb_phepns[ict][ui] = (Int_t(meanNSB*factorNSB_ct*100*size*size+0.5))/(100.0)*factorqe_NSB[ict]; 1355 1384 } 1356 1385 } … … 1375 1404 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1376 1405 // 1377 // Now aempty event with the conditin in which the camera is run1378 // issimulated. IN this way one gets an estimation of the1406 // Now 500 empty event with the conditin in which the camera is run 1407 // are simulated. IN this way one gets an estimation of the 1379 1408 // sigma for the pedestal of each FADC channel. 1380 1409 // This sigma computtaion is done assuming any noise taht effects … … 1385 1414 1386 1415 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){ 1416 for(UInt_t ui=0; 1417 ui<((MGeomCam*)(camgeom.UncheckedAt(ict)))->GetNumPixels(); 1418 ui++){ 1419 fadc_sigma[ui]=0.0; 1420 fadc_sigma_low[ui]=0.0; 1421 } 1422 for(int ie=0;ie<500;ie++){ 1423 Fadc_CT[ict]->Reset() ; 1424 if (addElecNoise){ 1425 Fadc_CT[ict]->ElecNoise(FADC_noise) ; 1426 } 1427 if(simulateNSB){ 1428 for(UInt_t ui=0; 1429 ui<((MGeomCam*)(camgeom.UncheckedAt(ict)))->GetNumPixels(); 1430 ui++){ 1431 if(nsb_phepns[ict][ui]>0.0){ 1432 if((*((MGeomCam*)(camgeom.UncheckedAt(ict))))[ui].GetD()>(*((MGeomCam*)(camgeom.UncheckedAt(ict))))[0].GetD()){ 1433 k=lons_outer.GetResponse(nsb_phepns[ict][ui],0.01, 1434 & nsb_trigresp[0], 1435 & nsb_fadcresp[0]); 1436 } 1437 else{ 1438 k=lons.GetResponse(nsb_phepns[ict][ui],0.01, 1439 & nsb_trigresp[0],& nsb_fadcresp[0]); 1440 } 1441 if(k==0){ 1442 cout << "Exiting.\n"; 1443 exit(1); 1444 } 1445 Fadc_CT[ict]->AddSignal(ui,nsb_fadcresp); 1446 } 1447 } 1448 } 1449 Fadc_CT[ict]->Pedestals(); 1392 1450 for(UInt_t ui=0; 1393 1451 ui<((MGeomCam*)(camgeom.UncheckedAt(ict)))->GetNumPixels(); 1394 1452 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 } 1453 fadc_sigma[ui]+=(Fadc_CT[ict]->GetPedestalNoise(ui,1))/500.0; 1454 fadc_sigma_low[ui]+=(Fadc_CT[ict]->GetPedestalNoise(ui,0))/500.0; 1411 1455 } 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 1456 } 1420 1457 HeaderFadc[ict]->SetPedestalSigma(&fadc_sigma_low[0],&fadc_sigma[0], … … 1554 1591 if (reflector_file_version<6){ 1555 1592 for(int ict=0;ict<ct_Number;ict++) 1556 fread( (char*)&mcevth, mcevth.mysize(), 1, inputfile[ict] ); 1593 fread( (char*)&mcevth[ict], mcevth[ict].mysize(), 1594 1, inputfile[ict] ); 1557 1595 } 1558 1596 else{ 1559 1597 for(int ict=0;ict<ct_Number;ict++) 1560 fread( (char*)&mcevth_2, mcevth_2.mysize(), 1, inputfile[ict] ); 1598 fread( (char*)&mcevth_2[ict], mcevth_2[ict].mysize(), 1599 1, inputfile[ict] ); 1561 1600 } 1562 1601 … … 1590 1629 1591 1630 // read the direction of the incoming shower 1592 1631 // It is done only for one telescope since it is suposed 1632 // to be the same shower for all of them 1593 1633 if (reflector_file_version<6){ 1594 thetashw = mcevth .get_theta();1595 phishw = mcevth .get_phi();1634 thetashw = mcevth[0].get_theta(); 1635 phishw = mcevth[0].get_phi(); 1596 1636 } 1597 1637 else{ 1598 thetashw = mcevth_2 .get_theta();1599 phishw = mcevth_2 .get_phi();1638 thetashw = mcevth_2[0].get_theta(); 1639 phishw = mcevth_2[0].get_phi(); 1600 1640 } 1601 1641 … … 1608 1648 if (reflector_file_version<6){ 1609 1649 1610 mcevth .get_core(&coreX, &coreY);1650 mcevth[0].get_core(&coreX, &coreY); 1611 1651 1612 // read the deviation of the telescope with respect to the shower 1613 mcevth.get_deviations ( &thetaCT, &phiCT ); 1614 1615 if ( (thetaCT == 0.) && (phiCT == 0.) ) { 1652 for(int ict=0;ict<ct_Number;ict++){ 1653 // read the deviation of the telescope with respect to the shower 1654 mcevth[ict].get_deviations ( &thetaCT[ict], &phiCT[ict] ); 1655 1656 if ( (thetaCT[ict] == 0.) && (phiCT[ict] == 0.) ) { 1616 1657 1617 // CT was looking to the source (both lines are parallel) 1618 // therefore, we calculate the impact parameter as the distance 1619 // between the CT axis and the core position 1620 1621 impactD = dist_r_P( 0., 0., 0., l1, m1, n1, coreX, coreY, 0. ); 1622 thetaCT += thetashw; 1623 phiCT += phishw; 1658 // CT was looking to the source (both lines are parallel) 1659 // therefore, we calculate the impact parameter as the distance 1660 // between the CT axis and the core position 1661 1662 impactD[ict] = dist_r_P( 0., 0., 0., l1, m1, n1, coreX, coreY, 0. ); 1663 thetaCT[ict] += thetashw; 1664 phiCT[ict] += phishw; 1665 } else { 1624 1666 1625 } else {1667 // the shower comes off-axis 1626 1668 1627 // the shower comes off-axis 1669 // obtain with this the final direction of the CT 1670 1671 thetaCT[ict] += thetashw; 1672 phiCT[ict] += phishw; 1673 1674 // calculate vector for telescope 1628 1675 1629 // obtain with this the final direction of the CT 1630 1631 thetaCT += thetashw; 1632 phiCT += phishw; 1633 1634 // calculate vector for telescope 1635 1636 l2 = sin(thetaCT)*cos(phiCT); 1637 m2 = sin(thetaCT)*sin(phiCT); 1638 n2 = cos(thetaCT); 1639 1640 num = (m1*n2*coreX - m2*n1*coreX + l2*n1*coreY - l1*n2*coreY); 1641 den = (SQR(l1*m2 - l2*m1) + 1642 SQR(m1*n2 - m2*n1) + 1643 SQR(n1*l2 - n2*l1)); 1644 den = sqrt(den); 1645 1646 impactD = fabs(num)/den; 1647 1676 l2 = sin(thetaCT[ict])*cos(phiCT[ict]); 1677 m2 = sin(thetaCT[ict])*sin(phiCT[ict]); 1678 n2 = cos(thetaCT[ict]); 1679 1680 num = (m1*n2*coreX - m2*n1*coreX + l2*n1*coreY - l1*n2*coreY); 1681 den = (SQR(l1*m2 - l2*m1) + 1682 SQR(m1*n2 - m2*n1) + 1683 SQR(n1*l2 - n2*l1)); 1684 den = sqrt(den); 1685 impactD[ict] = fabs(num)/den; 1686 } 1648 1687 } 1649 1688 } 1650 1689 else{ 1651 mcevth_2.get_core(&coreX, &coreY); 1652 thetaCT=mcevth_2.get_theta_CT(); 1653 phiCT=mcevth_2.get_phi_CT(); 1654 if ( (thetaCT == thetashw) && (phiCT == phishw) ) { 1690 mcevth_2[0].get_core(&coreX, &coreY); 1691 for(int ict=0;ict<ct_Number;ict++){ 1692 thetaCT[ict]=mcevth_2[ict].get_theta_CT(); 1693 phiCT[ict]=mcevth_2[ict].get_phi_CT(); 1694 if ( (thetaCT[ict] == thetashw) && (phiCT[ict] == phishw) ) { 1655 1695 1656 // CT was looking to the source (both lines are parallel)1657 // therefore, we calculate the impact parameter as the distance1658 // between the CT axis and the core position1659 1660 impactD= dist_r_P( 0., 0., 0., l1, m1, n1, coreX, coreY, 0. );1696 // CT was looking to the source (both lines are parallel) 1697 // therefore, we calculate the impact parameter as the distance 1698 // between the CT axis and the core position 1699 1700 impactD[ict] = dist_r_P( 0., 0., 0., l1, m1, n1, coreX, coreY, 0. ); 1661 1701 1662 } else {1702 } else { 1663 1703 1664 // the shower comes off-axis1704 // the shower comes off-axis 1665 1705 1666 // calculate vector for telescope1706 // calculate vector for telescope 1667 1707 1668 l2 = sin(thetaCT)*cos(phiCT);1669 m2 = sin(thetaCT)*sin(phiCT);1670 n2 = cos(thetaCT);1708 l2 = sin(thetaCT[ict])*cos(phiCT[ict]); 1709 m2 = sin(thetaCT[ict])*sin(phiCT[ict]); 1710 n2 = cos(thetaCT[ict]); 1671 1711 1672 num = (m1*n2*coreX - m2*n1*coreX + l2*n1*coreY - l1*n2*coreY);1673 den = (SQR(l1*m2 - l2*m1) +1674 SQR(m1*n2 - m2*n1) +1675 SQR(n1*l2 - n2*l1));1676 den = sqrt(den);1712 num = (m1*n2*coreX - m2*n1*coreX + l2*n1*coreY - l1*n2*coreY); 1713 den = (SQR(l1*m2 - l2*m1) + 1714 SQR(m1*n2 - m2*n1) + 1715 SQR(n1*l2 - n2*l1)); 1716 den = sqrt(den); 1677 1717 1678 impactD= fabs(num)/den;1718 impactD[ict] = fabs(num)/den; 1679 1719 1720 } 1680 1721 } 1681 1722 } … … 1685 1726 if ( Select_Energy ) { 1686 1727 if (reflector_file_version<6) 1687 if (( mcevth .get_energy() < Select_Energy_le ) ||1688 ( mcevth .get_energy() > Select_Energy_ue )) {1728 if (( mcevth[0].get_energy() < Select_Energy_le ) || 1729 ( mcevth[0].get_energy() > Select_Energy_ue )) { 1689 1730 log(SIGNATURE, "select_energy: shower rejected.\n"); 1690 1731 continue; 1691 1732 } 1692 1733 else 1693 if (( mcevth_2 .get_energy() < Select_Energy_le ) ||1694 ( mcevth_2 .get_energy() > Select_Energy_ue )) {1734 if (( mcevth_2[0].get_energy() < Select_Energy_le ) || 1735 ( mcevth_2[0].get_energy() > Select_Energy_ue )) { 1695 1736 log(SIGNATURE, "select_energy: shower rejected.\n"); 1696 1737 continue; … … 1699 1740 1700 1741 // Read first and last time and put inumphe_CT[0] to 0 1701 1702 if (reflector_file_version<6) 1703 mcevth.get_times(&arrtmin_ns,&arrtmax_ns); 1704 else 1705 mcevth_2.get_times(&arrtmin_ns,&arrtmax_ns); 1706 1707 ncph_system=0; 1742 float tm=0, tM=9E+50; 1743 for(int ict=0;ict<ct_Number;ict++){ 1744 1745 if (reflector_file_version<6) 1746 mcevth[ict].get_times(&arrtmin_ns,&arrtmax_ns); 1747 else 1748 mcevth_2[ict].get_times(&arrtmin_ns,&arrtmax_ns); 1749 1750 tm=(tm<arrtmin_ns)?tm:arrtmin_ns; 1751 tM=(tM<arrtmax_ns)?tM:arrtmax_ns; 1752 1753 } 1754 arrtmin_ns=tm;arrtmax_ns=tM; 1755 1708 1756 inumphe=0; 1709 1757 … … 1722 1770 &inumphe_CT[ict], // important for later: the size of photoe[] 1723 1771 fnpix, // will be changed by the function! 1724 &ncph , // will be changed by the function!1772 &ncph[ict], // will be changed by the function! 1725 1773 &arrtmin_ns, // will be changed by the function! 1726 1774 &arrtmax_ns, // will be changed by the function! … … 1728 1776 1729 1777 inumphe=(inumphe<inumphe_CT[ict])?inumphe_CT[ict]:inumphe; 1730 1778 1731 1779 if( k != 0 ){ // non-zero returnvalue means error 1732 1780 cout << "Exiting.\n"; … … 1795 1843 1796 1844 }// end if(simulateNSB && nphe2NSB<=inumphe_CT[0]) ... 1797 1798 inumphensb=0; 1799 for (UInt_t ui=0;ui< 1800 ((MGeomCam*)(camgeom.UncheckedAt(0)))->GetNumPixels();ui++){ 1801 inumphensb+=nsb_phepns[0][ui]*TOTAL_TRIGGER_TIME; 1845 1846 for(int ict=0;ict<ct_Number;ict++){ 1847 inumphensb[ict]=0; 1848 for (UInt_t ui=0;ui< 1849 ((MGeomCam*)(camgeom.UncheckedAt(ict)))->GetNumPixels();ui++){ 1850 inumphensb[ict]+=nsb_phepns[ict][ui]*TOTAL_TRIGGER_TIME; 1851 } 1852 ntcph[ict]+=ncph[ict]; 1853 if ((nshow+ntshow)%100 == 1){ 1854 log(SIGNATURE, "End of this event: %d cphs(+%d). . .\n", 1855 ncph[ict], ntcph[ict]); 1856 1857 cout << "Total number of phes in CT "<<ict<<": " 1858 << inumphe_CT[ict]<<" (+ "; 1859 cout<<inumphensb[ict]<<" mean expected number from NSB)"<<endl; 1860 } 1802 1861 } 1803 ntcph+=ncph_system;1804 if ((nshow+ntshow)%100 == 1){1805 log(SIGNATURE, "End of this event: %d cphs(+%d). . .\n",1806 ncph, ntcph);1807 1808 cout << "Total number of phes in CT 0: " << inumphe_CT[0]<<" + ";1809 cout<<inumphensb<<endl;1810 }1811 1862 1812 1863 // skip it ? 1813 1814 for ( i=0; i<nSkip; ++i ) { 1864 1865 int i; 1866 for (i=0; i<nSkip; ++i ) { 1815 1867 if (Skip[i] == (nshow+ntshow)) { 1816 1868 i = -1; … … 1878 1930 int iconcount; 1879 1931 for (iconcount=0, ithrescount=0, fthrescount=Trigger_loop_lthres;fthrescount<=Trigger_loop_uthres;ithrescount++, fthrescount+=Trigger_loop_sthres){ 1880 for (i =0;i<ct_NPixels;i++){1932 for (int i=0;i<ct_NPixels;i++){ 1881 1933 fpixelthres[i]= 1882 1934 ((Float_t)(fthrescount)>=qThreshold[0][i])? … … 1972 2024 EvtHeader[iconcount]->FillHeader ( (UInt_t) (ntshow + nshow),0); 1973 2025 // fill pixel information 1974 if (Lev1 ){2026 if (Lev1 || Write_All_Images){ 1975 2027 if (addElecNoise) Fadc_CT[0]->DigitalNoise(); 1976 2028 for(UInt_t i=0; … … 2013 2065 Float_t ftime, ltime; 2014 2066 if (reflector_file_version<6){ 2015 mcevth .get_times(&ftime, <ime);2016 McEvt ->Fill( 0,2017 (UShort_t) mcevth .get_primary() ,2018 mcevth .get_energy(),2067 mcevth[0].get_times(&ftime, <ime); 2068 McEvt[0]->Fill( 0, 2069 (UShort_t) mcevth[0].get_primary() , 2070 mcevth[0].get_energy(), 2019 2071 -1.0, 2020 2072 -1.0, 2021 2073 -1.0, 2022 mcevth .get_theta(),2023 mcevth .get_phi(),2024 mcevth .get_core(),2025 mcevth .get_coreX(),2026 mcevth .get_coreY(),2027 impactD ,2028 phiCT ,2029 thetaCT ,2074 mcevth[0].get_theta(), 2075 mcevth[0].get_phi(), 2076 mcevth[0].get_core(), 2077 mcevth[0].get_coreX(), 2078 mcevth[0].get_coreY(), 2079 impactD[0], 2080 phiCT[0], 2081 thetaCT[0], 2030 2082 ftime, 2031 2083 ltime, … … 2037 2089 0, 2038 2090 0, 2039 (UInt_t)mcevth .get_CORSIKA(),2040 (UInt_t)mcevth .get_AtmAbs(),2041 (UInt_t)(mcevth .get_MirrAbs()+mcevth.get_OutOfMirr()+mcevth.get_BlackSpot()),2042 (UInt_t) ncph ,2091 (UInt_t)mcevth[0].get_CORSIKA(), 2092 (UInt_t)mcevth[0].get_AtmAbs(), 2093 (UInt_t)(mcevth[0].get_MirrAbs()+mcevth[0].get_OutOfMirr()+mcevth[0].get_BlackSpot()), 2094 (UInt_t) ncph[0], 2043 2095 (UInt_t) inumphe_CT[0], 2044 (UInt_t) inumphensb +inumphe_CT[0],2096 (UInt_t) inumphensb[0]+inumphe_CT[0], 2045 2097 -1.0, 2046 2098 -1.0, … … 2049 2101 else{ 2050 2102 Float_t Nmax, t0, tmax, a, b, c, chi2; 2051 mcevth_2 .get_times(&ftime, <ime);2052 chi2=mcevth_2 .get_NKGfit(&Nmax, &t0, &tmax, &a, &b, &c);2053 McEvt ->Fill((UInt_t) mcevth_2.get_evt_number(),2054 (UShort_t) mcevth_2 .get_primary() ,2055 mcevth_2 .get_energy(),2056 mcevth_2 .get_thick0(),2057 mcevth_2 .get_first_target(),2058 mcevth_2 .get_z_first_int(),2059 mcevth_2 .get_theta(),2060 mcevth_2 .get_phi(),2061 mcevth_2 .get_core(),2062 mcevth_2 .get_coreX(),2063 mcevth_2 .get_coreY(),2064 impactD ,2065 mcevth_2 .get_phi_CT(),2066 mcevth_2 .get_theta_CT(),2103 mcevth_2[0].get_times(&ftime, <ime); 2104 chi2=mcevth_2[0].get_NKGfit(&Nmax, &t0, &tmax, &a, &b, &c); 2105 McEvt[0]->Fill((UInt_t) mcevth_2[0].get_evt_number(), 2106 (UShort_t) mcevth_2[0].get_primary() , 2107 mcevth_2[0].get_energy(), 2108 mcevth_2[0].get_thick0(), 2109 mcevth_2[0].get_first_target(), 2110 mcevth_2[0].get_z_first_int(), 2111 mcevth_2[0].get_theta(), 2112 mcevth_2[0].get_phi(), 2113 mcevth_2[0].get_core(), 2114 mcevth_2[0].get_coreX(), 2115 mcevth_2[0].get_coreY(), 2116 impactD[0], 2117 mcevth_2[0].get_phi_CT(), 2118 mcevth_2[0].get_theta_CT(), 2067 2119 ftime, 2068 2120 ltime, … … 2074 2126 c, 2075 2127 chi2, 2076 (UInt_t)mcevth_2 .get_CORSIKA(),2077 (UInt_t)mcevth_2 .get_AtmAbs(),2078 (UInt_t)(mcevth_2 .get_MirrAbs()+mcevth_2.get_OutOfMirr()+mcevth_2.get_BlackSpot()),2079 (UInt_t) ncph ,2128 (UInt_t)mcevth_2[0].get_CORSIKA(), 2129 (UInt_t)mcevth_2[0].get_AtmAbs(), 2130 (UInt_t)(mcevth_2[0].get_MirrAbs()+mcevth_2[0].get_OutOfMirr()+mcevth_2[0].get_BlackSpot()), 2131 (UInt_t) ncph[0], 2080 2132 (UInt_t) inumphe_CT[0], 2081 (UInt_t) inumphensb +inumphe_CT[0],2082 mcevth_2 .get_ElecFraction(),2083 mcevth_2 .get_MuonFraction(),2084 mcevth_2 .get_OtherFraction());2133 (UInt_t) inumphensb[0]+inumphe_CT[0], 2134 mcevth_2[0].get_ElecFraction(), 2135 mcevth_2[0].get_MuonFraction(), 2136 mcevth_2[0].get_OtherFraction()); 2085 2137 } 2086 2138 } … … 2090 2142 // Clear the branches 2091 2143 if(Write_McTrig){ 2092 for(i =0;i<numberBranches;i++){2144 for(int i=0;i<numberBranches;i++){ 2093 2145 McTrig[i]->Clear() ; 2094 2146 } 2095 2147 } 2096 2148 if( Write_RawEvt ){ 2097 for(i =0;i<numberBranches;i++){2149 for(int i=0;i<numberBranches;i++){ 2098 2150 EvtHeader[i]->Clear() ; 2099 2151 EvtData[i]->DeletePixels(); … … 2101 2153 } 2102 2154 if (Write_McEvt) 2103 McEvt ->Clear() ;2155 McEvt[0]->Clear() ; 2104 2156 } 2105 2157 } … … 2140 2192 2141 2193 Lev0MT[ict] = (Short_t) Trigger_CT[ict]->ZeroLevel() ; 2142 2194 2143 2195 Lev1MT[ict] = 0 ; 2144 2196 … … 2211 2263 // fill pixel information 2212 2264 2213 if (Lev1MT[ict] ){2265 if (Lev1MT[ict] || Write_All_Images){ 2214 2266 if (addElecNoise) Fadc_CT[ict]->DigitalNoise(); 2215 2267 for(UInt_t i=0; … … 2234 2286 if(FADC_Scan){ 2235 2287 if ( Lev0MT[ict] > 0 ) { 2236 Fadc_CT[ict]->ShowSignal( McEvt , (Float_t) 60. ) ;2288 Fadc_CT[ict]->ShowSignal( McEvt[ict], (Float_t) 60. ) ; 2237 2289 } 2238 2290 } … … 2240 2292 if(Trigger_Scan){ 2241 2293 if ( Lev0MT[ict] > 0 ) { 2242 Trigger_CT[ict]->ShowSignal(McEvt ) ;2294 Trigger_CT[ict]->ShowSignal(McEvt[ict]) ; 2243 2295 } 2244 2296 } … … 2248 2300 // If there is trigger in some telecope or we store all showers 2249 2301 if(btrigger){ 2250 // 2251 // fill the MMcEvt with all information 2252 // 2302 if (Write_McEvt){ 2303 // 2304 // fill the MMcEvt with all information 2305 // 2253 2306 2254 if (Write_McEvt){ 2255 Float_t ftime, ltime; 2256 if (reflector_file_version<6){ 2257 mcevth.get_times(&ftime, <ime); 2258 McEvt->Fill( 0, 2259 (UShort_t) mcevth.get_primary() , 2260 mcevth.get_energy(), 2261 -1.0, 2262 -1.0, 2263 -1.0, 2264 mcevth.get_theta(), 2265 mcevth.get_phi(), 2266 mcevth.get_core(), 2267 mcevth.get_coreX(), 2268 mcevth.get_coreY(), 2269 impactD, 2270 phiCT, 2271 thetaCT, 2272 ftime, 2273 ltime, 2274 0, 2275 0, 2276 0, 2277 0, 2278 0, 2279 0, 2280 0, 2281 (UInt_t)mcevth.get_CORSIKA(), 2282 (UInt_t)mcevth.get_AtmAbs(), 2283 (UInt_t)(mcevth.get_MirrAbs()+mcevth.get_OutOfMirr()+mcevth.get_BlackSpot()), 2284 (UInt_t) ncph, 2285 (UInt_t) inumphe_CT[0], 2286 (UInt_t) inumphensb+inumphe_CT[0], 2287 -1.0, 2288 -1.0, 2289 -1.0); 2290 } 2291 else{ 2292 Float_t Nmax, t0, tmax, a, b, c, chi2; 2293 mcevth_2.get_times(&ftime, <ime); 2294 chi2=mcevth_2.get_NKGfit(&Nmax, &t0, &tmax, &a, &b, &c); 2295 McEvt->Fill( (UInt_t) mcevth_2.get_evt_number(), 2296 (UShort_t) mcevth_2.get_primary() , 2297 mcevth_2.get_energy(), 2298 mcevth_2.get_thick0(), 2299 mcevth_2.get_first_target(), 2300 mcevth_2.get_z_first_int(), 2301 mcevth_2.get_theta(), 2302 mcevth_2.get_phi(), 2303 mcevth_2.get_core(), 2304 mcevth_2.get_coreX(), 2305 mcevth_2.get_coreY(), 2306 impactD, 2307 mcevth_2.get_phi_CT(), 2308 mcevth_2.get_theta_CT(), 2309 ftime, 2310 ltime, 2311 Nmax, 2312 t0, 2313 tmax, 2314 a, 2315 b, 2316 c, 2317 chi2, 2318 (UInt_t)mcevth_2.get_CORSIKA(), 2319 (UInt_t)mcevth_2.get_AtmAbs(), 2320 (UInt_t) (mcevth_2.get_MirrAbs()+mcevth_2.get_OutOfMirr()+mcevth_2.get_BlackSpot()), 2321 (UInt_t) ncph, 2322 (UInt_t) inumphe_CT[0], 2323 (UInt_t) inumphensb+inumphe_CT[0], 2324 mcevth_2.get_ElecFraction(), 2325 mcevth_2.get_MuonFraction(), 2326 mcevth_2.get_OtherFraction()); 2307 for (int ict=0;ict<ct_Number;ict++){ 2308 Float_t ftime, ltime; 2309 if (reflector_file_version<6){ 2310 mcevth[ict].get_times(&ftime, <ime); 2311 McEvt[ict]->Fill( 0, 2312 (UShort_t) mcevth[0].get_primary() , 2313 mcevth[ict].get_energy(), 2314 -1.0, 2315 -1.0, 2316 -1.0, 2317 mcevth[ict].get_theta(), 2318 mcevth[ict].get_phi(), 2319 mcevth[ict].get_core(), 2320 mcevth[ict].get_coreX(), 2321 mcevth[ict].get_coreY(), 2322 impactD[ict], 2323 phiCT[ict], 2324 thetaCT[ict], 2325 ftime, 2326 ltime, 2327 0, 2328 0, 2329 0, 2330 0, 2331 0, 2332 0, 2333 0, 2334 (UInt_t)mcevth[ict].get_CORSIKA(), 2335 (UInt_t)mcevth[ict].get_AtmAbs(), 2336 (UInt_t)(mcevth[ict].get_MirrAbs()+mcevth[0].get_OutOfMirr()+mcevth[0].get_BlackSpot()), 2337 (UInt_t) ncph[ict], 2338 (UInt_t) inumphe_CT[ict], 2339 (UInt_t) inumphensb[ict]+inumphe_CT[ict], 2340 -1.0, 2341 -1.0, 2342 -1.0); 2343 } 2344 else{ 2345 Float_t Nmax, t0, tmax, a, b, c, chi2; 2346 mcevth_2[ict].get_times(&ftime, <ime); 2347 chi2=mcevth_2[ict].get_NKGfit(&Nmax, &t0, &tmax, &a, &b, &c); 2348 McEvt[ict]->Fill( (UInt_t) mcevth_2[ict].get_evt_number(), 2349 (UShort_t) mcevth_2[ict].get_primary() , 2350 mcevth_2[ict].get_energy(), 2351 mcevth_2[ict].get_thick0(), 2352 mcevth_2[ict].get_first_target(), 2353 mcevth_2[ict].get_z_first_int(), 2354 mcevth_2[ict].get_theta(), 2355 mcevth_2[ict].get_phi(), 2356 mcevth_2[ict].get_core(), 2357 mcevth_2[ict].get_coreX(), 2358 mcevth_2[ict].get_coreY(), 2359 impactD[ict], 2360 mcevth_2[ict].get_phi_CT(), 2361 mcevth_2[ict].get_theta_CT(), 2362 ftime, 2363 ltime, 2364 Nmax, 2365 t0, 2366 tmax, 2367 a, 2368 b, 2369 c, 2370 chi2, 2371 (UInt_t)mcevth_2[ict].get_CORSIKA(), 2372 (UInt_t)mcevth_2[ict].get_AtmAbs(), 2373 (UInt_t) (mcevth_2[ict].get_MirrAbs()+mcevth_2[ict].get_OutOfMirr()+mcevth_2[ict].get_BlackSpot()), 2374 (UInt_t) ncph[ict], 2375 (UInt_t) inumphe_CT[ict], 2376 (UInt_t) inumphensb[ict]+inumphe_CT[ict], 2377 mcevth_2[ict].get_ElecFraction(), 2378 mcevth_2[ict].get_MuonFraction(), 2379 mcevth_2[ict].get_OtherFraction()); 2380 } 2327 2381 } 2328 2382 } … … 2342 2396 if (Write_RawEvt) EvtData[ict]->DeletePixels(); 2343 2397 if (Write_McTrig) McTrig[ict]->Clear() ; 2398 if (Write_McEvt) McEvt[ict]->Clear() ; 2344 2399 } 2345 if (Write_McEvt) McEvt->Clear() ;2346 2400 } 2347 2401 … … 2380 2434 2381 2435 // We search the maximum impact parameter fo the simualted showers 2382 maxpimpact=maxpimpact<impactD ?impactD:maxpimpact;2436 maxpimpact=maxpimpact<impactD[0]?impactD[0]:maxpimpact; 2383 2437 2384 2438 // look for the next event … … 2442 2496 telestheta=-10.0; 2443 2497 telesphi=-10.0; 2444 mcevth .get_theta_range(&shthetamin, &shthetamax);2445 mcevth .get_phi_range(&shphimin,&shphimax);2446 mcevth .get_theta_range(&shthetamin, &shthetamax);2447 mcevth .get_phi_range(&shphimin,&shphimax);2448 corsika=UInt_t(mcevth .get_VersionPGM()*1000);2498 mcevth[0].get_theta_range(&shthetamin, &shthetamax); 2499 mcevth[0].get_phi_range(&shphimin,&shphimax); 2500 mcevth[0].get_theta_range(&shthetamin, &shthetamax); 2501 mcevth[0].get_phi_range(&shphimin,&shphimax); 2502 corsika=UInt_t(mcevth[0].get_VersionPGM()*1000); 2449 2503 for (int i=0; i< 10;i++) 2450 heights[i]=mcevth .get_HeightLev (i);2451 rnum=mcevth .get_RunNumber();2504 heights[i]=mcevth[0].get_HeightLev (i); 2505 rnum=mcevth[0].get_RunNumber(); 2452 2506 } 2453 2507 else{ 2454 telestheta=mcevth_2 .get_theta_CT();2455 telesphi=mcevth_2 .get_phi_CT();2456 mcevth_2 .get_theta_range(&shthetamin, &shthetamax);2457 mcevth_2 .get_phi_range(&shphimin,&shphimax);2458 corsika=UInt_t(mcevth_2 .get_VersionPGM()*1000);2508 telestheta=mcevth_2[0].get_theta_CT(); 2509 telesphi=mcevth_2[0].get_phi_CT(); 2510 mcevth_2[0].get_theta_range(&shthetamin, &shthetamax); 2511 mcevth_2[0].get_phi_range(&shphimin,&shphimax); 2512 corsika=UInt_t(mcevth_2[0].get_VersionPGM()*1000); 2459 2513 for (int i=0; i< 10;i++) 2460 heights[i]=mcevth_2 .get_HeightLev (i);2461 rnum=mcevth_2 .get_RunNumber();2462 mcevth_2 .get_viewcone(&viewcone[0],&viewcone[1]);2514 heights[i]=mcevth_2[0].get_HeightLev (i); 2515 rnum=mcevth_2[0].get_RunNumber(); 2516 mcevth_2[0].get_viewcone(&viewcone[0],&viewcone[1]); 2463 2517 } 2464 2518 … … 2471 2525 McRunHeader->Fill(rnum, 2472 2526 (UInt_t) 0, 2473 mcevth .get_DateRun(),2527 mcevth[0].get_DateRun(), 2474 2528 ftime, 2475 2529 icontrigger, … … 2500 2554 shphimin, 2501 2555 maxpimpact, 2502 mcevth .get_CWaveLower(),2503 mcevth .get_CWaveUpper(),2504 mcevth .get_slope(),2556 mcevth[0].get_CWaveLower(), 2557 mcevth[0].get_CWaveUpper(), 2558 mcevth[0].get_slope(), 2505 2559 1, 2506 2560 heights, … … 2512 2566 McRunHeader->Fill(rnum, 2513 2567 (UInt_t) 0, 2514 mcevth_2 .get_DateRun(),2568 mcevth_2[0].get_DateRun(), 2515 2569 ftime, 2516 2570 icontrigger, … … 2541 2595 shphimin, 2542 2596 maxpimpact, 2543 mcevth_2 .get_CWaveLower(),2544 mcevth_2 .get_CWaveUpper(),2545 mcevth_2 .get_slope(),2597 mcevth_2[0].get_CWaveLower(), 2598 mcevth_2[0].get_CWaveUpper(), 2599 mcevth_2[0].get_slope(), 2546 2600 1, 2547 2601 heights, … … 2580 2634 1, 2581 2635 heights, 2582 mcevth_2 .get_slope(),2636 mcevth_2[0].get_slope(), 2583 2637 mcrunh.get_ELow(), 2584 2638 mcrunh.get_EUpp(), … … 2638 2692 // close input file 2639 2693 2640 log( SIGNATURE, "%d event(s), with a total of %d C.photons\n",2641 ntshow, ntcph );2642 datafile<<ntshow<<" event(s), with a total of "<<ntcph<<" C.photons"<<endl;2643 2694 if (Trigger_Loop){ 2695 log( SIGNATURE, "%d event(s), with a total of %d C.photons\n", 2696 ntshow, ntcph[0] ); 2697 datafile<<ntshow<<" event(s), with a total of "<<ntcph[0]<<" C.photons"<<endl; 2644 2698 log( SIGNATURE, "Trigger Mode. \n"); 2645 2699 log( SIGNATURE, "Fraction of triggers: \n"); … … 2658 2712 else{ 2659 2713 for(int ict=0;ict<ct_Number;ict++){ 2714 log( SIGNATURE, 2715 "%d event(s), with a total of %d C.photons in CT %i (%s)\n", 2716 ntshow, ntcph[ict],ict,GeometryName[ict] ); 2717 datafile<<ntshow<<" event(s), with a total of "<<ntcph[ict] 2718 <<" C.photons in CT "<<ict<<" ("<<GeometryName[ict]<<")"<<endl; 2660 2719 log( SIGNATURE, "Fraction of triggers: %5.1f%% (%d out of %d)\n", 2661 2720 ((float)ntrigger[ict]) / ((float)ntshow) * 100.0, ntrigger[ict], ntshow); … … 3839 3898 int k, ii; // counters 3840 3899 3841 MTrigger trigger(camgeom->GetNumPixels(),camgeom,Trigger_gate_length, Trigger_overlaping_time, Trigger_response_ampl, Trigger_response_fwhm);3842 MFadc flashadc(camgeom->GetNumPixels());3843 3844 3900 static float wl_nm[iNUMWAVEBANDS + 1] = { WAVEBANDBOUND1, 3845 3901 WAVEBANDBOUND2, … … 3886 3942 exit(1); 3887 3943 } 3944 3945 // Instance of MTrigger and MFadc 3946 3947 MTrigger trigger(camgeom->GetNumPixels(),camgeom,Trigger_gate_length, Trigger_overlaping_time, Trigger_response_ampl, Trigger_response_fwhm); 3948 MFadc flashadc(camgeom->GetNumPixels()); 3888 3949 3889 3950 // initialize flag … … 4157 4218 // 4158 4219 // $Log: not supported by cvs2svn $ 4220 // Revision 1.64 2003/10/21 07:42:50 blanch 4221 // A factor 2.35 to transform the fwhm into the sigma of gaussian was missing 4222 // in the storing of FADC single hpe pulse determination. 4223 // 4159 4224 // Revision 1.63 2003/10/17 19:38:31 blanch 4160 4225 // Now the camera program will stop if a undefined Geometry is required.
Note:
See TracChangeset
for help on using the changeset viewer.