Gaudi Framework, version v21r4

Home   Generated: 7 Sep 2009

GaudiHistos_3DVariableBinning.icpp

Go to the documentation of this file.
00001 // ==================================== 3D ====================================
00002 // ============================= Variable Binning =============================
00003 // ============================================================================
00004 // book the 3D histogram (book on demand)
00005 // ============================================================================
00006 template <class PBASE>
00007 AIDA::IHistogram3D*  GaudiHistos<PBASE>::book3D
00008 ( const std::string&  title        ,
00009   const HistoBinEdges&        edgesX       ,
00010   const HistoBinEdges&        edgesY       ,
00011   const HistoBinEdges&        edgesZ       ) const
00012 {
00013   // exist?
00014   AIDA::IHistogram3D * hist = histo3D ( title ) ;
00015   // histogram is already booked
00016   if( NULL != hist      )                   { return hist ; } // RETURN !!
00017 
00018   // propose the histogram ID
00019   HistoID ID;
00020   newHistoID( title, ID );
00021 
00022   // Create a new histogram and return
00023   return this -> book3D ( ID, title, edgesX, edgesY, edgesZ );
00024 }
00025 // ============================================================================
00026 // book the 2D histogram with forced ID (book on demand)
00027 // ============================================================================
00028 template <class PBASE>
00029 AIDA::IHistogram3D*  GaudiHistos<PBASE>::book3D
00030 ( const HistoID&      ID           ,
00031   const std::string&  title        ,
00032   const HistoBinEdges&        edgesX       ,
00033   const HistoBinEdges&        edgesY       ,
00034   const HistoBinEdges&        edgesZ       ) const
00035 {
00036   // Check ID
00037   if (ID.undefined())
00038   {
00039     this->Error("Undefined Histogram ID : Title='"+title+"'");
00040     return NULL;
00041   }
00042 
00043   // exist?
00044   AIDA::IHistogram3D * hist = histo3D ( ID ) ;
00045   // histogram is already booked
00046   if ( NULL != hist       )                 { return hist ; } // RETURN !!
00047 
00048   // Histogram title
00049   const std::string & htitle =
00050     ( title.empty() ? "Unnamed 3D Histogram ID="+ID.idAsString() : title ) ;
00051 
00052   // book the histogram
00053   if ( ID.numeric() )
00054   {
00055     hist = this->histoSvc() -> book ( histoPath()  ,
00056                                       ID.numericID() ,
00057                                       htitle       ,
00058                                       edgesX       , 
00059                                       edgesY       ,
00060                                       edgesZ       ) ;
00061   }
00062   else if ( ID.literal() )
00063   {
00064     hist = this->histoSvc() -> book ( histoPath()+"/"+
00065                                       ID.literalID() ,
00066                                       htitle         ,
00067                                       edgesX         ,
00068                                       edgesY         ,
00069                                       edgesZ         ) ;
00070   }
00071 
00072   // check OK
00073   if( NULL == hist )
00074   { this->Error( "IHistogram3D* points to NULL! ID='" + ID.idAsString() +
00075                  "' title='"+htitle+"'" ) ; return NULL; } // RETURN !!
00076 
00077   // add histogram into histogram storages
00078   if      ( ID.numeric() )
00079   { m_histo3DMapNumID [ ID.numericID() ] = hist ; }
00080   else if ( ID.literal() )
00081   { m_histo3DMapLitID [ ID.literalID() ] = hist ; }
00082   m_histo3DMapTitle [ title ] = hist ;
00083 
00084   // Declare to monitoring service
00085   monitorHisto( Gaudi::Utils::Histos::toBase ( hist ) , ID );
00086 
00087   // Printout and return
00088   if ( this->msgLevel(MSG::DEBUG) )
00089   { this->debug() << "Booked 3D Histogram : ID='" << ID
00090                   << "' Path=" << histoPath()
00091                   << " Title='"
00092                   << Gaudi::Utils::Histos::htitle ( hist )
00093                   << "'" << endmsg; }
00094   return hist ;
00095 }
00096 // ============================================================================
00097 // fill the 3D histogram (book on demand)
00098 // ============================================================================
00099 template <class PBASE>
00100 AIDA::IHistogram3D*
00101 GaudiHistos<PBASE>::plot3D
00102 ( const double        valueX ,
00103   const double        valueY ,
00104   const double        valueZ ,
00105   const std::string&  title  ,
00106   const HistoBinEdges&        edgesX ,
00107   const HistoBinEdges&        edgesY ,
00108   const HistoBinEdges&        edgesZ ,
00109   const double        weight ) const
00110 {
00111   AIDA::IHistogram3D * h(NULL);
00112   if ( produceHistos() )
00113   {
00114     // retrieve or book the histogram
00115     h = histo3D ( title ) ;
00116     if ( NULL == h ) { h = book3D ( title , edgesX , edgesY , edgesZ ) ; }
00117     // fill the histogram
00118     h = fill ( h , valueX , valueY , valueZ , weight , title );
00119   }
00120   return h;
00121 }
00122 // ============================================================================
00123 // fill the 3D variable histogram with forced ID assignment (book on demand)
00124 // ============================================================================
00125 template <class PBASE>
00126 AIDA::IHistogram3D*
00127 GaudiHistos<PBASE>::plot3D
00128 ( const double        valueX , 
00129   const double        valueY ,
00130   const double        valueZ ,
00131   const HistoID&      ID     ,
00132   const std::string&  title  ,
00133   const HistoBinEdges&        edgesX ,
00134   const HistoBinEdges&        edgesY ,
00135   const HistoBinEdges&        edgesZ ,
00136   const double        weight ) const
00137 {
00138   AIDA::IHistogram3D * h(NULL);
00139   if ( produceHistos() )
00140   {
00141     // retrieve or book the histogram
00142     h = histo3D ( ID ) ;
00143     if ( NULL == h ) {  h = book3D ( ID , title , edgesX , edgesY , edgesZ ) ; }
00144     // fill
00145     h = fill ( h , valueX , valueY , valueZ , weight , title ) ;
00146   }
00147   return h;
00148 }

Generated at Mon Sep 7 18:05:34 2009 for Gaudi Framework, version v21r4 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004