| 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: GaudiHistos.h,v 1.11 2008/10/27 19:22:20 marcocle Exp $ 002 // ============================================================================ 003 #ifndef GAUDIALG_GAUDIHISTOS_H 004 #define GAUDIALG_GAUDIHISTOS_H 1 005 // ============================================================================ 006 /* @file GaudiHistos.h 007 * 008 * Header file for class : GaudiHistos 009 * 010 * @author Chris Jones Christopher.Rob.Jones@cern.ch 011 * @author Vanya BELYAEV Ivan.Belyaev@itep.ru 012 * @date 2005-08-08 013 */ 014 // ============================================================================ 015 // Include files# 016 // ============================================================================ 017 // STD& STL 018 // ============================================================================ 019 #include <limits> 020 // ============================================================================ 021 // GaudiKernel 022 // ============================================================================ 023 #include "GaudiKernel/HistoProperty.h" 024 // ============================================================================ 025 // GaudiAlg 026 // ============================================================================ 027 #include "GaudiAlg/Maps.h" 028 #include "GaudiAlg/HbookName.h" 029 // ============================================================================ 030 // Forward declarations 031 namespace AIDA 032 { 033 class IHistogram1D; 034 class IHistogram2D; 035 class IHistogram3D; 036 class IProfile1D; 037 class IProfile2D; 038 } 039 // ============================================================================ 040 /** @class GaudiHistos GaudiHistos.h GaudiAlg/GaudiHistos.h 041 * 042 * Templated base class providing common histogramming methods for 043 * GaudiAlgorithm and GaudiTool like classes. 044 * 045 * @author Chris Jones Christopher.Rob.Jones@cern.ch 046 * @author Vanya BELYAEV Ivan.Belyaev@itep.ru 047 * @date 2005-08-08 048 */ 049 template <class PBASE> 050 class GaudiHistos : public PBASE 051 { 052 public: 053 // ========================================================================== 054 /// the actual type for histogram identifier 055 typedef GaudiAlg::HistoID HistoID; 056 // ========================================================================== 057 /// the actual type for (Numeric ID)->(1D histogram) mapping 058 typedef GaudiAlg::Histo1DMapNumericID Histo1DMapNumID; 059 /// the actual type for (Literal ID)->(1D histogram) mapping 060 typedef GaudiAlg::Histo1DMapLiteralID Histo1DMapLitID; 061 /// the actual type for title->(1D histogram) mapping 062 typedef GaudiAlg::Histo1DMapTitle Histo1DMapTitle; 063 // ========================================================================== 064 /// the actual type for (Numeric ID)->(2D histogram) mapping 065 typedef GaudiAlg::Histo2DMapNumericID Histo2DMapNumID; 066 /// the actual type for (Literal ID)->(2D histogram) mapping 067 typedef GaudiAlg::Histo2DMapLiteralID Histo2DMapLitID; 068 /// the actual type for title->(2D histogram) mapping 069 typedef GaudiAlg::Histo2DMapTitle Histo2DMapTitle; 070 // ========================================================================== 071 /// the actual type for (Numeric ID)->(3D histogram) mapping 072 typedef GaudiAlg::Histo3DMapNumericID Histo3DMapNumID; 073 /// the actual type for (Literal ID)->(3D histogram) mapping 074 typedef GaudiAlg::Histo3DMapLiteralID Histo3DMapLitID; 075 /// the actual type for title->(3D histogram) mapping 076 typedef GaudiAlg::Histo3DMapTitle Histo3DMapTitle; 077 // ========================================================================== 078 /// the actual type for (Numeric ID)->(1D profile histogram) mapping 079 typedef GaudiAlg::Profile1DMapNumericID Profile1DMapNumID; 080 /// the actual type for (Literal ID)->(1D profile histogram) mapping 081 typedef GaudiAlg::Profile1DMapLiteralID Profile1DMapLitID; 082 /// the actual type for title->(1D profile histogram) mapping 083 typedef GaudiAlg::Profile1DMapTitle Profile1DMapTitle; 084 // ========================================================================== 085 /// the actual type for (Numeric ID)->(2D profile histogram) mapping 086 typedef GaudiAlg::Profile2DMapNumericID Profile2DMapNumID; 087 /// the actual type for (Literal ID)->(2D profile histogram) mapping 088 typedef GaudiAlg::Profile2DMapLiteralID Profile2DMapLitID; 089 /// the actual type for title->(2D profile histogram) mapping 090 typedef GaudiAlg::Profile2DMapTitle Profile2DMapTitle; 091 // ========================================================================== 092 public: 093 // ========================================================================== 094 // ================================= 1D Histograms ========================== 095 // ========================================================================== 096 /** fill the 1D histogram (book on demand) 097 * 098 * @code 099 * 100 * const double mass = ... ; 101 * plot1D( mass , "Invariant Mass" , 2.5 , 3.5 , 100 ) 102 * 103 * @endcode 104 * 105 * This example illustrates the filling of the histogram 106 * titled <tt>"InvariantMass"</tt> with value @c mass . 107 * 108 * If the histogram with given title does not exist yet 109 * it will be automatically booked with parameters 110 * @c low equal to 2.5, parameters @c high equal to 3.5 111 * and @c bins equal to 100. 112 * 113 * @attention 114 * The histogram will get a unique identifier automatically assigned which by 115 * default will be equal to the histogram title. An option exists to instead 116 * use numerical IDs. In this case the first histogram booked will be ID=1 the 117 * next ID=2 and so on. Note though this scheme is not recommended as it does 118 * NOT guarantee predictability of the ID a given histogram will be given when 119 * filled under conditional statements, since in these circumstances the order 120 * in which the histograms are first filled, and thus booked, will depend on the 121 * nature of the first few events read. This is particularly problematic when 122 * users submit many parallel 'sub-jobs' and then attempt to merge the final 123 * output ROOT (or HBOOK) files, since a given histogram could have different IDs 124 * in each of the sub-jobs. Consequently it is strongly recommended that users do 125 * not use numerical automatic IDs unless they are sure they understand what they 126 * are doing. 127 * 128 * @see AIDA::IHistogram1D 129 * 130 * @param value value to be filled 131 * @param title histogram title (must be unique within the algorithm) 132 * @param low low limit for histogram 133 * @param high high limit for histogram 134 * @param bins number of bins 135 * @param weight weight 136 * @return pointer to AIDA 1D histogram 137 */ 138 AIDA::IHistogram1D* plot1D 139 ( const double value , 140 const std::string& title , 141 const double low , 142 const double high , 143 const unsigned long bins = 100 , 144 const double weight = 1.0 ) const ; 145 // ========================================================================== 146 /** fill the 1D histogram (book on demand) 147 * 148 * Wrapper method for the equivalent plot1D method. 149 * Retained for backwards compatibility, please use plot1D instead. 150 * 151 * @param value value to be filled 152 * @param title histogram title (must be unique within the algorithm) 153 * @param low low limit for histogram 154 * @param high high limit for histogram 155 * @param bins number of bins 156 * @param weight weight 157 * @return pointer to AIDA 1D histogram 158 */ 159 inline AIDA::IHistogram1D* plot 160 ( const double value , 161 const std::string& title , 162 const double low , 163 const double high , 164 const unsigned long bins = 100 , 165 const double weight = 1.0 ) const 166 { 167 return plot1D ( value, title, low, high, bins, weight ); 168 } 169 // ========================================================================== 170 /** fill the 1D histogram (book on demand) 171 * 172 * @code 173 * 174 * /// get the histogram descriptor: 175 * const Gaudi::Histo1DDef& hdef = ... ; 176 * 177 * const double mass = ... ; 178 * plot ( mass , hdef ) ; 179 * 180 * @endcode 181 * 182 * The histogram will get a unique identifier automatically assigned which by 183 * default will be equal to the histogram title. 184 * 185 * The histogram descriptor comes e.g. from the component properties. 186 * 187 * @see AIDA::IHistogram1D 188 * 189 * @param value value to be filled 190 * @param hdef histogram descriptor 191 * @param low low limit for histogram 192 * @param high high limit for histogram 193 * @param bins number of bins 194 * @param weight weight 195 * @return pointer to AIDA 1D histogram 196 */ 197 AIDA::IHistogram1D* plot 198 ( const double value , 199 const Gaudi::Histo1DDef& hdef , 200 const double weight = 1.0 ) const ; 201 // ========================================================================== 202 /** fill the 1D histogram with forced ID assignment (book on demand) 203 * 204 * @code 205 * 206 * const double mass = ... ; 207 * plot1D( mass , 15 , "Invariant Mass" , 2.5 , 3.5 , 100 ) 208 * 209 * @endcode 210 * 211 * This example illustrates the filling of the 1D histogram ID=15 212 * titled <tt>"Invariant Mass"</tt> with value @c mass . 213 * 214 * If the histogram with given ID does not exist yet 215 * it will be automatically booked with parameters 216 * @c low equal to 2.5, parameters @c high equal to 3.5 217 * and @c bins equal to 100. 218 * 219 * It is also possible to use literal IDs. For example :- 220 * 221 * @code 222 * 223 * const double mass = ... ; 224 * plot1D( mass , "mass" , "Invariant Mass" , 2.5 , 3.5 , 100 ) 225 * 226 * @endcode 227 * 228 * Will book the same histogram, using the id "mass". 229 * 230 * It is also possible using literal IDs, to place histograms in 231 * sub-directories from the main histogram directory, using for 232 * example :- 233 * 234 * @code 235 * 236 * const double mass = ... ; 237 * plot1D( mass , "subdir/mass" , "Invariant Mass" , 2.5 , 3.5 , 100 ) 238 * 239 * @endcode 240 * 241 * Which will create the histogram "mass" in the sub-directory "subdir". 242 * Histograms can also be created in sub-directories with numeric IDs if 243 * IDs such as "subdir/1" are used. 244 * 245 * @attention 246 * If the histogram with given ID is already booked 247 * through automatic assignment of histogram ID, 248 * the error will not be detected. 249 * Therefore it is recommended 250 * to use non-trivial histogram ID offset (property "HistoOffSet") 251 * if one need to combine these techniques together. 252 * It is still desirable to use the unique histogram title 253 * to avoid a bad interference. 254 * 255 * @see AIDA::IHistogram1D 256 * 257 * @param value value to be filled 258 * @param ID histogram identifier 259 * @param title histogram title (must be unique within the algorithm) 260 * @param low low limit for histogram 261 * @param high high limit for histogram 262 * @param bins number of bins 263 * @param weight weight 264 * @return pointer to AIDA 1D histogram 265 */ 266 // ========================================================================== 267 AIDA::IHistogram1D* plot1D 268 ( const double value , 269 const HistoID& ID , 270 const std::string& title , 271 const double low , 272 const double high , 273 const unsigned long bins = 100 , 274 const double weight = 1.0 ) const ; 275 // ========================================================================== 276 /** fill the 1D histogram with forced ID assignment (book on demand) 277 * 278 * Wrapper method for the equivalent plot1D method. 279 * Retained for backwards compatibility, please use plot1D instead. 280 * 281 * @param value value to be filled 282 * @param ID histogram identifier 283 * @param title histogram title (must be unique within the algorithm) 284 * @param low low limit for histogram 285 * @param high high limit for histogram 286 * @param bins number of bins 287 * @param weight weight 288 * @return pointer to AIDA 1D histogram 289 */ 290 inline AIDA::IHistogram1D* plot 291 ( const double value , 292 const HistoID& ID , 293 const std::string& title , 294 const double low , 295 const double high , 296 const unsigned long bins = 100 , 297 const double weight = 1.0 ) const 298 { 299 return plot1D ( value, ID, title, low, high, bins, weight ); 300 } 301 // ========================================================================== 302 /** fill the 1D histogram with forced ID assignment (book on demand) 303 * 304 * @code 305 * 306 * // get the histogram descriptor 307 * const Gaudi::Histo1DDef& hdef = ... ; 308 * 309 * // get the histogram ID 310 * const HistoID ID = ... ; 311 * 312 * const double mass = ... ; 313 * plot ( mass , ID , hdef ) 314 * 315 * @endcode 316 * 317 * @see AIDA::IHistogram1D 318 * 319 * The histogram descriptor comes e.g. from component properties 320 * 321 * @param value value to be filled 322 * @param ID histogram identifier 323 * @param hdef histogram descriptor 324 * @return pointer to AIDA 1D histogram 325 */ 326 AIDA::IHistogram1D* plot 327 ( const double value , 328 const HistoID& ID , 329 const Gaudi::Histo1DDef& hdef , 330 const double weight = 1.0 ) const ; 331 // ========================================================================== 332 /** fill the 1D histogram with information from 333 * [first,last) sequence 334 * 335 * @code 336 * 337 * std::vector<double> v = ... ; 338 * 339 * plot( sin , // function 340 * v.begin() , v.end() , // sequence 341 * " bla-bla " , // title 342 * -1. , 1.0 , // low and high limits 343 * 100 ) // number of bins 344 * 345 * @endcode 346 * 347 * @attention 348 * The histogram will get a unique identifier automatically assigned which by 349 * default will be equal to the histogram title. An option exists to instead 350 * use numerical IDs. In this case the first histogram booked will be ID=1 the 351 * next ID=2 and so on. Note though this scheme is not recommended as it does 352 * NOT guarantee predictability of the ID a given histogram will be given when 353 * filled under conditional statements, since in these circumstances the order 354 * in which the histograms are first filled, and thus booked, will depend on the 355 * nature of the first few events read. This is particularly problematic when 356 * users submit many parallel 'sub-jobs' and then attempt to merge the final 357 * output ROOT (or HBOOK) files, since a given histogram could have different IDs 358 * in each of the sub-jobs. Consequently it is strongly recommended that users do 359 * not use numerical automatic IDs unless they are sure they understand what they 360 * are doing. 361 * 362 * Sequence, objects and function can be non-trivial: 363 * @code 364 * 365 * Particles* p = ... ; 366 * 367 * plot( PT , // function 368 * p->begin() , p->end() , // sequence 369 * " bla-bla " , // title 370 * -1. , 1.0 , // low and high limits 371 * 100 ) ; // number of bins 372 * 373 * @endcode 374 * where <c>PT</c> can be any function or function object 375 * for which the expression <c>PT(p)</c> , with <c>p</c> of type 376 * <c>Particle*</c> have some sense and can be evaluated to 377 * the values, which is convertible to <c>double</c> 378 * 379 * @attention 380 * These plot methods using iterator ranges are more efficient than 381 * the simplier "value" only methods, since the associated histogram 382 * only requires locating from internal storage once per loop, as opposed 383 * to once per fill for the simplier functions. It is recommended to use 384 * these whenever possible. 385 * 386 * @see AIDA::IHistogram1D 387 * @param func function to be plotted 388 * @param first begin of the sequence 389 * @param last end of the sequence 390 * @param title histogram title 391 * @param low low limit for histogram 392 * @param high high limit for histogram 393 * @param bins number of bins for histogram 394 */ 395 template <class FUNCTION,class OBJECT> 396 inline AIDA::IHistogram1D* plot 397 ( const FUNCTION& func , 398 OBJECT first , 399 OBJECT last , 400 const std::string& title , 401 const double low , 402 const double high , 403 const unsigned long bins = 100 ) const 404 { 405 AIDA::IHistogram1D* h(0); 406 if ( produceHistos() ) 407 { 408 // retrieve or book the histogram 409 h = histo1D ( title ) ; 410 if ( 0 == h ) { h = book1D ( title , low , high , bins ); } 411 // fill histogram 412 while( first != last && 0 != h ) 413 { h = fill ( h , func( *first ) , 1.0 , title ) ; ++first ; } 414 } 415 return h ; 416 } 417 // ========================================================================== 418 /** fill the 1D histogram with forced ID and information from 419 * [first,last) sequence 420 * 421 * @code 422 * 423 * std::vector<double> v = ... ; 424 * 425 * // Example with numeric ID 426 * plot( sin , // function 427 * v.begin() , v.end() , // sequence 428 * 100 , " bla-bla " , // ID and title 429 * -1. , 1.0 , // low and high limits 430 * 100 ); // number of bins 431 * 432 * // Example with literal ID 433 * plot( sin , // function 434 * v.begin() , v.end() , // sequence 435 * "sin" , " bla-bla " , // ID and title 436 * -1. , 1.0 , // low and high limits 437 * 100 ); // number of bins 438 * 439 * @endcode 440 * 441 * Sequence, objects and function can be non-trivial: 442 * 443 * @code 444 * 445 * Particles* p = ... ; 446 * 447 * plot( PT , // function 448 * p->begin() , p->end() , // sequence 449 * 100 , " bla-bla " , // ID and title 450 * -1. , 1.0 , // low and high limits 451 * 100 ) ; // number of bins 452 * 453 * @endcode 454 * 455 * @attention 456 * These plot methods using iterator ranges are more efficient than 457 * the simplier "value" only methods, since the associated histogram 458 * only requires locating from internal storage once per loop, as opposed 459 * to once per fill for the simplier functions. It is recommended to use 460 * these whenever possible. 461 * 462 * @see AIDA::IHistogram1D 463 * 464 * @param func function to be plotted 465 * @param first begin of the sequence 466 * @param last end of the sequence 467 * @param ID histogram identifier 468 * @param title histogram title 469 * @param low low limit for histogram 470 * @param high high limit for histogram 471 * @param bins number of bins for histogram 472 */ 473 template <class FUNCTION,class OBJECT> 474 inline AIDA::IHistogram1D* plot 475 ( const FUNCTION& func , 476 OBJECT first , 477 OBJECT last , 478 const HistoID& ID , 479 const std::string& title , 480 const double low , 481 const double high , 482 const unsigned long bins = 100 ) const 483 { 484 AIDA::IHistogram1D* h(0); 485 if ( produceHistos() ) 486 { 487 // retrieve or book the histogram 488 h = histo1D ( ID ) ; 489 if ( 0 == h ) { h = book1D ( ID , title , low , high , bins ); } 490 // fill histogram 491 while( first != last && 0 != h ) 492 { h = fill( h , func( *first ) , 1.0 , title ) ; ++first ; } 493 } 494 return h; 495 } 496 // ========================================================================== 497 /** book and fill the 1D histogram with information from 498 * [first,last) sequence with given weight 499 * 500 * @code 501 * 502 * std::vector<double> v = ... ; 503 * 504 * plot( sin , // function 505 * v.begin() , v.end() , // sequence 506 * " bla-bla " , // title 507 * -1. , 1.0 , // low and high limits 508 * 100 , // number of bins 509 * tanh ); // weight function 510 * 511 * @endcode 512 * 513 * @attention 514 * The histogram will get a unique identifier automatically assigned which by 515 * default will be equal to the histogram title. An option exists to instead 516 * use numerical IDs. In this case the first histogram booked will be ID=1 the 517 * next ID=2 and so on. Note though this scheme is not recommended as it does 518 * NOT guarantee predictability of the ID a given histogram will be given when 519 * filled under conditional statements, since in these circumstances the order 520 * in which the histograms are first filled, and thus booked, will depend on the 521 * nature of the first few events read. This is particularly problematic when 522 * users submit many parallel 'sub-jobs' and then attempt to merge the final 523 * output ROOT (or HBOOK) files, since a given histogram could have different IDs 524 * in each of the sub-jobs. Consequently it is strongly recommended that users do 525 * not use numerical automatic IDs unless they are sure they understand what they 526 * are doing. 527 * 528 * Sequence, objects and function can be non-trivial: 529 * @code 530 * 531 * Particles* p = ... ; 532 * 533 * plot( PT , // function 534 * p->begin() , p->end() , // sequence 535 * " bla-bla " , // title 536 * -1. , 1.0 , // low and high limits 537 * 100 , // number of bins 538 * MASS ) ; // weight function 539 * 540 * @endcode 541 * where <c>PT</c> and <c>MASS</c> can be any function 542 * or function object 543 * for which the expressions <c>PT(p)</c> and 544 * <c>MASS</c> with <c>p</c> of type 545 * <c>Particle*</c> have some sense and can be evaluated to 546 * the values, which is convertible to <c>double</c> 547 * 548 * @attention 549 * These plot methods using iterator ranges are more efficient than 550 * the simplier "value" only methods, since the associated histogram 551 * only requires locating from internal storage once per loop, as opposed 552 * to once per fill for the simplier functions. It is recommended to use 553 * these whenever possible. 554 * 555 * @see AIDA::IHistogram1D 556 * @param first begin of the sequence 557 * @param last end of the sequence 558 * @param title histogram title 559 * @param func function to be plotted 560 * @param low low limit for histogram 561 * @param high high limit for histogram 562 * @param bins number of bins for histogram 563 * @param weight weight function 564 */ 565 template <class FUNCTION,class OBJECT,class WEIGHT> 566 inline AIDA::IHistogram1D* plot 567 ( const FUNCTION& func , 568 OBJECT first , 569 OBJECT last , 570 const std::string& title , 571 const double low , 572 const double high , 573 const unsigned long bins , 574 const WEIGHT& weight ) const 575 { 576 AIDA::IHistogram1D* h(0); 577 if ( produceHistos() ) 578 { 579 // retrieve or book the histogram 580 h = histo1D ( title ) ; 581 if ( 0 == h ) { h = book1D ( title , low , high , bins ); } 582 // fill histogram 583 while ( first != last && 0 != h ) 584 { h = fill ( h , 585 func ( *first ) , 586 weight ( *first ) , title ) ; ++first ; } 587 } 588 return h; 589 } 590 // ========================================================================== 591 /** book and fill the 1D histogram with forced ID and information from 592 * [first,last) sequence with given weight 593 * 594 * @code 595 * 596 * std::vector<double> v = ... ; 597 * 598 * // example with numerical ID 599 * plot( sin , // function 600 * v.begin() , v.end() , // sequence 601 * 100 , " bla-bla " , // ID and title 602 * -1. , 1.0 , // low and high limits 603 * 100 , // number of bins 604 * sinh ); // weight function 605 * 606 * // example with literal ID 607 * plot( sin , // function 608 * v.begin() , v.end() , // sequence 609 * "sin" , " bla-bla " , // ID and title 610 * -1. , 1.0 , // low and high limits 611 * 100 , // number of bins 612 * sinh ); // weight function 613 * 614 * @endcode 615 * 616 * @attention no checks for NaN or Finite are performed! 617 * 618 * Sequence, objects and function can be non-trivial: 619 * 620 * @code 621 * 622 * Particles* p = ... ; 623 * 624 * plot( PT , // function 625 * p->begin() , p->end() , // sequence 626 * 100 , " bla-bla " , // ID and title 627 * -1. , 1.0 , // low and high limits 628 * 100 , // number of bins 629 * MASS ) ; // weight function 630 * 631 * @endcode 632 * where <c>PT</c> and <c>MASS</c> can be any function 633 * or function object 634 * for which the expressions <c>PT(p)</c> and 635 * <c>MASS</c> with <c>p</c> of type 636 * <c>Particle*</c> have some sense and can be evaluated to 637 * the values, which is convertible to <c>double</c> 638 * 639 * @attention 640 * These plot methods using iterator ranges are more efficient than 641 * the simplier "value" only methods, since the associated histogram 642 * only requires locating from internal storage once per loop, as opposed 643 * to once per fill for the simplier functions. It is recommended to use 644 * these whenever possible. 645 * 646 * @see AIDA::IHistogram1D 647 * @param first begin of the sequence 648 * @param last end of the sequence 649 * @param ID histogram identifier 650 * @param title histogram title 651 * @param func function to be plotted 652 * @param low low limit for histogram 653 * @param high high limit for histogram 654 * @param bins number of bins for histogram 655 * @param weight weight function 656 */ 657 template <class FUNCTION,class OBJECT,class WEIGHT> 658 inline AIDA::IHistogram1D* plot 659 ( const FUNCTION& func , 660 OBJECT first , 661 OBJECT last , 662 const HistoID& ID , 663 const std::string& title , 664 const double low , 665 const double high , 666 const unsigned long bins , 667 const WEIGHT& weight ) const 668 { 669 AIDA::IHistogram1D* h(0); 670 if ( produceHistos() ) 671 { 672 // retrieve or book the histogram 673 h = histo1D ( ID ) ; 674 if ( 0 == h ) { h = book1D ( ID , title , low , high , bins ); } 675 // fill histogram 676 while( first != last && 0 != h ) 677 { h = fill ( h , 678 func ( *first ) , 679 weight ( *first ) , title ) ; ++first ; } 680 } 681 return h ; 682 } 683 // ========================================================================== 684 // ================================= 2D Histograms ========================== 685 // ========================================================================== 686 /** fill the 2D histogram (book on demand) 687 * 688 * @code 689 * 690 * const double mass1 = ... ; 691 * const double mass2 = ... ; 692 * plot2D( mass1, mass2, 693 * "Invariant Mass2 versus Mass1" ,2.5 ,3.5, 4.5, 5.5, 100, 200 ); 694 * 695 * @endcode 696 * 697 * This example illustrates the filling of the 2D histogram 698 * titled <tt>"Invariant Mass2 versus Mass1"</tt> with 699 * values @c mass1 and @c mass2 . 700 * 701 * If the histogram with given title does not exist yet 702 * it will be automatically booked with parameters 703 * @c lowX equal to 2.5, @c highX equal to 3.5, 704 * @c lowY equal to 4.5, @c highY equal to 5.5, 705 * @c binsX equal to 100 and @c binsY equal to 200. 706 * 707 * @attention 708 * The histogram will get a unique identifier automatically assigned which by 709 * default will be equal to the histogram title. An option exists to instead 710 * use numerical IDs. In this case the first histogram booked will be ID=1 the 711 * next ID=2 and so on. Note though this scheme is not recommended as it does 712 * NOT guarantee predictability of the ID a given histogram will be given when 713 * filled under conditional statements, since in these circumstances the order 714 * in which the histograms are first filled, and thus booked, will depend on the 715 * nature of the first few events read. This is particularly problematic when 716 * users submit many parallel 'sub-jobs' and then attempt to merge the final 717 * output ROOT (or HBOOK) files, since a given histogram could have different IDs 718 * in each of the sub-jobs. Consequently it is strongly recommended that users do 719 * not use numerical automatic IDs unless they are sure they understand what they 720 * are doing. 721 * 722 * @see AIDA::IHistogram2D 723 * 724 * @param valueX x value to be filled 725 * @param valueY y value to be filled 726 * @param title histogram title (must be unique within the algorithm) 727 * @param lowX low x limit for histogram 728 * @param highX high x limit for histogram 729 * @param lowY low y limit for histogram 730 * @param highY high y limit for histogram 731 * @param binsX number of bins in x 732 * @param binsY number of bins in y 733 * @param weight weight 734 * @return pointer to AIDA 2D histogram 735 */ 736 AIDA::IHistogram2D* plot2D 737 ( const double valueX , 738 const double valueY , 739 const std::string& title , 740 const double lowX , 741 const double highX , 742 const double lowY , 743 const double highY , 744 const unsigned long binsX = 50 , 745 const unsigned long binsY = 50 , 746 const double weight = 1.0 ) const; 747 // ========================================================================== 748 /** fill the 2D histogram with forced ID assignment (book on demand) 749 * 750 * @code 751 * 752 * const double mass1 = ... ; 753 * const double mass2 = ... ; 754 * plot2D( mass1, mass2, 15, 755 * "Invariant Mass2 versus Mass1" ,2.5 ,3.5, 4.5, 5.5, 100, 200 ); 756 * 757 * @endcode 758 * 759 * This example illustrates the filling of the 2D histogram ID=15 760 * titled <tt>"Invariant Mass2 versus Mass1"</tt> 761 * with values @c mass1 and @c mass2 . 762 * 763 * If the histogram with given title does not exist yet 764 * it will be automatically booked with parameters 765 * @c lowX equal to 2.5, @c highX equal to 3.5, 766 * @c lowY equal to 4.5, @c highY equal to 5.5, 767 * @c binsX equal to 100 and @c binsY equal to 200. 768 * 769 * It is also possible to use literal IDs. For example :- 770 * 771 * @code 772 * 773 * const double mass1 = ... ; 774 * const double mass2 = ... ; 775 * plot2D( mass1, mass2, "mass", 776 * "Invariant Mass2 versus Mass1" ,2.5 ,3.5, 4.5, 5.5, 100, 200 ); 777 * 778 * @endcode 779 * 780 * Will book the same histogram, using the id "mass". 781 * 782 * It is also possible using literal IDs, to place histograms in 783 * sub-directories from the main histogram directory, using for 784 * example :- 785 * 786 * @code 787 * 788 * const double mass1 = ... ; 789 * const double mass2 = ... ; 790 * plot2D( mass1, mass2, "subdir/mass", 791 * "Invariant Mass2 versus Mass1" ,2.5 ,3.5, 4.5, 5.5, 100, 200 ); 792 * 793 * @endcode 794 * 795 * Which will create the histogram "mass" in the sub-directory "subdir". 796 * Histograms can also be created in sub-directories with numeric IDs if 797 * IDs such as "subdir/1" are used. 798 * 799 * @attention 800 * If the histogram with given ID is already booked 801 * through automatic assignment of histogram ID, 802 * the error will not be detected. 803 * Therefore it is recommended 804 * to use non-trivial histogram ID offset (property "HistoOffSet") 805 * if one need to combine these techniques together 806 * It is still desirable to use the unique histogram title 807 * to avoid a bad interference 808 * 809 * @see AIDA::IHistogram2D 810 * 811 * @param valueX x value to be filled 812 * @param valueY y value to be filled 813 * @param ID Histogram ID to use 814 * @param title histogram title (must be unique within the algorithm) 815 * @param lowX low x limit for histogram 816 * @param highX high x limit for histogram 817 * @param lowY low y limit for histogram 818 * @param highY high y limit for histogram 819 * @param binsX number of bins in x 820 * @param binsY number of bins in y 821 * @param weight weight 822 * @return pointer to AIDA 2D histogram 823 */ 824 AIDA::IHistogram2D* plot2D 825 ( const double valueX , 826 const double valueY , 827 const HistoID& ID , 828 const std::string& title , 829 const double lowX , 830 const double highX , 831 const double lowY , 832 const double highY , 833 const unsigned long binsX = 50 , 834 const unsigned long binsY = 50 , 835 const double weight = 1.0 ) const; 836 // ========================================================================== 837 // ================================= 3D Histograms ========================== 838 // ========================================================================== 839 /** fill the 3D histogram (book on demand) 840 * 841 * @code 842 * 843 * const double X = ... ; 844 * const double Y = ... ; 845 * const double Z = ... ; 846 * plot3D( X, Y, Z, "Space Points" , 847 * 2.5 , 3.5 , 848 * 4.5 , 5.5 , 849 * 6.5 , 7.5 , 850 * 10, 20, 30 ); 851 * 852 * @endcode 853 * 854 * This example illustrates the filling of the 3D histogram 855 * titled <tt>"Space Points"</tt> with values @c X, @c Y and @c Z. 856 * 857 * If the histogram with given title does not exist yet 858 * it will be automatically booked with parameters 859 * @c lowX equal to 2.5, @c highX equal to 3.5, 860 * @c lowY equal to 4.5, @c highY equal to 5.5, 861 * @c lowZ equal to 6.5, @c highZ equal to 7.5, 862 * @c binsX equal to 10, @c binsY equal to 20 and @c binsZ equal to 30. 863 * 864 * @attention 865 * The histogram will get a unique identifier automatically assigned which by 866 * default will be equal to the histogram title. An option exists to instead 867 * use numerical IDs. In this case the first histogram booked will be ID=1 the 868 * next ID=2 and so on. Note though this scheme is not recommended as it does 869 * NOT guarantee predictability of the ID a given histogram will be given when 870 * filled under conditional statements, since in these circumstances the order 871 * in which the histograms are first filled, and thus booked, will depend on the 872 * nature of the first few events read. This is particularly problematic when 873 * users submit many parallel 'sub-jobs' and then attempt to merge the final 874 * output ROOT (or HBOOK) files, since a given histogram could have different IDs 875 * in each of the sub-jobs. Consequently it is strongly recommended that users do 876 * not use numerical automatic IDs unless they are sure they understand what they 877 * are doing. 878 * 879 * @see AIDA::IHistogram3D 880 * 881 * @param valueX x value to be filled 882 * @param valueY y value to be filled 883 * @param valueZ z value to be filled 884 * @param title histogram title (must be unique within the algorithm) 885 * @param lowX low x limit for histogram 886 * @param highX high x limit for histogram 887 * @param lowY low y limit for histogram 888 * @param highY high y limit for histogram 889 * @param lowZ low z limit for histogram 890 * @param highZ high z limit for histogram 891 * @param binsX number of bins in x 892 * @param binsY number of bins in y 893 * @param binsZ number of bins in z 894 * @param weight weight 895 * @return pointer to AIDA 3D histogram 896 */ 897 AIDA::IHistogram3D* plot3D 898 ( const double valueX , 899 const double valueY , 900 const double valueZ , 901 const std::string& title , 902 const double lowX , 903 const double highX , 904 const double lowY , 905 const double highY , 906 const double lowZ , 907 const double highZ , 908 const unsigned long binsX = 10 , 909 const unsigned long binsY = 10 , 910 const unsigned long binsZ = 10 , 911 const double weight = 1.0 ) const; 912 // ========================================================================== 913 /** fill the 3D histogram with forced ID assignment (book on demand) 914 * 915 * @code 916 * 917 * const double X = ... ; 918 * const double Y = ... ; 919 * const double Z = ... ; 920 * plot3D( X, Y, Z, 921 * 15 , "Space Points" , 922 * 2.5 ,3.5, 4.5, 5.5, 6.5, 7.5, 10, 20, 30 ); 923 * 924 * @endcode 925 * 926 * This example illustrates the filling of the 3D histogram ID=15 927 * titled <tt>"Space Points"</tt> with values @c X, @c Y and @c Z. 928 * 929 * If the histogram with given title does not exist yet 930 * it will be automatically booked with parameters 931 * @c lowX equal to 2.5, @c highX equal to 3.5, 932 * @c lowY equal to 4.5, @c highY equal to 5.5, 933 * @c lowZ equal to 6.5, @c highZ equal to 7.5, 934 * @c binsX equal to 10, @c binsY equal to 20 and @c binsZ equal to 30. 935 * 936 * It is also possible to use literal IDs. For example :- 937 * 938 * @code 939 * 940 * const double X = ... ; 941 * const double Y = ... ; 942 * const double Z = ... ; 943 * plot3D( X, Y, Z, 944 * "space", "Space Points" , 945 * 2.5 ,3.5, 4.5, 5.5, 6.5, 7.5, 10, 20, 30 ); 946 * 947 * @endcode 948 * 949 * Will book the same histogram, using the id "space". 950 * 951 * It is also possible using literal IDs, to place histograms in 952 * sub-directories from the main histogram directory, using for 953 * example :- 954 * 955 * @code 956 * 957 * const double X = ... ; 958 * const double Y = ... ; 959 * const double Z = ... ; 960 * plot3D( X, Y, Z, 961 * "subdir/space", "Space Points" , 962 * 2.5 ,3.5, 4.5, 5.5, 6.5, 7.5, 10, 20, 30 ); 963 * 964 * @endcode 965 * 966 * Which will create the histogram "space" in the sub-directory "subdir". 967 * Histograms can also be created in sub-directories with numeric IDs if 968 * IDs such as "subdir/1" are used. 969 * 970 * @attention 971 * If the histogram with given ID is already booked 972 * through automatic assignment of histogram ID, 973 * the error will not be detected. 974 * Therefore it is recommended 975 * to use non-trivial histogram ID offset (property "HistoOffSet") 976 * if one need to combine these techniques together 977 * It is still desirable to use the unique histogram title 978 * to avoid a bad interference 979 * 980 * @see AIDA::IHistogram3D 981 * 982 * @param valueX x value to be filled 983 * @param valueY y value to be filled 984 * @param valueZ z value to be filled 985 * @param ID Histogram ID to use 986 * @param title histogram title (must be unique within the algorithm) 987 * @param lowX low x limit for histogram 988 * @param highX high x limit for histogram 989 * @param lowY low y limit for histogram 990 * @param highY high y limit for histogram 991 * @param lowZ low z limit for histogram 992 * @param highZ high z limit for histogram 993 * @param binsX number of bins in x 994 * @param binsY number of bins in y 995 * @param binsZ number of bins in z 996 * @param weight weight 997 * @return pointer to AIDA 3D histogram 998 */ 999 AIDA::IHistogram3D* plot3D 1000 ( const double valueX , 1001 const double valueY , 1002 const double valueZ , 1003 const HistoID& ID , 1004 const std::string& title , 1005 const double lowX , 1006 const double highX , 1007 const double lowY , 1008 const double highY , 1009 const double lowZ , 1010 const double highZ , 1011 const unsigned long binsX = 10 , 1012 const unsigned long binsY = 10 , 1013 const unsigned long binsZ = 10 , 1014 const double weight = 1.0 ) const; 1015 // ========================================================================== 1016 // ================================= 1D Profile ============================= 1017 // ========================================================================== 1018 /** fill the 1D profile histogram (book on demand) 1019 * 1020 * @code 1021 * 1022 * const double mass1 = ... ; 1023 * const double mass2 = ... ; 1024 * profile1D( mass1, mass2, "Invariant Mass2 versus Mass1" ,2.5 ,3.5, 100 ); 1025 * 1026 * @endcode 1027 * 1028 * This example illustrates the filling of the 1D profile histogram 1029 * titled <tt>"Invariant Mass2 versus Mass1"</tt> 1030 * with values @c mass1 and @c mass2 . 1031 * 1032 * If the histogram with given title does not exist yet 1033 * it will be automatically booked with parameters 1034 * @c lowX equal to 2.5, @c highX equal to 3.5, 1035 * @c binsX equal to 100 1036 * 1037 * @attention 1038 * The histogram will get a unique identifier automatically assigned which by 1039 * default will be equal to the histogram title. An option exists to instead 1040 * use numerical IDs. In this case the first histogram booked will be ID=1 the 1041 * next ID=2 and so on. Note though this scheme is not recommended as it does 1042 * NOT guarantee predictability of the ID a given histogram will be given when 1043 * filled under conditional statements, since in these circumstances the order 1044 * in which the histograms are first filled, and thus booked, will depend on the 1045 * nature of the first few events read. This is particularly problematic when 1046 * users submit many parallel 'sub-jobs' and then attempt to merge the final 1047 * output ROOT (or HBOOK) files, since a given histogram could have different IDs 1048 * in each of the sub-jobs. Consequently it is strongly recommended that users do 1049 * not use numerical automatic IDs unless they are sure they understand what they 1050 * are doing. 1051 * 1052 * @see AIDA::IProfile1D 1053 * 1054 * @param valueX x value to be filled 1055 * @param valueY y value to be filled 1056 * @param title histogram title (must be unique within the algorithm) 1057 * @param lowX low x limit for histogram 1058 * @param highX high x limit for histogram 1059 * @param binsX number of bins in x 1060 * @param opt the options, used for evaluation of errors 1061 * @param lowY the min cut-off for y-values 1062 * @param highY the max cut-off for y-values 1063 * @param weight weight 1064 * @return pointer to AIDA 1D profile histogram 1065 */ 1066 AIDA::IProfile1D* profile1D 1067 ( const double valueX , 1068 const double valueY , 1069 const std::string& title , 1070 const double lowX , 1071 const double highX , 1072 const unsigned long binsX = 100 , 1073 const std::string& opt = "" , 1074 const double lowY = -std::numeric_limits<double>::max() , 1075 const double highY = std::numeric_limits<double>::max() , 1076 const double weight = 1.0 ) const ; 1077 // ========================================================================== 1078 /** fill the 1D profile histogram with forced ID assignment (book on demand) 1079 * 1080 * @code 1081 * 1082 * const double mass1 = ... ; 1083 * const double mass2 = ... ; 1084 * profile1D( mass1, mass2, 1085 * 15, "Invariant Mass2 versus Mass1" ,2.5 ,3.5, 100 ); 1086 * 1087 * @endcode 1088 * 1089 * This example illustrates the filling of the 1D profile histogram with ID=15 1090 * titled <tt>"Invariant Mass2 versus Mass1"</tt> with 1091 * values @c mass1 and @c mass2 . 1092 * 1093 * If the histogram with given title does not exist yet 1094 * it will be automatically booked with parameters 1095 * @c lowX equal to 2.5, @c highX equal to 3.5, 1096 * @c binsX equal to 100 1097 * 1098 * It is also possible to use literal IDs. For example :- 1099 * 1100 * @code 1101 * 1102 * const double mass1 = ... ; 1103 * const double mass2 = ... ; 1104 * profile1D( mass1, mass2, 1105 * "mass", "Invariant Mass2 versus Mass1" ,2.5 ,3.5, 100 ); 1106 * 1107 * @endcode 1108 * 1109 * Will book the same histogram, using the id "mass". 1110 * 1111 * It is also possible using literal IDs, to place histograms in 1112 * sub-directories from the main histogram directory, using for 1113 * example :- 1114 * 1115 * @code 1116 * 1117 * const double mass1 = ... ; 1118 * const double mass2 = ... ; 1119 * profile1D( mass1, mass2, 1120 * "subdir/mass", "Invariant Mass2 versus Mass1" ,2.5 ,3.5, 100 ); 1121 * 1122 * @endcode 1123 * 1124 * Which will create the histogram "mass" in the sub-directory "subdir". 1125 * Histograms can also be created in sub-directories with numeric IDs if 1126 * IDs such as "subdir/1" are used. 1127 * 1128 * @see AIDA::IProfile1D 1129 * 1130 * @param valueX x value to be filled 1131 * @param valueY y value to be filled 1132 * @param ID histogram identifier 1133 * @param title histogram title (must be unique within the algorithm) 1134 * @param lowX low x limit for histogram 1135 * @param highX high x limit for histogram 1136 * @param binsX number of bins in x 1137 * @param opt the options, used for evaluation of errors 1138 * @param lowY the min cut-off for y-values 1139 * @param highY the max cut-off for y-values 1140 * @param weight weight 1141 * @return pointer to AIDA 1D profile histogram 1142 */ 1143 AIDA::IProfile1D* profile1D 1144 ( const double valueX , 1145 const double valueY , 1146 const HistoID& ID , 1147 const std::string& title , 1148 const double lowX , 1149 const double highX , 1150 const unsigned long binsX = 100 , 1151 const std::string& opt = "" , 1152 const double lowY = -std::numeric_limits<double>::max() , 1153 const double highY = std::numeric_limits<double>::max() , 1154 const double weight = 1.0 ) const; 1155 // ========================================================================== 1156 // ================================= 2D Profile ============================= 1157 // ========================================================================== 1158 /** fill the 2D profile histogram (book on demand) 1159 * 1160 * @code 1161 * 1162 * const double X = ... ; 1163 * const double Y = ... ; 1164 * const double Z = ... ; 1165 * profile2D( X, Y, Z, "Space Points" ,2.5 ,3.5, 4.5, 5.5, 10, 20 ); 1166 * 1167 * @endcode 1168 * 1169 * This example illustrates the filling of the 2D profile histogram 1170 * titled <tt>"Space Points"</tt> with values @c X, @c Y and @c Z. 1171 * 1172 * If the histogram with given title does not exist yet 1173 * it will be automatically booked with parameters 1174 * @c lowX equal to 2.5, @c highX equal to 3.5, 1175 * @c lowY equal to 4.5, @c highY equal to 5.5, 1176 * @c binsX equal to 10, @c binsY equal to 20. 1177 * 1178 * @attention 1179 * The histogram will get a unique identifier automatically assigned which by 1180 * default will be equal to the histogram title. An option exists to instead 1181 * use numerical IDs. In this case the first histogram booked will be ID=1 the 1182 * next ID=2 and so on. Note though this scheme is not recommended as it does 1183 * NOT guarantee predictability of the ID a given histogram will be given when 1184 * filled under conditional statements, since in these circumstances the order 1185 * in which the histograms are first filled, and thus booked, will depend on the 1186 * nature of the first few events read. This is particularly problematic when 1187 * users submit many parallel 'sub-jobs' and then attempt to merge the final 1188 * output ROOT (or HBOOK) files, since a given histogram could have different IDs 1189 * in each of the sub-jobs. Consequently it is strongly recommended that users do 1190 * not use numerical automatic IDs unless they are sure they understand what they 1191 * are doing. 1192 * 1193 * @see AIDA::IProfile2D 1194 * 1195 * @param valueX x value to be filled 1196 * @param valueY y value to be filled 1197 * @param valueZ z value to be filled 1198 * @param title histogram title (must be unique within the algorithm) 1199 * @param lowX low x limit for histogram 1200 * @param highX high x limit for histogram 1201 * @param lowY low y limit for histogram 1202 * @param highY high y limit for histogram 1203 * @param binsX number of bins in x 1204 * @param binsY number of bins in y 1205 * @param weight weight 1206 * @return pointer to AIDA 2D profile histogram 1207 */ 1208 AIDA::IProfile2D* profile2D 1209 ( const double valueX , 1210 const double valueY , 1211 const double valueZ , 1212 const std::string& title , 1213 const double lowX , 1214 const double highX , 1215 const double lowY , 1216 const double highY , 1217 const unsigned long binsX = 50 , 1218 const unsigned long binsY = 50 , 1219 const double weight = 1.0 ) const; 1220 // ========================================================================== 1221 /** fill the 2D profile histogram with forced ID assignment (book on demand) 1222 * 1223 * @code 1224 * 1225 * const double X = ... ; 1226 * const double Y = ... ; 1227 * const double Z = ... ; 1228 * profile2D( X, Y, Z, 15, "Space Points" ,2.5 ,3.5, 4.5, 5.5, 10, 20 ); 1229 * 1230 * @endcode 1231 * 1232 * This example illustrates the filling of the 2D profile histogram with ID=15 1233 * titled <tt>"Space Points"</tt> with values @c X, @c Y and @c Z. 1234 * 1235 * If the histogram with given title does not exist yet 1236 * it will be automatically booked with parameters 1237 * @c lowX equal to 2.5, @c highX equal to 3.5, 1238 * @c lowY equal to 4.5, @c highY equal to 5.5, 1239 * @c binsX equal to 10, @c binsY equal to 20. 1240 * 1241 * It is also possible to use literal IDs. For example :- 1242 * 1243 * @code 1244 * 1245 * const double X = ... ; 1246 * const double Y = ... ; 1247 * const double Z = ... ; 1248 * profile2D( X, Y, Z, "space", "Space Points" ,2.5 ,3.5, 4.5, 5.5, 10, 20 ); 1249 * 1250 * @endcode 1251 * 1252 * Will book the same histogram, using the id "space". 1253 * 1254 * It is also possible using literal IDs, to place histograms in 1255 * sub-directories from the main histogram directory, using for 1256 * example :- 1257 * 1258 * @code 1259 * 1260 * const double X = ... ; 1261 * const double Y = ... ; 1262 * const double Z = ... ; 1263 * profile2D( X, Y, Z, 1264 * "subdir/space", "Space Points" ,2.5 ,3.5, 4.5, 5.5, 10, 20 ); 1265 * 1266 * @endcode 1267 * 1268 * Which will create the histogram "space" in the sub-directory "subdir". 1269 * Histograms can also be created in sub-directories with numeric IDs if 1270 * IDs such as "subdir/1" are used. 1271 * 1272 * @see AIDA::IProfile2D 1273 * 1274 * @param valueX x value to be filled 1275 * @param valueY y value to be filled 1276 * @param valueZ z value to be filled 1277 * @param ID histogram identifier 1278 * @param title histogram title (must be unique within the algorithm) 1279 * @param lowX low x limit for histogram 1280 * @param highX high x limit for histogram 1281 * @param lowY low y limit for histogram 1282 * @param highY high y limit for histogram 1283 * @param binsX number of bins in x 1284 * @param binsY number of bins in y 1285 * @param weight weight 1286 * @return pointer to AIDA 2D profile histogram 1287 */ 1288 AIDA::IProfile2D* profile2D 1289 ( const double valueX , 1290 const double valueY , 1291 const double valueZ , 1292 const HistoID& ID , 1293 const std::string& title , 1294 const double lowX , 1295 const double highX , 1296 const double lowY , 1297 const double highY , 1298 const unsigned long binsX = 50 , 1299 const unsigned long binsY = 50 , 1300 const double weight = 1.0 ) const; 1301 // ========================================================================== 1302 public: 1303 // ========================================================================== 1304 /** book the 1D histogram 1305 * 1306 * The histogram will be assigned a unique identifier 1307 * 1308 * @see AIDA::IHistogram1D 1309 * @param title histogram title (must be unique within the algorithm) 1310 * @param low low limit for histogram 1311 * @param high high limit for histogram 1312 * @param bins number of bins 1313 * @return pointer to AIDA 1D histogram 1314 */ 1315 AIDA::IHistogram1D* book1D 1316 ( const std::string& title , 1317 const double low = 0 , 1318 const double high = 100 , 1319 const unsigned long bins = 100 ) const ; 1320 // ========================================================================== 1321 /** book the 1D histogram 1322 * 1323 * Wrapper method for the equivalent book1D method. 1324 * Retained for backwards compatibility, please use book1D instead. 1325 * 1326 * @see IHistogram1D 1327 * @param title histogram title (must be unique within the algorithm) 1328 * @param low low limit for histogram 1329 * @param high high limit for histogram 1330 * @param bins number of bins 1331 * @return pointer to AIDA 1D histogram 1332 */ 1333 inline AIDA::IHistogram1D* book 1334 ( const std::string& title , 1335 const double low = 0 , 1336 const double high = 100 , 1337 const unsigned long bins = 100 ) const 1338 { 1339 return book1D( title, low, high, bins ); 1340 } 1341 // ========================================================================== 1342 /** book the 1D histogram 1343 * 1344 * The histogram will be assigned a unique identifier 1345 * 1346 * @see AIDA::IHistogram1D 1347 * @param hdef histogram description/definition 1348 * @return pointer to AIDA 1D histogram 1349 */ 1350 AIDA::IHistogram1D* book 1351 ( const Gaudi::Histo1DDef& hdef ) const ; 1352 // ========================================================================== 1353 /** book the 2D histogram 1354 * 1355 * The histogram will be assigned a unique identifier 1356 * 1357 * @see IHistogram2D 1358 * @param title histogram title (must be unique within the algorithm) 1359 * @param lowX low x limit for histogram 1360 * @param highX high x limit for histogram 1361 * @param binsX number of bins in x 1362 * @param lowY low y limit for histogram 1363 * @param highY high y limit for histogram 1364 * @param binsY number of bins in y 1365 * @return pointer to AIDA 2D histogram 1366 */ 1367 AIDA::IHistogram2D* book2D 1368 ( const std::string& title , 1369 const double lowX = 0 , 1370 const double highX = 100 , 1371 const unsigned long binsX = 50 , 1372 const double lowY = 0 , 1373 const double highY = 100 , 1374 const unsigned long binsY = 50 ) const ; 1375 // ========================================================================== 1376 /** book the 3D histogram 1377 * 1378 * The histogram will be assigned a unique identifier 1379 * 1380 * @see IHistogram3D 1381 * @param title histogram title (must be unique within the algorithm) 1382 * @param lowX low x limit for histogram 1383 * @param highX high x limit for histogram 1384 * @param binsX number of bins in x 1385 * @param lowY low y limit for histogram 1386 * @param highY high y limit for histogram 1387 * @param binsY number of bins in y 1388 * @param lowZ low y limit for histogram 1389 * @param highZ high y limit for histogram 1390 * @param binsZ number of bins in y 1391 * @return pointer to AIDA 3D histogram 1392 */ 1393 AIDA::IHistogram3D* book3D 1394 ( const std::string& title , 1395 const double lowX = 0 , 1396 const double highX = 100 , 1397 const unsigned long binsX = 10 , 1398 const double lowY = 0 , 1399 const double highY = 100 , 1400 const unsigned long binsY = 10 , 1401 const double lowZ = 0 , 1402 const double highZ = 100 , 1403 const unsigned long binsZ = 10 ) const ; 1404 // ========================================================================== 1405 /** book the 1D histogram with forced ID 1406 * 1407 * @see IHistogram1D 1408 * @param ID unique histogram ID 1409 * @param title histogram title (must be unique within the algorithm) 1410 * @param low low limit for histogram 1411 * @param high high limit for histogram 1412 * @param bins number of bins 1413 * @return pointer to AIDA histogram 1414 */ 1415 AIDA::IHistogram1D* book1D 1416 ( const HistoID& ID , 1417 const std::string& title , 1418 const double low = 0 , 1419 const double high = 100 , 1420 const unsigned long bins = 100 ) const ; 1421 // ========================================================================== 1422 /** book the 1D histogram with forced ID 1423 * 1424 * Wrapper method for the equivalent book1D method. 1425 * Retained for backwards compatibility, please use book1D instead. 1426 * 1427 * @see IHistogram1D 1428 * @param ID unique histogram ID 1429 * @param title histogram title (must be unique within the algorithm) 1430 * @param low low limit for histogram 1431 * @param high high limit for histogram 1432 * @param bins number of bins 1433 * @return pointer to AIDA histogram 1434 */ 1435 inline AIDA::IHistogram1D* book 1436 ( const HistoID& ID , 1437 const std::string& title , 1438 const double low = 0 , 1439 const double high = 100 , 1440 const unsigned long bins = 100 ) const 1441 { 1442 return book1D( ID, title, low, high, bins ); 1443 } 1444 // ========================================================================== 1445 /** book the 1D histogram with forced ID 1446 * 1447 * @see IHistogram1D 1448 * @param ID unique histogram ID 1449 * @param hdef histogram descriptor 1450 * @return pointer to AIDA histogram 1451 */ 1452 inline AIDA::IHistogram1D* book 1453 ( const HistoID& ID , 1454 const Gaudi::Histo1DDef& hdef ) const ; 1455 // ========================================================================== 1456 /** book the 2D histogram with forced ID 1457 * 1458 * @see IHistogram2D 1459 * @param ID unique histogram ID 1460 * @param title histogram title (must be unique within the algorithm) 1461 * @param low low limit for histogram 1462 * @param high high limit for histogram 1463 * @param bins number of bins 1464 * @return pointer to AIDA histogram 1465 */ 1466 AIDA::IHistogram2D* book2D 1467 ( const HistoID& ID , 1468 const std::string& title , 1469 const double lowX = 0 , 1470 const double highX = 100 , 1471 const unsigned long binsX = 50 , 1472 const double lowY = 0 , 1473 const double highY = 100 , 1474 const unsigned long binsY = 50 ) const ; 1475 // ========================================================================== 1476 /** book the 3D histogram with forced ID 1477 * 1478 * @see IHistogram3D 1479 * @param ID unique histogram ID 1480 * @param title histogram title (must be unique within the algorithm) 1481 * @param lowX low x limit for histogram 1482 * @param highX high x limit for histogram 1483 * @param binsX number of bins in x 1484 * @param lowY low y limit for histogram 1485 * @param highY high y limit for histogram 1486 * @param binsY number of bins in y 1487 * @param lowZ low y limit for histogram 1488 * @param highZ high y limit for histogram 1489 * @param binsZ number of bins in y 1490 * @return pointer to AIDA 3D histogram 1491 */ 1492 AIDA::IHistogram3D* book3D 1493 ( const HistoID& ID , 1494 const std::string& title , 1495 const double lowX = 0 , 1496 const double highX = 100 , 1497 const unsigned long binsX = 10 , 1498 const double lowY = 0 , 1499 const double highY = 100 , 1500 const unsigned long binsY = 10 , 1501 const double lowZ = 0 , 1502 const double highZ = 100 , 1503 const unsigned long binsZ = 10 ) const ; 1504 // ========================================================================== 1505 /** book the 1D profile histogram 1506 * 1507 * The histogram will be assigned a unique identifier 1508 * 1509 * @see IHistogram1D 1510 * @param title histogram title (must be unique within the algorithm) 1511 * @param low low limit for histogram 1512 * @param high high limit for histogram 1513 * @param bins number of bins 1514 * @param opt the options, used for evaluation of errors 1515 * @param lowY the min cut-off for y-values 1516 * @param highY the max cut-off for y-values 1517 * @return pointer to AIDA 1D profile histogram 1518 */ 1519 AIDA::IProfile1D* bookProfile1D 1520 ( const std::string& title , 1521 const double low = 0 , 1522 const double high = 100 , 1523 const unsigned long bins = 100 , 1524 const std::string& opt = "" , 1525 const double lowY = -std::numeric_limits<double>::max() , 1526 const double highY = std::numeric_limits<double>::max() ) const; 1527 // ========================================================================== 1528 /** book the 1D profile histogram 1529 * 1530 * The histogram will be assigned a unique identifier 1531 * 1532 * @see IHistogram1D 1533 * @param title histogram title (must be unique within the algorithm) 1534 * @param low low limit for histogram 1535 * @param high high limit for histogram 1536 * @param bins number of bins 1537 * @param opt the options, used for evaluation of errors 1538 * @param lowY the min cut-off for y-values 1539 * @param highY the max cut-off for y-values 1540 * @return pointer to AIDA 1D profile histogram 1541 */ 1542 AIDA::IProfile1D* bookProfile1D 1543 ( const HistoID& ID , 1544 const std::string& title , 1545 const double low = 0 , 1546 const double high = 100 , 1547 const unsigned long bins = 100 , 1548 const std::string& opt = "" , 1549 const double lowY = -std::numeric_limits<double>::max() , 1550 const double highY = std::numeric_limits<double>::max() ) const; 1551 // ========================================================================== 1552 /** book the 2D profile histogram 1553 * 1554 * The histogram will be assigned a unique identifier 1555 * 1556 * @see AIDA::IProfile2D 1557 * @param title histogram title (must be unique within the algorithm) 1558 * @param lowX low x limit for histogram 1559 * @param highX high x limit for histogram 1560 * @param binsX number of bins in x 1561 * @param lowY low y limit for histogram 1562 * @param highY high y limit for histogram 1563 * @param binsY number of bins in y 1564 * @return pointer to AIDA 2D histogram 1565 */ 1566 AIDA::IProfile2D* bookProfile2D 1567 ( const std::string& title , 1568 const double lowX = 0 , 1569 const double highX = 100 , 1570 const unsigned long binsX = 50 , 1571 const double lowY = 0 , 1572 const double highY = 100 , 1573 const unsigned long binsY = 50 ) const ; 1574 // ========================================================================== 1575 /** book the 2D profile histogram with forced ID 1576 * 1577 * @see AIDA::IProfile2D 1578 * @param ID unique histogram ID 1579 * @param title histogram title (must be unique within the algorithm) 1580 * @param low low limit for histogram 1581 * @param high high limit for histogram 1582 * @param bins number of bins 1583 * @return pointer to AIDA histogram 1584 */ 1585 AIDA::IProfile2D* bookProfile2D 1586 ( const HistoID& ID , 1587 const std::string& title , 1588 const double lowX = 0 , 1589 const double highX = 100 , 1590 const unsigned long binsX = 50 , 1591 const double lowY = 0 , 1592 const double highY = 100 , 1593 const unsigned long binsY = 50 ) const ; 1594 // ========================================================================== 1595 public: 1596 // ========================================================================== 1597 /** fill the 1D histogram with the value and weight 1598 * @param histo 1D histogram to be filled 1599 * @param value value to be put into the histogram 1600 * @param weight weight to be used 1601 * @param title histogram title (to be used for error report) 1602 * @return pointer to AIDA 1D histogram 1603 */ 1604 AIDA::IHistogram1D* fill 1605 ( AIDA::IHistogram1D* histo , 1606 const double value , 1607 const double weight , 1608 const std::string& title = "" ) const ; 1609 // ========================================================================== 1610 /** fill the 2D histogram with the value and weight 1611 * @param histo 2D histogram to be filled 1612 * @param valueX x value to be put into the histogram 1613 * @param valueY y value to be put into the histogram 1614 * @param weight weight to be used 1615 * @param title histogram title (to be used for error report) 1616 * @return pointer to AIDA 2D histogram 1617 */ 1618 AIDA::IHistogram2D* fill 1619 ( AIDA::IHistogram2D* histo , 1620 const double valueX , 1621 const double valueY , 1622 const double weight , 1623 const std::string& title = "" ) const ; 1624 // ========================================================================== 1625 /** fill the 3D histogram with the value and weight 1626 * @param histo 3D histogram to be filled 1627 * @param valueX x value to be put into the histogram 1628 * @param valueY y value to be put into the histogram 1629 * @param valueZ z value to be put into the histogram 1630 * @param weight weight to be used 1631 * @param title histogram title (to be used for error report) 1632 * @return pointer to AIDA 3D histogram 1633 */ 1634 AIDA::IHistogram3D* fill 1635 ( AIDA::IHistogram3D* histo , 1636 const double valueX , 1637 const double valueY , 1638 const double valueZ , 1639 const double weight , 1640 const std::string& title = "" ) const ; 1641 // ========================================================================== 1642 /** fill the 1D profile histogram with the values and weight 1643 * @param histo 1D profile histogram to be filled 1644 * @param valueX x value to be put into the histogram 1645 * @param valueY y value to be put into the histogram 1646 * @param weight weight to be used 1647 * @param title histogram title (to be used for error report) 1648 * @return pointer to AIDA 1D histogram 1649 */ 1650 AIDA::IProfile1D* fill 1651 ( AIDA::IProfile1D* histo , 1652 const double valueX , 1653 const double valueY , 1654 const double weight , 1655 const std::string& title = "" ) const ; 1656 // ========================================================================== 1657 /** fill the 2D profile histogram with the values and weight 1658 * @param histo 2D profile histogram to be filled 1659 * @param valueX x value to be put into the histogram 1660 * @param valueY y value to be put into the histogram 1661 * @param valueZ z value to be put into the histogram 1662 * @param weight weight to be used 1663 * @param title histogram title (to be used for error report) 1664 * @return pointer to AIDA 1D histogram 1665 */ 1666 AIDA::IProfile2D* fill 1667 ( AIDA::IProfile2D* histo , 1668 const double valueX , 1669 const double valueY , 1670 const double valueZ , 1671 const double weight , 1672 const std::string& title = "" ) const ; 1673 // ========================================================================== 1674 public: 1675 // ========================================================================== 1676 /** access the EXISTING 1D histogram by title 1677 * return the pointer to existing 1D histogram or NULL 1678 */ 1679 inline AIDA::IHistogram1D* histo1D ( const std::string& title ) const 1680 { 1681 Histo1DMapTitle::const_iterator found = histo1DMapTitle().find( title ) ; 1682 return ( histo1DMapTitle().end() == found ? 0 : found->second ); 1683 } 1684 // ========================================================================== 1685 /** access the EXISTING 1D histogram by title 1686 * 1687 * Wrapper method for the equivalent histo1D method. 1688 * Retained for backwards compatibility, please use histo1D instead. 1689 * 1690 * return the pointer to existing 1D histogram or NULL 1691 */ 1692 inline AIDA::IHistogram1D* histo ( const std::string& title ) const 1693 { 1694 return histo1D( title ); 1695 } 1696 // ========================================================================== 1697 /** access the EXISTING 2D histogram by title 1698 * return the pointer to existing 2D histogram or NULL 1699 */ 1700 inline AIDA::IHistogram2D* histo2D ( const std::string& title ) const 1701 { 1702 Histo2DMapTitle::const_iterator found = histo2DMapTitle().find( title ) ; 1703 return ( histo2DMapTitle().end() == found ? 0 : found->second ); 1704 } 1705 // ========================================================================== 1706 /** access the EXISTING 3D histogram by title 1707 * return the pointer to existing 3D histogram or NULL 1708 */ 1709 inline AIDA::IHistogram3D* histo3D ( const std::string& title ) const 1710 { 1711 Histo3DMapTitle::const_iterator found = histo3DMapTitle().find( title ) ; 1712 return ( histo3DMapTitle().end() == found ? 0 : found->second ); 1713 } 1714 // ========================================================================== 1715 /** access the EXISTING 1D profile histogram by title 1716 * return the pointer to existing 1D profile histogram or NULL 1717 */ 1718 inline AIDA::IProfile1D* profile1D ( const std::string& title ) const 1719 { 1720 Profile1DMapTitle::const_iterator found = profile1DMapTitle().find( title ) ; 1721 return ( profile1DMapTitle().end() == found ? 0 : found->second ); 1722 } 1723 // ========================================================================== 1724 /** access the EXISTING 2D profile histogram by title 1725 * return the pointer to existing 2D profile histogram or NULL 1726 */ 1727 inline AIDA::IProfile2D* profile2D ( const std::string& title ) const 1728 { 1729 Profile2DMapTitle::const_iterator found = profile2DMapTitle().find( title ) ; 1730 return ( profile2DMapTitle().end() == found ? 0 : found->second ); 1731 } 1732 // ========================================================================== 1733 public: 1734 // ========================================================================== 1735 /** access the EXISTING 1D histogram by ID 1736 * return the pointer to existing 1D histogram or NULL 1737 */ 1738 AIDA::IHistogram1D* histo1D ( const HistoID& ID ) const; 1739 // ========================================================================== 1740 /** access the EXISTING 1D histogram by ID 1741 * 1742 * Wrapper method for the equivalent histo1D method. 1743 * Retained for backwards compatibility, please use histo1D instead. 1744 * 1745 * return the pointer to existing 1D histogram or NULL 1746 */ 1747 inline AIDA::IHistogram1D* histo ( const HistoID& ID ) const 1748 { 1749 return histo1D( ID ); 1750 } 1751 // ========================================================================== 1752 /** access the EXISTING 2D histogram by ID 1753 * return the pointer to existing 2D histogram or NULL 1754 */ 1755 AIDA::IHistogram2D* histo2D ( const HistoID& ID ) const; 1756 // ========================================================================== 1757 /** access the EXISTING 3D histogram by ID 1758 * return the pointer to existing 3D histogram or NULL 1759 */ 1760 AIDA::IHistogram3D* histo3D ( const HistoID& ID ) const; 1761 // ========================================================================== 1762 /** access the EXISTING 1D profile histogram by ID 1763 * return the pointer to existing 1D profile histogram or NULL 1764 */ 1765 AIDA::IProfile1D* profile1D ( const HistoID& ID ) const; 1766 // ========================================================================== 1767 /** access the EXISTING 2D profile histogram by ID 1768 * return the pointer to existing 2D profile histogram or NULL 1769 */ 1770 AIDA::IProfile2D* profile2D ( const HistoID& ID ) const; 1771 // ========================================================================== 1772 public: 1773 // ========================================================================== 1774 /// check the existence AND validity of the histogram with given title 1775 inline bool histoExists ( const std::string& title ) const 1776 { 1777 return 1778 ( 0 != histo ( title ) || 1779 0 != histo2D ( title ) || 1780 0 != histo3D ( title ) || 1781 0 != profile1D ( title ) || 1782 0 != profile2D ( title ) ); 1783 } 1784 // ========================================================================== 1785 /// check the existence AND validity of the histogram with given title 1786 inline bool histoExists ( const HistoID& ID ) const 1787 { 1788 return 1789 ( 0 != histo ( ID ) || 1790 0 != histo2D ( ID ) || 1791 0 != histo3D ( ID ) || 1792 0 != profile1D ( ID ) || 1793 0 != profile2D ( ID ) ); 1794 } 1795 /// Returns the total number of histograms (of all types) currently booked 1796 unsigned int totalNumberOfHistos() const; 1797 // ========================================================================== 1798 public: // trivial & non-trivial accessors 1799 // ========================================================================== 1800 /// get the flag for histogram production (property "HistoProduce") 1801 inline bool produceHistos () const { return m_produceHistos ; } 1802 /// get flag to control output level of histograms 1803 inline bool fullDetail () const { return m_fullDetail ; } 1804 /// get the flag for NaN checks (property "HistoCheckForNan") 1805 inline bool checkForNaN () const { return m_checkForNaN ; } 1806 /// get the flag for histogram path split (property "HistoSplitDir") 1807 inline bool splitHistoDir () const { return m_splitHistoDir ; } 1808 /// get the value for histogram offset (property "HistoOffSet") 1809 inline HistoID::NumericID histoOffSet () const { return m_histoOffSet ; } 1810 /// get top-level histogram directory (property "HistoTopDir") 1811 inline const std::string& histoTopDir () const { return m_histoTopDir ; } 1812 /// get histogram directory (property "HistoDir") 1813 inline const std::string& histoDir () const { return m_histoDir ; } 1814 /// get the constructed histogram path 1815 inline std::string histoPath () const 1816 { 1817 const std::string path = histoTopDir() + histoDir(); 1818 return ( splitHistoDir() ? dirHbookName(path) : path ); 1819 } 1820 /// print histograms at finalization ? 1821 inline bool histosPrint () const { return m_histosPrint ; } 1822 /// Use old style sequencial numerical automatically assigned IDs ? 1823 inline bool useNumericAutoIDs() const { return m_useNumericAutoIDs; } 1824 // ========================================================================== 1825 /** perform the actual printout of histograms 1826 * @param level The message level to print at 1827 * @return number of active histograms 1828 */ 1829 int printHistos ( const MSG::Level level = MSG::ALWAYS ) const ; 1830 // ========================================================================== 1831 /** get access to the map of all 1D histograms indexed via their title 1832 * 1833 * Using this method one can inspect e.g. a list of active histograms 1834 * 1835 * @code 1836 * 1837 * const Histo1DMapTitle& histos = histo1DMapTitle() ; 1838 * // iterate over the map! 1839 * for ( Histo1DMapTitle::const_iterator entry = histos.begin() ; 1840 * histos.end() != entry ; ++entry ) 1841 * { 1842 * // histogram title 1843 * const std::string& title = entry->first ; 1844 * // histogram itself 1845 * AIDA::IHistogram1D* hist = entry->second ; 1846 * if( 0 == hist ) { continue ; } // ATTENTION! 1847 * 1848 * std::cout << " Histogram title " << title << std::endl ; 1849 * 1850 * } 1851 * 1852 * @endcode 1853 * 1854 * @attention The map *COULD* contains NULL pointers, 1855 * the check before use is mandatory! 1856 * 1857 */ 1858 const Histo1DMapTitle & histo1DMapTitle() const { return m_histo1DMapTitle; } 1859 // ========================================================================== 1860 /** get access to the map of 1D histograms index via a numeric ID 1861 * 1862 * @attention This map only contains 1D histogram booked via a numeric 1863 * ID, either forced or automatically assigned. 1864 * 1865 * @code 1866 * 1867 * const Histo1DMapNumID& histos = histo1DMapNumID() ; 1868 * // iterate over the map! 1869 * for ( Histo1DMapNumID::const_iterator entry = histos.begin() ; 1870 * histos.end() != entry ; ++entry ) 1871 * { 1872 * // histogram ID 1873 * const HistoID ID = entry->first ; 1874 * // histogram itself 1875 * AIDA::IHistogram1D* h = entry->second ; 1876 * if ( 0 == h ) { continue ;} 1877 * 1878 * std::cout << " Histogram ID " << ID 1879 * << " Histogram title " << h->title() << std::endl ; 1880 * 1881 * } 1882 * 1883 * @endcode 1884 * 1885 * @attention The map *COULD* contains NULL pointers, 1886 * the check before use is mandatory! 1887 * 1888 */ 1889 const Histo1DMapNumID & histo1DMapNumID () const { return m_histo1DMapNumID; } 1890 // ========================================================================== 1891 /** get access to the map of all 1D histograms index via a literal (string) ID 1892 * 1893 * @attention This map only contains 1D histogram booked via a literal ID. 1894 * 1895 * @code 1896 * 1897 * const Histo1DMapLitID& histos = histo1DMapLitID() ; 1898 * // iterate over the map! 1899 * for ( Histo1DMapLitID::const_iterator entry = histos.begin() ; 1900 * histos.end() != entry ; ++entry ) 1901 * { 1902 * // histogram ID 1903 * const HistoID ID = entry->first ; 1904 * // histogram itself 1905 * AIDA::IHistogram1D* h = entry->second ; 1906 * if ( 0 == h ) { continue ;} 1907 * 1908 * std::cout << " Histogram ID " << ID 1909 * << " Histogram title " << h->title() << std::endl ; 1910 * 1911 * } 1912 * 1913 * @endcode 1914 * 1915 * @attention The map *COULD* contains NULL pointers, 1916 * the check before use is mandatory! 1917 * 1918 */ 1919 const Histo1DMapLitID & histo1DMapLitID () const { return m_histo1DMapLitID; } 1920 // ========================================================================== 1921 /** get access to the map of all 2D histograms indexed via their title 1922 * 1923 * Using this method one can inspect e.g. a list of active histograms 1924 * 1925 * @code 1926 * 1927 * const Histo2DMapTitle& histos = histo2DMapTitle() ; 1928 * // iterate over the map! 1929 * for ( Histo2DMapTitle::const_iterator entry = histos.begin() ; 1930 * histos.end() != entry ; ++entry ) 1931 * { 1932 * // histogram title 1933 * const std::string& title = entry->first ; 1934 * // histogram itself 1935 * AIDA::IHistogram2D* hist = entry->second ; 1936 * if( 0 == hist ) { continue ; } // ATTENTION! 1937 * 1938 * std::cout << " Histogram title " << title << std::endl ; 1939 * 1940 * } 1941 * 1942 * @endcode 1943 * 1944 * @attention The map *COULD* contains NULL pointers, 1945 * the check before use is mandatory! 1946 * 1947 */ 1948 const Histo2DMapTitle & histo2DMapTitle() const { return m_histo2DMapTitle ; } 1949 // ========================================================================== 1950 /** get access to the map of 2D histograms index via a numeric ID 1951 * 1952 * @attention This map only contains 2D histogram booked via a numeric 1953 * ID, either forced or automatically assigned. 1954 * 1955 * @code 1956 * 1957 * const Histo2DMapNumID& histos = histo2DMapNumID() ; 1958 * // iterate over the map! 1959 * for ( Histo2DMapNumID::const_iterator entry = histos.begin() ; 1960 * histos.end() != entry ; ++entry ) 1961 * { 1962 * // histogram ID 1963 * const HistoID ID = entry->first ; 1964 * // histogram itself 1965 * AIDA::IHistogram2D* h = entry->second ; 1966 * if ( 0 == h ) { continue ;} 1967 * 1968 * std::cout << " Histogram ID " << ID 1969 * << " Histogram title " << h->title() << std::endl ; 1970 * 1971 * } 1972 * 1973 * @endcode 1974 * 1975 * @attention The map *COULD* contains NULL pointers, 1976 * the check before use is mandatory! 1977 * 1978 */ 1979 const Histo2DMapNumID & histo2DMapNumID () const { return m_histo2DMapNumID; } 1980 // ========================================================================== 1981 /** get access to the map of all 2D histograms index via a literal (string) ID 1982 * 1983 * @attention This map only contains 2D histogram booked via a literal ID. 1984 * 1985 * @code 1986 * 1987 * const Histo2DMapLitID& histos = histo2DMapLitID() ; 1988 * // iterate over the map! 1989 * for ( Histo2DMapLitID::const_iterator entry = histos.begin() ; 1990 * histos.end() != entry ; ++entry ) 1991 * { 1992 * // histogram ID 1993 * const HistoID ID = entry->first ; 1994 * // histogram itself 1995 * AIDA::IHistogram2D* h = entry->second ; 1996 * if ( 0 == h ) { continue ;} 1997 * 1998 * std::cout << " Histogram ID " << ID 1999 * << " Histogram title " << h->title() << std::endl ; 2000 * 2001 * } 2002 * 2003 * @endcode 2004 * 2005 * @attention The map *COULD* contains NULL pointers, 2006 * the check before use is mandatory! 2007 * 2008 */ 2009 const Histo2DMapLitID & histo2DMapLitID () const { return m_histo2DMapLitID; } 2010 // ========================================================================== 2011 /** get access to the map of all 3D histograms indexed via their title 2012 * 2013 * Using this method one can inspect e.g. a list of active histograms 2014 * 2015 * @code 2016 * 2017 * const Histo3DMapTitle& histos = histo3DMapTitle() ; 2018 * // iterate over the map! 2019 * for ( Histo3DMapTitle::const_iterator entry = histos.begin() ; 2020 * histos.end() != entry ; ++entry ) 2021 * { 2022 * // histogram title 2023 * const std::string& title = entry->first ; 2024 * // histogram itself 2025 * AIDA::IHistogram3D* hist = entry->second ; 2026 * if( 0 == hist ) { continue ; } // ATTENTION! 2027 * 2028 * std::cout << " Histogram title " << title << std::endl ; 2029 * 2030 * } 2031 * 2032 * @endcode 2033 * 2034 * @attention The map *COULD* contains NULL pointers, 2035 * the check before use is mandatory! 2036 * 2037 */ 2038 const Histo3DMapTitle & histo3DMapTitle () const { return m_histo3DMapTitle ; } 2039 // ========================================================================== 2040 /** get access to the map of 3D histograms index via a numeric ID 2041 * 2042 * @attention This map only contains 3D histogram booked via a numeric 2043 * ID, either forced or automatically assigned. 2044 * 2045 * @code 2046 * 2047 * const Histo3DMapNumID& histos = histo3DMapNumID() ; 2048 * // iterate over the map! 2049 * for ( Histo3DMapNumID::const_iterator entry = histos.begin() ; 2050 * histos.end() != entry ; ++entry ) 2051 * { 2052 * // histogram ID 2053 * const HistoID ID = entry->first ; 2054 * // histogram itself 2055 * AIDA::IHistogram3D* h = entry->second ; 2056 * if ( 0 == h ) { continue ;} 2057 * 2058 * std::cout << " Histogram ID " << ID 2059 * << " Histogram title " << h->title() << std::endl ; 2060 * 2061 * } 2062 * 2063 * @endcode 2064 * 2065 * @attention The map *COULD* contains NULL pointers, 2066 * the check before use is mandatory! 2067 * 2068 */ 2069 const Histo3DMapNumID & histo3DMapNumID () const { return m_histo3DMapNumID; } 2070 // ========================================================================== 2071 /** get access to the map of all 3D histograms index via a literal (string) ID 2072 * 2073 * @attention This map only contains 3D histogram booked via a literal ID. 2074 * 2075 * @code 2076 * 2077 * const Histo3DMapLitID& histos = histo3DMapLitID() ; 2078 * // iterate over the map! 2079 * for ( Histo3DMapLitID::const_iterator entry = histos.begin() ; 2080 * histos.end() != entry ; ++entry ) 2081 * { 2082 * // histogram ID 2083 * const HistoID ID = entry->first ; 2084 * // histogram itself 2085 * AIDA::IHistogram3D* h = entry->second ; 2086 * if ( 0 == h ) { continue ;} 2087 * 2088 * std::cout << " Histogram ID " << ID 2089 * << " Histogram title " << h->title() << std::endl ; 2090 * 2091 * } 2092 * 2093 * @endcode 2094 * 2095 * @attention The map *COULD* contains NULL pointers, 2096 * the check before use is mandatory! 2097 * 2098 */ 2099 const Histo3DMapLitID & histo3DMapLitID () const { return m_histo3DMapLitID; } 2100 // ========================================================================== 2101 /** get access to the map of all 1D profile histograms indexed via their title 2102 * 2103 * Using this method one can inspect e.g. a list of active histograms 2104 * 2105 * @code 2106 * 2107 * const Profile1DMapTitle& histos = profile1DMapTitle() ; 2108 * // iterate over the map! 2109 * for ( Profile1DMapTitle::const_iterator entry = histos.begin() ; 2110 * histos.end() != entry ; ++entry ) 2111 * { 2112 * // histogram title 2113 * const std::string& title = entry->first ; 2114 * // histogram itself 2115 * AIDA::IProfile1D* hist = entry->second ; 2116 * if( 0 == hist ) { continue ; } // ATTENTION! 2117 * 2118 * std::cout << " Histogram title " << title << std::endl ; 2119 * 2120 * } 2121 * 2122 * @endcode 2123 * 2124 * @attention The map *COULD* contains NULL pointers, 2125 * the check before use is mandatory! 2126 * 2127 */ 2128 const Profile1DMapTitle & profile1DMapTitle() const { return m_profile1DMapTitle; } 2129 // ========================================================================== 2130 /** get access to the map of 1D profile histograms index via a numeric ID 2131 * 2132 * @attention This map only contains 2D histogram booked via a numeric 2133 * ID, either forced or automatically assigned. 2134 * 2135 * @code 2136 * 2137 * const Profile1DMapNumID& histos = profile1DMapNumID() ; 2138 * // iterate over the map! 2139 * for ( Profile1DMapNumID::const_iterator entry = histos.begin() ; 2140 * histos.end() != entry ; ++entry ) 2141 * { 2142 * // histogram ID 2143 * const HistoID ID = entry->first ; 2144 * // histogram itself 2145 * AIDA::IProfile1D* h = entry->second ; 2146 * if ( 0 == h ) { continue ;} 2147 * 2148 * std::cout << " Histogram ID " << ID 2149 * << " Histogram title " << h->title() << std::endl ; 2150 * 2151 * } 2152 * 2153 * @endcode 2154 * 2155 * @attention The map *COULD* contains NULL pointers, 2156 * the check before use is mandatory! 2157 * 2158 */ 2159 const Profile1DMapNumID & profile1DMapNumID () const { return m_profile1DMapNumID; } 2160 // ========================================================================== 2161 /** get access to the map of 1D profile histograms index via a literal ID 2162 * 2163 * @attention This map only contains 2D histogram booked via a literal 2164 * ID, either forced or automatically assigned. 2165 * 2166 * @code 2167 * 2168 * const Profile1DMapLitID& histos = profile1DMapLitID() ; 2169 * // iterate over the map! 2170 * for ( Profile1DMapLitID::const_iterator entry = histos.begin() ; 2171 * histos.end() != entry ; ++entry ) 2172 * { 2173 * // histogram ID 2174 * const HistoID ID = entry->first ; 2175 * // histogram itself 2176 * AIDA::IProfile1D* h = entry->second ; 2177 * if ( 0 == h ) { continue ;} 2178 * 2179 * std::cout << " Histogram ID " << ID 2180 * << " Histogram title " << h->title() << std::endl ; 2181 * 2182 * } 2183 * 2184 * @endcode 2185 * 2186 * @attention The map *COULD* contains NULL pointers, 2187 * the check before use is mandatory! 2188 * 2189 */ 2190 const Profile1DMapLitID & profile1DMapLitID () const { return m_profile1DMapLitID; } 2191 // ========================================================================== 2192 /** get access to the map of all 2D profile histograms indexed via their title 2193 * 2194 * Using this method one can inspect e.g. a list of active histograms 2195 * 2196 * @code 2197 * 2198 * const Profile2DMapTitle& histos = profile2DMapTitle() ; 2199 * // iterate over the map! 2200 * for ( Profile2DMapTitle::const_iterator entry = histos.begin() ; 2201 * histos.end() != entry ; ++entry ) 2202 * { 2203 * // histogram title 2204 * const std::string& title = entry->first ; 2205 * // histogram itself 2206 * AIDA::IProfile2D* hist = entry->second ; 2207 * if( 0 == hist ) { continue ; } // ATTENTION! 2208 * 2209 * std::cout << " Histogram title " << title << std::endl ; 2210 * 2211 * } 2212 * 2213 * @endcode 2214 * 2215 * @attention The map *COULD* contains NULL pointers, 2216 * the check before use is mandatory! 2217 * 2218 */ 2219 const Profile2DMapTitle & profile2DMapTitle() const { return m_profile2DMapTitle; } 2220 // ========================================================================== 2221 /** get access to the map of 2D profile histograms index via a numeric ID 2222 * 2223 * @attention This map only contains 2D histogram booked via a numeric 2224 * ID, either forced or automatically assigned. 2225 * 2226 * @code 2227 * 2228 * const Profile2DMapNumID& histos = profile2DMapNumID() ; 2229 * // iterate over the map! 2230 * for ( Profile2DMapNumID::const_iterator entry = histos.begin() ; 2231 * histos.end() != entry ; ++entry ) 2232 * { 2233 * // histogram ID 2234 * const HistoID ID = entry->first ; 2235 * // histogram itself 2236 * AIDA::IProfile2D* h = entry->second ; 2237 * if ( 0 == h ) { continue ;} 2238 * 2239 * std::cout << " Histogram ID " << ID 2240 * << " Histogram title " << h->title() << std::endl ; 2241 * 2242 * } 2243 * 2244 * @endcode 2245 * 2246 * @attention The map *COULD* contains NULL pointers, 2247 * the check before use is mandatory! 2248 * 2249 */ 2250 const Profile2DMapNumID & profile2DMapNumID () const { return m_profile2DMapNumID; } 2251 // ========================================================================== 2252 /** get access to the map of 2D profile histograms index via a literal ID 2253 * 2254 * @attention This map only contains 2D histogram booked via a literal 2255 * ID, either forced or automatically assigned. 2256 * 2257 * @code 2258 * 2259 * const Profile2DMapLitID& histos = profile2DMapLitID() ; 2260 * // iterate over the map! 2261 * for ( Profile2DMapLitID::const_iterator entry = histos.begin() ; 2262 * histos.end() != entry ; ++entry ) 2263 * { 2264 * // histogram ID 2265 * const HistoID ID = entry->first ; 2266 * // histogram itself 2267 * AIDA::IProfile2D* h = entry->second ; 2268 * if ( 0 == h ) { continue ;} 2269 * 2270 * std::cout << " Histogram ID " << ID 2271 * << " Histogram title " << h->title() << std::endl ; 2272 * 2273 * } 2274 * 2275 * @endcode 2276 * 2277 * @attention The map *COULD* contains NULL pointers, 2278 * the check before use is mandatory! 2279 * 2280 */ 2281 const Profile2DMapLitID & profile2DMapLitID () const { return m_profile2DMapLitID; } 2282 // ========================================================================== 2283 public: // trivial setters 2284 // ========================================================================== 2285 /// set the flag for histogram production (property "HistoProduce") 2286 inline void setProduceHistos ( const bool val ) { m_produceHistos = val ; } 2287 /// set flag to control output level of histograms 2288 inline void setFullDetail ( const bool val ) { m_fullDetail = val ; } 2289 /// set the flag for NaN checks (property "HistoCheckForNan") 2290 inline void setCheckForNaN ( const bool val ) { m_checkForNaN = val ; } 2291 /// set the flag for histogram path split (property "HistoSplitDir") 2292 inline void setSplitHistoDir ( const bool val ) { m_splitHistoDir = val ; } 2293 /// set a value for histogram offset (property "HistoOffSet" 2294 inline void setHistoOffSet ( const HistoID::NumericID val ) 2295 { m_histoOffSet = val ; } 2296 // ========================================================================== 2297 /// set top-level histogram directory (property "HistoTopDir") 2298 inline void setHistoTopDir ( const std::string& val ) { m_histoTopDir = val ; } 2299 // ========================================================================== 2300 /// set histogram directory (property "HistoDir") 2301 inline void setHistoDir ( const std::string& val ) { m_histoDir = val ; } 2302 // ========================================================================== 2303 public: 2304 // ========================================================================== 2305 /// Algorithm constructor 2306 GaudiHistos ( const std::string & name, 2307 ISvcLocator * pSvcLocator ); 2308 // ========================================================================== 2309 /// Tool constructor 2310 GaudiHistos ( const std::string& type , 2311 const std::string& name , 2312 const IInterface* parent ); 2313 // ========================================================================== 2314 /// Destructor 2315 virtual ~GaudiHistos(); 2316 // ========================================================================== 2317 protected: 2318 // ========================================================================== 2319 /** standard initialization method 2320 * @return status code 2321 */ 2322 virtual StatusCode initialize (); 2323 // ========================================================================== 2324 /** standard finalization method 2325 * @return status code 2326 */ 2327 virtual StatusCode finalize (); 2328 // ========================================================================== 2329 private: 2330 // ========================================================================== 2331 /// Check if all histogram maps are empty 2332 bool noHistos() const; 2333 // ===========================================unsigned=============================== 2334 /// Constructor initialisation and job options 2335 void initGaudiHistosConstructor(); 2336 // ========================================================================== 2337 /** @brief Declare a histogram to the monitor service 2338 * 2339 * Uses the histogram ID as the 'name' sent to the monitor service and 2340 * the histogram title as the long description 2341 */ 2342 void monitorHisto( const AIDA::IBaseHistogram* hist, 2343 const HistoID& ID ) const; 2344 // ========================================================================== 2345 /** Create a new histogram ID using the given title 2346 * @param[in] title Histogram title 2347 * @param[out] ID The ID to use for the new histogram 2348 */ 2349 void newHistoID( const std::string & title, 2350 HistoID& ID ) const; 2351 // ========================================================================== 2352 /// Searches 'title' for all instancies of 'A' and replaces them with 'B' 2353 void stringSearchReplace( std::string & title, 2354 const std::string & A, 2355 const std::string & B ) const; 2356 // ========================================================================== 2357 protected: 2358 // ========================================================================== 2359 /// Create an ID string from a title string 2360 std::string convertTitleToID( const std::string & title ) const; 2361 // ========================================================================== 2362 private: 2363 // ========================================================================== 2364 /// flag to SWITCH ON/SWITCH OFF the histogrm fillling and booking 2365 bool m_produceHistos ; 2366 /// flag to control output level of histograms 2367 bool m_fullDetail; 2368 /// flag to control check for Nan/Finite while filling the histogram 2369 bool m_checkForNaN ; 2370 /// split histogram directory name (very useful for Hbook) 2371 bool m_splitHistoDir ; 2372 /// general histogram ID offset (only works for automatically assigned numeric IDs) 2373 HistoID::NumericID m_histoOffSet ; 2374 /// histogram top level directory 2375 std::string m_histoTopDir ; 2376 /// histogram directory 2377 std::string m_histoDir ; 2378 /// print histograms at finalization 2379 bool m_histosPrint ; 2380 /// Flag to turn on/off the registration of histograms to the Monitoring Service 2381 bool m_declareMoniHists; 2382 // ========================================================================== 2383 /// the actual storage/access of 1D histograms by unique title 2384 mutable Histo1DMapTitle m_histo1DMapTitle ; 2385 /// the actual storage/access of 1D histograms by unique numeric ID 2386 mutable Histo1DMapNumID m_histo1DMapNumID ; 2387 /// the actual storage/access of 1D histograms by unique literal ID 2388 mutable Histo1DMapLitID m_histo1DMapLitID ; 2389 // ========================================================================== 2390 /// the actual storage/access of 2D histograms by unique title 2391 mutable Histo2DMapTitle m_histo2DMapTitle ; 2392 /// the actual storage/access of 2D histograms by unique numeric ID 2393 mutable Histo2DMapNumID m_histo2DMapNumID ; 2394 /// the actual storage/access of 2D histograms by unique literal ID 2395 mutable Histo2DMapLitID m_histo2DMapLitID ; 2396 // ========================================================================== 2397 /// the actual storage/access of 3D histograms by unique title 2398 mutable Histo3DMapTitle m_histo3DMapTitle ; 2399 /// the actual storage/access of 3D histograms by unique numeric ID 2400 mutable Histo3DMapNumID m_histo3DMapNumID ; 2401 /// the actual storage/access of 3D histograms by unique literal ID 2402 mutable Histo3DMapLitID m_histo3DMapLitID ; 2403 // ========================================================================== 2404 /// the actual storage/access of 1D profile histograms by unique title 2405 mutable Profile1DMapTitle m_profile1DMapTitle ; 2406 /// the actual storage/access of 1D profile histograms by unique numeric ID 2407 mutable Profile1DMapNumID m_profile1DMapNumID ; 2408 /// the actual storage/access of 1D profile histograms by unique literal ID 2409 mutable Profile1DMapLitID m_profile1DMapLitID ; 2410 // ========================================================================== 2411 /// the actual storage/access of 2D profile histograms by unique title 2412 mutable Profile2DMapTitle m_profile2DMapTitle ; 2413 /// the actual storage/access of 2D profile histograms by unique numeric ID 2414 mutable Profile2DMapNumID m_profile2DMapNumID ; 2415 /// the actual storage/access of 2D profile histograms by unique literal ID 2416 mutable Profile2DMapLitID m_profile2DMapLitID ; 2417 // ========================================================================== 2418 /// format for printout of 1D-histograms as a table 2419 std::string m_histo1DTableFormat ; 2420 /// format for printout of 1D-histograms as a table 2421 std::string m_histo1DTableFormatShort ; 2422 /// the header for the table of 1-D historgrams 2423 std::string m_histo1DTableHeader ; 2424 /// Flag to switch back to the old style sequencial numerical automatic IDs 2425 bool m_useNumericAutoIDs; 2426 /** Map of strings to search and replace when using the title as the basis 2427 * of automatically generated literal IDs 2428 */ 2429 std::map<std::string,std::string> m_idReplaceInfo; 2430 }; 2431 // ============================================================================ 2432 // The END 2433 // ============================================================================ 2434 #endif // GAUDIALG_GAUDIHISTOS_H 2435 // ============================================================================ 2436
| [ 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. |
|