Changeset 1853 for trunk/MagicSoft/Mars/mdata
- Timestamp:
- 03/21/03 15:27:44 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mdata
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mdata/MDataChain.cc
r1661 r1853 18 18 ! Author(s): Thomas Bretz 04/2002 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 220 ! Copyright: MAGIC Software Development, 2000-2003 21 21 ! 22 22 ! … … 72 72 // abs(x) absolute value of x, |x| 73 73 // floor(x) round down to the nearest integer (floor(9.9)=9) 74 // 74 // r2d(x) transform radians to degrees 75 // d2r(x) transform degrees to radians 76 // rand(x) returns a uniform deviate on the interval ( 0, x ]. 77 // (gRandom->Uniform(x) is returned) 78 // randp(x) returns gRandom->Poisson(x) 79 // rande(x) returns gRandom->Exp(x) 80 // randi(x) returns gRandom->Integer(x) 81 // randg(x) returns gRandom->Gaus(0, x) 82 // randl(x) returns gRandom->Landau(0, x) 83 // 84 // REMARK: 85 // - All the random functions are returning 0 if gRandom==0 86 // - You may get better results if you are using a TRandom3 75 87 // 76 88 // FIXME: The possibility to use other objects inheriting from MData … … 86 98 #include <ctype.h> // isalnum, ... 87 99 #include <stdlib.h> // strtod, ... 100 101 #include <TRandom.h> 88 102 89 103 #include "MLog.h" … … 231 245 if (txt=="sgn") return kESgn; 232 246 if (txt=="floor") return kEFloor; 247 if (txt=="r2d") return kERad2Deg; 248 if (txt=="d2r") return kEDeg2Rad; 249 if (txt=="rand") return kERandom; 250 if (txt=="randp") return kERandomP; 251 if (txt=="rande") return kERandomE; 252 if (txt=="randi") return kERandomI; 253 if (txt=="randg") return kERandomG; 254 if (txt=="randl") return kERandomL; 233 255 if (txt[0]=='-') return kENegative; 234 256 if (txt[0]=='+') return kEPositive; … … 477 499 case kEPositive: return val; 478 500 case kEFloor: return floor(val); 501 case kERad2Deg: return val*180/TMath::Pi(); 502 case kEDeg2Rad: return val*TMath::Pi()/180; 503 case kERandom: return gRandom ? gRandom->Uniform(val) : 0; 504 case kERandomP: return gRandom ? gRandom->Poisson(val) : 0; 505 case kERandomE: return gRandom ? gRandom->Exp(val) : 0; 506 case kERandomI: return gRandom ? gRandom->Integer(val) : 0; 507 case kERandomG: return gRandom ? gRandom->Gaus(0, val) : 0; 508 case kERandomL: return gRandom ? gRandom->Landau(0, val) : 0; 479 509 case kENoop: return val; 480 510 } … … 561 591 case kEPositive: str += "+" ; break; 562 592 case kEFloor: str += "floor"; break; 593 case kERad2Deg: str += "r2d" ; break; 594 case kEDeg2Rad: str += "d2r" ; break; 595 case kERandom: str += "rand" ; break; 596 case kERandomP: str += "randp"; break; 597 case kERandomE: str += "rande"; break; 598 case kERandomI: str += "randi"; break; 599 case kERandomG: str += "randg"; break; 600 case kERandomL: str += "randl"; break; 563 601 case kENoop: 564 602 break; … … 585 623 return fMember->GetDataMember(); 586 624 } 625 -
trunk/MagicSoft/Mars/mdata/MDataChain.h
r1661 r1853 40 40 kEPositive, 41 41 kENegative, 42 kEFloor 42 kEFloor, 43 kERad2Deg, 44 kEDeg2Rad, 45 kERandom, 46 kERandomP, 47 kERandomE, 48 kERandomI, 49 kERandomG, 50 kERandomL 43 51 } OperatorType_t; 44 52
Note:
See TracChangeset
for help on using the changeset viewer.