Changeset 1600 for trunk/MagicSoft
- Timestamp:
- 11/13/02 17:03:19 (22 years ago)
- Location:
- trunk/MagicSoft
- Files:
-
- 2 added
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1599 r1600 1 1 -*-*- END -*-*- 2 3 2002/11/13: Thomas Bretz 4 5 * mfilter/MFEventSelector.[h,cc]: 6 - if total number of events read from file the selector worked only for 7 one eventloop - fixed. 8 - changed MReadMarsFile to MRead 9 10 * mbase/MContinue.cc: 11 - fixed a typo 12 13 * mbase/MEvtLoop.cc, meventdisp/MGEvtDisplay.cc: 14 - renamed MReadMarsFile/MReadTree to MRead 15 16 * mfileio/FileIOLinkDef.h, mfileio/Makefile: 17 - added MRead 18 19 * mfileio/MRead.[h,cc]: 20 - added 21 22 * mfileio/MReadMarsFile.[h,cc], mfileio/MReadTree.[h,cc]: 23 - renamed from MReadMarsFile to MRead 24 - derived from MRead 25 - removed progressbar support from MReadTree 26 27 * mfileio/MWriteRootFile.cc: 28 - added a info output 29 30 * mfileio/MCT1ReadPreProc.[h,cc]: 31 - changed to work much much better :) 32 33 * mgeom/GeomLinkDef.h, mmc/McLinkDef.h: 34 - added missing LinkDefs (helllo Oscar!) 35 36 * mgeom/MGeomCamCT1.cc: 37 - mirrored the CT1 camera in x (CT1 default) 38 39 * mgeom/MGeomMirror.[h,cc]: 40 - some small changes 41 42 * mgeom/MGeomPMT.[h,cc]: 43 - changed usage of TArrayF from pointer to reference 44 45 * mgui/MCamDisplay.cc: 46 - fixed a crash at delete when the user closed a automatically 47 created canvas 48 49 * mhist/MHFadcCam.[h,cc]: 50 - implemented ResetHistograms 51 52 * mhist/MHMatrix.[h,cc]: 53 - implemented ReduceNumberOfRows (preliminary, untested) 54 55 * mmc/MMcConfigRunHeader.[h,cc]: 56 - some small changes 57 - changed usage of TArrayF from pointer to reference 58 59 2 60 3 61 2002/11/11: Thomas Bretz -
trunk/MagicSoft/Mars/mbase/MContinue.cc
r1538 r1600 27 27 // MContinue // 28 28 // // 29 // Does nothing than return kCONTINUE in the Process-fu cntion //29 // Does nothing than return kCONTINUE in the Process-function // 30 30 // (use with filters) // 31 31 // // -
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r1540 r1600 85 85 #include "MTaskList.h" 86 86 #ifdef __MARS__ 87 #include "MRead Tree.h"// for setting progress bar87 #include "MRead.h" // for setting progress bar 88 88 #include "MProgressBar.h" // MProgressBar::GetBar 89 89 #endif … … 213 213 else 214 214 { 215 MReadTree *read = (MReadTree*)fTaskList->FindObject("MReadTree"); 216 if (!read) 217 read = (MReadTree*)fTaskList->FindObject("MReadMarsFile"); 218 if (read) 215 MRead *read = (MRead*)fTaskList->FindObject("MRead"); 216 if (read && read->GetEntries()>0) 219 217 fProgress->SetRange(0, read->GetEntries()); 220 218 } -
trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc
r1542 r1600 92 92 MReadTree *MGEvtDisplay::GetReader() const 93 93 { 94 return (MReadTree*)GetTaskList()->FindObject("MRead MarsFile");94 return (MReadTree*)GetTaskList()->FindObject("MRead"); 95 95 } 96 96 -
trunk/MagicSoft/Mars/mfileio/FileIOLinkDef.h
r1574 r1600 6 6 7 7 #pragma link C++ class MChain+; 8 #pragma link C++ class MRead+; 8 9 #pragma link C++ class MReadTree+; 9 10 #pragma link C++ class MReadMarsFile+; -
trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc
r1599 r1600 42 42 // 43 43 ///////////////////////////////////////////////////////////////////////////// 44 45 44 #include "MCT1ReadPreProc.h" 46 45 … … 81 80 // 82 81 MCT1ReadPreProc::MCT1ReadPreProc(const char *fname, const char *name, 83 const char *title) : fIn(NULL) 84 { 85 fName = name ? name : "M CT1ReadPreProc";82 const char *title) : fIn(NULL), fEntries(0) 83 { 84 fName = name ? name : "MRead"; 86 85 fTitle = title ? title : "Task to loop over events in CT1 ascii file"; 87 86 … … 113 112 void MCT1ReadPreProc::AddFile(const char *txt) 114 113 { 115 TNamed *name = new TNamed(txt, ""); 116 fFileNames->AddLast(name); 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; 122 return; 123 } 124 125 fEntries += GetNumEvents(); 126 127 delete fIn; 128 129 fIn = store; 130 131 fFileNames->AddLast(new TNamed(txt, "")); 117 132 } 118 133 … … 123 138 // data members 124 139 // 125 void MCT1ReadPreProc::Process Header(const struct outputpars &outpars)126 { 127 fNumPixels = outpars.inumpixels; // number of pixels in the camera128 129 if (fNumPixels>iMAXNUMPIX || fNumPixels==0) 130 fNumPixels=iMAXNUMPIX;140 void MCT1ReadPreProc::ProcessRunHeader(const struct outputpars &outpars) 141 { 142 if (outpars.inumpixels != iMAXNUMPIX) 143 *fLog << warn << "WARNING! File doesn't contain " << iMAXNUMPIX << " Pixels... maybe corrupt." << endl; 144 145 fNumEventsInRun = 0; 131 146 132 147 // … … 166 181 *fLog << "Source: RA=" << outpars.dsourcera_hours << "h DEC="; 167 182 *fLog << outpars.dsourcedec_deg << "deg" << endl; 168 169 *fLog << "Pixels: " << fNumPixels << endl;170 183 171 184 //int inummuonpixels; // number of pixels in the muon shield … … 262 275 263 276 // 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()); 277 fSrcPos->SetXY(-outpars.fypointcorr_deg/fGeom->GetConvMm2Deg(), 278 -outpars.fxpointcorr_deg/fGeom->GetConvMm2Deg()); 279 fSrcPos->SetReadyToSave(); 266 280 267 281 /* … … 342 356 343 357 fIsMcFile = outpars.bmontecarlo==TRUE; 358 359 fPedest->SetReadyToSave(); 344 360 } 345 361 … … 348 364 // Read CT1 PreProc File Header: 349 365 // 350 Bool_t MCT1ReadPreProc::Read Header()366 Bool_t MCT1ReadPreProc::ReadRunHeader() 351 367 { 352 368 char cheadertitle[iHEADERTITLELENGTH]; … … 381 397 fIn->read((Byte_t*)&outpars, sizeof(struct outputpars)); 382 398 383 Process Header(outpars);399 ProcessRunHeader(outpars); 384 400 385 401 return kTRUE; 386 402 } 387 403 388 Bool_t MCT1ReadPreProc::Read Footer()404 Bool_t MCT1ReadPreProc::ReadRunFooter() 389 405 { 390 406 char cheadertitle[iHEADERTITLELENGTH]; … … 400 416 401 417 if (!s.BeginsWith(m(0,p))) 402 return kFALSE; 418 { 419 fIn->seekg(-iHEADERTITLELENGTH, ios::cur); 420 return kFALSE; 421 } 403 422 404 423 *fLog << inf << cheadertitle << flush; … … 423 442 */ 424 443 444 fNumFilterEvts += filterres.ifilter_passed_evts; 445 fNumRuns++; 446 447 *fLog << inf << "Read " << fNumEventsInRun << " events from run." << endl; 448 449 if (fNumEventsInRun!=(UInt_t)filterres.ifilter_passed_evts) 450 { 451 *fLog << warn << "WARNING! Number of events in run doesn't match number of read events." << endl; 452 *fLog << " File might be corrupt." << endl; 453 } 454 425 455 return kTRUE; 426 456 } … … 468 498 *fLog << inf << "-----------------------------------------------------------------------" << endl; 469 499 470 //*fLog << "File contains " << GetNumEvents() << " events." << endl; 471 472 Bool_t rc = ReadHeader(); 500 *fLog << "File contains " << GetNumEvents() << " events." << endl; 501 502 // WORKAROUND for not working seekg(0) in GetNumEvents 503 fIn->close(); 504 fIn->open(gSystem->ExpandPathName(name)); 505 506 Bool_t rc = ReadRunHeader(); 473 507 474 508 if (!rc) 475 *fLog << warn << "Unable to read header... skipping file." << endl;509 *fLog << warn << "Unable to read first run header... skipping file." << endl; 476 510 477 511 return rc; … … 480 514 Int_t MCT1ReadPreProc::GetNumEvents() 481 515 { 482 Int_t n = 0; 516 *fLog << inf << "Scanning file for size" << flush; 517 518 const TString m(cEND_EVENTS_TEMPLATE); 519 const Int_t p = m.First('%'); 520 const TString test = m(0, p); 521 522 Int_t nevts = 0; 523 Int_t nruns = 0; 483 524 484 525 while (!fIn->eof()) 485 526 { 486 if (fIn->get()!=cEND_EVENTS_TEMPLATE[0]) 487 continue; 488 489 char cheadertitle[iHEADERTITLELENGTH]; 490 fIn->read(cheadertitle, iHEADERTITLELENGTH-1); 491 492 TString s = cheadertitle; 493 TString m = cEND_EVENTS_TEMPLATE; 494 Int_t p = m.First('%'); 495 496 if (!s.BeginsWith(m(1,p-1))) 497 continue; 498 499 int num; 500 501 sscanf(cheadertitle, &cEND_EVENTS_TEMPLATE[1], &num); 502 503 n += num; 504 } 505 506 fIn->seekg(0); 507 508 return n; 527 fIn->seekg(iHEADERTITLELENGTH, ios::cur); 528 fIn->seekg(sizeof(struct outputpars), ios::cur); 529 530 while (1) 531 { 532 if (fIn->peek()==cEND_EVENTS_TEMPLATE[0]) 533 { 534 char cheadertitle[iHEADERTITLELENGTH]; 535 fIn->read(cheadertitle, iHEADERTITLELENGTH); 536 537 const TString s = cheadertitle; 538 if (s.BeginsWith(test)) 539 { 540 fIn->seekg(sizeof(struct filterresults), ios::cur); 541 nruns++; 542 break; 543 } 544 545 fIn->seekg(-iHEADERTITLELENGTH, ios::cur); 546 } 547 548 fIn->seekg(sizeof(struct eventrecord), ios::cur); 549 if (fIn->eof()) 550 break; 551 nevts++; 552 } 553 *fLog << "." << flush; 554 } 555 556 *fLog << "done." << endl; 557 *fLog << "Found " << nevts << " events in " << nruns << " runs." << endl; 558 559 return nevts; 509 560 } 510 561 … … 542 593 // look for the source position in the camera 543 594 // 544 fSrcPos = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam" );595 fSrcPos = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam", "Source"); 545 596 if (!fSrcPos) 546 597 return kFALSE; … … 566 617 if (!fMcTrig) 567 618 return kFALSE; 619 620 fNumFilterEvts = 0; 621 fNumRuns = 0; 568 622 569 623 return kTRUE; … … 582 636 int isecfrac_200ns; // fractional part of isecs_since_midday 583 637 short snot_ok_flags; // the bits in these two bytes are flags for additional information on the event: Everything OK =: all Bits = 0 584 int ipreproc_alt_arcs; // "should be" alt according to preproc (arcseconds)585 int ipreproc_az_arcs; // "should be" az according to preproc (arcseconds)586 638 587 639 // for ALT-AZ mount telescopes: rotation angle of the field of … … 602 654 float fhourangle; 603 655 */ 604 /*605 *fLog << event.isecs_since_midday << "s ";606 *fLog << event.ipreproc_alt_arcs << "s ";607 *fLog << event.ipreproc_az_arcs << "s ";608 *fLog << event.ifieldrot_arcs << "s ";609 *fLog << event.fhourangle << endl;610 */611 656 612 657 // … … 614 659 // too the list with it's id, number of photons and error 615 660 // 616 fNphot->InitSize( fNumPixels);661 fNphot->InitSize(iMAXNUMPIX); 617 662 618 663 // number of photoelectrons measured in each pixel only the 619 664 // actual number of pixels (outputpars.inumpixels) is written out 620 665 // short spixsig_10thphot[iMAXNUMPIX]; 621 for (Int_t i=0; i<fNumPixels; i++) 622 { 623 if (event.spixsig_10thphot[i]>0) 624 fNphot->AddPixel(i, 0.1*event.spixsig_10thphot[i], 625 (*fPedest)[i].GetMeanRms()); 626 } 666 for (Int_t i=0; i<iMAXNUMPIX; i++) 667 { 668 if (event.spixsig_10thphot[i]==0) 669 continue; 670 671 fNphot->AddPixel(i, 0.1*event.spixsig_10thphot[i], 672 (*fPedest)[i].GetMeanRms()); 673 } 674 fNphot->SetReadyToSave(); 675 676 // int ipreproc_alt_arcs; // "should be" alt according to preproc (arcseconds) 677 // int ipreproc_az_arcs; // "should be" az according to preproc (arcseconds) 627 678 628 679 fMcEvt->SetTheta(TMath::Pi()*(0.5-1./180*event.ialt_arcs/3600)); // altitude (arcseconds) 629 680 fMcEvt->SetPhi(TMath::Pi()/180*event.iaz_arcs/3600); // azimuth (arcseconds) 681 682 fMcEvt->SetReadyToSave(); 630 683 631 684 if (!fIsMcFile) … … 636 689 fMcEvt->SetImpact(event.imcimpact_m*100); // simulated impact 637 690 638 fMcTrig->SetFirstLevel(event.imctriggerflag); // MC data from Dorota get a triggerflag: 1 means triggered, 0 not. */ 691 fMcTrig->SetFirstLevel(event.imctriggerflag); // MC data from Dorota get a triggerflag: 1 means triggered, 0 not. */ 692 fMcTrig->SetReadyToSave(); 639 693 640 694 //float fmcsize_phel; // Simulated SIZE … … 655 709 656 710 // 657 // If the first character isn't the first of the footer it must be 658 // an event 659 // 660 if (fIn->peek()!=cEND_EVENTS_TEMPLATE[0]) 661 return kTRUE; 662 663 // 664 // Remember the current position if the first character faked a 665 // footer 666 // 667 const Int_t pos = fIn->tellg(); 668 669 // 670 // Try reading the footer. If it isn't succefull jump back... 671 // must be an event 672 // 673 if (!ReadFooter()) 674 { 675 fIn->seekg(pos, ios::beg); 676 return kTRUE; 677 } 678 679 *fLog << inf << "Footer found." << endl; 680 681 // 682 // No after reading the footer check if we reached the end of the file 683 // 684 if (fIn->eof()) 685 { 686 *fLog << "End of file." << endl; 687 return kFALSE; 688 } 689 690 // 691 // If the eof isn't reached a new header must follow. Check for it. 692 // 693 if (fIn->peek()!=cTITLE_TEMPLATE[0]) 694 { 695 *fLog << inf << "Error finding new run header in file (possible EOF)... skipping rest of file." << endl; 696 return kFALSE; 697 } 698 699 *fLog << "-----------------------------------------------------------------------" << endl; 700 if (ReadHeader()) 701 return kTRUE; 702 703 *fLog << inf << "Error reading run header in file... skipping rest of file." << endl; 704 return kFALSE; 711 // Because we can have 0-event runs in the file we loop as often 712 // as we don't find a new footer-header combination. 713 // 714 while (1) 715 { 716 // 717 // If the first character isn't the first of the footer it must be 718 // an event 719 // 720 if (fIn->peek()!=cEND_EVENTS_TEMPLATE[0]) 721 return kTRUE; 722 723 // 724 // Try reading the footer. If it isn't succefull... 725 // must be an event 726 // 727 if (!ReadRunFooter()) 728 return kTRUE; 729 730 *fLog << inf << "Footer found." << endl; 731 732 // 733 // No after reading the footer check if we reached the end of the file 734 // 735 if (fIn->eof()) 736 { 737 *fLog << "End of file." << endl; 738 return kFALSE; 739 } 740 741 // 742 // If the eof isn't reached a new header must follow. Check for it. 743 // 744 if (fIn->peek()!=cTITLE_TEMPLATE[0]) 745 { 746 *fLog << inf << "Error finding new run header in file (possible EOF)... skipping rest of file." << endl; 747 return kFALSE; 748 } 749 750 *fLog << "-----------------------------------------------------------------------" << endl; 751 if (!ReadRunHeader()) 752 return kTRUE; 753 } 705 754 } 706 755 … … 726 775 struct eventrecord event; 727 776 728 const int size1 = sizeof(event)-sizeof(event.spixsig_10thphot); 729 const int size2 = sizeof(event.spixsig_10thphot[0])*fNumPixels; 730 731 // read the eventrecord with the recorded number of stored pixels 732 fIn->read((Byte_t*)&event, size1+size2); 733 734 if (fIn->eof()) 735 return kFALSE; 777 // read the eventrecord from the file 778 fIn->read((Byte_t*)&event, sizeof(struct eventrecord)); 736 779 737 780 ProcessEvent(event); 738 781 739 fNumEvent++; 782 fNumEvents++; 783 fNumEventsInRun++; 740 784 741 785 return kTRUE; 742 786 } 743 787 788 Bool_t MCT1ReadPreProc::PostProcess() 789 { 790 *fLog << all; 791 *fLog << "Number events passed the filter: " << fNumFilterEvts << endl; 792 *fLog << "Number of Events read from file: " << fNumEvents << endl; 793 *fLog << "Number of Runs read from file: " << fNumRuns << endl; 794 795 if (fNumEvents!=fNumFilterEvts) 796 { 797 *fLog << warn << "WARNING! Number of events in file doesn't match number of read events..." << endl; 798 *fLog << " File might be corrupt." << endl; 799 } 800 801 return kTRUE; 802 } -
trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.h
r1583 r1600 2 2 #define MARS_MCT1ReadPreProc 3 3 4 #ifndef MARS_M Task5 #include "M Task.h"4 #ifndef MARS_MRead 5 #include "MRead.h" 6 6 #endif 7 7 … … 18 18 struct eventrecord; 19 19 20 class MCT1ReadPreProc : public M Task20 class MCT1ReadPreProc : public MRead 21 21 { 22 22 private: 23 ifstream *fIn; // the inputfile 24 MGeomCam *fGeom; // camera geometry 25 MCerPhotEvt *fNphot; // the data container for all data. 26 MPedestalCam *fPedest; // ct1 pedestals 27 MMcEvt *fMcEvt; // monte carlo data container for MC files 28 MMcTrig *fMcTrig; // mc data container for trigger information 29 MSrcPosCam *fSrcPos; // source position in the camera 30 TList *fFileNames; // Array which stores the \0-terminated filenames 31 MBlindPixels *fBlinds; // Array holding blind pixels 23 ifstream *fIn; // the inputfile 24 TList *fFileNames; // Array which stores the \0-terminated filenames 32 25 33 Int_t fNumPixels; 34 Bool_t fIsMcFile; 26 MGeomCam *fGeom; // camera geometry 27 MCerPhotEvt *fNphot; // the data container for all data. 28 MPedestalCam *fPedest; // ct1 pedestals 29 MMcEvt *fMcEvt; // monte carlo data container for MC files 30 MMcTrig *fMcTrig; // mc data container for trigger information 31 MSrcPosCam *fSrcPos; // source position in the camera 32 MBlindPixels *fBlinds; // Array holding blind pixels 35 33 36 UInt_t fNumEvents; 37 UInt_t fNumEvent; 34 Bool_t fIsMcFile; // Flag whether current run is a MC run 35 36 UInt_t fNumEvents; // number of events counted in all runs in all files 37 UInt_t fNumEventsInRun; // number of events in the counted in th ecurrent run 38 UInt_t fNumRuns; // number of processed runs of all files 39 UInt_t fEntries; // entries of all files succesfully added 40 UInt_t fNumFilterEvts; // number of events mentioned in the runs footers 38 41 39 42 Bool_t OpenNextFile(); … … 42 45 43 46 void ReadPedestals(); 44 Bool_t Read Header();45 Bool_t Read Footer();47 Bool_t ReadRunHeader(); 48 Bool_t ReadRunFooter(); 46 49 Bool_t CheckFilePosition(); 47 void Process Header(const struct outputpars &outpars);50 void ProcessRunHeader(const struct outputpars &outpars); 48 51 void ProcessEvent(const struct eventrecord &event); 49 52 50 53 public: 51 54 MCT1ReadPreProc(const char *filename=NULL, 52 const char *name=NULL,53 const char *title=NULL);55 const char *name=NULL, 56 const char *title=NULL); 54 57 55 58 ~MCT1ReadPreProc(); … … 59 62 Bool_t PreProcess(MParList *pList); 60 63 Bool_t Process(); 64 Bool_t PostProcess(); 65 66 UInt_t GetEntries() { return fEntries; } 61 67 62 68 ClassDef(MCT1ReadPreProc, 0) // Reads the CT1 data file -
trunk/MagicSoft/Mars/mfileio/MReadMarsFile.cc
r1583 r1600 54 54 MReadMarsFile::MReadMarsFile() : fRun(NULL) 55 55 { 56 fName = "MRead MarsFile";56 fName = "MRead"; 57 57 fTitle = "Task to loop over all events in a tree of a Mars file."; 58 58 } … … 67 67 : MReadTree(tname, fname) 68 68 { 69 fName = name ? name : "MRead MarsFile";69 fName = name ? name : "MRead"; 70 70 fTitle = title ? title : "Task to loop over all events in a tree of a Mars file."; 71 71 -
trunk/MagicSoft/Mars/mfileio/MReadTree.cc
r1583 r1600 55 55 #include <TFile.h> // TFile::GetName 56 56 #include <TSystem.h> // gSystem->ExpandPath 57 #include <TGProgressBar.h>57 //#include <TGProgressBar.h> 58 58 #include <TChainElement.h> 59 59 #include <TOrdCollection.h> … … 75 75 // 76 76 MReadTree::MReadTree() 77 : fNumEntry(0), fNumEntries(0), fBranchChoosing(kFALSE), fAutoEnable(kTRUE) , fProgress(NULL)78 { 79 fName = "MRead Tree";77 : fNumEntry(0), fNumEntries(0), fBranchChoosing(kFALSE), fAutoEnable(kTRUE) 78 { 79 fName = "MRead"; 80 80 fTitle = "Task to loop over all events in one single tree"; 81 81 … … 99 99 MReadTree::MReadTree(const char *tname, const char *fname, 100 100 const char *name, const char *title) 101 : fNumEntry(0), fNumEntries(0), fBranchChoosing(kFALSE), fAutoEnable(kTRUE) , fProgress(NULL)102 { 103 fName = name ? name : "MRead Tree";101 : fNumEntry(0), fNumEntries(0), fBranchChoosing(kFALSE), fAutoEnable(kTRUE) 102 { 103 fName = name ? name : "MRead"; 104 104 fTitle = title ? title : "Task to loop over all events in one single tree"; 105 105 … … 415 415 if (TestBit(kChainWasChanged)) 416 416 { 417 *fLog << inf << "Scanning chain... " << flush; 417 418 fNumEntries = (UInt_t)fChain->GetEntries(); 419 *fLog << fNumEntries << " events found." << endl; 418 420 ResetBit(kChainWasChanged); 419 421 } … … 566 568 567 569 // 568 // If a progress bar is given set its range.569 //570 if (fProgress)571 fProgress->SetRange(0, fNumEntries);572 573 //574 570 // Now we can start notifying. Reset tree makes sure, that TChain thinks 575 571 // that the correct file is not yet initialized and reinitilizes it -
trunk/MagicSoft/Mars/mfileio/MReadTree.h
r1572 r1600 2 2 #define MARS_MReadTree 3 3 4 #ifndef MARS_M Task5 #include "M Task.h"4 #ifndef MARS_MRead 5 #include "MRead.h" 6 6 #endif 7 7 8 8 class MChain; 9 9 class TBranch; 10 class TGProgressBar;11 10 12 class MReadTree : public M Task11 class MReadTree : public MRead 13 12 { 14 13 private: … … 27 26 28 27 private: 29 TGProgressBar *fProgress; //! Possible display of status30 31 28 void SetBranchStatus(const TList *list, Bool_t status); 32 29 void SetBranchStatus(TObject *branch, Bool_t status); … … 50 47 void EnableBranch(const char *name); 51 48 void VetoBranch(const char *name); 52 53 void SetProgressBar(TGProgressBar *bar) { fProgress = bar; }54 49 55 50 Bool_t GetEvent(); -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
r1583 r1600 130 130 // - Branches are automatically deleted by the tree destructor 131 131 // 132 133 *fLog << inf << "Output File closed and deleted." << endl; 132 134 } 133 135 -
trunk/MagicSoft/Mars/mfileio/Makefile
r1574 r1600 32 32 33 33 SRCFILES = MChain.cc \ 34 MRead.cc \ 34 35 MReadTree.cc \ 35 36 MReadMarsFile.cc \ -
trunk/MagicSoft/Mars/mfilter/MFEventSelector.cc
r1589 r1600 40 40 // To get around 2000 events from all events use (Remark: This will only 41 41 // work if the parlist has an entry called MTaskList which has a task 42 // MR TeadTree inheriting from MReadTree):42 // MRead inheriting from MRead): 43 43 // MFEventSelector sel; 44 // sel.SetNumSelectEv ents(2000);44 // sel.SetNumSelectEvts(2000); 45 45 // MFillH filler(...); 46 46 // filler.SetFilter(&sel); … … 48 48 // tlist.AddToList(&filler); 49 49 // 50 // If you don't have MRead Treeavailable you have to set the number of50 // If you don't have MRead available you have to set the number of 51 51 // total events manually, using sel.SetNumTotalEvts(10732); 52 52 // … … 67 67 #include "MParList.h" 68 68 #include "MTaskList.h" 69 #include "MRead Tree.h"69 #include "MRead.h" 70 70 71 71 #include "MLog.h" … … 127 127 return kFALSE; 128 128 } 129 MReadTree *read = (MReadTree*)tlist->FindObject("MReadTree"); 130 if (!read) 131 read = (MReadTree*)tlist->FindObject("MReadMarsFile"); 129 MRead *read = (MRead*)tlist->FindObject("MRead"); 132 130 if (!read) 133 131 { 134 *fLog << err << dbginf << "Sorry can't determin total number of events from 'MRead Tree/MReadMarsFile'." << endl;132 *fLog << err << dbginf << "Sorry can't determin total number of events from 'MRead'." << endl; 135 133 return kFALSE; 136 134 } 137 135 fNumTotalEvts = read->GetEntries(); 136 137 SetBit(kNumTotalFromFile); 138 138 } 139 139 … … 166 166 Bool_t MFEventSelector::PostProcess() 167 167 { 168 if (TestBit(kNumTotalFromFile)) 169 fNumTotalEvts = -1; 168 170 return kTRUE; 169 171 } -
trunk/MagicSoft/Mars/mfilter/MFEventSelector.h
r1588 r1600 27 27 void StreamPrimitive(ofstream &out) const; 28 28 29 enum { kNumTotalFromFile = BIT(14) }; 29 30 /* 30 31 enum { kUseFixedRatio=BIT(14) } … … 38 39 Bool_t IsExpressionTrue() const { return fResult; } 39 40 40 void SetNumTotalEvts(Int_t n) { fNumTotalEvts = n; }41 void SetNumTotalEvts(Int_t n) { fNumTotalEvts = n; ResetBit(kNumTotalFromFile); } 41 42 void SetNumSelectEvts(Int_t n) { fNumSelectEvts = n; } 42 43 void SetSelectionRatio(Float_t f) { fSelRatio = f; } -
trunk/MagicSoft/Mars/mgeom/GeomLinkDef.h
r1436 r1600 5 5 #pragma link off all functions; 6 6 7 #pragma link C++ class MGeomPMT+; 8 #pragma link C++ class MGeomMirror+; 7 9 #pragma link C++ class MGeomPix+; 8 10 #pragma link C++ class MGeomCam+; -
trunk/MagicSoft/Mars/mgeom/MGeomCamCT1.cc
r1458 r1600 237 237 // 238 238 for (int i=0; i<ring; i++) 239 (*this)[pixnum++].Set(( -ring+i*0.5)*diameter,239 (*this)[pixnum++].Set((ring-i*0.5)*diameter, 240 240 i*kS32*diameter, 241 241 diameter); 242 242 243 243 for (int i=0; i<ring; i++) 244 (*this)[pixnum++].Set(( -ring*0.5+i)*diameter,244 (*this)[pixnum++].Set((ring*0.5-i)*diameter, 245 245 ring*kS32 * diameter, 246 246 diameter); 247 247 248 248 for (int i=0; i<ring; i++) 249 (*this)[pixnum++].Set(-(ring+i)*0.5*diameter, 250 (ring-i)*kS32*diameter, 251 diameter); 252 253 for (int i=0; i<ring; i++) 254 (*this)[pixnum++].Set((0.5*i-ring)*diameter, 255 -i*kS32*diameter, 256 diameter); 257 258 for (int i=0; i<ring; i++) 259 (*this)[pixnum++].Set((i-ring*0.5)*diameter, 260 -ring*kS32 * diameter, 261 diameter); 262 263 for (int i=0; i<ring; i++) 249 264 (*this)[pixnum++].Set((ring+i)*0.5*diameter, 250 (ring-i)*kS32*diameter,251 diameter);252 253 for (int i=0; i<ring; i++)254 (*this)[pixnum++].Set((ring-0.5*i)*diameter,255 -i*kS32*diameter,256 diameter);257 258 for (int i=0; i<ring; i++)259 (*this)[pixnum++].Set((ring*0.5-i)*diameter,260 -ring*kS32 * diameter,261 diameter);262 263 for (int i=0; i<ring; i++)264 (*this)[pixnum++].Set((-ring-i)*0.5*diameter,265 265 (-ring+i)*kS32*diameter, 266 266 diameter); -
trunk/MagicSoft/Mars/mgeom/MGeomMirror.cc
r1596 r1600 69 69 } 70 70 71 // -------------------------------------------------------------------------- 72 // 73 // DESCRIPTION MISSING 74 // 71 75 void MGeomMirror::SetMirrorContent(Int_t mir, Float_t focal, Float_t curv_x, 72 76 Float_t curv_y, Float_t lin_x, Float_t lin_y, -
trunk/MagicSoft/Mars/mgeom/MGeomMirror.h
r1596 r1600 9 9 { 10 10 private: 11 12 Int_t fMirrorId; // the Mirror Id 11 Int_t fMirrorId; // the Mirror Id 13 12 14 13 Float_t fFocalDist; // focal distance of that mirror [cm] … … 33 32 // of the spot of a single mirror on the camera plane 34 33 public: 35 36 34 MGeomMirror(Int_t mir=-1, const char *name=NULL, const char *title=NULL); 37 35 38 Int_t 36 Int_t GetMirrorId() const { return fMirrorId; } 39 37 40 void 41 42 43 44 38 void SetMirrorContent(Int_t mir, Float_t focal, Float_t curv_x, 39 Float_t curv_y, Float_t lin_x, Float_t lin_y, 40 Float_t lin_z, Float_t theta, Float_t phi, 41 Float_t x_n, Float_t y_n, Float_t z_n, 42 Float_t dev_x, Float_t dev_y); 45 43 46 44 ClassDef(MGeomMirror, 1) // class containing information about the Cerenkov Photons in a pixel -
trunk/MagicSoft/Mars/mgeom/MGeomPMT.cc
r1596 r1600 30 30 // 31 31 /////////////////////////////////////////////////////////////////////// 32 #include "MGeomPMT.h" 32 33 33 34 #include "MLog.h" 34 35 #include "MLogManip.h" 35 36 #include "MGeomPMT.h"37 36 38 37 ClassImp(MGeomPMT); … … 43 42 // 44 43 MGeomPMT::MGeomPMT(Int_t pmt, const char *name=NULL, const char *title=NULL) 44 : fPMTId(pmt), fWavelength(0), fQE(0) 45 45 { 46 46 fName = name ? name : "MGeomPMT"; 47 47 fTitle = title ? title : "Storage container for a PMT characteristics"; 48 } 49 50 // -------------------------------------------------------------------------- 51 // 52 // DESCRIPTION MISSING 53 // 54 void MGeomPMT::SetPMTContent(Int_t pmt, const TArrayF &wav, const TArrayF &qe) 55 { 56 if (fWavelength.GetSize()!=wav.GetSize() || 57 fQE.GetSize()!=qe.GetSize()) 58 { 59 *fLog << err << dbginf << " fWavelength or fQE do not have "; 60 *fLog << "size of setting arrays" << endl; 61 return; 62 } 48 63 49 64 fPMTId = pmt; 50 fWavelength->Set(0);51 fQE->Set(0);52 65 53 } 54 55 void MGeomPMT::SetPMTContent(Int_t pmt, TArrayF *wav, TArrayF *qe) 56 { 57 fPMTId = pmt; 58 59 if(fWavelength->GetSize()==wav->GetSize() && 60 fQE->GetSize()==qe->GetSize()){ 61 wav->Copy(*fWavelength); 62 qe->Copy(*fQE); 63 } 64 else 65 *fLog<<err << "MGeomPMT::SetPMTContent fWavelength " 66 <<"and fQE do not have " 67 <<"size of setting arrays"<<endl; 68 66 fWavelength = wav; 67 fQE = qe; 69 68 } 70 69 -
trunk/MagicSoft/Mars/mgeom/MGeomPMT.h
r1596 r1600 12 12 { 13 13 private: 14 Int_t fPMTId; // the PMT Id 14 15 15 Int_t fPMTId; // the PMT Id 16 17 TArrayF *fWavelength; // List of wavelength 18 TArrayF *fQE; // QE values 16 TArrayF fWavelength; // List of wavelength 17 TArrayF fQE; // QE values 19 18 20 19 public: … … 24 23 Int_t GetPMTId() const { return fPMTId; } 25 24 26 void SetArray s(Int_t dim) {fWavelength->Set(dim);fQE->Set(dim);}25 void SetArraySize(Int_t dim) { fWavelength.Set(dim); fQE.Set(dim); } 27 26 28 void SetPMTContent(Int_t pmt, TArrayF *wav, TArrayF *qe);27 void SetPMTContent(Int_t pmt, const TArrayF &wav, const TArrayF &qe); 29 28 30 29 ClassDef(MGeomPMT, 1) // class containing information about PMTs -
trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
r1554 r1600 154 154 // delete fGeomCam; 155 155 156 // Maybe harmfull! Don't exchange the order! 157 if (fIsAllocated && fDrawingPad->GetListOfPrimitives()->FindObject(this)==this) 158 { 159 fDrawingPad->RecursiveRemove(this); 160 delete fDrawingPad; 161 } 156 // Not allocated by MCamDisplay or already deleted by the user 157 if (!fIsAllocated || !gROOT->GetListOfCanvases()->FindObject(fDrawingPad)) 158 return; 159 160 // If it is not already removed make sure that nothing of this object 161 // maybe be deleted automatically by the canvas destructor 162 if (!fDrawingPad->GetListOfPrimitives()->FindObject(this)) 163 return; 164 165 fDrawingPad->RecursiveRemove(this); 166 delete fDrawingPad; 162 167 } 163 168 -
trunk/MagicSoft/Mars/mhist/MHFadcCam.cc
r1303 r1600 112 112 return kTRUE; 113 113 } 114 115 void MHFadcCam::ResetHistograms() 116 { 117 for (Int_t i=0; i<577; i++) 118 { 119 GetHistHi(i)->Reset(); 120 GetHistLo(i)->Reset(); 121 } 122 } -
trunk/MagicSoft/Mars/mhist/MHFadcCam.h
r1208 r1600 36 36 Bool_t Fill(const MParContainer *par); 37 37 38 void ResetHistograms(); 39 38 40 // 39 41 // FIXME! This should be replaced by a Draw(Option_t)-function -
trunk/MagicSoft/Mars/mhist/MHMatrix.cc
r1593 r1600 614 614 return fData ? fData->GetDataMember() : TString(""); 615 615 } 616 617 // -------------------------------------------------------------------------- 618 // 619 // Return a comma seperated list of all data members used in the matrix. 620 // This is mainly used in MTask::AddToBranchList 621 // 622 void MHMatrix::ReduceNumberOfRows(UInt_t numrows, const TString opt) 623 { 624 UInt_t rows = fM.GetNrows(); 625 626 if (rows==numrows) 627 { 628 *fLog << warn << "Matrix has already the correct number of rows..." << endl; 629 return; 630 } 631 632 Float_t ratio = (Float_t)numrows/fM.GetNrows(); 633 634 if (ratio>=1) 635 { 636 *fLog << warn << "Matrix cannot be enlarged..." << endl; 637 return; 638 } 639 640 Double_t sum = 0; 641 642 UInt_t oldrow = 0; 643 UInt_t newrow = 0; 644 645 while (oldrow<rows) 646 { 647 sum += ratio; 648 649 if (newrow<=(unsigned int)sum) 650 { 651 TVector vold(fM.GetNcols()); 652 vold = TMatrixRow(fM, oldrow); 653 654 TMatrixRow rownew(fM, newrow); 655 rownew = vold; 656 newrow++; 657 } 658 659 oldrow++; 660 } 661 662 /* 663 664 TMatrix m(n, fM.GetNcols()); 665 for (int i=0; i<n; i++) 666 { 667 TVector vold(n); 668 vold = TMatrixRow(fM, idx[i]); 669 670 TMatrixRow rownew(m, i); 671 rownew = vold; 672 } 673 */ 674 675 } -
trunk/MagicSoft/Mars/mhist/MHMatrix.h
r1574 r1600 29 29 TMatrix fM; // Matrix to be filled 30 30 31 TMatrix fM2; //! 31 TMatrix fM2; //! Covariance Matrix 32 32 33 33 MDataArray *fData; // List of data members (columns) … … 89 89 TString GetDataMember() const; 90 90 91 void ReduceNumberOfRows(UInt_t numrows, const TString opt); 92 91 93 ClassDef(MHMatrix, 1) // Multidimensional Matrix to store events 92 94 }; -
trunk/MagicSoft/include-Classes/MMcFormat/MMcConfigRunHeader.cc
r1597 r1600 35 35 // 36 36 //////////////////////////////////////////////////////////////////////////// 37 38 #ifndef MARS_MMcConfigRunHeader39 37 #include "MMcConfigRunHeader.h" 40 #endif41 38 42 39 #include <fstream.h> 43 40 #include <iomanip.h> 44 41 42 #include <TArrayF.h> 43 45 44 #include "MLog.h" 46 45 #include "MLogManip.h" 46 47 47 ClassImp(MMcConfigRunHeader); 48 48 … … 53 53 // 54 54 MMcConfigRunHeader::MMcConfigRunHeader(const char *name, const char *title) 55 : fNumMirrors(0), fNumPMTs(0), fIncidentTheta(181), fLightGuidesFactor(181) 55 56 { 56 57 fName = name ? name : "MMcConfigRunHeader"; 57 58 fTitle = title ? title : "Mc Configuration Information"; 58 59 59 fNumMirrors=0; 60 fNumPMTs=0; 61 62 fRadiusMirror=-10.0; 63 fFocalDist=-10.0; 64 fFocalStdev=-10.0; 65 fPointSpread=-10.0; 66 fPointStdev=-10.0; 67 fDevAdjust=-10.0; 68 fBlackSpot=-10.0; 69 fCameraWidth=-10.0; 70 71 fIncidentTheta->Set(181); 72 fLightGuidesFactor->Set(181); 60 fRadiusMirror=-1; 61 fFocalDist =-1; 62 fFocalStdev =-1; 63 fPointSpread =-1; 64 fPointStdev =-1; 65 fDevAdjust =-1; 66 fBlackSpot =-1; 67 fCameraWidth =-1; 73 68 74 69 fMirrors = new TClonesArray("MGeomMirror", 0); … … 77 72 } 78 73 79 // ------------------------------------------------------------------------- 74 // -------------------------------------------------------------------------- 80 75 // 81 // SetMagicDef76 // DESCRIPTION MISSING 82 77 // 83 78 void MMcConfigRunHeader::SetMagicDef(const Float_t radius, … … 101 96 } 102 97 103 void MMcConfigRunHeader::SetLightGuides(TArrayF *theta, TArrayF *factor){ 104 105 if(fIncidentTheta->GetSize()==theta->GetSize() && 106 fLightGuidesFactor->GetSize()==factor->GetSize()){ 107 theta->Copy(*fIncidentTheta); 108 factor->Copy(*fLightGuidesFactor); 109 } 110 else 111 *fLog<<err << "MMcConfigRunHeader::SetLightGuides: fIncidentTheta " 112 <<"and fLightGuidesFactor do not have " 113 <<"size of setting arrays"<<endl; 98 // -------------------------------------------------------------------------- 99 // 100 // DESCRIPTION MISSING 101 // 102 void MMcConfigRunHeader::SetLightGuides(const TArrayF &theta, const TArrayF &factor) 103 { 104 if (fIncidentTheta.GetSize() !=theta.GetSize() || 105 fLightGuidesFactor.GetSize()!=factor.GetSize()) 106 { 107 *fLog<< err << dbginf << "fIncidentTheta or fLightGuidesFactor "; 108 *fLog << "do not have size of setting arrays" << endl; 109 return; 110 } 114 111 112 fIncidentTheta = theta; 113 fLightGuidesFactor = factor; 115 114 } 116 117 118 -
trunk/MagicSoft/include-Classes/MMcFormat/MMcConfigRunHeader.h
r1596 r1600 5 5 #include <TClonesArray.h> 6 6 #endif 7 #ifndef ROOT_TArrayF 8 #include <TArrayF.h> 9 #endif 7 10 8 #ifndef MARS_MGeomMirror 11 9 #include "MGeomMirror.h" 12 10 #endif 13 14 11 #ifndef MARS_MGeomPMT 15 12 #include "MGeomPMT.h" … … 23 20 private: 24 21 // Mirror Information 25 UShort_t 22 UShort_t fNumMirrors; 26 23 Float_t fRadiusMirror;// [cm] Radius of a single mirror 27 24 TClonesArray *fMirrors; // FIXME: Change TClonesArray away from a pointer? … … 42 39 43 40 // Light Guides Information 44 TArrayF *fIncidentTheta; // [deg]45 TArrayF *fLightGuidesFactor;// []41 TArrayF fIncidentTheta; // [deg] 42 TArrayF fLightGuidesFactor;// [] 46 43 47 44 public: … … 51 48 void SetMagicDef(Float_t radius, Float_t focal, Float_t stdfocal, Float_t point, 52 49 Float_t stdpoint, Float_t adjust, Float_t spot, Float_t camwidth); 53 void SetLightGuides( TArrayF *theta, TArrayF *factor);50 void SetLightGuides(const TArrayF &theta, const TArrayF &factor); 54 51 55 52 UInt_t GetNumMirror() const { return fNumMirrors; } -
trunk/MagicSoft/include-Classes/MMcFormat/McLinkDef.h
r1243 r1600 10 10 #pragma link C++ class MMcTrigHeader+; 11 11 #pragma link C++ class MMcFadcHeader+; 12 #pragma link C++ class MMcConfigRunHeader+; 12 13 13 14 #endif
Note:
See TracChangeset
for help on using the changeset viewer.