Changeset 1891 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 04/03/03 10:28:31 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MBinning.h
r1668 r1891 42 42 void SetEdgesCos(const Int_t nbins, const Axis_t lo, Axis_t up); 43 43 44 Int_t FindLoEdge(Double_t val) const 45 { 46 for (int i=0; i<fEdges.GetSize(); i++) 47 { 48 if (val >= ((TArrayD)fEdges)[i]) 49 return i; 50 } 51 return -1; 52 } 53 Int_t FindHiEdge(Double_t val) const 54 { 55 for (int i=0; i<fEdges.GetSize(); i++) 56 { 57 if (val < ((TArrayD)fEdges)[i]) 58 return i; 59 } 60 return -1; 61 } 62 44 63 // FIXME: ROOT workaround: "operator[] const" missing 45 64 Double_t GetEdgeLo() const { return ((TArrayD)fEdges)[0]; } -
trunk/MagicSoft/Mars/mhist/MHMatrix.cc
r1887 r1891 1002 1002 1003 1003 // -------------------------------------------------------------------------- 1004 // 1005 // Read the setup from a TEnv: 1006 // Column0, Column1, Column2, ..., Column10, ..., Column100, ... 1007 // 1008 // Searching stops if the first key isn't found in the TEnv. Empty 1009 // columns are not allowed 1010 // 1011 // eg. 1012 // MHMatrix.Column0: cos(MMcEvt.fTelescopeTheta) 1013 // MHMatrix.Column1: MHillasSrc.fAlpha 1014 // 1015 Bool_t MHMatrix::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 1016 { 1017 if (fM.IsValid()) 1018 { 1019 *fLog << err << "ERROR - matrix is already in use. Can't add a new column from TEnv... skipped." << endl; 1020 return kERROR; 1021 } 1022 1023 if (TestBit(kIsLocked)) 1024 { 1025 *fLog << err << "ERROR - matrix is locked. Can't add new column from TEnv... skipped." << endl; 1026 return kERROR; 1027 } 1028 1029 if (fData) 1030 { 1031 *fLog << inf << "Removing all existing columns in " << GetDescriptor() << endl; 1032 fData->Delete(); 1033 } 1034 else 1035 { 1036 fData = new MDataArray; 1037 SetBit(kIsOwner); 1038 } 1039 1040 // 1041 // Search (beginning with 0) all keys 1042 // 1043 for (int i=0;; i++) 1044 { 1045 TString idx = "Column"; 1046 idx += i; 1047 1048 // Output if print set to kTRUE 1049 IsEnvDefined(env, prefix, idx, print); 1050 1051 // Try to get the file name 1052 TString name = GetEnvValue(env, prefix, idx, ""); 1053 if (name.IsNull()) 1054 return kTRUE; 1055 1056 /* 1057 if (name.BeginsWith("\"") && name.EndsWith("\"")) 1058 { 1059 name.Remove(name.Last('\"'), 1); 1060 name.Remove(name.First('\"'), 1); 1061 } 1062 */ 1063 1064 if (print) 1065 *fLog << all << "Add Column: " << name << endl; 1066 fData->AddEntry(name); 1067 } 1068 1069 return kTRUE; 1070 } -
trunk/MagicSoft/Mars/mhist/MHMatrix.h
r1879 r1891 110 110 Bool_t DefRefMatrix(Int_t nmaxevts=0, TMatrix *mrest=NULL); 111 111 112 Bool_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE); 113 112 114 ClassDef(MHMatrix, 1) // Multidimensional Matrix to store events 113 115 };
Note:
See TracChangeset
for help on using the changeset viewer.