Changeset 1337 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 06/03/02 10:10:21 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MAGIC.h
r1278 r1337 22 22 // ParticleId for Monte Carlo simulation 23 23 // 24 const Int_t kGAMMA = 0;24 const Int_t kGAMMA = 1; 25 25 const Int_t kPROTON = 14; 26 26 const Int_t kHELIUM = 402; -
trunk/MagicSoft/Mars/mbase/MParList.cc
r1320 r1337 215 215 // -------------------------------------------------------------------------- 216 216 // 217 // Find an object with the same name in the list and replace it with 218 // the new one. If the kIsOwner flag is set and the object was not 219 // created automatically, the object is deleted. 220 // 221 Bool_t MParList::Replace(MParContainer *cont) 222 { 223 // 224 // check if the object (you want to add) exists 225 // 226 if (!cont) 227 return kFALSE; 228 229 TObject *obj = FindObject(cont->GetName()); 230 if (!obj) 231 { 232 *fLog << warn << "No object with the same name '"; 233 *fLog << cont->GetName() << "' in list... ignored." << endl; 234 return kFALSE; 235 } 236 237 fContainer->Remove(obj); 238 239 if (TestBit(kIsOwner) && !fAutodelete->FindObject(obj)) 240 delete obj; 241 242 *fLog << inf << "MParContainer '" << obj->GetName() << "' found and replaced..." << endl; 243 244 return AddToList(cont); 245 } 246 247 // -------------------------------------------------------------------------- 248 // 217 249 // Find an object in the list. 218 250 // 'name' is the name of the object you are searching for. -
trunk/MagicSoft/Mars/mbase/MParList.h
r1186 r1337 42 42 void AddToList(TObjArray *list); 43 43 44 Bool_t Replace(MParContainer *obj); 45 44 46 void SetLogStream(MLog *log); 45 47 -
trunk/MagicSoft/Mars/mbase/MReadMarsFile.cc
r1332 r1337 108 108 Bool_t MReadMarsFile::Notify() 109 109 { 110 Int_t runtype = -1; 111 /* 112 const MRawRunHeader *runheader = (MRawRunHeader*)fParList->FindObject("MRawRunHeader"); 113 if (runheader) 114 runtype = runheader->GetRunType(); 115 */ 110 116 // 111 117 // Try to read the new run headers. If reading the new run header 112 118 // was successfull call the ReInits 113 119 // 120 const Int_t idx = GetFileIndex(); 121 fRun->SetEventNum(idx<0?0:idx); // Assumption: One Entry per File! 114 122 if (fRun->Process()) 115 123 { 116 *fLog << inf << "MReadMarsFile: Switching to '" << GetFileName() << "' "; 117 *fLog << "(before event #" << GetEventNum()-1 << ")" << endl; 118 124 *fLog << inf << "MReadMarsFile: Switching to #" << GetFileIndex(); 125 *fLog << " '" << GetFileName() << "' (before event #"; 126 *fLog << GetEventNum()-1 << ")" << endl; 127 /* 128 if (runheader) 129 if (runtype != runheader->GetRunType()) 130 *fLog << warn << "Warning - You are mixing files with different run types!" << endl; 131 */ 119 132 if (fTaskList->ReInit()) 120 133 return kTRUE; … … 137 150 Bool_t MReadMarsFile::PreProcess(MParList *pList) 138 151 { 152 fParList = pList; 139 153 fTaskList = (MTaskList*)pList->FindObject("MTaskList"); 140 154 141 155 if (!fRun->PreProcess(pList)) 156 { 157 *fLog << err << "Error - PreProcessing MReadMarsFile::fRun... aborting." << endl; 142 158 return kFALSE; 159 } 143 160 161 const Int_t idx = GetFileIndex(); 162 fRun->SetEventNum(idx<0?0:idx); // Assumption: One Entry per File! 144 163 if (!fRun->Process()) 164 { 165 *fLog << err << "Error - Processing MReadMarsFile::fRun... aborting." << endl; 145 166 return kFALSE; 146 147 fRun->SetEventNum(0); 167 } 148 168 149 169 return MReadTree::PreProcess(pList); -
trunk/MagicSoft/Mars/mbase/MReadMarsFile.h
r1114 r1337 6 6 #endif 7 7 8 class MParList; 8 9 class MTaskList; 9 10 … … 12 13 private: 13 14 MReadTree *fRun; 15 MParList *fParList; //! Parlist for reinitialization 14 16 MTaskList *fTaskList; //! Tasklist for reinitialization 15 17 -
trunk/MagicSoft/Mars/mbase/MReadTree.cc
r1333 r1337 55 55 #include <TFile.h> // TFile::GetName 56 56 #include <TChain.h> 57 #include <TSystem.h> // gSystem->ExpandPath 57 58 #include <TGProgressBar.h> 58 59 #include <TChainElement.h> … … 746 747 // -------------------------------------------------------------------------- 747 748 // 749 // Return the number of the file in the chain, -1 in case of an error 750 // 751 Int_t MReadTree::GetFileIndex() const 752 { 753 return fChain->GetTreeNumber(); 754 /* 755 const TString filename = fChain->GetFile()->GetName(); 756 757 int i=0; 758 TObject *file = NULL; 759 760 TIter Next(fChain->GetListOfFiles()); 761 while ((file=Next())) 762 { 763 if (filename==gSystem->ExpandPathName(file->GetTitle())) 764 return i; 765 i++; 766 } 767 return -1; 768 */ 769 } 770 771 // -------------------------------------------------------------------------- 772 // 748 773 // This schedules a TObject which Notify(9 function is called in case 749 774 // of MReadTree (TChain) switches from one file in the chain to another … … 759 784 *fLog << all << GetDescriptor() << dec << endl; 760 785 *fLog << setfill('-') << setw(strlen(GetDescriptor())) << "" << endl; 761 *fLog << " Files :" << endl;786 *fLog << " Files [Tree]:" << endl; 762 787 763 788 int i = 0; … … 765 790 TObject *obj = NULL; 766 791 while ((obj=Next())) 767 *fLog << " " << i++ << ") " << obj->Get Name()<< endl;768 769 *fLog << " Entries: " << fNumEntries << endl;770 *fLog << " Next Entry : " << fNumEntry << endl;771 } 792 *fLog << " " << i++ << ") " << obj->GetTitle() << " [" << obj->GetName() << "]" << endl; 793 794 *fLog << " Total Number of Entries: " << fNumEntries << endl; 795 *fLog << " Next Entry to read: " << fNumEntry << endl; 796 } -
trunk/MagicSoft/Mars/mbase/MReadTree.h
r1203 r1337 59 59 60 60 TString GetFileName() const; 61 Int_t GetFileIndex() const; 61 62 62 63 virtual void AddNotify(TObject *obj); -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r1332 r1337 303 303 fParList = pList; 304 304 305 fTasksProcess. Delete();305 fTasksProcess.Clear(); 306 306 307 307 // … … 317 317 while ((task=(MTask*)Next())) 318 318 { 319 *fLog << all << task->GetName() << "... " << flush; 320 319 321 if (CheckClassForProcess(task->IsA())) 320 322 fTasksProcess.Add(task); … … 457 459 while ( (task=(MTask*)Next()) ) 458 460 { 461 *fLog << all << task->GetName() << "... " << flush; 462 459 463 if (!task->CallPostProcess()) 460 464 return kFALSE; 461 462 *fLog << all << task->GetName() << "... " << flush;463 465 } 464 466 -
trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.cc
r1331 r1337 263 263 } 264 264 265 /* 266 Bool_t MWriteAsciiFile::PreProcess(MParList *plist) 267 { 268 MDataChain *chain=NULL; 269 270 TIter Next(&fList); 271 while (((MDataChain*)chain=Next())) 272 if (!chain->PreProcess(plist)) 273 return kFALSE; 274 275 return MWriteFile::PreProcess(plist); 276 } 277 278 void MWriteAsciiFile::Add(const char *rule) 279 { 280 MDataChain *chain = new MDataChain(rule); 281 fList.Add(chain); 282 } 283 */ -
trunk/MagicSoft/Mars/mbase/MWriteAsciiFile.h
r1236 r1337 29 29 30 30 TString fNameFile; 31 31 /* 32 TList fList; 33 */ 32 34 virtual void CheckAndWrite() const; 33 35 virtual Bool_t IsFileOpen() const; … … 47 49 void AddContainer(MParContainer *cont, const char *member="", Double_t scale=1); 48 50 51 /* 52 Bool_t PreProcess(MParList *plist); 53 void Add(const char *rule); 54 */ 55 49 56 ClassDef(MWriteAsciiFile, 0) // Class to write one container to an ascii file 50 57 };
Note:
See TracChangeset
for help on using the changeset viewer.