| Report problems to ATLAS LXR Team (with time and IP address indicated) |
|
[ source navigation ] [ diff markup ] [ identifier search ] [ general search ] |
||||
|
||||||
| Links to LXR source navigation pages for stable releases | [ 12.*.* ] [ 13.*.* ] [ 14.*.* ] [ 15.*.* ] | |||||
001 // $Id: IHistoTool.h,v 1.3 2005/01/18 15:51:53 mato Exp $ 002 // ============================================================================ 003 #ifndef GAUDIALG_IHISTOTOOL_H 004 #define GAUDIALG_IHISTOTOOL_H 1 005 // ============================================================================ 006 // Include files 007 // ============================================================================ 008 // from STL 009 // ============================================================================ 010 #include <string> 011 // ============================================================================ 012 // from Gaudi 013 // ============================================================================ 014 #include "GaudiKernel/IAlgTool.h" 015 #include "GaudiAlg/HistoID.h" 016 // ============================================================================ 017 018 namespace AIDA 019 { 020 class IHistogram1D; 021 class IHistogram2D; 022 class IHistogram3D; 023 }; 024 025 /** @class IHistoTool IHistoTool.h GaudiTools/IHistoTool.h 026 * 027 * An abstract interaface for "histogramming tool" 028 * 029 * @author Vanya BELYAEV Ivan.Belyaev@itep.ru 030 * @date 2004-06-28 031 */ 032 033 class IHistoTool : virtual public IAlgTool 034 { 035 public: 036 037 /// the actual type for histogram identifier (HBOOK style) 038 typedef Histos::HistoID HistoID ; 039 040 public: 041 042 /// Return the unique interface ID 043 static const InterfaceID& interfaceID() ; 044 045 public: 046 047 // ================================= 1D Histograms ======================================== 048 049 /** fill the 1D histogram (book on demand) 050 * 051 * @code 052 * 053 * const double mass = ... ; 054 * plot1D( mass , "Invariant Mass" , 2.5 , 3.5 , 100 ) 055 * 056 * @endcode 057 * 058 * - This example illustrates the filling of the histogram 059 * titled <tt>"InvariantMass"</tt> with value @c mass . 060 * - If the histogram with given title does not exist yet 061 * it will be automatically booked with parameters 062 * @c low equal to 2.5, parameters @c high equal to 3.5 063 * and @c bins equal to 100. 064 * 065 * The histogram will get a unique integer identifier automatically assigned. 066 * 067 * @see AIDA::IHistogram1D 068 * 069 * @param value value to be filled 070 * @param title histogram title (must be unique within the algorithm) 071 * @param low low limit for histogram 072 * @param high high limit for histogram 073 * @param bins number of bins 074 * @param weight weight 075 * @return pointer to AIDA 1D histogram 076 */ 077 virtual AIDA::IHistogram1D* plot1D 078 ( const double value , 079 const std::string& title , 080 const double low , 081 const double high , 082 const unsigned long bins = 100 , 083 const double weight = 1.0 ) const = 0 ; 084 085 /** fill the 1D histogram (book on demand) 086 * 087 * Wrapper method for the equivalent plot1D method. 088 * Retained for backwards compatibility, please use plot1D instead. 089 * 090 * @param value value to be filled 091 * @param title histogram title (must be unique within the algorithm) 092 * @param low low limit for histogram 093 * @param high high limit for histogram 094 * @param bins number of bins 095 * @param weight weight 096 * @return pointer to AIDA 1D histogram 097 */ 098 AIDA::IHistogram1D* plot 099 ( const double value , 100 const std::string& title , 101 const double low , 102 const double high , 103 const unsigned long bins = 100 , 104 const double weight = 1.0 ) const 105 { 106 return plot1D ( value, title, low, high, bins, weight ); 107 } 108 109 /** fill the 1D histogram with forced ID assignement (book on demand) 110 * 111 * @code 112 * 113 * const double mass = ... ; 114 * plot1D( mass , 15 , "Invariant Mass" , 2.5 , 3.5 , 100 ) 115 * 116 * @endcode 117 * 118 * - This example illustrates the filling of the 1D histogram ID=15 119 * titled <tt>"Invariant Mass"</tt> with value @c mass . 120 * - If the histogram with given ID does not exist yet 121 * it will be automatically booked with parameters 122 * @c low equal to 2.5, parameters @c high equal to 3.5 123 * and @c bins equal to 100. 124 * 125 * @attention 126 * If the histogram with given ID is already booked 127 * through automatic assignement of histogram ID, 128 * the error will not be detected. 129 * Therefore it is recommended 130 * to use non-trivial histogram ID offset (property "HistoOffSet") 131 * if one need to combine these techniques together 132 * It is still desirable to use the unique histogram title 133 * to avoid a bad interference. 134 * 135 * Note : This method is more efficient that the similar method without 136 * forced ID, since the histogram lookup is faster using a numerical ID. 137 * 138 * @see AIDA::IHistogram1D 139 * 140 * @param value value to be filled 141 * @param ID histogram identifier 142 * @param title histogram title (must be unique within the algorithm) 143 * @param low low limit for histogram 144 * @param high high limit for histogram 145 * @param bins number of bins 146 * @param weight weight 147 * @return pointer to AIDA histogram 148 */ 149 virtual AIDA::IHistogram1D* plot1D 150 ( const double value , 151 const HistoID& ID , 152 const std::string& title , 153 const double low , 154 const double high , 155 const unsigned long bins = 100 , 156 const double weight = 1.0 ) const = 0 ; 157 158 /** fill the 1D histogram with forced ID assignment (book on demand) 159 * 160 * Wrapper method for the equivalent plot1D method. 161 * Retained for backwards compatibility, please use plot1D instead. 162 * 163 * @param value value to be filled 164 * @param ID histogram identifier 165 * @param title histogram title (must be unique within the algorithm) 166 * @param low low limit for histogram 167 * @param high high limit for histogram 168 * @param bins number of bins 169 * @param weight weight 170 * @return pointer to AIDA histogram 171 */ 172 AIDA::IHistogram1D* plot 173 ( const double value , 174 const HistoID& ID , 175 const std::string& title , 176 const double low , 177 const double high , 178 const unsigned long bins = 100 , 179 const double weight = 1.0 ) const 180 { 181 return plot1D ( value, ID, title, low, high, bins, weight ); 182 }; 183 184 // ================================= 2D Histograms ======================================== 185 186 /** fill the 2D histogram (book on demand) 187 * 188 * @code 189 * 190 * const double mass1 = ... ; 191 * const double mass2 = ... ; 192 * plot2D( mass1, mass2, "Invariant Mass2 versus Mass1" ,2.5 ,3.5, 4.5, 5.5, 100, 200 ); 193 * 194 * @endcode 195 * 196 * - This example illustrates the filling of the 2D histogram 197 * titled <tt>"Invariant Mass2 versus Mass1"</tt> with values @c mass1 and @c mass2 . 198 * - If the histogram with given title does not exist yet 199 * it will be automatically booked with parameters 200 * @c lowX equal to 2.5, @c highX equal to 3.5, 201 * @c lowY equal to 4.5, @c highY equal to 5.5, 202 * @c binsX equal to 100 and @c binsY equal to 200. 203 * 204 * The histogram will get a unique integer identifier automatically assigned 205 * 206 * @see AIDA::IHistogram2D 207 * 208 * @param valueX x value to be filled 209 * @param valueY y value to be filled 210 * @param title histogram title (must be unique within the algorithm) 211 * @param lowX low x limit for histogram 212 * @param highX high x limit for histogram 213 * @param lowY low y limit for histogram 214 * @param highY high y limit for histogram 215 * @param binsX number of bins in x 216 * @param binsY number of bins in y 217 * @param weight weight 218 * @return pointer to AIDA 2D histogram 219 */ 220 virtual AIDA::IHistogram2D* plot2D 221 ( const double valueX , 222 const double valueY , 223 const std::string& title , 224 const double lowX , 225 const double highX , 226 const double lowY , 227 const double highY , 228 const unsigned long binsX = 50 , 229 const unsigned long binsY = 50 , 230 const double weight = 1.0 ) const = 0; 231 232 /** fill the 2D histogram with forced ID assignment (book on demand) 233 * 234 * @code 235 * 236 * const double mass1 = ... ; 237 * const double mass2 = ... ; 238 * plot2D( mass1, mass2, 15, "Invariant Mass2 versus Mass1" ,2.5 ,3.5, 4.5, 5.5, 100, 200 ); 239 * 240 * @endcode 241 * 242 * - This example illustrates the filling of the 2D histogram ID=15 243 * titled <tt>"Invariant Mass2 versus Mass1"</tt> with values @c mass1 and @c mass2 . 244 * - If the histogram with given title does not exist yet 245 * it will be automatically booked with parameters 246 * @c lowX equal to 2.5, @c highX equal to 3.5, 247 * @c lowY equal to 4.5, @c highY equal to 5.5, 248 * @c binsX equal to 100 and @c binsY equal to 200. 249 * 250 * @attention 251 * If the histogram with given ID is already booked 252 * through automatic assignment of histogram ID, 253 * the error will not be detected. 254 * Therefore it is recommended 255 * to use non-trivial histogram ID offset (property "HistoOffSet") 256 * if one need to combine these techniques together 257 * It is still desirable to use the unique histogram title 258 * to avoid a bad interference 259 * 260 * Note : This method is more efficient that the similar method without 261 * forced ID, since the histogram lookup is faster using a numerical ID. 262 * 263 * @see AIDA::IHistogram2D 264 * 265 * @param valueX x value to be filled 266 * @param valueY y value to be filled 267 * @param ID Histogram ID to use 268 * @param title histogram title (must be unique within the algorithm) 269 * @param lowX low x limit for histogram 270 * @param highX high x limit for histogram 271 * @param lowY low y limit for histogram 272 * @param highY high y limit for histogram 273 * @param binsX number of bins in x 274 * @param binsY number of bins in y 275 * @param weight weight 276 * @return pointer to AIDA 2D histogram 277 */ 278 virtual AIDA::IHistogram2D* plot2D 279 ( const double valueX , 280 const double valueY , 281 const HistoID& ID , 282 const std::string& title , 283 const double lowX , 284 const double highX , 285 const double lowY , 286 const double highY , 287 const unsigned long binsX = 50 , 288 const unsigned long binsY = 50 , 289 const double weight = 1.0 ) const = 0; 290 291 // ================================= 3D Histograms ======================================== 292 293 /** fill the 3D histogram (book on demand) 294 * 295 * @code 296 * 297 * const double mass1 = ... ; 298 * const double mass2 = ... ; 299 * const double mass3 = ... ; 300 * plot3D( X, Y, Z, "Space Points" ,2.5 ,3.5, 4.5, 5.5, 6.5, 7.5, 10, 20, 30 ); 301 * 302 * @endcode 303 * 304 * - This example illustrates the filling of the 3D histogram 305 * titled <tt>"Space Points"</tt> with values @c X, @c Y and @c Z. 306 * - If the histogram with given title does not exist yet 307 * it will be automatically booked with parameters 308 * @c lowX equal to 2.5, @c highX equal to 3.5, 309 * @c lowY equal to 4.5, @c highY equal to 5.5, 310 * @c lowZ equal to 6.5, @c highZ equal to 7.5, 311 * @c binsX equal to 10, @c binsY equal to 20 and @c binsZ equal to 30. 312 * 313 * The histogram will get a unique integer identifier automatically assigned 314 * 315 * @see AIDA::IHistogram3D 316 * 317 * @param valueX x value to be filled 318 * @param valueY y value to be filled 319 * @param valueZ z value to be filled 320 * @param title histogram title (must be unique within the algorithm) 321 * @param lowX low x limit for histogram 322 * @param highX high x limit for histogram 323 * @param lowY low y limit for histogram 324 * @param highY high y limit for histogram 325 * @param lowZ low z limit for histogram 326 * @param highZ high z limit for histogram 327 * @param binsX number of bins in x 328 * @param binsY number of bins in y 329 * @param binsZ number of bins in z 330 * @param weight weight 331 * @return pointer to AIDA 3D histogram 332 */ 333 virtual AIDA::IHistogram3D* plot3D 334 ( const double valueX , 335 const double valueY , 336 const double valueZ , 337 const std::string& title , 338 const double lowX , 339 const double highX , 340 const double lowY , 341 const double highY , 342 const double lowZ , 343 const double highZ , 344 const unsigned long binsX = 10 , 345 const unsigned long binsY = 10 , 346 const unsigned long binsZ = 10 , 347 const double weight = 1.0 ) const = 0; 348 349 /** fill the 3D histogram with forced ID assignment (book on demand) 350 * 351 * @code 352 * 353 * const double mass1 = ... ; 354 * const double mass2 = ... ; 355 * const double mass3 = ... ; 356 * plot3D( X, Y, Z, "Space Points" ,2.5 ,3.5, 4.5, 5.5, 6.5, 7.5, 10, 20, 30 ); 357 * 358 * @endcode 359 * 360 * - This example illustrates the filling of the 3D histogram 361 * titled <tt>"Space Points"</tt> with values @c X, @c Y and @c Z. 362 * - If the histogram with given title does not exist yet 363 * it will be automatically booked with parameters 364 * @c lowX equal to 2.5, @c highX equal to 3.5, 365 * @c lowY equal to 4.5, @c highY equal to 5.5, 366 * @c lowZ equal to 6.5, @c highZ equal to 7.5, 367 * @c binsX equal to 10, @c binsY equal to 20 and @c binsZ equal to 30. 368 * 369 * @attention 370 * If the histogram with given ID is already booked 371 * through automatic assignment of histogram ID, 372 * the error will not be detected. 373 * Therefore it is recommended 374 * to use non-trivial histogram ID offset (property "HistoOffSet") 375 * if one need to combine these techniques together 376 * It is still desirable to use the unique histogram title 377 * to avoid a bad interference 378 * 379 * Note : This method is more efficient that the similar method without 380 * forced ID, since the histogram lookup is faster using a numerical ID. 381 * 382 * @see AIDA::IHistogram3D 383 * 384 * @param valueX x value to be filled 385 * @param valueY y value to be filled 386 * @param valueZ z value to be filled 387 * @param ID Histogram ID to use 388 * @param title histogram title (must be unique within the algorithm) 389 * @param lowX low x limit for histogram 390 * @param highX high x limit for histogram 391 * @param lowY low y limit for histogram 392 * @param highY high y limit for histogram 393 * @param lowZ low z limit for histogram 394 * @param highZ high z limit for histogram 395 * @param binsX number of bins in x 396 * @param binsY number of bins in y 397 * @param binsZ number of bins in z 398 * @param weight weight 399 * @return pointer to AIDA 3D histogram 400 */ 401 virtual AIDA::IHistogram3D* plot3D 402 ( const double valueX , 403 const double valueY , 404 const double valueZ , 405 const HistoID& ID , 406 const std::string& title , 407 const double lowX , 408 const double highX , 409 const double lowY , 410 const double highY , 411 const double lowZ , 412 const double highZ , 413 const unsigned long binsX = 10 , 414 const unsigned long binsY = 10 , 415 const unsigned long binsZ = 10 , 416 const double weight = 1.0 ) const = 0; 417 418 public: 419 420 /** book the 1D histogram 421 * 422 * The histogram will be assigned a unique identifier 423 * 424 * @see IHistogram1D 425 * @param title histogram title (must be unique within the algorithm) 426 * @param low low limit for histogram 427 * @param high high limit for histogram 428 * @param bins number of bins 429 * @return pointer to AIDA 1D histogram 430 */ 431 virtual AIDA::IHistogram1D* book1D 432 ( const std::string& title , 433 const double low = 0 , 434 const double high = 100 , 435 const unsigned long bins = 100 ) const = 0 ; 436 437 /** book the 1D histogram 438 * 439 * Wrapper method for the equivalent book1D method. 440 * Retained for backwards compatibility, please use book1D instead. 441 * 442 * @see IHistogram1D 443 * @param title histogram title (must be unique within the algorithm) 444 * @param low low limit for histogram 445 * @param high high limit for histogram 446 * @param bins number of bins 447 * @return pointer to AIDA 1D histogram 448 */ 449 AIDA::IHistogram1D* book 450 ( const std::string& title , 451 const double low = 0 , 452 const double high = 100 , 453 const unsigned long bins = 100 ) const 454 { 455 return book1D( title, low, high, bins ); 456 } 457 458 /** book the 2D histogram 459 * 460 * The histogram will be assigned a unique identifier 461 * 462 * @see IHistogram2D 463 * @param title histogram title (must be unique within the algorithm) 464 * @param lowX low x limit for histogram 465 * @param highX high x limit for histogram 466 * @param binsX number of bins in x 467 * @param lowY low y limit for histogram 468 * @param highY high y limit for histogram 469 * @param binsY number of bins in y 470 * @return pointer to AIDA 2D histogram 471 */ 472 virtual AIDA::IHistogram2D* book2D 473 ( const std::string& title , 474 const double lowX = 0 , 475 const double highX = 100 , 476 const unsigned long binsX = 50 , 477 const double lowY = 0 , 478 const double highY = 100 , 479 const unsigned long binsY = 50 ) const = 0; 480 481 /** book the 3D histogram 482 * 483 * The histogram will be assigned a unique identifier 484 * 485 * @see IHistogram3D 486 * @param title histogram title (must be unique within the algorithm) 487 * @param lowX low x limit for histogram 488 * @param highX high x limit for histogram 489 * @param binsX number of bins in x 490 * @param lowY low y limit for histogram 491 * @param highY high y limit for histogram 492 * @param binsY number of bins in y 493 * @param lowZ low y limit for histogram 494 * @param highZ high y limit for histogram 495 * @param binsZ number of bins in y 496 * @return pointer to AIDA 3D histogram 497 */ 498 virtual AIDA::IHistogram3D* book3D 499 ( const std::string& title , 500 const double lowX = 0 , 501 const double highX = 100 , 502 const unsigned long binsX = 10 , 503 const double lowY = 0 , 504 const double highY = 100 , 505 const unsigned long binsY = 10 , 506 const double lowZ = 0 , 507 const double highZ = 100 , 508 const unsigned long binsZ = 10 ) const = 0; 509 510 /** book the 1D histogram with forced ID 511 * 512 * @see IHistogram1D 513 * @param ID unique histogram ID 514 * @param title histogram title (must be unique within the algorithm) 515 * @param low low limit for histogram 516 * @param high high limit for histogram 517 * @param bins number of bins 518 * @return pointer to AIDA histogram 519 */ 520 virtual AIDA::IHistogram1D* book1D 521 ( const HistoID& ID , 522 const std::string& title = "" , 523 const double low = 0 , 524 const double high = 100 , 525 const unsigned long bins = 100 ) const = 0 ; 526 527 /** book the 1D histogram with forced ID 528 * 529 * Wrapper method for the equivalent book1D method. 530 * Retained for backwards compatibility, please use book1D instead. 531 * 532 * @see IHistogram1D 533 * @param ID unique histogram ID 534 * @param title histogram title (must be unique within the algorithm) 535 * @param low low limit for histogram 536 * @param high high limit for histogram 537 * @param bins number of bins 538 * @return pointer to AIDA histogram 539 */ 540 AIDA::IHistogram1D* book 541 ( const HistoID& ID , 542 const std::string& title = "" , 543 const double low = 0 , 544 const double high = 100 , 545 const unsigned long bins = 100 ) const 546 { 547 return book1D( ID, title, low, high, bins ); 548 } 549 550 /** book the 2D histogram with forced ID 551 * 552 * @see IHistogram2D 553 * @param ID unique histogram ID 554 * @param title histogram title (must be unique within the algorithm) 555 * @param low low limit for histogram 556 * @param high high limit for histogram 557 * @param bins number of bins 558 * @return pointer to AIDA histogram 559 */ 560 virtual AIDA::IHistogram2D* book2D 561 ( const HistoID& ID , 562 const std::string& title , 563 const double lowX = 0 , 564 const double highX = 100 , 565 const unsigned long binsX = 100 , 566 const double lowY = 0 , 567 const double highY = 100 , 568 const unsigned long binsY = 100 ) const = 0; 569 570 /** book the 3D histogram with forced ID 571 * 572 * @see IHistogram3D 573 * @param ID unique histogram ID 574 * @param title histogram title (must be unique within the algorithm) 575 * @param lowX low x limit for histogram 576 * @param highX high x limit for histogram 577 * @param binsX number of bins in x 578 * @param lowY low y limit for histogram 579 * @param highY high y limit for histogram 580 * @param binsY number of bins in y 581 * @param lowZ low y limit for histogram 582 * @param highZ high y limit for histogram 583 * @param binsZ number of bins in y 584 * @return pointer to AIDA 3D histogram 585 */ 586 virtual AIDA::IHistogram3D* book3D 587 ( const HistoID& ID , 588 const std::string& title , 589 const double lowX = 0 , 590 const double highX = 100 , 591 const unsigned long binsX = 10 , 592 const double lowY = 0 , 593 const double highY = 100 , 594 const unsigned long binsY = 10 , 595 const double lowZ = 0 , 596 const double highZ = 100 , 597 const unsigned long binsZ = 10 ) const = 0; 598 599 /** fill the 1D histo with the value and weight 600 * @param histo 1D histogram to be filled 601 * @param value value to be put into the histogram 602 * @param weight weight to be used 603 * @param title histogram title (to be used for error report) 604 * @return pointer to AIDA 1D histogram 605 */ 606 virtual AIDA::IHistogram1D* fill 607 ( AIDA::IHistogram1D* histo , 608 const double value , 609 const double weight , 610 const std::string& title = "") const = 0 ; 611 612 /** fill the 2D histo with the value and weight 613 * @param histo 2D histogram to be filled 614 * @param valueX x value to be put into the histogram 615 * @param valueY y value to be put into the histogram 616 * @param weight weight to be used 617 * @param title histogram title (to be used for error report) 618 * @return pointer to AIDA 2D histogram 619 */ 620 virtual AIDA::IHistogram2D* fill 621 ( AIDA::IHistogram2D* histo , 622 const double valueX , 623 const double valueY , 624 const double weight , 625 const std::string& title = "" ) const = 0 ; 626 627 /** fill the 3D histo with the value and weight 628 * @param histo 3D histogram to be filled 629 * @param valueX x value to be put into the histogram 630 * @param valueY y value to be put into the histogram 631 * @param valueZ z value to be put into the histogram 632 * @param weight weight to be used 633 * @param title histogram title (to be used for error report) 634 * @return pointer to AIDA 3D histogram 635 */ 636 virtual AIDA::IHistogram3D* fill 637 ( AIDA::IHistogram3D* histo , 638 const double valueX , 639 const double valueY , 640 const double valueZ , 641 const double weight , 642 const std::string& title = "" ) const = 0 ; 643 644 /** access the EXISTING 1D histogram by title 645 * return the pointer to existing 1D histogram or NULL 646 */ 647 virtual AIDA::IHistogram1D* histo1D ( const std::string& title ) const = 0 ; 648 649 /** access the EXISTING 1D histogram by title 650 * 651 * Wrapper method for the equivalent histo1D method. 652 * Retained for backwards compatibility, please use histo1D instead. 653 * 654 * return the pointer to existing 1D histogram or NULL 655 */ 656 AIDA::IHistogram1D* histo ( const std::string& title ) const 657 { 658 return histo1D( title ); 659 }; 660 661 /** access the EXISTING 2D histogram by title 662 * return the pointer to existing 2D histogram or NULL 663 */ 664 virtual AIDA::IHistogram2D* histo2D ( const std::string& title ) const = 0; 665 666 667 /** access the EXISTING 3D histogram by title 668 * return the pointer to existing 3D histogram or NULL 669 */ 670 virtual AIDA::IHistogram3D* histo3D ( const std::string& title ) const = 0; 671 672 /** access the EXISTING 1D histogram by ID 673 * return the pointer to existing 1D histogram or NULL 674 */ 675 virtual AIDA::IHistogram1D* histo1D ( const HistoID& ID ) const = 0 ; 676 677 /** access the EXISTING 1D histogram by ID 678 * 679 * Wrapper method for the equivalent histo1D method. 680 * Retained for backwards compatibility, please use histo1D instead. 681 * 682 * return the pointer to existing 1D histogram or NULL 683 */ 684 AIDA::IHistogram1D* histo ( const HistoID& ID ) const 685 { 686 return histo1D( ID ); 687 }; 688 689 /** access the EXISTING 2D histogram by ID 690 * return the pointer to existing 2D histogram or NULL 691 */ 692 virtual AIDA::IHistogram2D* histo2D ( const HistoID& ID ) const = 0; 693 694 /** access the EXISTING 3D histogram by ID 695 * return the pointer to existing 3D histogram or NULL 696 */ 697 virtual AIDA::IHistogram3D* histo3D ( const HistoID& ID ) const = 0; 698 699 /// check the existence AND validity of the histogram with given title 700 virtual bool histoExists ( const std::string& title ) const = 0 ; 701 702 /// check the existence AND validity of the histogram with given title 703 virtual bool histoExists ( const HistoID& ID ) const = 0 ; 704 705 public: // non-virtual methods 706 707 /** fill the 1D histogram with information from 708 * [first,last) sequence 709 * 710 * @code 711 * 712 * std::vector<double> v = ... ; 713 * 714 * plot( sin , // function 715 * v.begin() , v.end() , // sequence 716 * " bla-bla " , // title 717 * -1. , 1.0 , // low and high limits 718 * 100 ) // number of bins 719 * 720 * @endcode 721 * 722 * The histogram will get a unique integer identifier automatically assigned 723 * 724 * Sequence, objects and function can be non-trivial: 725 * @code 726 * 727 * Particles* p = ... ; 728 * 729 * plot( PT , // function 730 * p->begin() , p->end() , // sequence 731 * " bla-bla " , // title 732 * -1. , 1.0 , // low and high limits 733 * 100 ) ; // number of bins 734 * 735 * @endcode 736 * where <c>PT</c> can be any function or function object 737 * for which the expression <c>PT(p)</c> , with <c>p</c> of type 738 * <c>Particle*</c> have some sense and can be evaluated to 739 * the values, which is convertible to <c>double</c> 740 * 741 * Note : These plot methods using iterator ranges are more efficient than 742 * the simplier "value" only methods, since the associated histogram 743 * only requires locating from internal storage once per loop, as opposed 744 * to once per fill for the simplier functions. It is recommended to use 745 * these whenever possible. 746 * 747 * @see AIDA::IHistogram1D 748 * @param func function to be plotted 749 * @param first begin of the sequence 750 * @param last end of the sequence 751 * @param title histogram title 752 * @param low low limit for histogram 753 * @param high high limit for histogram 754 * @param bins number of bins for histogram 755 */ 756 template <class FUNCTION,class OBJECT> 757 AIDA::IHistogram1D* plot 758 ( const FUNCTION& func , 759 OBJECT first , 760 OBJECT last , 761 const std::string& title , 762 const double low , 763 const double high , 764 const unsigned long bins = 100 ) const 765 { 766 // retrieve or book the histogram 767 AIDA::IHistogram1D* h = histo1D ( title ) ; 768 if ( 0 == h ) { h = book1D ( title , low , high , bins ); } 769 while ( first != last && 0 != h ) 770 { h = fill ( h , func( *first ) , 1.0 , title ) ; ++first ; } 771 return h ; 772 }; 773 774 /** fill the 1D histogram with forced ID and information from 775 * [first,last) sequence 776 * 777 * @code 778 * 779 * std::vector<double> v = ... ; 780 * 781 * plot( sin , // function 782 * v.begin() , v.end() , // sequence 783 * 100 , " bla-bla " , // ID and title 784 * -1. , 1.0 , // low and high limits 785 * 100 ); // number of bins 786 * 787 * @endcode 788 * 789 * Sequence, objects and function can be non-trivial: 790 * 791 * @code 792 * 793 * Particles* p = ... ; 794 * 795 * plot( PT , // function 796 * p->begin() , p->end() , // sequence 797 * 100 , " bla-bla " , // ID and title 798 * -1. , 1.0 , // low and high limits 799 * 100 ) ; // number of bins 800 * 801 * @endcode 802 * 803 * Note : These plot methods using iterator ranges are more efficient than 804 * the simplier "value" only methods, since the associated histogram 805 * only requires locating from internal storage once per loop, as opposed 806 * to once per fill for the simplier functions. It is recommended to use 807 * these whenever possible. 808 * 809 * Note : This method is more efficient that the similar method without 810 * forced ID, since the histogram lookup is faster using a numerical ID. 811 * 812 * @see AIDA::IHistogram1D 813 * 814 * @param func function to be plotted 815 * @param first begin of the sequence 816 * @param last end of the sequence 817 * @param ID histogram identifier 818 * @param title histogram title 819 * @param low low limit for histogram 820 * @param high high limit for histogram 821 * @param bins number of bins for histogram 822 */ 823 template <class FUNCTION,class OBJECT> 824 AIDA::IHistogram1D* plot 825 ( const FUNCTION& func , 826 OBJECT first , 827 OBJECT last , 828 const HistoID& ID , 829 const std::string& title , 830 const double low , 831 const double high , 832 const unsigned long bins = 100 ) const 833 { 834 // retrieve or book the histogram 835 AIDA::IHistogram1D* h = histo1D ( ID ) ; 836 if ( 0 == h ) { h = book1D ( ID , title , low , high , bins ); } 837 while ( first != last && 0 != h ) 838 { h = fill( h , func( *first ) , 1.0 , title ) ; ++first ; } 839 return h ; 840 }; 841 842 /** book and fill the 1D histogram with information from 843 * [first,last) sequence with given weight 844 * 845 * @code 846 * 847 * std::vector<double> v = ... ; 848 * 849 * plot( sin , // function 850 * v.begin() , v.end() , // sequence 851 * " bla-bla " , // title 852 * -1. , 1.0 , // low and high limits 853 * 100 , // number of bins 854 * tanh ); // weight function 855 * 856 * @endcode 857 * 858 * The histogram will get a unique integer identifier automatically assigned 859 * 860 * Sequence, objects and function can be non-trivial: 861 * @code 862 * 863 * Particles* p = ... ; 864 * 865 * plot( PT , // function 866 * p->begin() , p->end() , // sequence 867 * " bla-bla " , // title 868 * -1. , 1.0 , // low and high limits 869 * 100 , // number of bins 870 * MASS ) ; // weight function 871 * 872 * @endcode 873 * where <c>PT</c> and <c>MASS</c> can be any function 874 * or function object 875 * for which the expressions <c>PT(p)</c> and 876 * <c>MASS</c> with <c>p</c> of type 877 * <c>Particle*</c> have some sense and can be evaluated to 878 * the values, which is convertible to <c>double</c> 879 * 880 * Note : These plot methods using iterator ranges are more efficient than 881 * the simplier "value" only methods, since the associated histogram 882 * only requires locating from internal storage once per loop, as opposed 883 * to once per fill for the simplier functions. It is recommended to use 884 * these whenever possible. 885 * 886 * @see AIDA::IHistogram1D 887 * @param first begin of the sequence 888 * @param last end of the sequence 889 * @param title histogram title 890 * @param func function to be plotted 891 * @param low low limit for histogram 892 * @param high high limit for histogram 893 * @param bins number of bins for histogram 894 * @param weight weight function 895 */ 896 template <class FUNCTION,class OBJECT,class WEIGHT> 897 AIDA::IHistogram1D* plot 898 ( const FUNCTION& func , 899 OBJECT first , 900 OBJECT last , 901 const std::string& title , 902 const double low , 903 const double high , 904 const unsigned long bins , 905 const WEIGHT& weight ) const 906 { 907 // retrieve or book the histogram 908 AIDA::IHistogram1D* h = histo1D ( title ) ; 909 if ( 0 == h ) { h = book1D ( title , low , high , bins ); } 910 while( first != last && 0 != h ) 911 { h = fill ( h , 912 func ( *first ) , 913 weight ( *first ) , title ) ; ++first ; } 914 return h ; 915 }; 916 917 /** book and fill the 1D histogram with forced ID and information from 918 * [first,last) sequence with given weight 919 * 920 * @code 921 * 922 * std::vector<double> v = ... ; 923 * 924 * plot( sin , // function 925 * v.begin() , v.end() , // sequence 926 * 100 , " bla-bla " , // ID and title 927 * -1. , 1.0 , // low and high limits 928 * 100 , // number of bins 929 * sinh ); // weight function 930 * 931 * @endcode 932 * 933 * @attention no checks for NaN and Finite is performed! 934 * 935 * Sequence, objects and function can be non-trivial: 936 * 937 * @code 938 * 939 * Particles* p = ... ; 940 * 941 * plot( PT , // function 942 * p->begin() , p->end() , // sequence 943 * 100 , " bla-bla " , // ID and title 944 * -1. , 1.0 , // low and high limits 945 * 100 , // number of bins 946 * MASS ) ; // weight function 947 * 948 * @endcode 949 * where <c>PT</c> and <c>MASS</c> can be any function 950 * or function object 951 * for which the expressions <c>PT(p)</c> and 952 * <c>MASS</c> with <c>p</c> of type 953 * <c>Particle*</c> have some sense and can be evaluated to 954 * the values, which is convertible to <c>double</c> 955 * 956 * Note : These plot methods using iterator ranges are more efficient than 957 * the simplier "value" only methods, since the associated histogram 958 * only requires locating from internal storage once per loop, as opposed 959 * to once per fill for the simplier functions. It is recommended to use 960 * these whenever possible. 961 * 962 * Note : This method is more efficient that the similar method without 963 * forced ID, since the histogram lookup is faster using a numerical ID. 964 * 965 * @see AIDA::IHistogram1D 966 * @param first begin of the sequence 967 * @param last end of the sequence 968 * @param ID histogram identifier 969 * @param title histogram title 970 * @param func function to be plotted 971 * @param low low limit for histogram 972 * @param high high limit for histogram 973 * @param bins number of bins for histogram 974 * @param weight weight function 975 */ 976 template <class FUNCTION,class OBJECT,class WEIGHT> 977 AIDA::IHistogram1D* plot 978 ( const FUNCTION& func , 979 OBJECT first , 980 OBJECT last , 981 const HistoID& ID , 982 const std::string& title , 983 const double low , 984 const double high , 985 const unsigned long bins , 986 const WEIGHT& weight ) const 987 { 988 // retrieve or book the histogram 989 AIDA::IHistogram1D* h = histo1D ( ID ) ; 990 if ( 0 == h ) { h = book1D ( ID , title , low , high , bins ); } 991 while( first != last && 0 != h ) 992 { h = fill ( h , 993 func ( *first ) , 994 weight ( *first ) , title ) ; ++first ; } 995 return h ; 996 }; 997 998 protected: 999 1000 virtual ~IHistoTool() ; 1001 1002 }; 1003 1004 #endif // GAUDIALG_IHISTOTOOL_H 1005
| [ source navigation ] | [ diff markup ] | [ identifier search ] | [ general search ] |
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems | |
| This page was automatically generated by the LXR engine. |
|