Changeset 7142 for trunk/MagicSoft/Mars/mhbase
- Timestamp:
- 06/10/05 13:10:09 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mhbase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhbase/MBinning.cc
r6954 r7142 261 261 // lo: lowest edge 262 262 // hi: highest edge 263 // type: "lin" <default>, "log", "cos" (without quotationmarks)263 // type: "lin" <default>, "log", "cos", "asin" (without quotationmarks) 264 264 // title: Whatever the title might be 265 265 // … … 296 296 str.Remove(0, pos); 297 297 str = str.Strip(TString::kBoth); 298 if (typ!=(TString)"lin" && typ!=(TString)"log" && typ!=(TString)"cos" )298 if (typ!=(TString)"lin" && typ!=(TString)"log" && typ!=(TString)"cos" && typ!=(TString)"asin") 299 299 { 300 300 *fLog << warn << GetDescriptor() << "::SetEdges: Type " << typ << " unknown... ignored." << endl; … … 384 384 return; 385 385 } 386 if (o.Contains("asin", TString::kIgnoreCase)) 387 { 388 SetEdgesASin(nbins, lo, up); 389 return; 390 } 386 391 if (o.Contains("cos", TString::kIgnoreCase)) 387 392 { … … 420 425 const Axis_t ud = up/kRad2Deg; 421 426 422 const Double_t binsize = (cos(ld)-cos(ud))/nbins; 427 const Double_t cld = ld<0 ? cos(ld)-1 : 1-cos(ld); 428 const Double_t cud = ud<0 ? cos(ud)-1 : 1-cos(ud); 429 430 SetEdgesASin(nbins, ld, ud); 431 /* 432 const Double_t binsize = (cld-cud)/nbins; 423 433 fEdges.Set(nbins+1); 424 434 for (int i=0; i<=nbins; i++) 425 fEdges[i] = acos(cos(ld)-binsize*i)*kRad2Deg; 435 { 436 const Double_t a = cld-binsize*i; 437 fEdges[i] = a<0 ? -acos(1+a)*kRad2Deg : acos(1-a)*kRad2Deg; 438 cout << a << " " << fEdges[i] << endl; 439 } 440 441 fType = kIsCosinic;*/ 442 } 443 444 // -------------------------------------------------------------------------- 445 // 446 // Specify the number of bins <nbins> (not the number of edges), the 447 // lowest [deg] <lo> and highest [deg] <up> Edge (of your histogram) 448 // 449 void MBinning::SetEdgesASin(const Int_t nbins, Axis_t lo, Axis_t up) 450 { 451 const Double_t binsize = nbins<=0 ? 0 : (up-lo)/nbins; 452 fEdges.Set(nbins+1); 453 for (int i=0; i<=nbins; i++) 454 { 455 const Double_t a = binsize*i + lo; 456 fEdges[i] = a<0 ? -acos(1+a)*kRad2Deg : acos(1-a)*kRad2Deg; 457 } 426 458 427 459 fType = kIsCosinic; … … 543 575 { 544 576 type = GetEnvValue(env, prefix, "Type", "lin"); 545 if (type!=(TString)"lin" && type!=(TString)"log" && type!=(TString)"cos" )577 if (type!=(TString)"lin" && type!=(TString)"log" && type!=(TString)"cos" && type!=(TString)"acos") 546 578 { 547 579 *fLog << warn << GetDescriptor() << "::ReadEnv - WARNING: Type is not lin, log nor cos... assuming lin." << endl; -
trunk/MagicSoft/Mars/mhbase/MBinning.h
r6958 r7142 66 66 void SetEdgesLog(const Int_t nbins, const Axis_t lo, Axis_t up); 67 67 void SetEdgesCos(const Int_t nbins, const Axis_t lo, Axis_t up); 68 void SetEdgesASin(const Int_t nbins, Axis_t lo, Axis_t up); 68 69 69 70 Int_t FindLoEdge(Double_t val) const
Note:
See TracChangeset
for help on using the changeset viewer.