Changeset 1664 for trunk/MagicSoft
- Timestamp:
- 11/21/02 16:20:21 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1662 r1664 19 19 * macros/collarea.C: 20 20 - some simplifications 21 22 * mhist/MHMcRate.h, mhist/MHMcIntRate.h, mhist/MHEnergyTime.h, 23 mhist/MHEnergyTheta.h, mfileio/MCTReadPreProc.cc, mfileio/MChain.h, 24 mfileio/MReadMarsFile.h, mfileio/MReadTree.cc, mfileio/MWriteAsciiFile.h, 25 mfileio/MWriteRoootFile.[h,cc], manalysis/MMatrixLoop.h, 26 manalysis/MEnergyEstimate.h, mbase/MGGroupFrame.h, mbase/MGTask.h, 27 mfilter/MFParticleId.h: 28 - updated documentation 29 30 * mfileio/MCT1ReadPreProc.cc: 31 - Changed MSrcPosCam name from Source to MSrcPosCam 32 - changed the way the MC data is filled into the MC container 33 - updated algorithm to read preproc files 34 35 * mfileio/MReadMarsFile.cc: 36 - printed a warning to the screen in case Camera=V0.5 37 38 * mfileio/structures.h: 39 - changed to version 0.6 40 41 * mmc/MMcEvt.hxx: 42 - added GetTelescopePhi 43 - added GetTelescopeTheta 21 44 22 45 * mdata/MDataChain.[h,cc]: -
trunk/MagicSoft/Mars/manalysis/MEnergyEstimate.h
r1211 r1664 23 23 Bool_t Process(); 24 24 25 ClassDef(MEnergyEstimate, 0) // Task to estimate the energy25 ClassDef(MEnergyEstimate, 0) // Task to copy the MC energy (preliminary) 26 26 }; 27 27 -
trunk/MagicSoft/Mars/manalysis/MMatrixLoop.h
r1525 r1664 30 30 Bool_t Process(); 31 31 32 ClassDef(MMatrixLoop, 0) 32 ClassDef(MMatrixLoop, 0) // Task 'reading' events from a MHMatrix 33 33 }; 34 34 -
trunk/MagicSoft/Mars/mbase/MGGroupFrame.h
r1076 r1664 37 37 virtual Bool_t ProcessMessage(Long_t msg, Long_t param1, Long_t param2); 38 38 39 ClassDef(MGGroupFrame, 0) 39 ClassDef(MGGroupFrame, 0) // A interface to widgets in a group frame (makes live easier) 40 40 }; 41 41 -
trunk/MagicSoft/Mars/mbase/MGTask.h
r1080 r1664 45 45 void CreateGui(TGCompositeFrame *f, TGLayoutHints *layout=NULL); 46 46 47 ClassDef(MGTask, 0) //Abstract base class for a task47 ClassDef(MGTask, 0) // Abstract base class for a task having a gui 48 48 }; 49 49 -
trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.h
r1013 r1664 44 44 UInt_t w=800, UInt_t h=500, 45 45 UInt_t options = kMainFrame|kVerticalFrame); 46 47 46 ~MGDisplayAdc(); 48 47 -
trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc
r1663 r1664 112 112 void MCT1ReadPreProc::AddFile(const char *txt) 113 113 { 114 ifstream *store = fIn; 115 116 fIn = new ifstream(gSystem->ExpandPathName(txt)); 117 118 if (!(*fIn)) 119 { 120 *fLog << warn << "Cannot open file '" << txt << "'... ignored." << endl; 121 fIn = store; 114 const TString fname = gSystem->ExpandPathName(txt); 115 116 if (!CheckHeader(fname)) 117 { 118 *fLog << warn << "WARNING - Problem reading header... ignored." << endl; 122 119 return; 123 120 } 124 121 125 fEntries += GetNumEvents(); 126 127 delete fIn; 128 129 fIn = store; 122 const Int_t n = GetNumEvents(fname); 123 if (n==0) 124 { 125 *fLog << warn << "WARNING - File contains no data... ignored." << endl; 126 return; 127 } 128 129 fEntries += n; 130 131 *fLog << inf << "File " << txt << " contains " << n << " events (Total=" << fEntries << ")" << endl; 130 132 131 133 fFileNames->AddLast(new TNamed(txt, "")); … … 390 392 &dummy/*&outpars.eruntype*/, &outpars.iproc_mjdate); 391 393 392 if (STRUCT_VERSION != structversion) 394 if (fpreprocversion<0.6) 395 { 396 *fLog << err << "Sorry only files from PreProc V0.6 and newer are supported." << endl; 397 return kFALSE; 398 } 399 400 // 401 // This is a stupid way of getting rid of numerical uncertanties when 402 // comparing floating point numbers (Argh...) 403 // 404 TString s1 = Form("%.2f", structversion); 405 TString s2 = Form("%.2f", STRUCT_VERSION); 406 407 if (s1 != s2) 393 408 { 394 409 *fLog << warn << "WARNING: Version of C-structures of file (V"; 395 *fLog << s tructversion<< ") not identical with current structures (V";396 *fLog << STRUCT_VERSION<< ")" << endl;410 *fLog << s1 << ") not identical with current structures (V"; 411 *fLog << s2 << ")" << endl; 397 412 } 398 413 … … 404 419 } 405 420 406 Bool_t MCT1ReadPreProc::ReadRunFooter()421 Int_t MCT1ReadPreProc::ReadRunFooter() 407 422 { 408 423 char cheadertitle[iHEADERTITLELENGTH]; … … 420 435 { 421 436 fIn->seekg(-iHEADERTITLELENGTH, ios::cur); 422 return kFALSE;437 return 0; 423 438 } 424 439 … … 444 459 */ 445 460 446 fNumFilterEvts += filterres.ifilter_passed_evts; 461 if (fNumEventsInRun!=(UInt_t)filterres.ifilter_passed_evts) 462 { 463 *fLog << err << "ERROR! Number of events in run (" << (UInt_t)filterres.ifilter_passed_evts; 464 *fLog << ") doesn't match number of read events ("; 465 *fLog << fNumEventsInRun << ")" << endl; 466 *fLog << " File corrupted." << endl; 467 return -1; 468 } 469 470 fNumFilterEvts += fNumEventsInRun; 447 471 fNumRuns++; 448 472 449 *fLog << inf << "Read " << fNumEventsInRun << " events from run." << endl; 450 451 if (fNumEventsInRun!=(UInt_t)filterres.ifilter_passed_evts) 452 { 453 *fLog << warn << "WARNING! Number of events in run doesn't match number of read events." << endl; 454 *fLog << " File might be corrupt." << endl; 455 } 456 457 return kTRUE; 473 *fLog << inf << "Read " << fNumEventsInRun << " events from run (Total="; 474 *fLog << fNumFilterEvts << "/" << fEntries << " ["; 475 *fLog << 100*fNumFilterEvts/fEntries << "%], Runs=" << fNumRuns << ")"; 476 *fLog << endl; 477 478 return 1; 458 479 } 459 480 … … 481 502 // open the file which is the first one in the chain 482 503 // 483 const char *name = file->GetName(); 484 485 fIn = new ifstream(gSystem->ExpandPathName(name)); 486 487 if (!(*fIn)) 488 { 489 *fLog << dbginf << "Cannot open file '" << name << "'" << endl; 490 return kFALSE; 491 } 492 493 *fLog << "Open file: '" << name << "'" << endl; 504 const TString name = file->GetName(); 505 const TString fname = gSystem->ExpandPathName(name); 494 506 495 507 // … … 498 510 fFileNames->Remove(file); 499 511 512 *fLog << inf << "Open file: '" << name << "'" << endl; 513 514 if (!CheckHeader(fname)) 515 return kFALSE; 516 517 fIn = new ifstream(fname); 518 500 519 *fLog << inf << "-----------------------------------------------------------------------" << endl; 501 520 502 *fLog << "File contains " << GetNumEvents() << " events." << endl; 503 504 // WORKAROUND for not working seekg(0) in GetNumEvents 505 fIn->close(); 506 fIn->open(gSystem->ExpandPathName(name)); 507 508 Bool_t rc = ReadRunHeader(); 509 510 if (!rc) 521 if (!ReadRunHeader()) 522 { 511 523 *fLog << warn << "Unable to read first run header... skipping file." << endl; 512 513 return rc; 514 } 515 516 Int_t MCT1ReadPreProc::GetNumEvents() 517 { 518 *fLog << inf << "Scanning file for size" << flush; 524 return kFALSE; 525 } 526 527 return kTRUE; 528 } 529 530 Bool_t MCT1ReadPreProc::CheckHeader(const TString fname) const 531 { 532 ifstream fin(fname); 533 if (!fin) 534 { 535 *fLog << dbginf << err << "ERROR - Cannot open file '" << fname << "'" << endl; 536 return kFALSE; 537 } 538 539 char cheadertitle[iHEADERTITLELENGTH]; 540 fin.read(cheadertitle, iHEADERTITLELENGTH); 541 542 Float_t fpreprocversion, structversion, dummy; 543 544 sscanf(cheadertitle, cTITLE_TEMPLATE, 545 &fpreprocversion, &structversion, 546 &dummy, &dummy, &dummy, &dummy); 547 548 if (fpreprocversion < 0.6) 549 { 550 *fLog << dbginf << err << "ERROR - You must use PreProc V0.6 or higher." << endl; 551 return kFALSE; 552 } 553 554 if (STRUCT_VERSION > structversion) 555 { 556 *fLog << warn << "WARNING: Version of C-structures of file (V"; 557 *fLog << structversion << ") newer than current structures (V"; 558 *fLog << STRUCT_VERSION << ")" << endl; 559 } 560 561 *fLog << "Current structures: " << STRUCT_VERSION << " "; 562 *fLog << "Structures in file: " << structversion << " "; 563 *fLog << "Used preproc version: " << fpreprocversion << endl; 564 565 return kTRUE; 566 } 567 568 569 Int_t MCT1ReadPreProc::GetNumEvents(const TString fname) const 570 { 571 *fLog << inf << "Scanning file " << fname << " for size" << flush; 572 573 ifstream fin(fname); 574 if (!fin) 575 { 576 *fLog << dbginf << err << "ERROR - Opening file." << endl; 577 return 0; 578 } 519 579 520 580 const TString m(cEND_EVENTS_TEMPLATE); … … 525 585 Int_t nruns = 0; 526 586 527 while (!f In->eof())528 { 529 f In->seekg(iHEADERTITLELENGTH, ios::cur);530 f In->seekg(sizeof(struct outputpars), ios::cur);587 while (!fin.eof() && fin.peek()!=EOF) 588 { 589 fin.seekg(iHEADERTITLELENGTH, ios::cur); 590 fin.seekg(sizeof(struct outputpars), ios::cur); 531 591 532 592 while (1) 533 593 { 534 if (f In->peek()==cEND_EVENTS_TEMPLATE[0])594 if (fin.peek()==cEND_EVENTS_TEMPLATE[0]) 535 595 { 536 596 char cheadertitle[iHEADERTITLELENGTH]; 537 f In->read(cheadertitle, iHEADERTITLELENGTH);597 fin.read(cheadertitle, iHEADERTITLELENGTH); 538 598 539 599 const TString s = cheadertitle; 540 600 if (s.BeginsWith(test)) 541 601 { 542 f In->seekg(sizeof(struct filterresults), ios::cur);602 fin.seekg(sizeof(struct filterresults), ios::cur); 543 603 nruns++; 544 604 break; 545 605 } 546 606 547 f In->seekg(-iHEADERTITLELENGTH, ios::cur);607 fin.seekg(-iHEADERTITLELENGTH, ios::cur); 548 608 } 549 609 550 f In->seekg(sizeof(struct eventrecord), ios::cur);551 if (f In->eof())610 fin.seekg(sizeof(struct eventrecord), ios::cur); 611 if (fin.eof()) 552 612 break; 613 553 614 nevts++; 554 615 } … … 746 807 // must be an event 747 808 // 748 if (!ReadRunFooter()) 809 switch (ReadRunFooter()) 810 { 811 case -1: 812 return kFALSE; 813 case 0: 749 814 return kTRUE; 815 } 750 816 751 817 *fLog << inf << "Footer found." << endl; 818 819 const char c = fIn->peek(); 752 820 753 821 // 754 822 // No after reading the footer check if we reached the end of the file 755 823 // 756 if (fIn->eof() )824 if (fIn->eof() || c==EOF) 757 825 { 758 826 *fLog << "End of file." << endl; … … 763 831 // If the eof isn't reached a new header must follow. Check for it. 764 832 // 765 if ( fIn->peek()!=cTITLE_TEMPLATE[0])833 if (c!=cTITLE_TEMPLATE[0]) 766 834 { 767 835 *fLog << inf << "Error finding new run header in file (possible EOF)... skipping rest of file." << endl; … … 813 881 *fLog << "Number of Events read from file: " << fNumEvents << endl; 814 882 *fLog << "Number of Runs read from file: " << fNumRuns << endl; 883 *fLog << "Number of events detected first: " << fEntries << endl; 815 884 816 885 if (fNumEvents!=fNumFilterEvts) -
trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.h
r1663 r1664 42 42 Bool_t OpenNextFile(); 43 43 44 Int_t GetNumEvents(); 44 Int_t GetNumEvents(const TString name) const; 45 Bool_t CheckHeader(const TString fname) const; 45 46 46 47 void ReadPedestals(); 47 48 Bool_t ReadRunHeader(); 48 Bool_tReadRunFooter();49 Int_t ReadRunFooter(); 49 50 Bool_t CheckFilePosition(); 50 51 void ProcessRunHeader(const struct outputpars &outpars); -
trunk/MagicSoft/Mars/mfileio/MChain.h
r1472 r1664 22 22 Int_t LoadTree(Int_t entry); 23 23 24 ClassDef(MChain, 1) 24 ClassDef(MChain, 1) // Class derived from TChain to give access to Notify-return value 25 25 }; 26 26 -
trunk/MagicSoft/Mars/mfileio/MReadMarsFile.cc
r1600 r1664 160 160 *fLog << "in this case you may get less photons than you would expect." << endl; 161 161 } 162 if (mcheader->GetCamVersion==50) 163 { 164 *fLog << warn << "Warning - You are using a file created with Camera 0.5." << endl; 165 *fLog << "In this camera version some events have undefined Impact-Values" << endl; 166 *fLog << "(MMcEvt::fImpact) Please don't use it for MC studies using the" << endl; 167 *fLog << "impact parameter." << endl; 168 } 162 169 } 163 170 -
trunk/MagicSoft/Mars/mfileio/MReadMarsFile.h
r1472 r1664 26 26 Int_t AddFile(const char *fname); 27 27 28 ClassDef(MReadMarsFile, 1) // Reads a tree from file(s) 28 ClassDef(MReadMarsFile, 1) // Reads a tree from file(s) and the information from the 'RunHeader'-tree 29 29 }; 30 30 -
trunk/MagicSoft/Mars/mfileio/MReadTree.cc
r1600 r1664 55 55 #include <TFile.h> // TFile::GetName 56 56 #include <TSystem.h> // gSystem->ExpandPath 57 //#include <TGProgressBar.h>58 57 #include <TChainElement.h> 59 58 #include <TOrdCollection.h> -
trunk/MagicSoft/Mars/mfileio/MWriteAsciiFile.h
r1408 r1664 40 40 void AddColumns(MParContainer *cont); 41 41 42 ClassDef(MWriteAsciiFile, 0) // Class to write one containerto an ascii file42 ClassDef(MWriteAsciiFile, 0) // Class to write data into an ascii file 43 43 }; 44 44 -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
r1600 r1664 131 131 // 132 132 133 *fLog << inf << "Output File closed and deleted." << endl;133 *fLog << inf << "Output File closed and object deleted." << endl; 134 134 } 135 135 -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h
r1477 r1664 95 95 void Print(Option_t *t=NULL) const; 96 96 97 ClassDef(MWriteRootFile, 1) // Class to write one containerto a root file97 ClassDef(MWriteRootFile, 1) // Task to write data into a root file 98 98 }; 99 99 -
trunk/MagicSoft/Mars/mfileio/structures.h
r1583 r1664 33 33 #define _structures_h_ "__structures_h__" 34 34 35 #define STRUCT_VERSION 0. 535 #define STRUCT_VERSION 0.6 36 36 37 37 #define iHEADERTITLELENGTH 60 -
trunk/MagicSoft/Mars/mfilter/MFParticleId.h
r1481 r1664 42 42 Bool_t Process(); 43 43 44 ClassDef(MFParticleId, 1) // A Filter for the Level 1 Trigger44 ClassDef(MFParticleId, 1) // A Filter for the (corsika) particle Id 45 45 }; 46 46
Note:
See TracChangeset
for help on using the changeset viewer.