Changeset 9144 for trunk/MagicSoft/Mars/datacenter/macros
- Timestamp:
- 10/23/08 14:23:28 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/macros/fillcamera.C
r8996 r9144 18 18 ! Author(s): Thomas Bretz, 06/2007 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! Author(s): Daniela Dorner, 11/2005 <mailto:dorner@astro.uni-wuerzburg.de> 20 ! Author(s): Daniel Hoehne, 10/2007<mailto:hoehne@astro.uni-wuerzburg.de>20 ! Author(s): Daniel Hoehne, 06/2008 <mailto:hoehne@astro.uni-wuerzburg.de> 21 21 ! 22 ! Copyright: MAGIC Software Development, 2000-200 722 ! Copyright: MAGIC Software Development, 2000-2008 23 23 ! 24 24 ! … … 37 37 // 38 38 // Make sure, that database and password are corretly set in a resource 39 // file called mcsql.rc and the resource file is found. 39 // file called sql.rc and the resource file is found. 40 // In order not to confuse the MC processing with the data processing, 41 // both branches will be processed in two different Mars directories, 42 // e.g. Mars-2.0 for data and Mars.MC for MCs. 40 43 // 41 44 // Returns 2 in case of failure and 1 in case of success. … … 171 174 Double_t point = runheader2->GetPointSpread(); 172 175 Double_t pointspreadx = runheader2->GetPointSpreadX(); 176 Double_t addspotsize; 177 if (pointspreadx < 0.25) 178 { 179 addspotsize = 0; 180 } 181 else 182 { 183 addspotsize = TMath::Sqrt(pointspreadx*pointspreadx - 0.25); 184 } 185 Double_t realpsf = TMath::Sqrt(pointspreadx*pointspreadx + 0.25); 173 186 Double_t pointspready = runheader2->GetPointSpreadY(); 174 187 Double_t coneai = runheader1->GetViewconeAngleInner(); … … 184 197 185 198 // some calculations: round the given values 186 pointspreadx=TMath::Floor(pointspreadx*100+0.5)/100; 187 pointspready=TMath::Floor(pointspready*100+0.5)/100; 188 point=TMath::Floor(point*10+0.5)/10; 189 coneai=TMath::Floor(coneai*10+0.5)/10; 190 coneao=TMath::Floor(coneao*10+0.5)/10; 191 spectrum=TMath::Floor(spectrum*10+0.5)/10; 199 pointspreadx = TMath::Floor(pointspreadx*100+0.5)/100; 200 addspotsize = TMath::Floor(addspotsize*100+0.5)/100; 201 realpsf = TMath::Floor(realpsf*100+0.5)/100; 202 pointspready = TMath::Floor(pointspready*100+0.5)/100; 203 point = TMath::Floor(point*10+0.5)/10; 204 coneai = TMath::Floor(coneai*10+0.5)/10; 205 coneao = TMath::Floor(coneao*10+0.5)/10; 206 spectrum = TMath::Floor(spectrum*10+0.5)/10; 192 207 193 208 // Definition of strings 209 TString numslices = Form("%5.0i", rawheader->GetNumSamplesHiGain()); 194 210 TString elow = Form("%5.1f", runheader1->GetELowLim()); 195 211 TString eupp = Form("%5.1f", runheader1->GetEUppLim()); … … 202 218 TString psf = Form("%5.1f", point); 203 219 TString psfx = Form("%5.2f", pointspreadx); 220 TString addspot = Form("%5.2f", addspotsize); 221 TString rpsf = Form("%5.2f", realpsf); 204 222 TString psfy = Form("%5.2f", pointspready); 205 223 TString psfadd = Form("%5.2f", TMath::Hypot(runheader2->GetPointSpreadX(), runheader2->GetPointSpread())); … … 247 265 248 266 //get the psf value for the path for linking 249 Float_t pointsfuncx=pointspreadx*10; 250 pointsfuncx=TMath::Floor(pointsfuncx*10+0.5)/10; 251 Int_t pointsfx = TMath::Nint(pointsfuncx); 267 Float_t pointsfuncx = pointspreadx*10; 268 pointsfuncx = TMath::Floor(pointsfuncx*10+0.5)/10; 269 Int_t pointsfx = TMath::Nint(pointsfuncx); 270 271 Float_t aspotsize = addspotsize*10; 272 aspotsize = TMath::Floor(aspotsize*10+0.5)/10; 273 Int_t ass = TMath::Nint(aspotsize); 274 275 Float_t realpointsf = realpsf*10; 276 realpointsf = TMath::Floor(realpointsf*10+0.5)/10; 277 Int_t rpointsf = TMath::Nint(realpointsf); 278 252 279 253 280 // Get zbin … … 264 291 Int_t amplfadckey; 265 292 Int_t psfkey; 293 Int_t spotsizekey; 266 294 Int_t viewconeangleokey; 267 295 Int_t spectrumkey; … … 299 327 cout << "ElecNoise " << enoise << endl; 300 328 cout << "DigiNoise " << dnoise << endl; 329 cout << "Num HiGainSlices " << numslices << endl; 301 330 cout << "PhiMin " << pmin << endl; 302 331 cout << "PhiMax " << pmax << endl; … … 312 341 cout << "CamVer " << camvers << " -> " << "n/a" <<endl; 313 342 cout << "PointSpreadX " << psfx << " -> " << "0" <<endl; 343 cout << "Add. SpotSize " << addspot << " -> " << "0" <<endl; 344 cout << "Real PSF " << rpsf << " -> " << "0" <<endl; 314 345 cout << "PointSpreadY " << psfy << " -> " << "0" <<endl; 315 346 cout << "MispointingX " << misx << " -> " << "0" <<endl; … … 319 350 cout << endl; 320 351 321 corsikakey =1;322 reflectorkey =1;323 camerakey =1;324 observationkey =1;325 particlekey = 1;326 atmomodelkey = serv.QueryKeyOfName("AtmosphericModel", atmomodel.Data());327 amplfadckey = serv.QueryKeyOfName("AmplFadc", amplfadc.Data());352 corsikakey = 1; 353 reflectorkey = 1; 354 camerakey = 1; 355 observationkey = 1; 356 particlekey = 1; 357 atmomodelkey = serv.QueryKeyOfName("AtmosphericModel", atmomodel.Data()); 358 amplfadckey = serv.QueryKeyOfName("AmplFadc", amplfadc.Data()); 328 359 viewconeangleokey = serv.QueryKeyOfName("ViewconeAngleO", coneangleo.Data()); 329 spectrumkey = 1; 330 psfkey = 1; 360 spectrumkey = 1; 361 psfkey = 1; 362 spotsizekey = 1; 331 363 332 364 if (corsvers==0) … … 355 387 } 356 388 357 cout << "corsikakey: " << corsikakey << endl;358 cout << "reflectorkey: " << reflectorkey << endl;359 cout << "camerakey: " << camerakey << endl;389 cout << "corsikakey: " << corsikakey << endl; 390 cout << "reflectorkey: " << reflectorkey << endl; 391 cout << "camerakey: " << camerakey << endl; 360 392 cout << "observationkey: " << observationkey << endl; 361 cout << "particlekey: " << particlekey << endl; 362 cout << "atmomodelkey: " << atmomodelkey << endl; 363 cout << "amplfadckey: " << amplfadckey << endl; 364 cout << "psfkey: " << psfkey << endl; 365 cout << "coneangleokey: " << viewconeangleokey << endl; 366 cout << "spectrumkey: " << spectrumkey << endl; 393 cout << "particlekey: " << particlekey << endl; 394 cout << "atmomodelkey: " << atmomodelkey << endl; 395 cout << "amplfadckey: " << amplfadckey << endl; 396 cout << "psfkey: " << psfkey << endl; 397 cout << "spotsizekey: " << spotsizekey << endl; 398 cout << "coneangleokey: " << viewconeangleokey << endl; 399 cout << "spectrumkey: " << spectrumkey << endl; 367 400 cout << endl; 368 401 369 402 // For ped/cal: fixed values for psf and mispointing 370 vars = Form("fPointSpreadX=0, f PointSpreadY=0, fMissPointingX=0, fMissPointingY=0, ");403 vars = Form("fPointSpreadX=0, fAdditionalSpotSize=0, fRealPointSpread=0, fPointSpreadY=0, fMissPointingX=0, fMissPointingY=0, "); 371 404 372 405 } … … 387 420 cout << "CamVer " << camera << endl; 388 421 cout << "ParticleId " << partid << endl; 389 cout << "ParticleName " 422 cout << "ParticleName " << partname << endl; 390 423 cout << "PointSpread " << psf << endl; 391 424 cout << "PointSpreadX " << pointspreadx << endl; 425 cout << "Add. SpotSize " << addspot << endl; 426 cout << "Real PSF " << rpsf << endl; 392 427 cout << "PointSpreadXY " << psfx << " /" << psfy << endl; 393 428 // cout << "AdditionPSF " << psfadd << endl; … … 407 442 cout << "ElecNoise " << enoise << endl; 408 443 cout << "DigiNoise " << dnoise << endl; 444 cout << "Num HiGainSlices " << numslices << endl; 409 445 cout << "PhiMin " << pmin << endl; 410 446 cout << "PhiMax " << pmax << endl; … … 418 454 cout << endl; 419 455 420 corsikakey =1;421 reflectorkey =1;422 camerakey =1;456 corsikakey = 1; 457 reflectorkey = 1; 458 camerakey = 1; 423 459 observationkey = serv.QueryKeyOfName("ObservationMode", wobblemod.Data()); 424 particlekey = serv.QueryKeyOfName("MCParticle", partname.Data());425 atmomodelkey = serv.QueryKeyOfName("AtmosphericModel", atmomodel.Data());426 amplfadckey = serv.QueryKeyOfName("AmplFadc", amplfadc.Data());460 particlekey = serv.QueryKeyOfName("MCParticle", partname.Data()); 461 atmomodelkey = serv.QueryKeyOfName("AtmosphericModel", atmomodel.Data()); 462 amplfadckey = serv.QueryKeyOfName("AmplFadc", amplfadc.Data()); 427 463 viewconeangleokey = serv.QueryKeyOfName("ViewconeAngleO", coneangleo.Data()); 428 psfkey = serv.QueryKeyOfName("PSF", psfx); 429 spectrumkey = serv.QueryKeyOfName("Spectrum", slope); 464 psfkey = serv.QueryKeyOfName("PSF", rpsf); 465 spotsizekey = serv.QueryKeyOfName("AddSpotSize", addspot); 466 spectrumkey = serv.QueryKeyOfName("Spectrum", slope); 430 467 431 468 if (corsvers==0) … … 454 491 } 455 492 456 cout << "corsikakey: " << corsikakey << endl;457 cout << "reflectorkey: " << reflectorkey << endl;458 cout << "camerakey: " << camerakey << endl;493 cout << "corsikakey: " << corsikakey << endl; 494 cout << "reflectorkey: " << reflectorkey << endl; 495 cout << "camerakey: " << camerakey << endl; 459 496 cout << "observationkey: " << observationkey << endl; 460 cout << "particlekey: " << particlekey << endl; 461 cout << "atmomodelkey: " << atmomodelkey << endl; 462 cout << "amplfadckey: " << amplfadckey << endl; 463 cout << "psfkey: " << psfkey << endl; 464 cout << "coneangleokey: " << viewconeangleokey << endl; 465 cout << "spectrumkey: " << spectrumkey << endl; 497 cout << "particlekey: " << particlekey << endl; 498 cout << "atmomodelkey: " << atmomodelkey << endl; 499 cout << "amplfadckey: " << amplfadckey << endl; 500 cout << "psfkey: " << psfkey << endl; 501 cout << "spotsizekey: " << spotsizekey << endl; 502 cout << "coneangleokey: " << viewconeangleokey << endl; 503 cout << "spectrumkey: " << spectrumkey << endl; 466 504 cout << endl; 467 505 468 506 // For data runs the values are taken from the file 469 vars = Form("fPointSpreadX=%5.2f, f PointSpreadY=%5.2f, fMissPointingX=%s, fMissPointingY=%s, ",470 pointspreadx, pointspready, misx.Data(), misy.Data());507 vars = Form("fPointSpreadX=%5.2f, fAdditionalSpotSize=%5.2f, fRealPointSpread=%5.2f, fPointSpreadY=%5.2f, fMissPointingX=%s, fMissPointingY=%s, ", 508 pointspreadx, addspotsize, realpsf, pointspready, misx.Data(), misy.Data()); 471 509 472 510 } … … 488 526 TSQLRow *row = 0; 489 527 row = res->Next(); 528 if (!row) 529 return 2; 490 530 TString num=(*row)[0]; 491 531 Int_t RunNum=atoi(num.Data()); … … 518 558 "fThetaMax=%s, fPointSpread=%s, " 519 559 "fPedesMean=%s, fLow2HighGain=%s, " 520 "fAmplFadc =%s, fAmplFadcOuter=%s, ",560 "fAmplFadcInner=%s, fAmplFadcOuter=%s, ", 521 561 elow.Data(), eupp.Data(), spectrum, 522 562 imax.Data(), numsimshow, numevents, … … 528 568 Form("fElectricNoise=%s, " 529 569 "fDigitalNoise=%s, fRunNumber=%d, " 530 "f CorsikaVersionKEY=%d, "570 "fNumSlices=%s, fCorsikaVersionKEY=%d, " 531 571 "fReflectorVersionKEY=%d, fCameraVersionKEY=%d, " 532 572 "fObservationModeKEY=%d, fMCParticleKEY=%d, " 533 573 "fSequenceFirst=0, fNumTriggers=%d, fViewconeAngleInner=%5.2f, fViewconeAngleOuter=%5.2f, " 534 "fAtmosphericModelKEY=%d, fAmplFadcKEY=%d, "574 "fAtmosphericModelKEY=%d, fAmplFadcKEY=%d, fAddSpotSizeKEY=%d, " 535 575 "fPSFKEY=%d, fViewconeAngleOKEY=%d, fSpectrumKEY=%d ", 536 576 enoise.Data(), 537 577 dnoise.Data(), RunNum, 538 corsikakey,578 numslices.Data(), corsikakey, 539 579 reflectorkey, camerakey, 540 580 observationkey, particlekey, 541 581 ntrig, coneai, coneao, 542 atmomodelkey, amplfadckey, 582 atmomodelkey, amplfadckey, spotsizekey, 543 583 psfkey, viewconeangleokey, spectrumkey); 544 584 … … 588 628 "fThetaMax=%s, fPointSpread=%s, " 589 629 "fPedesMean=%s, fLow2HighGain=%s, " 590 "fAmplFadc =%s, fAmplFadcOuter=%s, ",630 "fAmplFadcInner=%s, fAmplFadcOuter=%s, ", 591 631 elow.Data(), eupp.Data(), spectrum, 592 632 imax.Data(), numsimshow, numevents, … … 598 638 Form("fElectricNoise=%s, " 599 639 "fDigitalNoise=%s, fRunNumber=%d, " 600 "f CorsikaVersionKEY =%d, "640 "fNumSlices=%s, fCorsikaVersionKEY =%d, " 601 641 "fReflectorVersionKEY=%d, fCameraVersionKEY=%d, " 602 642 "fObservationModeKEY=%d, fMCParticleKEY=%d, " 603 643 "fSequenceFirst=0, fNumTriggers=%d, fViewconeAngleInner=%5.2f, fViewconeAngleOuter=%5.2f, " 604 "fAtmosphericModelKEY=%d, fAmplFadcKEY=%d, "644 "fAtmosphericModelKEY=%d, fAmplFadcKEY=%d, fAddSpotSizeKEY=%d, " 605 645 "fPSFKEY=%d, fViewconeAngleOKEY=%d, fSpectrumKEY=%d ", 606 646 enoise.Data(), 607 647 dnoise.Data(), RunNum, 608 corsikakey,648 numslices.Data(), corsikakey, 609 649 reflectorkey, camerakey, 610 650 observationkey, particlekey, 611 651 ntrig, coneai, coneao, 612 atmomodelkey, amplfadckey, 652 atmomodelkey, amplfadckey, spotsizekey, 613 653 psfkey, viewconeangleokey, spectrumkey); 614 654 … … 656 696 TString query3(Form("SELECT fMCParticleName, fSpectrum FROM MCRunData " 657 697 "LEFT JOIN MCParticle USING (fMCParticleKEY) " 698 // "LEFT JOIN ON MCRunData.fMCParticleKEY=MCParticle.fMCParticleKEY " 658 699 "LEFT JOIN Spectrum USING (fSpectrumKEY) " 700 // "LEFT JOIN Spectrum ON Spectrum.fSpectrumKEY=MCRunData.fSpectrumKEY " 659 701 "WHERE MCRunData.fRunNumber=%d;", RunNum)); 660 702 res = serv.Query(query3); … … 666 708 667 709 row = res->Next(); 710 if (!row) 711 return 2; 712 668 713 669 714 // Definition of variables for linking the file … … 675 720 TString mkdir; 676 721 TString link; 722 TString linkname; 677 723 TString RunNumber=Form("%08d",RunNum); 678 724 679 725 delete res; 680 rawpath = Form("/magic/montecarlo/rawfiles/19%02d/%02d/%02d", zBin2, amplfadckey, pointsfx);681 // rawpath = Form("/home/hoehne/Analyse/TestMonteCarlo/montecarlo/rawfiles/19%02d/%02d/%02d", zBin2, amplfadckey, pointsfx);726 rawpath = Form("/magic/montecarlo/rawfiles/19%02d/%02d/%02d", zBin2, amplfadckey, ass); 727 // rawpath = Form("/home/hoehne/Analyse/TestMonteCarlo/montecarlo/rawfiles/19%02d/%02d/%02d", zBin2, amplfadckey, ass); 682 728 mkdir = Form("mkdir -p -v %s", rawpath.Data()); 683 729 … … 732 778 } 733 779 734 if (obsmode!=1) 735 { 736 link = Form("ln -sv %s %s/19%02d%02d%02d_%s_%s_%s%s%s_E.root", fname.Data(), rawpath.Data(), zBin2, amplfadckey, pointsfx, RunNumber.Data(), type.Data(), particle.Data(), spec.Data(), obsmode.Data()); 780 if (observationkey!=1) 781 { 782 link = Form("ln -sv %s %s/19%02d%02d%02d_%s_%s_%s%s%s_E.root", fname.Data(), rawpath.Data(), zBin2, amplfadckey, ass, RunNumber.Data(), type.Data(), particle.Data(), spec.Data(), obsmode.Data()); 783 linkname = Form("%s/19%02d%02d%02d_%s_%s_%s%s%s_E.root", rawpath.Data(), zBin2, amplfadckey, ass, RunNumber.Data(), type.Data(), particle.Data(), spec.Data(), obsmode.Data()); 737 784 738 785 if (dummy==kFALSE) … … 740 787 gSystem->Exec(mkdir); 741 788 gSystem->Exec(link); 789 790 TString vars3 = 791 Form("fRunLinked=Now(), fLinkName=\"%s\", fRunNumber=%d ", 792 linkname.Data(), RunNum); 793 794 if (!serv.ExistStr("fRunNumber", "MCRunProcessStatus", Form("%d", RunNum))) 795 { 796 if (!serv.Insert("MCRunProcessStatus", vars3)) 797 return 2; 798 } 799 else 800 if (!serv.Update("MCRunProcessStatus", vars3, Form("fRunNumber=%d", RunNum))) 801 return 2; 802 742 803 } 743 804 else … … 753 814 { 754 815 cout << "" << endl; 755 cout << " Linking will be done by fillcamera script" << endl;816 cout << "P/C Linking will be done by fillcamera script" << endl; 756 817 cout << "" << endl; 757 818 } 758 819 759 delete runheader1;760 delete runheader2;761 delete runheader3;762 delete fadcheader;763 delete rawheader;764 delete evtbasic;820 // delete runheader1; 821 // delete runheader2; 822 // delete runheader3; 823 // delete fadcheader; 824 // delete rawheader; 825 // delete evtbasic; 765 826 766 827 … … 772 833 int fillcamera(TString fname, Bool_t dummy=kTRUE) 773 834 { 774 MSQLMagic serv("sql.rc"); 835 TEnv env("sql.rc"); 836 837 MSQLMagic serv(env); 775 838 if (!serv.IsConnected()) 776 839 { … … 794 857 int fillcamera(TString path="/magic/montecarlo/camera", Bool_t dummy=kTRUE) 795 858 { 796 MSQLMagic serv("mcsql.rc"); 859 // TEnv env("mcsql.rc"); 860 // TEnv env("sql.rc"); 861 862 // MSQLMagic serv(env); 863 MSQLMagic serv("sql.rc"); 797 864 if (!serv.IsConnected()) 798 865 {
Note:
See TracChangeset
for help on using the changeset viewer.