- Timestamp:
- 07/22/08 19:56:42 (16 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r9030 r9036 44 44 - added 45 45 46 * mfileio/MreadRflFile.[h,cc]: 47 - derived from MReadFiles (untested) 48 46 49 * datacenter/macros/checkfileavail.C: 47 50 - fixed a type (TSQLRow instead of TSQlRow) 51 - added a missing ; 52 53 * mfileio/MReadTree.[h,cc]: 54 - added some includes 55 - added the IsOwned member function to make sure we don't 56 spoil memory when out pointers are deleted in the destructor 57 - removed some really obsolete workarounds 58 - added a member function to add friends 59 - don't allocate memory in AddFile 60 - implemented the possibility to process also friends 61 - implemented the possibility to read branches from unknown 62 "vendors", i.e. branches for which the class is not available 63 in the dictionary 64 - added a list to hold all parameter containers to be able to 65 call SetReadyToSave more easily than previously 66 67 * mbase/MParEmulated.[h,cc]: 68 - added 69 70 * mbase/Makefile, mbase/BaseLinkDef.h: 71 - added MParEmulated 72 73 * mbase/MParameters.h: 74 - added functions to get the pointer to the values. Handle this 75 with care. 76 77 * mbase/MParConatiner.h: 78 - made GetterMethod virtual to allow MParEmulated to overwrite it 79 - made fgListMethodCall protected to allow MParEmulated to 80 add its new TMethodCalls 81 82 * datacenter/macros/checkfileavail.C: 83 - removed dependence on caco-files. 84 - fixed query 85 - output query in case of failure 86 87 * datacenter/scripts/checkfilesforsequenceavail: 88 - fixed to use new checkfileavail.C 89 90 * mcalib/MCalibrateData.cc: 91 - removed the fixed scale factor for MCs. It is now left open, 92 thus it can be changed from the callisto resource file 93 94 * mdata/MDataMember.cc: 95 - small improvement to error output 96 97 * mfileio/MWriteRootFile.cc: 98 - small change to log-level 99 48 100 49 101 -
trunk/MagicSoft/Mars/NEWS
r9024 r9036 21 21 * sequences (MSequence or MSequenceSQL) can now directly be retrieved 22 22 from the database. See the constructors for more details. 23 24 * MReadTree now supports friends 25 26 * MReadTree can now read also files not written by MARS and store 27 the data encapsulated in emulated MParContainers 23 28 24 29 ;merpp -
trunk/MagicSoft/Mars/datacenter/macros/checkfileavail.C
r9033 r9036 75 75 // ------------------------------------------- 76 76 77 TString query = " MIN( NOT ("77 TString query = "SELECT MIN( NOT (" 78 78 "ISNULL(fRawFileAvail) OR " 79 79 "ISNULL(fCCFileAvail) OR " 80 "ISNULL(fCaCoFileAvail) OR "81 "ISNULL(fCaCoFileFound) OR "80 // "ISNULL(fCaCoFileAvail) OR " 81 // "ISNULL(fCaCoFileFound) OR " 82 82 "ISNULL(fTimingCorrection) OR " 83 83 "ISNULL(fCompmux) " … … 94 94 { 95 95 cout << "ERROR - Unexpected number of returned rows (" << res->GetRowCount() << ")" << endl; 96 cout << query << endl; 96 97 delete res; 97 98 return 3; … … 103 104 { 104 105 cout << "ERROR - Unexpected result." << endl; 106 cout << query << endl; 105 107 delete res; 106 108 return 3; -
trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail
r9017 r9036 72 72 checkfileavailpath=$logpath/$program/$no 73 73 makedir $checkfileavailpath >> $scriptlog 2>&1 74 checkfileavaillog=$checkfileavailpath/$program-$ sequence.log74 checkfileavaillog=$checkfileavailpath/$program-$no2.log 75 75 76 sequencefile=$sequpath/$no/sequence$no2.txt 77 78 primvar=$no2 76 primvar=$sequence 79 77 setstatus "start" >> $scriptlog 2>&1 80 78 81 check1=`root -q -b $macrospath/checkfileavail.C+\( \""$sequencefile\",1"\) | tee $checkfileavaillog | intgrep`79 check1=`root -q -b $macrospath/checkfileavail.C+\($sequence,1\) | tee $checkfileavaillog | intgrep` 82 80 83 81 case $check1 in -
trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc
r8957 r9036 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MCalibrateData.cc,v 1.7 1 2008-06-14 15:55:51tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MCalibrateData.cc,v 1.72 2008-07-22 18:55:08 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 156 156 : fGeomCam(NULL), fBadPixels(NULL), fCalibrations(NULL), 157 157 fQEs(NULL), fSignals(NULL), fCerPhotEvt(NULL), fCalibConstCam(NULL), 158 fPedestalFlag(kNo), fSignalType(kPhot), fRenormFactor(1.), fScaleFactor(1 .)158 fPedestalFlag(kNo), fSignalType(kPhot), fRenormFactor(1.), fScaleFactor(1) 159 159 { 160 160 … … 424 424 if (header->IsMonteCarloRun()) 425 425 { 426 *fLog << inf << "Additional scale factor forced to: 1 (MonteCarloRun)" << endl;427 fScaleFactor = 1;426 if (fScaleFactor!=1) 427 *fLog << warn << "WARNING - Additional scale factor for MonteCarlo run not unity but " << fScaleFactor << endl; 428 428 } 429 429 else -
trunk/MagicSoft/Mars/mdata/MDataMember.cc
r8892 r9036 136 136 137 137 default: 138 *fLog << err << "DataMember " << fDataMember << " of "; 139 *fLog << fObject->GetName() << " neither int nor float... returning 0." << endl; 138 *fLog << err << "ERROR - MDataMember::GetValue: " << fObject->GetName(); 139 *fLog << "." << fDataMember << " has unkown type (="; 140 *fLog << fCall->ReturnType() << ")... returning 0." << endl; 140 141 return 0; 141 142 } -
trunk/MagicSoft/Mars/mfileio/MReadTree.cc
r9034 r9036 60 60 #include <TFile.h> // TFile::GetName 61 61 #include <TSystem.h> // gSystem->ExpandPath 62 #include <TLeaf Element.h>62 #include <TLeaf.h> 63 63 #include <TChainElement.h> 64 64 #include <TFriendElement.h> … … 70 70 #include "MTaskList.h" 71 71 #include "MParameters.h" 72 #include "MParEmulated.h" 72 73 #include "MStatusDisplay.h" 73 74 … … 226 227 } 227 228 229 void MReadTree::GetListOfBranches(TList &list) const 230 { 231 list.AddAll(fTree->GetListOfBranches()); 232 233 TIter NextF(fTree->GetListOfFriends()); 234 TFriendElement *e = 0; 235 while ((e=(TFriendElement*)NextF())) 236 list.AddAll(e->GetTree()->GetListOfBranches()); 237 } 238 228 239 // -------------------------------------------------------------------------- 229 240 // … … 234 245 Bool_t MReadTree::CheckBranchSize() 235 246 { 236 TArrayI entries(fTree->GetListOfBranches()->GetSize()); 237 Int_t num=0; 238 239 TIter Next(fTree->GetListOfBranches()); 240 241 TBranch *element = NULL; 242 while ((element=(TBranch*)Next())) 243 entries[num++] = (Int_t)element->GetEntries(); 244 245 // Check the number of entries of the branches pair-wise 246 for (int i=0; i<num; i++) 247 for (int j=i; j<num; j++) 247 Int_t entries = -1; 248 249 TList list; 250 GetListOfBranches(list); 251 252 TIter Next(&list); 253 TBranch *b = NULL; 254 while ((b=(TBranch*)Next())) 255 { 256 if (entries>=0 && entries!=(Int_t)b->GetEntries()) 248 257 { 249 if (entries[i]==entries[j])250 continue;251 252 258 *fLog << err << "ERROR - File corruption detected:" << endl; 253 *fLog << " Due to several circumstances (such at a bug in MReadTree or wrong" << endl; 254 *fLog << " usage of the file UPDATE mode) you may have produced a file in which" << endl; 255 *fLog << " at least two branches in the same tree (" << fTree->GetName() << ") have different" << endl; 256 *fLog << " number of entries. Sorry, but this file (" << GetFileName() << ")" << endl; 257 *fLog << " is unusable." << endl; 259 *fLog << " Due to several circumstances (such at a bug in MReadTree or wrong usgae of" << endl; 260 *fLog << " the file UPDATE mode) you may have produced a file in which at least two" << endl; 261 *fLog << " branches have different number of entries. Sorry, but this combination of" << endl; 262 *fLog << " branches, trees and files is unusable." << endl; 258 263 return kFALSE; 259 264 } 265 266 entries = (Int_t)b->GetEntries(); 267 } 260 268 261 269 return kTRUE; … … 678 686 679 687 SetBranchStatus(branch->GetListOfBranches(), kFALSE); 688 } 689 690 MParContainer *MReadTree::FindCreateObj(MParList &plist, const char *cname, const char *name) 691 { 692 MParContainer *pcont=plist.FindCreateObj(cname, name); 693 if (!pcont) 694 { 695 // 696 // if class is not existing in the (root) environment 697 // we cannot proceed reading this branch 698 // 699 *fLog << err << dbginf << "ERROR - Class '" << cname; 700 *fLog << "' for " << name << " not existing in dictionary. Branch skipped." << endl; 701 return 0; 702 } 703 704 fParList.Add(pcont); 705 return pcont; 706 } 707 708 void *MReadTree::GetParameterPtr(MParList &plist, const TString &name, const char *parname) 709 { 710 if (name=="Int_t" || name=="UInt_t" || 711 name=="Short_t" || name=="UShort_t" || 712 name=="Char_t" || name=="UChar_t" || 713 name=="Bool_t") 714 { 715 MParameterI *par = (MParameterI*)FindCreateObj(plist, "MParameterI", parname); 716 return par ? par->GetPtr() : 0; 717 } 718 719 if (name=="Float_t" || name=="Double_t") 720 { 721 MParameterD *par = (MParameterD*)FindCreateObj(plist, "MParameterD", parname); 722 return par ? par->GetPtr() : 0; 723 } 724 725 // MParContainer **pcont= new MParContainer*; 726 // return FindCreateObj(plist, name, parname); 727 728 MParEmulated *par = (MParEmulated*)FindCreateObj(plist, "MParEmulated", parname); 729 if (!par) 730 return 0; 731 732 par->SetClassName(name); 733 return par->GetPtr(); 734 } 735 736 Bool_t MReadTree::SetBranchAddress(TBranch &b, void *ptr, const char *prefix, const char *type) 737 { 738 if (!ptr) 739 { 740 DisableSubBranches(&b); 741 return kFALSE; 742 } 743 744 if (fChain) 745 { 746 TChainElement *element = (TChainElement*)fChain->GetStatus()->FindObject(b.GetName()); 747 if (element && IsOwned(*element)) 748 *fLog << warn << "WARNING - Branch address for " << b.GetName() << " was already setup by the user." << endl; 749 } 750 751 const TString bname = b.GetName(); 752 const TString cname = type ? type : b.GetClassName(); 753 754 fTree->SetBranchAddress(bname, ptr); 755 756 *fLog << inf2 << prefix << " address '" << bname << "' "; 757 if (bname!=cname) 758 *fLog << "[" << cname << "] "; 759 *fLog << "setup for reading." << endl; 760 761 return kTRUE; 680 762 } 681 763 … … 751 833 *fLog << inf << fNumEntries << " entries found in file(s)." << endl; 752 834 835 // Get all branches of this tree and all friends 836 TList blist; 837 GetListOfBranches(blist); 838 753 839 // 754 840 // Get all branches of this tree and 755 841 // create the Iterator to loop over all branches 756 842 // 757 TIter Next( fTree->GetListOfBranches()); // *CHANGED-fChain-to-fTree*843 TIter Next(&blist); // *CHANGED-fChain-to-fTree* 758 844 TBranch *branch=NULL; 759 845 … … 784 870 } 785 871 786 // 787 // Create a pointer to the pointer to the object in which the 788 // branch data is stored. The pointers are stored in the TChain 789 // object and we get the pointers from there to delete it. 790 // 791 MParContainer **pcont= new MParContainer*; 792 793 #if ROOT_VERSION_CODE < ROOT_VERSION(3,02,06) 794 const char *classname = oname; 795 #else 796 const char *classname = branch->GetClassName(); 797 #endif 798 799 // 800 // check if object is existing in the list 801 // 802 *pcont=pList->FindCreateObj(classname, oname); 803 804 if (!*pcont) 872 // Branch already setup/ FIXME: WHAT IF THIS IS A TREE??? 873 if (fChain && fChain->GetStatus()->FindObject(branch->GetName())) 805 874 { 806 // 807 // if class is not existing in the (root) environment 808 // we cannot proceed reading this branch 809 // 810 *fLog << warn << dbginf << "Warning: Class '" << classname; 811 *fLog << "' for " << oname << " not existing in dictionary. Branch skipped." << endl; 812 DisableSubBranches(branch); 875 *fLog << warn << "WARNING - Branch " << branch->GetName() << " already setup." << endl; 813 876 continue; 814 877 } 815 878 816 // 817 // Check whether a Pointer to a pointer already exists. 818 // If we created one already, delete it. 819 // 820 // *CHANGED-fChain-to-fTree* 821 if (fChain) 879 // Get the corresponding class 880 const TString classname = branch->GetClassName(); 881 882 TClass *cls = gROOT->GetClass(classname); 883 if (!cls) 822 884 { 823 TChainElement *element = (TChainElement*)fChain->GetStatus()->FindObject(bname); 824 if (element) 825 delete (MParContainer**)element->GetBaddress(); 885 // FIXME: With or without dot? 886 TLeaf *l = branch->GetLeaf(branch->GetName()); // FIXME: 1st leaf? 887 if (!l) 888 continue; 889 890 void *ptr = GetParameterPtr(*pList, l->GetTypeName(), oname); 891 if (SetBranchAddress(*branch, ptr, "Leaf", l->GetTypeName())) 892 num++; 893 894 continue; 826 895 } 827 /* This can't be done here for memory trees - see 828 PostProcess for more details. 896 897 // The class is known in the dictionary and loaded! 898 if (!cls->IsLoaded() || !cls->InheritsFrom(MParContainer::Class())) 899 { 900 void *ptr = GetParameterPtr(*pList, classname, oname); 901 if (SetBranchAddress(*branch, ptr, "Emulated branch")) 902 num++; 903 } 829 904 else 830 905 { 831 TBranch *branch = (TBranch*)fTree->GetBranch(bname); 832 if (branch) 833 { 834 *fLog << bname << " " << (void*)branch->GetAddress() << " " << pcont << endl; 835 delete (MParContainer**)branch->GetAddress(); 836 } 906 MParContainer **pcont= new MParContainer*; 907 *pcont=FindCreateObj(*pList, classname, oname); 908 if (SetBranchAddress(*branch, pcont, "Master branch")) 909 num++; 837 910 } 838 */839 840 //841 // here pcont is a pointer the to container in which the data from842 // the actual branch should be stored - enable branch.843 //844 fTree->SetBranchAddress(bname, pcont); // *CHANGED-fChain-to-fTree*845 846 *fLog << inf2 << "Master branch address '" << bname << "' ";847 if ((TString)bname!=(TString)classname)848 *fLog << "[" << classname << "] ";849 *fLog << "setup for reading." << endl;850 851 //*fLog << "Branch " << bname << " autodel: " << (int)branch->IsAutoDelete() << endl;852 //branch->SetAutoDelete();853 854 num++;855 911 } 856 912 … … 889 945 void MReadTree::SetReadyToSave(Bool_t flag) 890 946 { 891 if (!fChain) 892 return; 893 894 TIter Next(fChain->GetStatus()); 895 896 TChainElement *element = NULL; 897 while ((element=(TChainElement*)Next())) 898 { 899 // 900 // Check whether the branch is enabled 901 // 902 if (!element->GetStatus()) 903 continue; 904 905 // 906 // Get the pointer to the pointer of the corresponding container 907 // 908 MParContainer **pcont = (MParContainer**)element->GetBaddress(); 909 910 // 911 // Check whether the pointer is not NULL 912 // 913 if (!pcont || !*pcont) 914 continue; 915 916 // 917 // Set the ready to save status of the container. 918 // 919 (*pcont)->SetReadyToSave(flag); 920 } 947 fParList.R__FOR_EACH(MParContainer, SetReadyToSave)(flag); 921 948 922 949 MTask::SetReadyToSave(flag); -
trunk/MagicSoft/Mars/mfileio/MReadTree.h
r9034 r9036 31 31 32 32 MTaskList *fTaskList; // Tasklist to set StreamId 33 TList fParList; 33 34 34 35 enum { kChainWasChanged = BIT(14) }; … … 42 43 43 44 Bool_t IsOwned(const TChainElement &e) const; 45 46 void GetListOfBranches(TList &list) const; 47 MParContainer *FindCreateObj(MParList &plist, const char *cname, const char *name); 48 void *GetParameterPtr(MParList &plist, const TString &bb, const char *parname); 49 Bool_t SetBranchAddress(TBranch &b, void *ptr, const char *prefix, const char *type=0); 44 50 45 51 void DisableSubBranches(TBranch *b); … … 103 109 104 110 #endif 105 -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
r8999 r9036 469 469 } 470 470 471 *fLog << inf << "Unnecessary parameter container '" << cname << "' not found..." << endl;471 *fLog << inf2 << "Unnecessary parameter container '" << cname << "' not found..." << endl; 472 472 delete fBranches.Remove(entry); 473 473 continue;
Note:
See TracChangeset
for help on using the changeset viewer.