Changeset 1483
- Timestamp:
- 08/05/02 16:12:14 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1482 r1483 39 39 * mhist/MH3.[h,cc]: 40 40 - added the missing const-qualifier of StreamPrimitive 41 42 * mbase/MParContainer.[h,cc]: 43 - implemented setting a unique id in SavePrimitive 44 - imnplemented GetUniqueID 45 46 * manalysis/MHillasSrcCalc.cc, manalysis/MImgCleanStd.cc, 47 manalysis/MSrcPosCam.cc, mbase/MEvtLoop.cc, mbase/MParList.cc, 48 mbase/MTaskList.cc, mfileio/MReadTree.cc, mfileio/MWriteRootFile.cc, 49 mhist/MF.cc, mfilter/MFAlpha.cc, mfilter/MFDataMember.cc, 50 mfilter/MFParticleId.cc, mfilter/MFTriggerLvl1.cc, mhist/MBinning.cc, 51 mhist/MFillH.cc, mhist/MH3.cc: 52 - changed the 'instance' name to the UniqueName 53 - in some files: implemented a static constant name and title, which 54 is used to descide whether the name and/or title should be stream 55 in the constructor-call in StreamPrimitive 41 56 42 57 -
trunk/MagicSoft/Mars/manalysis/MHillasSrcCalc.cc
r1477 r1483 115 115 fHillasSrc->SavePrimitive(out); 116 116 117 out << " MHillasSrcCalc " << ToLower(fName) << "(";117 out << " MHillasSrcCalc " << GetUniqueName() << "("; 118 118 119 119 if (fSrcPos) 120 out << "&" << ToLower(fSrcPos->GetName());120 out << "&" << fSrcPos->GetUniqueName(); 121 121 else 122 122 out << "\"" << fSrcName << "\""; 123 123 124 124 if (fHillasSrc) 125 out << "&" << ToLower(fHillasSrc->GetName());125 out << "&" << fHillasSrc->GetUniqueName(); 126 126 else 127 127 out << "\"" << fHillasName << "\""; -
trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc
r1477 r1483 416 416 void MImgCleanStd::StreamPrimitive(ofstream &out) const 417 417 { 418 out << " MImgCleanStd " << ToLower(fName) << "(";418 out << " MImgCleanStd " << GetUniqueName() << "("; 419 419 out << fCleanLvl1 << ", " << fCleanLvl2 << ", \""; 420 420 out << fName << "\", \"" << fTitle << "\");" << endl; -
trunk/MagicSoft/Mars/manalysis/MSrcPosCam.cc
r1477 r1483 90 90 void MSrcPosCam::StreamPrimitive(ofstream &out) const 91 91 { 92 out << " MSrcPosCam " << ToLower(fName) << "(\"";92 out << " MSrcPosCam " << GetUniqueName() << "(\""; 93 93 out << fName << "\", \"" << fTitle << "\");" << endl; 94 94 95 out << " " << ToLower(fName) << ".SetXY(" << fX << ", " << fY << ");" << endl;}95 out << " " << GetUniqueName() << ".SetXY(" << fX << ", " << fY << ");" << endl;} -
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r1481 r1483 371 371 out << " MEvtLoop evtloop;" << endl; 372 372 if (fParList) 373 out << " evtloop.SetParList(&" << ToLower(fParList->GetName()) << ");" << endl;373 out << " evtloop.SetParList(&" << fParList->GetUniqueName() << ");" << endl; 374 374 else 375 375 out << " // fParList empty..." << endl; -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r1477 r1483 37 37 #include "MParContainer.h" 38 38 39 #include <ctype.h> // isdigit 39 40 #include <fstream.h> // ofstream, AsciiWrite 40 41 … … 139 140 // -------------------------------------------------------------------------- 140 141 // 142 // Return a unique name for this container. It is created from 143 // the container name and the unique Id. (This is mostly used 144 // in the StreamPrimitive member functions) 145 // 146 const TString MParContainer::GetUniqueName() const 147 { 148 TString ret = ToLower(fName); 149 150 if (isdigit(ret[ret.Length()-1])) 151 ret+="_"; 152 153 ret+=GetUniqueID(); 154 155 return ret; 156 } 157 158 // -------------------------------------------------------------------------- 159 // 141 160 // List MParContainer name and title. 142 161 // … … 359 378 void MParContainer::SavePrimitive(ofstream &out, Option_t *o) 360 379 { 380 static UInt_t uid = 0; 381 361 382 if (IsSavedAsPrimitive()) 362 383 return; 363 384 385 SetUniqueID(uid++/*gRandom->Uniform(kMaxInt)*/); 364 386 StreamPrimitive(out); 365 387 SetBit(kIsSavedAsPrimitive); … … 373 395 { 374 396 out << " // Using MParContainer::StreamPrimitive" << endl; 375 out << " " << ClassName() << " " << ToLower(fName) << "(\"";397 out << " " << ClassName() << " " << GetUniqueName() << "(\""; 376 398 out << fName << "\", \"" << fTitle << "\");" << endl; 377 399 } -
trunk/MagicSoft/Mars/mbase/MParContainer.h
r1477 r1483 55 55 virtual void FillBuffer(char *&buffer); 56 56 57 virtual const char *GetDescriptor() const { return Form("%s [%s]", fName.Data(), ClassName()); } 58 virtual const char *GetName() const { return fName.Data(); } 59 virtual const char *GetTitle() const { return fTitle.Data(); } 60 virtual ULong_t Hash() const { return fName.Hash(); } 61 virtual Bool_t IsSortable() const { return kTRUE; } 57 virtual const char *GetDescriptor() const { return Form("%s [%s]", fName.Data(), ClassName()); } 58 virtual const TString GetUniqueName() const; 59 virtual const char *GetName() const { return fName.Data(); } 60 virtual const char *GetTitle() const { return fTitle.Data(); } 61 virtual ULong_t Hash() const { return fName.Hash(); } 62 virtual Bool_t IsSortable() const { return kTRUE; } 62 63 63 64 virtual void SetName(const char *name); // *MENU* -
trunk/MagicSoft/Mars/mbase/MParList.cc
r1477 r1483 52 52 ClassImp(MParList); 53 53 54 static const TString gsDefName = "MParList"; 55 static const TString gsDefTitle = "A list of Parameter Containers"; 56 54 57 // -------------------------------------------------------------------------- 55 58 // … … 59 62 MParList::MParList(const char *name, const char *title) 60 63 { 61 fName = name ? name : "MParList";62 fTitle = title ? title : "A list of Parameter Containers";64 fName = name ? name : gsDefName.Data(); 65 fTitle = title ? title : gsDefTitle.Data(); 63 66 64 67 // … … 668 671 void MParList::StreamPrimitive(ofstream &out) const 669 672 { 670 out << " MParList " << ToLower(fName) << "(\""; 671 out << fName << "\", \"" << fTitle << "\");" << endl << endl; 673 out << " MParList " << GetUniqueName(); 674 if (fName!=gsDefName) 675 { 676 out << "(\"" << fName << "\""; 677 if (fTitle!=gsDefTitle) 678 out << ", \"" << fTitle << "\""; 679 out <<")"; 680 } 681 out << ";" << endl << endl; 672 682 673 683 TIter Next(fContainer); 674 684 675 TObject*cont = NULL;676 while ((cont= Next()))685 MParContainer *cont = NULL; 686 while ((cont=(MParContainer*)Next())) 677 687 { 678 688 cont->SavePrimitive(out, ""); 679 689 680 out << " " << ToLower(fName) << ".AddToList(&"; 681 out << ToLower(cont->GetName()) << ");" << endl << endl; 682 } 683 } 684 690 out << " " << GetUniqueName() << ".AddToList(&"; 691 out << cont->GetUniqueName() << ");" << endl << endl; 692 } 693 } 694 695 // -------------------------------------------------------------------------- 696 // 697 // Adds one TNamed object per object in the list. The TNamed object must 698 // be deleted by the user. 699 // 685 700 void MParList::GetNames(TObjArray &arr) const 686 701 { … … 689 704 } 690 705 706 // -------------------------------------------------------------------------- 707 // 708 // Sets name and title of each object in the list from the objects in 709 // the array. 710 // 691 711 void MParList::SetNames(TObjArray &arr) 692 712 { -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r1477 r1483 71 71 ClassImp(MTaskList); 72 72 73 static const TString gsDefName = "MTaskList"; 74 static const TString gsDefTitle = "A list for tasks to be executed"; 73 75 // -------------------------------------------------------------------------- 74 76 // … … 79 81 MTaskList::MTaskList(const char *name, const char *title) 80 82 { 81 fName = name ? name : "MTaskList";82 fTitle = title ? title : "A list for tasks to be executed";83 fName = name ? name : gsDefName.Data(); 84 fTitle = title ? title : gsDefTitle.Data(); 83 85 84 86 fTasks = new TList; … … 522 524 void MTaskList::StreamPrimitive(ofstream &out) const 523 525 { 524 out << " MTaskList " << ToLower(fName) << "(\""; 525 out << fName << "\", \"" << fTitle << "\");" << endl << endl; 526 out << " MTaskList " << GetUniqueName(); 527 if (fName!=gsDefName) 528 { 529 out << "(\"" << fName << "\""; 530 if (fTitle!=gsDefTitle) 531 out << ", \"" << fTitle << "\""; 532 out <<")"; 533 } 534 out << ";" << endl << endl; 526 535 527 536 TIter Next(fTasks); 528 537 529 TObject*cont = NULL;530 while ((cont= Next()))538 MParContainer *cont = NULL; 539 while ((cont=(MParContainer*)Next())) 531 540 { 532 541 cont->SavePrimitive(out, ""); 533 out << " " << ToLower(fName) << ".AddToList(&";534 out << ToLower(cont->GetName()) << ");" << endl << endl;542 out << " " << GetUniqueName() << ".AddToList(&"; 543 out << cont->GetUniqueName() << ");" << endl << endl; 535 544 } 536 545 } -
trunk/MagicSoft/Mars/mfileio/MReadTree.cc
r1477 r1483 785 785 void MReadTree::StreamPrimitive(ofstream &out) const 786 786 { 787 TString name = ToLower(fName); 788 789 out << " " << ClassName() << " " << name << "(\""; 787 out << " " << ClassName() << " " << GetUniqueName() << "(\""; 790 788 out << fChain->GetName() << "\", \"" << fName << "\", \"" << fTitle << "\");" << endl; 791 789 … … 793 791 TObject *obj = NULL; 794 792 while ((obj=Next())) 795 out << " " << name<< ".AddFile(\"" << obj->GetTitle() << "\");" << endl;793 out << " " << GetUniqueName() << ".AddFile(\"" << obj->GetTitle() << "\");" << endl; 796 794 797 795 if (!fAutoEnable) 798 out << " " << name<< ".DisableAutoScheme();" << endl;796 out << " " << GetUniqueName() << ".DisableAutoScheme();" << endl; 799 797 800 798 if (fNumEntry!=0) 801 out << " " << name<< ".SetEventNum(" << fNumEntry << ");" << endl;802 803 804 } 799 out << " " << GetUniqueName() << ".SetEventNum(" << fNumEntry << ");" << endl; 800 801 802 } -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
r1477 r1483 405 405 void MWriteRootFile::StreamPrimitive(ofstream &out) const 406 406 { 407 out << " MWriteRootFile " << ToLower(fName) << "(\"";407 out << " MWriteRootFile " << GetUniqueName() << "(\""; 408 408 out << fOut->GetName() << "\", \""; 409 409 out << fOut->GetOption() << "\", \""; … … 419 419 { 420 420 entry->GetContainer()->SavePrimitive(out); 421 out << "&" << ToLower(entry->GetContainer()->GetName());421 out << "&" << entry->GetContainer()->GetUniqueName(); 422 422 } 423 423 else -
trunk/MagicSoft/Mars/mfilter/MF.cc
r1481 r1483 372 372 void MF::StreamPrimitive(ofstream &out) const 373 373 { 374 out << " MF " << ToLower(fName) << "";375 } 376 374 out << " MF " << GetUniqueName() << ""; 375 } 376 -
trunk/MagicSoft/Mars/mfilter/MFAlpha.cc
r1481 r1483 117 117 fHillas->SavePrimitive(out); 118 118 119 out << " MFParticleId " << ToLower(fName) << "(";119 out << " MFParticleId " << GetUniqueName() << "("; 120 120 121 121 if (fHillas) 122 out << "&" << ToLower(fHillas->GetName());122 out << "&" << fHillas->GetUniqueName(); 123 123 else 124 124 out << "\"" << fContName << "\""; -
trunk/MagicSoft/Mars/mfilter/MFDataMember.cc
r1481 r1483 103 103 void MFDataMember::StreamPrimitive(ofstream &out) const 104 104 { 105 out << " MFDataMember " << ToLower(fName) << "(\"";105 out << " MFDataMember " << GetUniqueName() << "(\""; 106 106 out << fData.GetRule() << "\", '"; 107 107 out << (fFilterType==kELowerThan?"<":">"); -
trunk/MagicSoft/Mars/mfilter/MFParticleId.cc
r1481 r1483 128 128 fMcEvt->SavePrimitive(out); 129 129 130 out << " MFParticleId " << ToLower(fName) << "(";130 out << " MFParticleId " << GetUniqueName() << "("; 131 131 132 132 if (fMcEvt) 133 out << "&" << ToLower(fMcEvt->GetName());133 out << "&" << fMcEvt->GetUniqueName(); 134 134 else 135 135 out << "\"" << fContName << "\""; -
trunk/MagicSoft/Mars/mfilter/MFTriggerLvl1.cc
r1481 r1483 123 123 fMcTrig->SavePrimitive(out); 124 124 125 out << " MFTriggerLvl1 " << ToLower(fName) << "(";125 out << " MFTriggerLvl1 " << GetUniqueName() << "("; 126 126 127 127 if (fMcTrig) 128 out << "&" << ToLower(fMcTrig->GetName());128 out << "&" << fMcTrig->GetUniqueName(); 129 129 else 130 130 out << "\"" << fContName << "\""; -
trunk/MagicSoft/Mars/mhist/MBinning.cc
r1477 r1483 36 36 ClassImp(MBinning); 37 37 38 static const TString gsDefName = "MBinning"; 39 static const TString gsDefTitle = "Container describing the binning of an axis"; 40 38 41 // -------------------------------------------------------------------------- 39 42 // … … 46 49 // set the name and title of this object 47 50 // 48 fName = name ? name : "MBinning";49 fTitle = title ? title : "Container describing the binning of an axis";51 fName = name ? name : gsDefName.Data(); 52 fTitle = title ? title : gsDefTitle.Data(); 50 53 51 54 SetEdges(10, 0, 1); … … 105 108 void MBinning::StreamPrimitive(ofstream &out) const 106 109 { 107 out << " MBinning " << ToLower(fName) << "(\""; 108 out << fName << "\", \"" << fTitle << "\");" << endl; 110 out << " MBinning " << GetUniqueName(); 111 if (fName!=gsDefName) 112 { 113 out << "(\"" << fName << "\""; 114 if (fTitle!=gsDefTitle) 115 out << ", \"" << fTitle << "\""; 116 out <<")"; 117 } 118 out << ";" << endl; 109 119 110 120 if (IsDefault()) … … 113 123 if (IsLinear() || IsLogarithmic()) 114 124 { 115 out << " " << ToLower(fName) << ".SetEdges";125 out << " " << GetUniqueName() << ".SetEdges"; 116 126 if (IsLogarithmic()) 117 127 out << "Log"; … … 124 134 for (int i=0; i<GetNumEdges(); i++) 125 135 out << " dummy[" << i << "]=" << GetEdges()[i] << ";" << endl; 126 out << " " << ToLower(fName) << ".SetEdges(dummy);" << endl;136 out << " " << GetUniqueName() << ".SetEdges(dummy);" << endl; 127 137 out << " }" << endl; 128 138 } -
trunk/MagicSoft/Mars/mhist/MFillH.cc
r1481 r1483 358 358 fParContainer->SavePrimitive(out); 359 359 360 out << " MFillH " << ToLower(fName) << "(";360 out << " MFillH " << GetUniqueName() << "("; 361 361 362 362 if (fH) 363 out << "&" << ToLower(fH->GetName());363 out << "&" << fH->GetUniqueName(); 364 364 else 365 365 out << "\"" << fHName << "\""; 366 366 367 367 if (fParContainer) 368 out << ", &" << ToLower(fParContainer->GetName());368 out << ", &" << fParContainer->GetUniqueName(); 369 369 else 370 370 if (!fParContainerName.IsNull()) -
trunk/MagicSoft/Mars/mhist/MH3.cc
r1481 r1483 78 78 ClassImp(MH3); 79 79 80 static const TString gsDefName = "MH3"; 81 static const TString gsDefTitle = "Container for a %dD Mars Histogram"; 82 80 83 MH3::MH3() : fDimension(0), fHist(NULL) 81 84 { 82 fName = "MH3";83 fTitle = "Container for a 1D Mars Histogram";85 fName = gsDefName; 86 fTitle = Form(gsDefTitle.Data(), 0); 84 87 85 88 fData[0] = fData[1] = fData[2] = NULL; … … 101 104 fData[2] = NULL; 102 105 103 fName = "MH3";104 fTitle = "Container for a 1D Mars Histogram";106 fName = gsDefName; 107 fTitle = Form(gsDefTitle.Data(), 1); 105 108 106 109 fHist->SetDirectory(NULL); … … 127 130 fData[2] = NULL; 128 131 129 fName = "MH3";130 fTitle = "Container for a 2D Mars Histogram";132 fName = gsDefName; 133 fTitle = Form(gsDefTitle.Data(), 2); 131 134 132 135 fHist->SetDirectory(NULL); … … 153 156 fData[2] = new MDataChain(memberz); 154 157 155 fName = "MH3";156 fTitle = "Container for a 3D Mars Histogram";158 fName = gsDefName; 159 fTitle = Form(gsDefTitle.Data(), 3); 157 160 158 161 fHist->SetDirectory(NULL); … … 386 389 void MH3::StreamPrimitive(ofstream &out) const 387 390 { 388 TString name = ToLower(fName);391 TString name = GetUniqueName(); 389 392 390 393 out << " MH3 " << name << "(\""; … … 397 400 out << ");" << endl; 398 401 399 out << " " << name << ".SetName(\"" << fName << "\");" << endl; 400 out << " " << name << ".SetTitle(\"" << fTitle << "\");" << endl; 402 if (fName!=gsDefName) 403 out << " " << name << ".SetName(\"" << fName << "\");" << endl; 404 405 if (fTitle!=Form(gsDefTitle.Data(), fDimension)) 406 out << " " << name << ".SetTitle(\"" << fTitle << "\");" << endl; 401 407 402 408 switch (fDimension)
Note:
See TracChangeset
for help on using the changeset viewer.