- Timestamp:
- 08/12/09 15:37:04 (15 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r9486 r9487 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2009/08/12 Daniel Hoehne-Moench 22 * datacenter/macros/filldotrun.C: 23 - inserted Arehucas versions 090625-0, 0907[02,06,31]-0 including 24 the new columns L3TriggerRate, L3TriggerTable, WheelPos1, 25 WheelPos2, Cycle, PI, WorkingGroup and Proposal 26 - implemented MAGIC 2 run file handling 27 - removed readout of columns by ReadToDelim(); now the columns are 28 filled into an TObjArray 29 30 20 31 21 32 2009/08/11 Daniela Dorner -
trunk/MagicSoft/Mars/datacenter/macros/filldotrun.C
r9469 r9487 42 42 // 070416-0, 43 43 // 080220-0, 080519-0, 080912-0, 081204-0, 081214-0, 44 // 090203-0, 090221-0, 090522-0, 090525-0, 090616-0 44 // 090203-0, 090221-0, 090522-0, 090525-0, 090616-0, 090625-0, 090702-0, 45 // 090706-0, 090731-0 45 46 // 46 47 // Usage: … … 96 97 return -1; 97 98 } 98 //read the file a second time for the check for number of columns99 ifstream fin2(filename);100 99 101 100 TString strng; 102 TString strng2;103 101 TObjArray *array = new TObjArray(); 104 102 Int_t check=0; 105 103 106 104 strng.ReadLine(fin); 107 strng2.ReadLine(fin2);108 105 if (strng!=TString("[CC Plain Run Summary File]")) 109 106 { … … 115 112 116 113 strng.ReadLine(fin); 117 strng2.ReadLine(fin2);118 114 TRegexp reg("[0-9][0-9][0-9][0-9][0-9][0-9]-[0-9]"); 119 115 TString arehucas = strng(reg); … … 134 130 version!=200812040 && version!=200812140 && 135 131 version!=200902030 && version!=200902210 && version!=200905220 && 136 version!=200905250 && version!=200906160) 132 version!=200905250 && version!=200906160 && version!=200906250 && 133 version!=200907020 && version!=200907060 && version!=200907310) 137 134 { 138 135 cout << filename << ": File Version unknown - please update the macro!" << endl; … … 142 139 } 143 140 141 Int_t telcheck=1; 142 TString tcheck; 144 143 if (version >= 200805190) 145 144 { 146 strng.ReadLine(fin); 147 strng2.ReadLine(fin2); 145 strng.ReadLine(fin); 148 146 if (!strng.BeginsWith("Telescope M")) 149 147 { 150 148 cout << "WARNING - Line 3 doesn't start with 'Telescope M'." << endl; 151 149 cout << strng << endl; 150 } 151 telcheck = atoi(strng.Data()+11); 152 153 if (telcheck != 1 && telcheck != 2) 154 { 155 cout << filename << ": Telescope declaration wrong!" << endl; 156 cout << "Third Line: " << strng << endl; 157 cout << endl; 158 return -1; 152 159 } 153 160 } … … 156 163 { 157 164 strng.ReadLine(fin); 158 strng2.ReadLine(fin2);159 165 if (strng[0]!='#') 160 166 { … … 176 182 // 200603300 - 200802200: 52 columns 177 183 // 200805190 - 200809120: 54 columns 178 // > 200812040: 55 columns 184 // 200812040 - 200906160: 55 columns 185 // >= 200906250: 61 columns 179 186 // 180 181 strng2.ReadLine(fin2); 182 //fill an array with the values separated by ' ' 183 array=strng2.Tokenize(" "); 184 check=array->GetEntries(); 185 cout << check << endl; 187 strng.ReadLine(fin); 188 //fill an array with the values separated by ' '. Advantage: In contrast to ReadToDelim(' ') objects 'between' 189 //two whitespaces are not written to the array. In case of a missing column the error is detected by comparison 190 //with the number of default columns. In case of an 'accidental' double(triple)-whitespace the columns are treated 191 //in the right way, only a warning is released to edit the file, if necessary. 192 array = strng.Tokenize(" "); 193 check = array->GetEntries(); 194 195 if (strng.Contains(" ") || strng. Contains(" ")) 196 { 197 cout << "WARNING - Multiple whitespaces found, please check the file:" << endl; 198 cout << filename << endl; 199 } 200 201 /* 202 for (int n=0; n< array->GetEntries(); n++) 203 { 204 cout << (*array)[n]->GetName() << endl; 205 } 206 */ 186 207 //check the number of columns for the different versions, if there is an empty line (check=0), do nothing 187 208 if (check != 0) … … 192 213 (version > 200510250 && version <= 200802200 && check != 52) || 193 214 (version > 200802200 && version <= 200809120 && check != 54) || 194 (version > 200809120 && check != 55)) 195 { 196 strng.ReadLine(fin); 197 cout << "ERROR - Number of columns doesn't match number of required columns." << endl; 198 array->Delete(); 199 continue; 200 } 201 } 202 array->Delete(); 203 215 (version > 200809120 && version <= 200906160 && check != 55) || 216 (version > 200906160 && ((telcheck == 1 && check != 61) || (telcheck == 2 && check != 63)))) 217 { 218 cout << "ERROR - Number of columns (" << check << ") doesn't match number of required columns, please check the file:" << endl; 219 cout << filename << endl; 220 delete array; 221 continue; 222 } 223 } 224 225 //when reaching the end of the file... 226 if (!fin) 227 break; 228 229 // count variable for the columns 230 Int_t i = 0; 204 231 205 232 // ========== Col 1: Telescope Number ========= … … 207 234 if (version >=200805190) 208 235 { 209 strng.ReadToDelim(fin, ' '); 210 if (!fin) 211 break; 212 if (strng[0]!='M') 236 strng = (*array)[i++]->GetName(); 237 238 if (strng[0]!='M') 213 239 { 214 240 cout << "WARNING - First character is not an M." << endl; 215 241 cout << strng << endl; 216 strng.ReadLine(fin); 217 continue; 218 } 219 if (strng[1]!='1') 220 { 221 cout << "WARNING - Only MAGIC 1 implemented so far." << endl; 222 cout << strng << endl; 223 strng.ReadLine(fin); 224 continue; 225 } 226 227 telnumber = atoi(strng.Data()+1); 242 delete array; 243 continue; 244 } 245 telnumber = atoi(strng.Data()+1); 246 228 247 } 229 248 … … 231 250 //Reading the line 232 251 //and converting some strings to ints/floats 233 strng.ReadToDelim(fin, ' '); 234 if (!fin) 235 break; 252 strng = (*array)[i++]->GetName(); 236 253 237 254 Int_t runnumber = atoi(strng.Data()); … … 241 258 if (runnumber == 0) 242 259 { 243 strng.ReadLine(fin);260 delete array; 244 261 cout << "WARNING - Runnumber == 0" << endl; 245 cout << strng << endl;246 262 continue; 247 } 263 } 264 265 //cout << runnumber << " "; 248 266 249 267 // ========== Col 3: Subrun Number ========= starting with version 200805190 … … 251 269 if (version >=200805190) 252 270 { 253 strng.ReadToDelim(fin, ' ');271 strng = (*array)[i++]->GetName(); 254 272 filenumber = atoi(strng.Data()); 255 273 } … … 261 279 // FIXME: Maybe we can implement a switch to update mode? 262 280 cout << "WARNING - Entry M" << telnumber << ":" << runnumber << "/" << filenumber << " already existing... skipped." << endl; 263 strng.ReadLine(fin);281 delete array; 264 282 continue; 265 } 283 } 284 266 285 267 286 // ========== Col 4: Run Type ========= 268 strng.ReadToDelim(fin, ' ');287 strng = (*array)[i++]->GetName(); 269 288 if (strng.Contains("???")) 270 289 strng="n/a"; … … 274 293 { 275 294 cout << "ERROR - RunType " << strng << " not available." << endl; 276 strng.ReadLine(fin);295 delete array; 277 296 continue; 278 } 279 280 //cout << runtype << " "; 297 } 298 281 299 282 300 // ========== Col 5,6: Start Time ========= 283 301 TString startdate, starttime; 284 startdate.ReadToDelim(fin, ' ');285 starttime.ReadToDelim(fin, ' ');302 startdate = (*array)[i++]->GetName(); 303 starttime = (*array)[i++]->GetName(); 286 304 //cout << startdate << " " << starttime << " "; 287 305 288 306 // ========== Col 7,8: Stop Time ========= 289 290 stopdate.ReadToDelim(fin, ' ');291 stoptime.ReadToDelim(fin, ' ');307 TString stopdate, stoptime; 308 stopdate = (*array)[i++]->GetName(); 309 stoptime = (*array)[i++]->GetName(); 292 310 //cout << stopdate << " " << stoptime << " "; 293 311 … … 302 320 303 321 // ========== Col 9: Source Name ========= 304 strng.ReadToDelim(fin, ' ');322 strng = (*array)[i++]->GetName(); 305 323 if (strng.Contains("???")) 306 324 strng="Unavailable"; … … 309 327 if (sourcekey<0) 310 328 { 311 strng.ReadLine(fin);329 delete array; 312 330 continue; 313 331 } 314 //cout << sourcekey << " "; 332 333 //cout << sourcekey << " "; 315 334 316 335 // ========== Col 10,11: Local source position ========= 317 strng.ReadToDelim(fin, ' ');336 strng = (*array)[i++]->GetName(); 318 337 Float_t zd = atof(strng.Data()); 319 338 320 strng.ReadToDelim(fin, ' ');321 339 strng = (*array)[i++]->GetName(); 340 Float_t az = atof(strng.Data()); 322 341 323 342 //cout << zd << " " << az << " "; 324 343 325 344 // ========== Col 12: Number of Events ========= 326 strng.ReadToDelim(fin, ' ');327 345 strng = (*array)[i++]->GetName(); 346 Int_t evtno = atoi(strng.Data()); 328 347 329 348 //cout << evtno << " "; 330 349 331 350 // ========== Col 13: Project Name ========= 332 strng.ReadToDelim(fin, ' ');351 strng = (*array)[i++]->GetName(); 333 352 if (strng.Contains("???")) 334 353 strng="Unavailable"; … … 337 356 if (projkey<0) 338 357 { 339 strng.ReadLine(fin);358 delete array; 340 359 continue; 341 360 } 342 361 //cout << projkey << " "; 343 362 344 363 // ========== Col 14: Trigger Table Name ========= 345 364 // starting from version 200411130: Col 14,15: Trigger Table Name ========= 346 strng.ReadToDelim(fin, ' ');365 strng = (*array)[i++]->GetName(); 347 366 if (strng.Contains("???")) 348 367 strng="n/a"; … … 355 374 if (l1triggerkey<0) 356 375 { 357 strng.ReadLine(fin);358 continue; 359 } 360 361 strng.ReadToDelim(fin, ' ');376 delete array; 377 continue; 378 } 379 380 strng = (*array)[i++]->GetName(); 362 381 if (strng.Contains("???")) 363 382 strng="n/a"; … … 366 385 if (l2triggerkey<0) 367 386 { 368 strng.ReadLine(fin);369 continue; 370 387 delete array; 388 continue; 389 } 371 390 } 372 391 else … … 390 409 if (l2triggerkey<0) 391 410 { 392 strng.ReadLine(fin);411 delete array; 393 412 continue; 394 413 } … … 408 427 if (l1triggerkey<0) 409 428 { 410 strng.ReadLine(fin);429 delete array; 411 430 continue; 412 431 } … … 415 434 if (l2triggerkey<0) 416 435 { 417 strng.ReadLine(fin);436 delete array; 418 437 continue; 419 438 } … … 426 445 if (l1triggerkey<0) 427 446 { 428 strng.ReadLine(fin);447 delete array; 429 448 continue; 430 449 } … … 450 469 451 470 // ========== Col 16-18: TrigRate, L2 UnPresc Rate, L2 Presc Rate ========== 452 strng.ReadToDelim(fin, ' ');471 strng = (*array)[i++]->GetName(); 453 472 Float_t trigrate = atof(strng.Data()); 454 473 455 strng.ReadToDelim(fin, ' ');474 strng = (*array)[i++]->GetName(); 456 475 Float_t l2uprate = atof(strng.Data()); 457 476 458 strng.ReadToDelim(fin, ' ');477 strng = (*array)[i++]->GetName(); 459 478 Float_t l2prrate = atof(strng.Data()); 460 479 461 480 // ========== Col 19,20: DaqRate, Storage Rate ========== 462 strng.ReadToDelim(fin, ' ');481 strng = (*array)[i++]->GetName(); 463 482 Float_t daqrate = atof(strng.Data()); 464 483 465 strng.ReadToDelim(fin, ' ');484 strng = (*array)[i++]->GetName(); 466 485 Float_t storerate = atof(strng.Data()); 467 486 468 487 // ========== Col 21: HV table ========= 469 if (version==200405050 || version==200405140) 470 strng.ReadToDelim(fin, '\n'); 471 else 472 strng.ReadToDelim(fin, ' '); 488 strng = (*array)[i++]->GetName(); 489 if (version==200405050 || version==200405140) 490 { 491 delete array; 492 continue; 493 } 473 494 if (strng.Contains("???")) 474 495 strng="n/a"; … … 477 498 if (hvkey<0) 478 499 { 479 //strng.ReadLine(fin);500 delete array; 480 501 continue; 481 502 } 482 503 483 504 if (version==200405180 || version==200407270) 484 strng.ReadLine(fin); 505 { 506 delete array; 507 continue; 508 } 485 509 486 510 Int_t testflagkey=1; … … 492 516 { 493 517 // ========== Col 22-38: DC and HV-values, mjd ========= 494 for (int i=0 ; i<17 ; i++)495 { 496 strng.ReadToDelim(fin, ' ');518 for (int n=0 ; n<17 ; n++) 519 { 520 i++; 497 521 } 498 522 499 523 // ========== Col 39: test-flag ========= 500 strng.ReadToDelim(fin, ' ');524 strng = (*array)[i++]->GetName(); 501 525 if (strng.Contains("???")) 502 526 strng="n/a"; … … 505 529 if (testflagkey<0) 506 530 { 507 strng.ReadLine(fin);531 delete array; 508 532 continue; 509 533 } 510 534 511 535 // ========== Col 40: light conditions ========= 512 strng.ReadToDelim(fin, ' ');536 strng = (*array)[i++]->GetName(); 513 537 if (strng.Contains("???")) 514 538 strng="n/a"; … … 517 541 if (lightcondkey<0) 518 542 { 519 strng.ReadLine(fin);543 delete array; 520 544 continue; 521 545 } 522 546 523 547 // ========== Col 41: discriminator threshold table ========= 524 strng.ReadToDelim(fin, ' ');548 strng = (*array)[i++]->GetName(); 525 549 if (strng.Contains("???")) 526 550 strng="n/a"; … … 529 553 if (dttablekey<0) 530 554 { 531 strng.ReadLine(fin);555 delete array; 532 556 continue; 533 557 } 534 558 535 559 // ========== Col 42: trigger delay table ========= 536 strng.ReadToDelim(fin, ' ');560 strng = (*array)[i++]->GetName(); 537 561 if (strng.Contains("???")) 538 562 strng="n/a"; … … 541 565 if (triggerdelaytablekey<0) 542 566 { 543 strng.ReadLine(fin);567 delete array; 544 568 continue; 545 569 } 546 570 547 571 // ========== Col 43,44: Telescope RA and Dec sent to drive ========= 548 strng.ReadToDelim(fin, ' ');549 strng.ReadToDelim(fin, ' ');572 i++; 573 i++; 550 574 551 575 // ========== Col 45: Calibration Script ========= 576 strng = (*array)[i++]->GetName(); 552 577 if (version>=200411130 && version<=200510250) 553 strng.ReadToDelim(fin, '\n'); 554 else 555 strng.ReadToDelim(fin, ' '); 578 { 579 delete array; 580 continue; 581 } 556 582 if (strng.Contains("???")) 557 583 strng="n/a"; … … 560 586 if (calibrationscriptkey<0) 561 587 { 562 strng.ReadLine(fin);588 delete array; 563 589 continue; 564 590 } … … 570 596 { 571 597 // ========== Col 46: Observation Mode ========= 572 strng.ReadToDelim(fin, ' ');598 strng = (*array)[i++]->GetName(); 573 599 if (strng.Contains("???")) 574 600 strng="n/a"; … … 577 603 if (observationmodekey<0) 578 604 { 579 strng.ReadLine(fin);605 delete array; 580 606 continue; 581 607 } 582 608 583 609 // ========== Col 47-54: Source RA and Dec, DT's and IPR ========= 584 for (int i=0 ; i<7 ; i++) 585 { 586 strng.ReadToDelim(fin, ' '); 587 } 588 if (version<=200809120) 589 strng.ReadToDelim(fin, '\n'); 590 else 591 strng.ReadToDelim(fin, ' '); 610 for (int n=0 ; n<7 ; n++) 611 { 612 i++; 613 } 614 strng = (*array)[i++]->GetName(); 615 if (version<=200809120) 616 { 617 delete array; 618 continue; 619 } 592 620 } 593 621 … … 596 624 { 597 625 // ========= Col 55: SumTrigger flag ========= 598 strng.ReadToDelim(fin, '\n'); 599 if (strng.Contains("???")) 626 strng = (*array)[i++]->GetName(); 627 if (version<=200906160) 628 { 629 delete array; 630 continue; 631 } 632 if (strng.Contains("???")) 600 633 strng="n/a"; 601 634 … … 603 636 if (sumtriggerflagkey<0) 604 637 { 605 strng.ReadLine(fin); 606 continue; 607 } 608 609 } 638 delete array; 639 continue; 640 } 641 } 642 643 Int_t l3triggerkey=1; 644 Int_t cyclekey=1; 645 Int_t pikey=1; 646 Int_t workinggroupkey=1; 647 Int_t proposalkey=1; 648 Float_t l3trigrate=0; 649 TString wheelpos1 = "NULL"; 650 TString wheelpos2 = "NULL"; 651 if (version>=200906250) 652 { 653 // for MAGIC 2: additional columns wheel_pos1 and ~2 654 655 if (telnumber == 2) 656 { 657 strng = (*array)[i++]->GetName(); 658 wheelpos1 = strng.Data(); 659 strng = (*array)[i++]->GetName(); 660 wheelpos2 = strng.Data(); 661 } 662 663 // ========= Col 56: L3 trigger table ========= 664 strng = (*array)[i++]->GetName(); 665 if (strng.Contains("???") || strng.Contains("na") || strng.Contains("Unknown")) 666 strng="n/a"; 667 668 l3triggerkey = serv.QueryKeyOfName("L3TriggerTable", strng); 669 if (l3triggerkey<0) 670 { 671 delete array; 672 continue; 673 } 674 675 // ========= Col 57: L3 trigger rate ========= 676 strng = (*array)[i++]->GetName(); 677 l3trigrate = atof(strng.Data()); 678 679 // ========= Col 58: Cycle ========= 680 strng = (*array)[i++]->GetName(); 681 if (strng.Contains("???") || strng.Contains("na")) 682 strng="n/a"; 683 684 cyclekey = serv.QueryKeyOfName("Cycle", strng); 685 if (cyclekey<0) 686 { 687 delete array; 688 continue; 689 } 690 691 // ========= Col 59: PI ========= 692 strng = (*array)[i++]->GetName(); 693 if (strng.Contains("???") || strng.Contains("na")) 694 strng="n/a"; 695 696 pikey = serv.QueryKeyOfName("PI", strng); 697 if (pikey<0) 698 { 699 delete array; 700 continue; 701 } 702 703 // ========= Col 60: Working group ========= 704 strng = (*array)[i++]->GetName(); 705 if (strng.Contains("???") || strng.Contains("na")) 706 strng="n/a"; 707 708 workinggroupkey = serv.QueryKeyOfName("WorkingGroup", strng); 709 if (workinggroupkey<0) 710 { 711 delete array; 712 continue; 713 } 714 715 // ========= Col 61: Proposal ========= 716 strng = (*array)[i++]->GetName(); 717 if (strng.Contains("???") || strng.Contains("na")) 718 strng="n/a"; 719 720 proposalkey = serv.QueryKeyOfName("Proposal", strng); 721 if (proposalkey<0) 722 { 723 delete array; 724 continue; 725 } 726 } 727 delete array; 610 728 611 729 … … 635 753 query += Form("fObservationModeKEY=%d, ", observationmodekey); 636 754 query += Form("fSumTriggerFlagKEY=%d, ", sumtriggerflagkey); 755 query += Form("fL3TriggerTableKEY=%d, ", l3triggerkey); 756 query += Form("fCycleKEY=%d, ", cyclekey); 757 query += Form("fPIKEY=%d, ", pikey); 758 query += Form("fWorkingGroupKEY=%d, ", workinggroupkey); 759 query += Form("fProposalKEY=%d, ", proposalkey); 637 760 if (!TMath::IsNaN(zd) && TMath::Finite(zd)) 638 761 query += Form("fZenithDistance=%d, ", TMath::Nint(zd)); … … 649 772 if (!TMath::IsNaN(l2uprate) && TMath::Finite(l2uprate)) 650 773 query += Form("fL2RateUnpresc=%d, ", TMath::Nint(l2uprate)); 774 if (!TMath::IsNaN(l3trigrate) && TMath::Finite(l3trigrate)) 775 query += Form("fL3TriggerRate=%d, ", TMath::Nint(l3trigrate)); 776 query += Form("fWheelPos1=%s, ", wheelpos1.Data()); 777 query += Form("fWheelPos2=%s, ", wheelpos2.Data()); 651 778 query += "fMagicNumberKEY=1, fExcludedFDAKEY=1"; 652 779
Note:
See TracChangeset
for help on using the changeset viewer.