Changeset 1583
- Timestamp:
- 11/06/02 16:50:54 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1577 r1583 1 1 -*-*- END -*-*- 2 2002/11/06: Thomas Bretz 3 4 * Makfile.conf.osf5.1: 5 - added 6 7 * mhist/MHMatrix.cc: 8 - changed all math.h functions or similar to TMath 9 - added 2*pow(rows, 1/(4+cols))^2 as the standard kernel window 10 11 * mfileio/MCT1ReadPreProc.cc: 12 - corrected the reading routines 13 14 * mfileio/*.cc: 15 - changed my eMail address 16 17 * mfileio/structures.h: 18 - small changes to make it architecture independant 19 20 21 2 22 2002/11/04: Thomas Bretz 3 23 … … 107 127 - removed an unused variable to get rid of a compiler warning on Alpha 108 128 129 130 109 131 2002/10/31: Wolfgang Wittek 110 132 111 133 * mhist/MHFlux.[h,cc]: 112 134 - type of fVarname and fUnit changed from char* to TString 135 113 136 114 137 -
trunk/MagicSoft/Mars/mfileio/MCT1ReadAscii.cc
r1574 r1583 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@ uni-sw.gwdg.de>18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! Author(s): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de) 20 20 ! 21 ! Copyright: MAGIC Software Development, 2000-200 121 ! Copyright: MAGIC Software Development, 2000-2002 22 22 ! 23 23 ! -
trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc
r1575 r1583 211 211 212 212 *fLog << "Exclude: "; 213 213 214 // Boolean bexcludepix[iMAXNUMPIX]; 214 215 for (int i=0; i<iMAXNUMPIX; i++) 215 if (outpars.bdontusepix[i]) 216 if (outpars.bexcludepix[i]) 217 { 216 218 *fLog << i << " "; 219 fBlinds->SetPixelBlind(i); 220 } 217 221 *fLog << endl; 222 218 223 /* bexcludepix[] is set TRUE (== exclude from pedestal, Laser 219 224 * calibration and the further analysis) when the Mean value … … 254 259 // float fypointcorr_deg; // pointing correction (to be added along the camera y axis) e.g. from point run */ 255 260 *fLog << "Pointing correction: dx=" << outpars.fxpointcorr_deg << "deg "; 256 *fLog << "dy=" << outpars.fxpointcorr_deg << "deg" << endl; 257 258 /* 259 fSrcPos->SetXY( outpars.fxpointcorr_deg/fGeom->GetConvMm2Deg(), 260 outpars.fypointcorr_deg/fGeom->GetConvMm2Deg()); 261 */ 261 *fLog << "dy=" << outpars.fypointcorr_deg << "deg" << endl; 262 263 // FIXME? Is x-y echanged between Mars CT1 geometry and CT1 definition? 264 fSrcPos->SetXY(outpars.fypointcorr_deg/fGeom->GetConvMm2Deg(), 265 outpars.fxpointcorr_deg/fGeom->GetConvMm2Deg()); 262 266 263 267 /* … … 333 337 * be treated further. */ 334 338 335 if (outpars.bmontecarlo) 336 *fLog << "File is a Monte Carlo file." << endl; 339 *fLog << "File is a "; 340 *fLog << (outpars.bmontecarlo ? "Monte Carlo" : "Real Data"); 341 *fLog << " file." << endl; 337 342 338 343 fIsMcFile = outpars.bmontecarlo==TRUE; … … 343 348 // Read CT1 PreProc File Header: 344 349 // 345 voidMCT1ReadPreProc::ReadHeader()350 Bool_t MCT1ReadPreProc::ReadHeader() 346 351 { 347 352 char cheadertitle[iHEADERTITLELENGTH]; 348 353 fIn->read(cheadertitle, iHEADERTITLELENGTH); 349 354 355 TString s = cheadertitle; 356 TString m = cTITLE_TEMPLATE; 357 358 if (!s.BeginsWith(m(0, m.First('%')))) 359 return kFALSE; 360 350 361 *fLog << cheadertitle << flush; 351 362 352 363 // cTITLE_TEMPLATE "PREPROC V%f/S%f CT %d RUN %d %d PROCMJD %d\n" 353 364 struct outputpars outpars; 365 366 int dummy; 354 367 355 368 Float_t fpreprocversion, structversion; … … 357 370 &fpreprocversion, &structversion, 358 371 &outpars.itelescope, &outpars.irunnum, 359 & outpars.eruntype, &outpars.iproc_mjdate);372 &dummy/*&outpars.eruntype*/, &outpars.iproc_mjdate); 360 373 361 374 if (STRUCT_VERSION != structversion) … … 369 382 370 383 ProcessHeader(outpars); 371 } 372 373 void MCT1ReadPreProc::ReadFooter() 384 385 return kTRUE; 386 } 387 388 Bool_t MCT1ReadPreProc::ReadFooter() 374 389 { 375 390 char cheadertitle[iHEADERTITLELENGTH]; 376 391 fIn->read(cheadertitle, iHEADERTITLELENGTH); 377 392 /* 378 ss scanf(cheadertitle, cEND_EVENTS_TEMPLATE,379 393 sscanf(cheadertitle, cEND_EVENTS_TEMPLATE, 394 &filterres.ifilter_passed_evts); 380 395 */ 381 396 397 TString s = cheadertitle; 398 TString m = cEND_EVENTS_TEMPLATE; 399 Int_t p = m.First('%'); 400 401 if (!s.BeginsWith(m(0,p))) 402 return kFALSE; 403 404 *fLog << inf << cheadertitle << flush; 405 382 406 struct filterresults filterres; 407 <<<<<<< MCT1ReadPreProc.cc 408 fIn->read(&filterres, sizeof(struct filterresults)); 409 410 ======= 383 411 fIn->read((Byte_t*)&filterres, sizeof(struct filterresults)); 412 >>>>>>> 1.2 384 413 /* 385 414 int imax_alt_arcs; // maximum altitude reached during the run … … 398 427 float fstddev_event_rate_hz; // standard deviation of the rate before filtering 399 428 */ 429 430 return kTRUE; 400 431 } 401 432 … … 441 472 442 473 *fLog << inf << "-----------------------------------------------------------------------" << endl; 443 const Int_t sizef = sizeof(struct filterresults)+iHEADERTITLELENGTH; 444 const Int_t sizeh = sizeof(struct outputpars) +iHEADERTITLELENGTH; 445 446 fIn->seekg(0, ios::end); 447 const Int_t filesize = fIn->tellg(); 448 449 fIn->seekg(filesize-sizef, ios::beg); 450 ReadFooter(); 451 fIn->seekg(0, ios::beg); 452 ReadHeader(); 453 454 struct eventrecord event; 455 const int size1 = sizeof(event)-sizeof(event.spixsig_10thphot); 456 const int size2 = sizeof(event.spixsig_10thphot[0])*fNumPixels; 457 const int evtsize = size1+size2; 458 459 *fLog << "Storage for events: " << filesize-sizef-sizeh << "b" << endl; 460 *fLog << "Size of one Event: " << evtsize << "b" << endl; 461 462 fNumEvents = (filesize-sizef-sizeh)/evtsize-1; 463 fNumEvent = 0; 464 465 *fLog << "Calculated Number of Events: " << (float)(filesize-sizef-sizeh)/evtsize << " " << (filesize-sizef-sizeh)%evtsize << endl; 466 467 *fLog << "-----------------------------------------------------------------------" << endl; 468 469 return kTRUE; 474 475 //*fLog << "File contains " << GetNumEvents() << " events." << endl; 476 477 Bool_t rc = ReadHeader(); 478 479 if (!rc) 480 *fLog << warn << "Unable to read header... skipping file." << endl; 481 482 return rc; 483 } 484 485 Int_t MCT1ReadPreProc::GetNumEvents() 486 { 487 Int_t n = 0; 488 489 while (!fIn->eof()) 490 { 491 if (fIn->get()!=cEND_EVENTS_TEMPLATE[0]) 492 continue; 493 494 char cheadertitle[iHEADERTITLELENGTH]; 495 fIn->read(cheadertitle, iHEADERTITLELENGTH-1); 496 497 TString s = cheadertitle; 498 TString m = cEND_EVENTS_TEMPLATE; 499 Int_t p = m.First('%'); 500 501 if (!s.BeginsWith(m(1,p-1))) 502 continue; 503 504 int num; 505 506 sscanf(cheadertitle, &cEND_EVENTS_TEMPLATE[1], &num); 507 508 n += num; 509 } 510 511 fIn->seekg(0); 512 513 return n; 470 514 } 471 515 … … 526 570 fMcTrig = (MMcTrig*)pList->FindCreateObj("MMcTrig"); 527 571 if (!fMcTrig) 528 return kFALSE;529 530 //531 // Try to open at least one (the first) file532 //533 if (!OpenNextFile())534 572 return kFALSE; 535 573 … … 549 587 int isecfrac_200ns; // fractional part of isecs_since_midday 550 588 short snot_ok_flags; // the bits in these two bytes are flags for additional information on the event: Everything OK =: all Bits = 0 551 int ialt_arcs; // altitude (arcseconds)552 int iaz_arcs; // azimuth (arcseconds)553 589 int ipreproc_alt_arcs; // "should be" alt according to preproc (arcseconds) 554 590 int ipreproc_az_arcs; // "should be" az according to preproc (arcseconds) … … 573 609 /* 574 610 *fLog << event.isecs_since_midday << "s "; 575 *fLog << event.ialt_arcs << "s ";576 *fLog << event.iaz_arcs << "s ";577 611 *fLog << event.ipreproc_alt_arcs << "s "; 578 612 *fLog << event.ipreproc_az_arcs << "s "; … … 597 631 } 598 632 633 fMcEvt->SetTheta(TMath::Pi()*(0.5-1./180*event.ialt_arcs/3600)); // altitude (arcseconds) 634 fMcEvt->SetPhi(TMath::Pi()/180*event.iaz_arcs/3600); // azimuth (arcseconds) 635 599 636 if (!fIsMcFile) 600 637 return; … … 611 648 // -------------------------------------------------------------------------- 612 649 // 650 // Because of the file format of the preproc output we have to check at any 651 // event where in the file stream we are... 652 // 653 Bool_t MCT1ReadPreProc::CheckFilePosition() 654 { 655 // 656 // Means: If no file is open (first call) try to open the first file 657 // 658 if (!fIn) 659 return kFALSE; 660 661 // 662 // If the first character isn't the first of the footer it must be 663 // an event 664 // 665 if (fIn->peek()!=cEND_EVENTS_TEMPLATE[0]) 666 return kTRUE; 667 668 // 669 // Remember the current position if the first character faked a 670 // footer 671 // 672 const Int_t pos = fIn->tellg(); 673 674 // 675 // Try reading the footer. If it isn't succefull jump back... 676 // must be an event 677 // 678 if (!ReadFooter()) 679 { 680 fIn->seekg(pos, ios::beg); 681 return kTRUE; 682 } 683 684 *fLog << inf << "Footer found." << endl; 685 686 // 687 // No after reading the footer check if we reached the end of the file 688 // 689 if (fIn->eof()) 690 { 691 *fLog << "End of file." << endl; 692 return kFALSE; 693 } 694 695 // 696 // If the eof isn't reached a new header must follow. Check for it. 697 // 698 if (fIn->peek()!=cTITLE_TEMPLATE[0]) 699 { 700 *fLog << inf << "Error finding new run header in file (possible EOF)... skipping rest of file." << endl; 701 return kFALSE; 702 } 703 704 *fLog << "-----------------------------------------------------------------------" << endl; 705 if (ReadHeader()) 706 return kTRUE; 707 708 *fLog << inf << "Error reading run header in file... skipping rest of file." << endl; 709 return kFALSE; 710 } 711 712 // -------------------------------------------------------------------------- 713 // 613 714 // Check for the event number and depending on this number decide if 614 715 // pedestals or event data has to be read. … … 620 721 { 621 722 // 622 // check if we are done. Try to open the next file in chain. 623 // If it was possible start reading. If not break the event loop 624 // 625 if (fNumEvent++==fNumEvents-1) 626 return OpenNextFile() ? kCONTINUE : kFALSE; 723 // Check where in the file we are. If neither a new event, nor a 724 // footer/header combination is detected go to the next file. 725 // 726 if (!CheckFilePosition()) 727 if (!OpenNextFile()) 728 return kFALSE; 627 729 628 730 // event data to be read from the file … … 637 739 ProcessEvent(event); 638 740 741 fNumEvent++; 742 639 743 return kTRUE; 640 744 } -
trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.h
r1574 r1583 39 39 Bool_t OpenNextFile(); 40 40 41 void ReadPedestals(); 42 void ReadHeader(); 43 void ReadFooter(); 44 void ProcessHeader(const struct outputpars &outpars); 45 void ProcessEvent(const struct eventrecord &event); 41 Int_t GetNumEvents(); 42 43 void ReadPedestals(); 44 Bool_t ReadHeader(); 45 Bool_t ReadFooter(); 46 Bool_t CheckFilePosition(); 47 void ProcessHeader(const struct outputpars &outpars); 48 void ProcessEvent(const struct eventrecord &event); 46 49 47 50 public: -
trunk/MagicSoft/Mars/mfileio/MChain.cc
r1472 r1583 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@ uni-sw.gwdg.de>18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 20 ! Copyright: MAGIC Software Development, 2000-2002 -
trunk/MagicSoft/Mars/mfileio/MReadMarsFile.cc
r1569 r1583 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@ uni-sw.gwdg.de>18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 20 ! Copyright: MAGIC Software Development, 2000-2002 -
trunk/MagicSoft/Mars/mfileio/MReadTree.cc
r1572 r1583 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@ uni-sw.gwdg.de>18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 20 ! Copyright: MAGIC Software Development, 2000-2002 -
trunk/MagicSoft/Mars/mfileio/MWriteAsciiFile.cc
r1408 r1583 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 06/2001 <mailto:tbretz@ uni-sw.gwdg.de>18 ! Author(s): Thomas Bretz 06/2001 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 20 ! Copyright: MAGIC Software Development, 2000-2002 -
trunk/MagicSoft/Mars/mfileio/MWriteFile.cc
r1381 r1583 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 06/2001 <mailto:tbretz@ uni-sw.gwdg.de>18 ! Author(s): Thomas Bretz 06/2001 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 120 ! Copyright: MAGIC Software Development, 2000-2002 21 21 ! 22 22 ! -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
r1549 r1583 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 06/2001 <mailto:tbretz@ uni-sw.gwdg.de>19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 118 ! Author(s): Thomas Bretz 06/2001 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2002 21 21 ! 22 22 ! -
trunk/MagicSoft/Mars/mfileio/structures.h
r1574 r1583 102 102 /* file name) */ 103 103 enum onoroff eruntype; 104 #ifdef LINUX 105 int dummy; 106 #endif 104 107 /* indicates if the */ 105 108 /* run is on- or off source (from runfile cross checked with */ … … 122 125 float fpixdiameter_deg; 123 126 /* smallest pixel diameter (degrees) (from parameters file) */ 124 axes ese1_is;127 enum axes ese1_is; 125 128 /* name of the axis to which shaft encoder 1 is attached */ 126 129 /* (implies the type of mount) */ … … 218 221 /* tracking mode (for ALT/AZ CTs) */ 219 222 int iproc_evts; 223 #ifdef LINUX 224 int dummy2; 225 #endif 220 226 /* number of events processed */ 221 227 double dactual_sourcera_hours; … … 867 873 /* y position relative to the central CT for each CT */ 868 874 }; 869 870 871 875 #endif 872 876
Note:
See TracChangeset
for help on using the changeset viewer.