Changeset 2117 for trunk/MagicSoft/Mars/mfileio
- Timestamp:
- 05/16/03 13:11:23 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mfileio
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc
r2091 r2117 549 549 // Check for the existence of a next file to read 550 550 // 551 TNamed *file = (TNamed*)fFileNames->First(); 552 if (!file) 553 return kFALSE; 551 if (fNumFile >= (UInt_t)fFileNames->GetSize()) 552 return kFALSE; 553 554 TNamed *file = (TNamed*)fFileNames->At(fNumFile); 555 556 //TNamed *file = (TNamed*)fFileNames->GetFirst(); 557 //if (!file) 558 // return kFALSE; 554 559 555 560 // … … 565 570 // Remove this file from the list of pending files 566 571 // 567 fFileNames->Remove(file);572 //fFileNames->Remove(file); 568 573 569 574 *fLog << inf << "Open file: '" << name << "'" << endl; 570 575 571 576 if (!CheckHeader(fname)) 572 { 573 *fLog << "OpenNextFile : CheckHeader(fname) is FALSE" << endl; 574 return kFALSE; 575 } 577 return kFALSE; 578 579 fNumFile++; 576 580 577 581 fIn = new ifstream(fname); 578 582 579 583 *fLog << inf << "-----------------------------------------------------------------------" << endl; 580 581 584 582 585 switch (ReadRunHeader()) … … 690 693 } 691 694 692 // -------------------------------------------------------------------------- 693 // 694 // Open the first file in the list. Check for the output containers or create 695 // them if they don't exist. 696 // 697 // Initialize the size of the MPedestalCam container to 127 pixels (CT1 camera) 698 // 699 Bool_t MCT1ReadPreProc::PreProcess(MParList *pList) 700 { 701 702 fParList = pList; 703 704 // 705 // look for the HourAngle container in the plist 706 // 707 fHourAngle = (MParameterD*)pList->FindCreateObj("MParameterD", "HourAngle"); 708 if (!fHourAngle) 709 return kFALSE; 710 fHourAngle->SetTitle("Store the CT1 hour angle [deg]"); 711 712 // 713 // look for the ThetaOrig container in the plist 714 // 715 fThetaOrig = (MParameterD*)pList->FindCreateObj("MParameterD", "ThetaOrig"); 716 if (!fThetaOrig) 717 return kFALSE; 718 fThetaOrig->SetTitle("Store the original CT1 zenith angle [rad]"); 719 720 // 721 // look for the MCerPhotEvt class in the plist 722 // 723 fNphot = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt"); 724 if (!fNphot) 725 return kFALSE; 726 727 // 728 // look for the pedestal class in the plist 729 // 730 fPedest = (MPedestalCam*)pList->FindCreateObj("MPedestalCam"); 731 if (!fPedest) 732 return kFALSE; 733 734 // 735 // look for the time class in the plist 736 // 737 fTime = (MTime*)pList->FindCreateObj("MTime"); 738 if (!fTime) 739 return kFALSE; 740 741 // 742 // look for the pedestal class in the plist 743 // 744 fBlinds = (MBlindPixels*)pList->FindCreateObj("MBlindPixels"); 745 if (!fBlinds) 746 return kFALSE; 747 748 // 749 // look for the source position in the camera 750 // 751 fSrcPos = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam"); 752 if (!fSrcPos) 753 return kFALSE; 754 755 // 756 // look for the camera geometry 757 // 758 fGeom = (MGeomCam*)pList->FindCreateObj("MGeomCamCT1", "MGeomCam"); 759 if (!fGeom) 760 return kFALSE; 761 762 // 763 // look for the mc event class 764 // 765 fMcEvt = (MMcEvt*)pList->FindCreateObj("MMcEvt"); 766 if (!fMcEvt) 767 return kFALSE; 768 769 // 770 // look for the mc trigger class 771 // 772 fMcTrig = (MMcTrig*)pList->FindCreateObj("MMcTrig"); 773 if (!fMcTrig) 774 return kFALSE; 775 776 // 777 // look for the raw run header class 778 // 779 fRawRunHeader = (MRawRunHeader*)pList->FindCreateObj("MRawRunHeader"); 780 if (!fRawRunHeader) 781 return kFALSE; 782 783 fBinningT = (MBinning*)pList->FindObject("BinningTheta"); 784 695 Bool_t MCT1ReadPreProc::Rewind() 696 { 785 697 fNumFilterEvts = 0; 786 698 fNumEvents = 0; 787 699 fNumRuns = 0; 700 fNumFile = 0; 701 if (fIn) 702 delete fIn; 703 704 fIn=NULL; 705 706 return kTRUE; 707 } 708 709 // -------------------------------------------------------------------------- 710 // 711 // Open the first file in the list. Check for the output containers or create 712 // them if they don't exist. 713 // 714 // Initialize the size of the MPedestalCam container to 127 pixels (CT1 camera) 715 // 716 Bool_t MCT1ReadPreProc::PreProcess(MParList *pList) 717 { 718 fParList = pList; 719 720 // 721 // look for the HourAngle container in the plist 722 // 723 fHourAngle = (MParameterD*)pList->FindCreateObj("MParameterD", "HourAngle"); 724 if (!fHourAngle) 725 return kFALSE; 726 fHourAngle->SetTitle("Store the CT1 hour angle [deg]"); 727 728 // 729 // look for the ThetaOrig container in the plist 730 // 731 fThetaOrig = (MParameterD*)pList->FindCreateObj("MParameterD", "ThetaOrig"); 732 if (!fThetaOrig) 733 return kFALSE; 734 fThetaOrig->SetTitle("Store the original CT1 zenith angle [rad]"); 735 736 // 737 // look for the MCerPhotEvt class in the plist 738 // 739 fNphot = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt"); 740 if (!fNphot) 741 return kFALSE; 742 743 // 744 // look for the pedestal class in the plist 745 // 746 fPedest = (MPedestalCam*)pList->FindCreateObj("MPedestalCam"); 747 if (!fPedest) 748 return kFALSE; 749 750 // 751 // look for the time class in the plist 752 // 753 fTime = (MTime*)pList->FindCreateObj("MTime"); 754 if (!fTime) 755 return kFALSE; 756 757 // 758 // look for the pedestal class in the plist 759 // 760 fBlinds = (MBlindPixels*)pList->FindCreateObj("MBlindPixels"); 761 if (!fBlinds) 762 return kFALSE; 763 764 // 765 // look for the source position in the camera 766 // 767 fSrcPos = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam"); 768 if (!fSrcPos) 769 return kFALSE; 770 771 // 772 // look for the camera geometry 773 // 774 fGeom = (MGeomCam*)pList->FindCreateObj("MGeomCamCT1", "MGeomCam"); 775 if (!fGeom) 776 return kFALSE; 777 778 // 779 // look for the mc event class 780 // 781 fMcEvt = (MMcEvt*)pList->FindCreateObj("MMcEvt"); 782 if (!fMcEvt) 783 return kFALSE; 784 785 // 786 // look for the mc trigger class 787 // 788 fMcTrig = (MMcTrig*)pList->FindCreateObj("MMcTrig"); 789 if (!fMcTrig) 790 return kFALSE; 791 792 // 793 // look for the raw run header class 794 // 795 fRawRunHeader = (MRawRunHeader*)pList->FindCreateObj("MRawRunHeader"); 796 if (!fRawRunHeader) 797 return kFALSE; 798 799 fBinningT = (MBinning*)pList->FindObject("BinningTheta"); 800 801 Rewind(); 788 802 789 803 fPedest->InitSize(iMAXNUMPIX); … … 1115 1129 } 1116 1130 1131 delete fIn; 1132 fIn = NULL; 1133 1117 1134 return GetSelector() ? GetSelector()->CallPostProcess() : kTRUE; 1118 1135 } -
trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.h
r1952 r2117 50 50 Bool_t fIsMcFile; // Flag whether current run is a MC run 51 51 52 UInt_t fNumFile; 52 53 UInt_t fNumEvents; // number of events counted in all runs in all files 53 54 UInt_t fNumEventsInRun; // number of events in the counted in th ecurrent run … … 76 77 Bool_t PostProcess(); 77 78 79 Bool_t Rewind(); 80 78 81 public: 79 82 MCT1ReadPreProc(const char *filename=NULL, -
trunk/MagicSoft/Mars/mfileio/MRead.cc
r1902 r2117 41 41 42 42 ClassImp(MRead); 43 44 Bool_t MRead::Rewind() 45 { 46 *fLog << err << "ERROR - Rewind() not implemented for " << GetDescriptor() << endl; 47 return kFALSE; 48 } 43 49 44 50 // -------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mfileio/MRead.h
r1880 r2117 17 17 18 18 virtual UInt_t GetEntries() = 0; 19 virtual Bool_t Rewind(); 19 20 20 21 void SetSelector(MFilter *f) { fSelector = f; } -
trunk/MagicSoft/Mars/mfileio/MReadMarsFile.h
r1668 r2117 26 26 Int_t AddFile(const char *fname, Int_t entries=-1); 27 27 28 Bool_t Rewind() { if (fRun) fRun->Rewind(); MReadTree::Rewind(); return kTRUE; } 29 28 30 ClassDef(MReadMarsFile, 1) // Reads a tree from file(s) and the information from the 'RunHeader'-tree 29 31 }; -
trunk/MagicSoft/Mars/mfileio/MReadTree.cc
r2106 r2117 131 131 // 132 132 // Delete all the pointers to pointers to the objects where the 133 // branche data gets stored. 133 // branche data gets stored. FIXME: When PreProcessed twice this 134 // creates a memory leak! 134 135 // 135 136 TIter Next(fChain->GetStatus()); … … 239 240 if (numfiles>0) 240 241 SetBit(kChainWasChanged); 241 242 *fLog << warn << "WARNING: '" << fname << "' not added to " << GetDescriptor() << endl;242 else 243 *fLog << warn << "WARNING: '" << fname << "' not added to " << GetDescriptor() << endl; 243 244 244 245 return numfiles; -
trunk/MagicSoft/Mars/mfileio/MReadTree.h
r1836 r2117 57 57 UInt_t GetEntries(); 58 58 59 TString 60 Int_t 59 TString GetFileName() const; 60 Int_t GetFileIndex() const; 61 61 62 virtual void AddNotify(TObject *obj); 63 virtual void SetOwner(Bool_t flag=kTRUE); 64 virtual void Print(Option_t *opt="") const; 62 virtual void AddNotify(TObject *obj); 63 virtual void SetOwner(Bool_t flag=kTRUE); 65 64 66 virtual Int_t 67 virtual Int_t 65 virtual Int_t AddFile(const char *fname, Int_t entries=-1); 66 virtual Int_t AddFiles(const MReadTree &read); 68 67 69 virtualBool_t PreProcess(MParList *pList);70 virtualBool_t Process();71 virtualBool_t PostProcess();68 Bool_t PreProcess(MParList *pList); 69 Bool_t Process(); 70 Bool_t PostProcess(); 72 71 73 virtual Bool_t Notify(); 72 Bool_t Notify(); 73 Bool_t Rewind() { SetEventNum(0); return kTRUE; } 74 void Print(Option_t *opt="") const; 74 75 75 76 ClassDef(MReadTree, 1) // Reads a tree from file(s)
Note:
See TracChangeset
for help on using the changeset viewer.