Changeset 2328
- Timestamp:
- 09/10/03 13:38:45 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2327 r2328 1 1 -*-*- END OF LINE -*-*- 2 2 3 2003/09/10: Thomas Bretz 4 5 * mdata/MDataChain.[h,cc]: 6 - added log2, acosh, asinh, atanh, ceil, isnan and finite 7 - changed math.h callings to TMath:: namespace to be more 8 consistent 9 10 * mhist/MHMatrix.[h,cc]: 11 - added RemoveInvalidRows member function to get rid of rows 12 containing invalid numbers (nan, inf) 13 14 * mraw/MRawEvtHeader.cc: 15 - fixed variable types calculating the time (ns, s, m and h) 16 to get rid of some compiler warnings, casting the values 17 for-, back- and forward only wasts computing time. 18 19 20 3 21 2003/09/08: Abelardo Moralejo 22 4 23 * mhist/MHOnSubtraction.cc: 5 24 - added some casts in the arguments of function calls, to get rid … … 8 27 TH1D constructor of fSignificanceHist (number of bins and bin 9 28 limits). 29 10 30 * mraw/MRawEvtHeader.cc: 11 31 - Added casts to arguments of fTime->SetTime(h, m, s, ns) to get … … 16 36 with gcc2.96, abs() was not recognized. 17 37 38 39 18 40 2003/09/07: Abelardo Moralejo 41 19 42 * manalysis/MCerPhotCalc.cc: 20 43 - removed normalization of array fWeight introduced on 30/06. For … … 44 67 slice was wrong by 0.5 units... once more: please Thomas B, 45 68 be careful with these kind of changes. 69 46 70 47 71 -
trunk/MagicSoft/Mars/mdata/MDataChain.cc
r2173 r2328 58 58 // log(x) natural logarithm of x 59 59 // pow10(x) 10^x 60 // log2(x) logarithm of x to base two 60 61 // log10(x) logarithm of x to base ten 61 62 // cos(x) cosine of x … … 65 66 // sinh(x) hyperbolic sine of x 66 67 // tanh(x) hyperbolic tangent of x 68 // acosh(x) arc hyperbolic cosine of x 69 // asinh(x) arc hyperbolic sine of x 70 // atanh(x) arc hyperbolic tangent of x 67 71 // acos(x) arc cosine (inverse cosine) of x 68 72 // asin(x) arc sine (inverse sine) of x … … 72 76 // abs(x) absolute value of x, |x| 73 77 // floor(x) round down to the nearest integer (floor(9.9)=9) 78 // ceil(x) round up to the nearest integer (floor(9.1)=10) 74 79 // r2d(x) transform radians to degrees 75 80 // d2r(x) transform degrees to radians … … 81 86 // randg(x) returns gRandom->Gaus(0, x) 82 87 // randl(x) returns gRandom->Landau(0, x) 83 // 88 // isnan(x) return 1 if x is NaN (Not a Number) otherwise 0 89 // finite(x) return 1 if the number is a valid double (not NaN, inf) 90 // 91 // NaN (Not a Number) means normally a number which is to small to be 92 // stored in a floating point variable (eg. 0<x<1e-56 or similar) or 93 // a number which function is not defined (like asin(1.5)) 94 // 95 // inf is the symbol for an infinite number. 84 96 // 85 97 // Constants are implemented in ParseDataMember, namely: … … 110 122 #include "MDataChain.h" 111 123 112 #include <math.h> // fabs on Alpha113 124 #include <ctype.h> // isalnum, ... 114 125 #include <stdlib.h> // strtod, ... … … 236 247 txt.ToLower(); 237 248 238 if (txt=="abs") return kEAbs; 239 if (txt=="fabs") return kEAbs; 240 if (txt=="log") return kELog; 241 if (txt=="log10") return kELog10; 242 if (txt=="sin") return kESin; 243 if (txt=="cos") return kECos; 244 if (txt=="tan") return kETan; 245 if (txt=="sinh") return kESinH; 246 if (txt=="cosh") return kECosH; 247 if (txt=="tanh") return kETanH; 248 if (txt=="asin") return kEASin; 249 if (txt=="acos") return kEACos; 250 if (txt=="atan") return kEATan; 251 if (txt=="sqrt") return kESqrt; 252 if (txt=="sqr") return kESqr; 253 if (txt=="exp") return kEExp; 254 if (txt=="pow10") return kEPow10; 255 if (txt=="sgn") return kESgn; 256 if (txt=="floor") return kEFloor; 257 if (txt=="r2d") return kERad2Deg; 258 if (txt=="d2r") return kEDeg2Rad; 259 if (txt=="rand") return kERandom; 260 if (txt=="randp") return kERandomP; 261 if (txt=="rande") return kERandomE; 262 if (txt=="randi") return kERandomI; 263 if (txt=="randg") return kERandomG; 264 if (txt=="randl") return kERandomL; 265 if (txt[0]=='-') return kENegative; 266 if (txt[0]=='+') return kEPositive; 249 if (txt=="abs") return kEAbs; 250 if (txt=="fabs") return kEAbs; 251 if (txt=="log") return kELog; 252 if (txt=="log2") return kELog2; 253 if (txt=="log10") return kELog10; 254 if (txt=="sin") return kESin; 255 if (txt=="cos") return kECos; 256 if (txt=="tan") return kETan; 257 if (txt=="sinh") return kESinH; 258 if (txt=="cosh") return kECosH; 259 if (txt=="tanh") return kETanH; 260 if (txt=="asin") return kEASin; 261 if (txt=="acos") return kEACos; 262 if (txt=="atan") return kEATan; 263 if (txt=="asinh") return kEASinH; 264 if (txt=="acosh") return kEACosH; 265 if (txt=="atanh") return kEATanH; 266 if (txt=="sqrt") return kESqrt; 267 if (txt=="sqr") return kESqr; 268 if (txt=="exp") return kEExp; 269 if (txt=="pow10") return kEPow10; 270 if (txt=="sgn") return kESgn; 271 if (txt=="floor") return kEFloor; 272 if (txt=="r2d") return kERad2Deg; 273 if (txt=="d2r") return kEDeg2Rad; 274 if (txt=="rand") return kERandom; 275 if (txt=="randp") return kERandomP; 276 if (txt=="rande") return kERandomE; 277 if (txt=="randi") return kERandomI; 278 if (txt=="randg") return kERandomG; 279 if (txt=="randl") return kERandomL; 280 if (txt=="isnan") return kEIsNaN; 281 if (txt=="finite") return kEFinite; 282 if (txt[0]=='-') return kENegative; 283 if (txt[0]=='+') return kEPositive; 267 284 268 285 return kENoop; … … 523 540 switch (fOperatorType) 524 541 { 525 case kEAbs: return fabs(val); 526 case kELog: return log(val); 527 case kELog10: return log10(val); 528 case kESin: return sin(val); 529 case kECos: return cos(val); 530 case kETan: return tan(val); 531 case kESinH: return sinh(val); 532 case kECosH: return cosh(val); 533 case kETanH: return tanh(val); 534 case kEASin: return asin(val); 535 case kEACos: return acos(val); 536 case kEATan: return atan(val); 537 case kESqrt: return sqrt(val); 542 case kEAbs: return TMath::Abs(val); 543 case kELog: return TMath::Log(val); 544 case kELog2: return TMath::Log2(val); 545 case kELog10: return TMath::Log10(val); 546 case kESin: return TMath::Sin(val); 547 case kECos: return TMath::Cos(val); 548 case kETan: return TMath::Tan(val); 549 case kESinH: return TMath::SinH(val); 550 case kECosH: return TMath::CosH(val); 551 case kETanH: return TMath::TanH(val); 552 case kEASin: return TMath::ASin(val); 553 case kEACos: return TMath::ACos(val); 554 case kEATan: return TMath::ATan(val); 555 case kEASinH: return TMath::ASinH(val); 556 case kEACosH: return TMath::ACosH(val); 557 case kEATanH: return TMath::ATanH(val); 558 case kESqrt: return TMath::Sqrt(val); 538 559 case kESqr: return val*val; 539 case kEExp: return exp(val);540 case kEPow10: return pow(10, val);560 case kEExp: return TMath::Exp(val); 561 case kEPow10: return TMath::Power(10, val); 541 562 case kESgn: return val<0 ? -1 : 1; 542 563 case kENegative: return -val; 543 564 case kEPositive: return val; 544 case kEFloor: return floor(val); 565 case kEFloor: return TMath::Floor(val); 566 case kECeil: return TMath::Ceil(val); 545 567 case kERad2Deg: return val*180/TMath::Pi(); 546 568 case kEDeg2Rad: return val*TMath::Pi()/180; … … 551 573 case kERandomG: return gRandom ? gRandom->Gaus(0, val) : 0; 552 574 case kERandomL: return gRandom ? gRandom->Landau(0, val) : 0; 575 case kEIsNaN: return TMath::IsNaN(val); 576 case kEFinite: return TMath::Finite(val); 553 577 case kENoop: return val; 554 578 } … … 615 639 switch (fOperatorType) 616 640 { 617 case kEAbs: str += "abs" ; break; 618 case kELog: str += "log" ; break; 619 case kELog10: str += "log10"; break; 620 case kESin: str += "sin" ; break; 621 case kECos: str += "cos" ; break; 622 case kETan: str += "tan" ; break; 623 case kESinH: str += "sinh" ; break; 624 case kECosH: str += "cosh" ; break; 625 case kETanH: str += "tanh" ; break; 626 case kEASin: str += "asin" ; break; 627 case kEACos: str += "acos" ; break; 628 case kEATan: str += "atan" ; break; 629 case kESqrt: str += "sqrt" ; break; 630 case kESqr: str += "sqr" ; break; 631 case kEExp: str += "exp" ; break; 632 case kEPow10: str += "pow10"; break; 633 case kESgn: str += "sgn" ; break; 634 case kENegative: str += "-" ; break; 635 case kEPositive: str += "+" ; break; 636 case kEFloor: str += "floor"; break; 637 case kERad2Deg: str += "r2d" ; break; 638 case kEDeg2Rad: str += "d2r" ; break; 639 case kERandom: str += "rand" ; break; 640 case kERandomP: str += "randp"; break; 641 case kERandomE: str += "rande"; break; 642 case kERandomI: str += "randi"; break; 643 case kERandomG: str += "randg"; break; 644 case kERandomL: str += "randl"; break; 641 case kEAbs: str += "abs" ; break; 642 case kELog: str += "log" ; break; 643 case kELog2: str += "log2" ; break; 644 case kELog10: str += "log10" ; break; 645 case kESin: str += "sin" ; break; 646 case kECos: str += "cos" ; break; 647 case kETan: str += "tan" ; break; 648 case kESinH: str += "sinh" ; break; 649 case kECosH: str += "cosh" ; break; 650 case kETanH: str += "tanh" ; break; 651 case kEASin: str += "asin" ; break; 652 case kEACos: str += "acos" ; break; 653 case kEATan: str += "atan" ; break; 654 case kEASinH: str += "asinh" ; break; 655 case kEACosH: str += "acosh" ; break; 656 case kEATanH: str += "atanh" ; break; 657 case kESqrt: str += "sqrt" ; break; 658 case kESqr: str += "sqr" ; break; 659 case kEExp: str += "exp" ; break; 660 case kEPow10: str += "pow10" ; break; 661 case kESgn: str += "sgn" ; break; 662 case kENegative: str += "-" ; break; 663 case kEPositive: str += "+" ; break; 664 case kEFloor: str += "floor" ; break; 665 case kECeil: str += "ceil" ; break; 666 case kERad2Deg: str += "r2d" ; break; 667 case kEDeg2Rad: str += "d2r" ; break; 668 case kERandom: str += "rand" ; break; 669 case kERandomP: str += "randp" ; break; 670 case kERandomE: str += "rande" ; break; 671 case kERandomI: str += "randi" ; break; 672 case kERandomG: str += "randg" ; break; 673 case kERandomL: str += "randl" ; break; 674 case kEIsNaN: str += "isnan" ; break; 675 case kEFinite: str += "finite"; break; 645 676 case kENoop: 646 677 break; -
trunk/MagicSoft/Mars/mdata/MDataChain.h
r2117 r2328 19 19 MData *fMember; // Filter 20 20 21 // PLEASE, always add new enums to the end of the enumeration, 22 // otherwise you would break loading old data chains... 21 23 typedef enum { 22 24 kENoop, 23 kELog10, 24 kELog, 25 kELog, kELog2, kELog10, 25 26 kEAbs, 26 kESin, 27 kECos, 28 kETan, 29 kESinH, 30 kECosH, 31 kETanH, 32 kEASin, 33 kEACos, 34 kEATan, 35 kESqrt, 36 kESqr, 37 kEPow10, 38 kEExp, 27 kESin, kECos, kETan, kESinH, kECosH, kETanH, 28 kEASin, kEACos, kEATan, kEASinH, kEACosH, kEATanH, 29 kESqrt, kESqr, kEPow10, kEExp, 39 30 kESgn, 40 31 kEPositive, 41 32 kENegative, 42 kEFloor, 43 kERad2Deg, 44 kEDeg2Rad, 45 kERandom, 46 kERandomP, 47 kERandomE, 48 kERandomI, 49 kERandomG, 50 kERandomL 33 kEFloor, kECeil, 34 kERad2Deg, kEDeg2Rad, kERandom, 35 kERandomP, kERandomE, kERandomI, kERandomG, kERandomL, 36 kEIsNaN, kEFinite 51 37 } OperatorType_t; 52 38 -
trunk/MagicSoft/Mars/mhist/MHMatrix.cc
r2307 r2328 1120 1120 } 1121 1121 1122 // -------------------------------------------------------------------------- 1123 // 1124 // Reduces the number of rows to the given number num by cutting out the 1125 // last rows. 1126 // 1122 1127 void MHMatrix::ReduceRows(UInt_t num) 1123 1128 { … … 1135 1140 TMatrixRow(fM, irow) = tmp = TMatrixRow(m, irow); 1136 1141 } 1142 1143 // -------------------------------------------------------------------------- 1144 // 1145 // Remove rows which contains numbers not fullfilling TMath::Finite 1146 // 1147 Bool_t MHMatrix::RemoveInvalidRows() 1148 { 1149 TMatrix m(fM); 1150 1151 const Int_t ncol=fM.GetNcols(); 1152 TVector vold(ncol); 1153 int irow=0; 1154 1155 for (int i=0; i<m.GetNrows(); i++) 1156 { 1157 const TMatrixRow &row = TMatrixRow(m, i); 1158 1159 // finite (-> math.h) checks for NaN as well as inf 1160 int jcol; 1161 for (jcol=0; jcol<ncol; jcol++) 1162 if (!TMath::Finite(vold(jcol))) 1163 break; 1164 1165 if (jcol==ncol) 1166 TMatrixRow(fM, irow++) = vold = row; 1167 else 1168 *fLog << warn << "Warning - MHMatrix::RemoveInvalidRows: row #" << i<< " removed." << endl; 1169 } 1170 1171 // Do not use ResizeTo (in older root versions this doesn't save the contents 1172 ReduceRows(irow); 1173 1174 return kTRUE; 1175 } 1176 -
trunk/MagicSoft/Mars/mhist/MHMatrix.h
r2296 r2328 103 103 104 104 void ReduceNumberOfRows(UInt_t numrows, const TString opt); 105 Bool_t RemoveInvalidRows(); 105 106 106 107 Int_t Read(const char *name); -
trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc
r2326 r2328 247 247 const Double_t mhz = 9.375; // [1e6 ticks/s] 248 248 const Double_t t = (Double_t)fAbsTime[0]/mhz*1e-3; // [ns] 249 const Double_t ns = (UShort_t)fmod(t, 1e9);250 const Double_t s= (Byte_t)fmod(t/1e9, 60);251 const Double_t m= (Byte_t)fmod(t/60e9, 60);252 const Double_t h= (Byte_t)(t/3600e9);253 254 fTime->SetTime( (Byte_t)h, (Byte_t)m, (Byte_t)s, (UShort_t)ns);249 const UShort_t ns = (UShort_t)fmod(t, 1e9); 250 const Byte_t s = (Byte_t)fmod(t/1e9, 60); 251 const Byte_t m = (Byte_t)fmod(t/60e9, 60); 252 const Byte_t h = (Byte_t)(t/3600e9); 253 254 fTime->SetTime(h, m, s, ns); 255 255 fTime->SetTime(fAbsTime[0], fAbsTime[1]); 256 256
Note:
See TracChangeset
for help on using the changeset viewer.