- Timestamp:
- 10/23/08 14:23:28 (16 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r9143 r9144 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2008/10/23 Daniel Hoehne-Moench 22 23 * datacenter/macros/fillcamera.C: 24 - added and changed some parameters 25 26 * datacenter/scripts/fillcamera: 27 - rewritten 28 29 20 30 21 31 2008/10/14 Thomas Bretz -
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 { -
trunk/MagicSoft/Mars/datacenter/scripts/fillcamera
r8759 r9144 18 18 # 19 19 # 20 # Author(s): Daniel Hoehne 0 9/2007<mailto:hoehne@astro.uni-wuerzburg.de>21 # 22 # Copyright: MAGIC Software Development, 2000-200 720 # Author(s): Daniel Hoehne 06/2008 <mailto:hoehne@astro.uni-wuerzburg.de> 21 # 22 # Copyright: MAGIC Software Development, 2000-2008 23 23 # 24 24 # … … 44 44 #mccampath=$mcpath/camera 45 45 mccampath=/magic/montecarlo/camera 46 cameradirs=`find $mccampath -maxdepth 1 -mindepth 1 -type d` 46 #workaround 47 cameradirs=`find /magic/montecarlo/camera -maxdepth 4 -mindepth 2 -type d ! -name Gamma ! -name Muon ! -name Proton ! -name Spot_?.?` 48 #cameradirs=`find /magic/montecarlo/camera -maxdepth 3 -mindepth 2 -type d ! -name Gamma ! -name Muon ! -name Proton` 49 #cameradirs=`find $mccampath -maxdepth 1 -mindepth 1 -type d` 47 50 echo "camera dirs: "${cameradirs[@]} >> $scriptlog 2>&1 48 51 echo "" >> $scriptlog 2>&1 … … 55 58 printprocesslog "INFO inserting information for all root camera files in $cameradir" 56 59 cam=`basename $cameradir` 60 spot=`echo $cameradir | cut -d/ -f7` #spotsize 61 par=`echo $cameradir | cut -d/ -f6` #particle name 62 if [ $cam = "Cal_and_Ped" ] 63 then 64 par="" 65 spot="" 66 fi 67 epo=`echo $cameradir | cut -d/ -f5` #epoch 57 68 echo "dir: "$cameradir >> $scriptlog 2>&1 58 69 fillcamerapath=$logpath/$program 59 70 makedir $fillcamerapath >> $scriptlog 2>&1 60 fillcameralog=$fillcamerapath/$program-$ cam.log71 fillcameralog=$fillcamerapath/$program-$epo-$par-$spot-$cam.log 61 72 62 73 check0=`root -q -b $macrospath/fillcamera.C+\("\"$cameradir\""\,kFALSE\) | tee $fillcameralog | intgrep` 74 # check0=`root -q -b $macrospath/fillcamera.C+\("\"$cameradir\""\,kTRUE\) | tee $fillcameralog | intgrep` 63 75 case $check0 in 64 76 1) echo "check0=$check0 -> everything ok " >> $scriptlog 2>&1 … … 77 89 echo "linking cal and ped files" >> $scriptlog 2>&1 78 90 79 epo=`basename $cameradir` #filename 80 pedfile=`find $cameradir/Cal_and_Ped -name *_P_*.root` 81 calfile=`find $cameradir/Cal_and_Ped -name *_C_*.root` 82 83 echo "calfile for epoch $epo : " $calfile >> $scriptlog 2>&1 84 echo "pedfile for epoch $epo : " $pedfile >> $scriptlog 2>&1 85 86 #check number of files 87 numfiles=`echo $pedfile $calfile | wc -w` 88 89 if [ "$numfiles" != "2" ] 91 if [ $cam = "Cal_and_Ped" ]; 90 92 then 91 echo "too many files in the directory $epoch/Cal_and_Ped -> exit" >> $scriptlog 2>&1 92 rm -v $lockfile >> $scriptlog 2>&1 93 exit 94 printprocesslog "ERROR too many ped and cal files found in $epoch/Cal_and_Ped" 95 finish >> $scriptlog 2>&1 96 fi 97 98 99 user="test" 100 db="TestMonteCarlo" 101 pw="Ics+eaTD" 102 cquery=" select fRunNumber from MCRunProcessStatus where fFileName=\"$calfile\" " 103 pquery=" select fRunNumber from MCRunProcessStatus where fFileName=\"$pedfile\" " 104 105 crun=`mysql -ss -u $user --password=$pw --host=vela $db -e " $cquery "` 106 prun=`mysql -ss -u $user --password=$pw --host=vela $db -e " $pquery "` 107 cnum=`printf %08d $crun` 108 pnum=`printf %08d $prun` 109 echo "calrun number: " $cnum >> $scriptlog 2>&1 110 echo "pedrun number: " $pnum >> $scriptlog 2>&1 111 #get all directories in the linked structure for the epoch 112 # dirs=`find $mcrawpath/ -mindepth 3 -maxdepth 3 -type d` 113 files=`find $mcrawpath/ -lname *$epo*.root` 114 115 for file in ${files[@]} 116 do 117 dir=`dirname $file` 118 date=`echo $file | cut -c 28-31,33,34,36,37` 119 120 if ls $dir | grep MonteCarlo | grep $pnum 121 then 122 # echo "P run already there, do nothing" >> $scriptlog 2>&1 123 continue 124 else 125 echo "linking P run for epoch $epo" >> $scriptlog 2>&1 126 newpedfile="${dir}/${date}_${pnum}_P_MonteCarlo_E.root" 127 ln -sv $pedfile $newpedfile >> $scriptlog 2>&1 93 echo "Cal_and_Ped folder, no cal and ped files will be linked" >> $scriptlog 2>&1 94 else 95 96 epo=`echo $cameradir | cut -d/ -f5` #filename 97 #epo=`basename $cameradir` #filename 98 pedfile=`find $mccampath/$epo/Cal_and_Ped -name *_P_*.root` 99 calfile=`find $mccampath/$epo/Cal_and_Ped -name *_C_*.root` 100 101 echo "calfile for epoch $epo : " $calfile >> $scriptlog 2>&1 102 echo "pedfile for epoch $epo : " $pedfile >> $scriptlog 2>&1 103 104 #check number of files 105 numfiles=`echo $pedfile $calfile | wc -w` 106 107 if [ "$numfiles" != "2" ] 108 then 109 echo "too many or too less files in the directory $epo/Cal_and_Ped -> exit" >> $scriptlog 2>&1 110 rm -v $lockfile >> $scriptlog 2>&1 111 exit 112 printprocesslog "ERROR too many ped and cal files found in $epo/Cal_and_Ped" 113 finish >> $scriptlog 2>&1 128 114 fi 129 115 130 if ls $dir | grep MonteCarlo | grep $cnum 131 then 132 # echo "C run already there, do nothing" >> $scriptlog 2>&1 133 continue 134 else 135 echo "linking C run for epoch $epo" >> $scriptlog 2>&1 116 117 # user="test" 118 # db="TestMonteCarlo" 119 # pw="Ics+eaTD" 120 user="operator" 121 db="MyMagicMonteCarlo" 122 pw="Ics+eMM!" 123 cquery=" select fRunNumber from MCRunProcessStatus where fFileName=\"$calfile\" " 124 pquery=" select fRunNumber from MCRunProcessStatus where fFileName=\"$pedfile\" " 125 126 crun=`mysql -ss -u $user --password=$pw --host=vela $db -e " $cquery "` 127 prun=`mysql -ss -u $user --password=$pw --host=vela $db -e " $pquery "` 128 cnum=`printf %08d $crun` 129 pnum=`printf %08d $prun` 130 echo "calrun number: " $cnum >> $scriptlog 2>&1 131 echo "pedrun number: " $pnum >> $scriptlog 2>&1 132 #get all directories in the linked structure for the epoch 133 #dirs=`find $mcrawpath/ -mindepth 3 -maxdepth 3 -type d` 134 files=`find $mcrawpath/ -lname *$epo*.root` 135 136 for file in ${files[@]} 137 do 138 dir=`dirname $file` 139 #datacenter 140 date=`echo $file | cut -c 28-31,33,34,36,37` 141 #for tests 142 #date=`echo $file | cut -c 57-60,62,63,65,66` 143 144 newpedfile="${dir}/${date}_${pnum}_P_MonteCarlo_E.root" 136 145 newcalfile="${dir}/${date}_${cnum}_C_MonteCarlo_E.root" 137 ln -sv $calfile $newcalfile >> $scriptlog 2>&1 138 fi 139 140 done 146 pupdate=" update MCRunProcessStatus set fRunLinked=Now(), fLinkName=\"$newpedfile\" where fRunNumber=\"$prun\" " 147 cupdate=" update MCRunProcessStatus set fRunLinked=Now(), fLinkName=\"$newcalfile\" where fRunNumber=\"$crun\" " 148 if ls $dir | grep MonteCarlo | grep $pnum 149 then 150 echo "P run already there, do mysql update" >> $scriptlog 2>&1 151 # continue 152 mysql -ss -u $user --password=$pw --host=vela $db -e " $pupdate " 153 else 154 echo "linking P run for epoch $epo" >> $scriptlog 2>&1 155 ln -sv $pedfile $newpedfile >> $scriptlog 2>&1 156 mysql -ss -u $user --password=$pw --host=vela $db -e " $pupdate " 157 fi 158 159 if ls $dir | grep MonteCarlo | grep $cnum 160 then 161 echo "C run already there, do mysql update" >> $scriptlog 2>&1 162 # continue 163 mysql -ss -u $user --password=$pw --host=vela $db -e " $cupdate " 164 else 165 echo "linking C run for epoch $epo" >> $scriptlog 2>&1 166 ln -sv $calfile $newcalfile >> $scriptlog 2>&1 167 mysql -ss -u $user --password=$pw --host=vela $db -e " $cupdate " 168 fi 169 170 done 171 172 fi 141 173 142 174 done … … 145 177 146 178 # observation epochs 147 epochs=("" "After January 07 ( new MUX)," "From April 06 to January 07," "Before April 06")179 epochs=("" "After January 07 (MUX FADCs)," "From April 06 to January 07 (Siegen FADCs with splitters)," "Before April 06 (Siegen FADCs)") 148 180 149 181 # print information and explanation of structure into README.txt … … 156 188 echo "YYYY represents 19zbin" >> $readme 2>&1 157 189 echo "MM represents the epoch" >> $readme 2>&1 158 echo "DD represents the psfin mm" >> $readme 2>&1190 echo "DD represents the additional spot size in mm" >> $readme 2>&1 159 191 echo "" >> $readme 2>&1 160 192 echo "explanation of the epochs" >> $readme 2>&1 … … 180 212 echo "<P/C/D> indicates the run type" >> $readme 2>&1 181 213 echo "<Particle>: Gamma, Proton, Muon, MonteCarlo (for P,C runs)" >> $readme 2>&1 182 echo "<Spectrum>: empty or HE, depending on the simulated MC spectrum" >> $readme 2>&1 183 echo "<ObservationMode>: empty (On), W1/W2 (Wobble), FW1/FW2 (Fake Wobble), Diff (Diffuse)" >> $readme 2>&1 184 echo "" >> $readme 2>&1 185 echo "Run numbers for Cal and Ped files are linked depending on the epoch:" >> $readme 2>&1 186 echo "MC_old: P=1, C=2" >> $readme 2>&1 187 echo "MC_up_to_April06: P=1, C=2" >> $readme 2>&1 188 echo "MC_April_May06: P=3, C=4" >> $readme 2>&1 189 echo "MC_post_June06: P=3, C=4" >> $readme 2>&1 190 echo "MC_MuxFADCs: P=5, C=6" >> $readme 2>&1 191 echo "MC_MuxFADCs_NEW: P=5, C=6" >> $readme 2>&1 214 echo "<Spectrum>: 'empty' or HE, depending on the simulated MC spectrum" >> $readme 2>&1 215 echo "<ObservationMode>: 'empty' (On), W1/W2 (Wobble), FW (Fake Wobble), Diff (Diffuse)" >> $readme 2>&1 192 216 echo "" >> $readme 2>&1 193 217
Note:
See TracChangeset
for help on using the changeset viewer.