Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

ROList.h

Go to the documentation of this file.
00001 
00009 #ifndef __ROLIST_H
00010 #define __ROLIST_H
00011 
00012 #include "jbltools/sfh/RegO.h"
00013 
00014 #include <TH1.h> // defines Option_t
00015 
00016 #include <map>
00017 
00018 class HVisitor;
00019 class ConstHVisitor;
00020 class TPad;
00021 class TVirtualPS;
00022 class ROListPoR;
00023 
00024 //  Class ROList:
00026 
00076 class ROList: public RegO {
00077     
00078   public:
00080     typedef unsigned long long IndexType;
00081   
00082   private:  
00083     enum {LINEAR = 0, LOGY = 1, LOGX = 2, LOGXY = 3};   
00084     typedef std::map<IndexType, RegO *> MapType;
00085   public:
00086     typedef MapType::const_iterator         const_iterator;
00087     typedef MapType::iterator               iterator;
00088     typedef MapType::const_reverse_iterator const_reverse_iterator;
00089     typedef MapType::reverse_iterator       reverse_iterator;
00090     
00091   public:
00093     ROList ();
00095     ROList (const ROListPoR& mother        
00096            );
00097     
00098     virtual ~ROList ();
00099                       
00101     int registerObject (RegO* h          
00102                        );    
00104     int registerObject (IndexType n,  
00105                         RegO* h          
00106                        );    
00107     
00109     virtual void Write ();
00110     
00112 
00117     virtual ROList& visit (HVisitor& v      
00118                           );
00120     virtual ROList& visit (const ConstHVisitor& v);
00121     
00123 
00136     virtual int Draw (TPad *pad,              
00137                        TVirtualPS *ps = 0,     
00138                        Option_t *option = 0,   
00139                        bool across = true,     
00140                        Int_t nx = 1,           
00141                        Int_t ny = 1,           
00142                        Float_t xmargin = 0.01, 
00143                        Float_t ymargin = 0.01, 
00144                        Int_t color = 0,        
00145                        Int_t log = 0,          
00146                        bool recursive = false,  
00147                        int izone = 0            
00148                       );
00151     virtual int Draw (TPad *pad,              
00152                        TVirtualPS *ps,         
00153                        Option_t *option,       
00154                        bool across,            
00155                        Int_t nx,               
00156                        Int_t ny,               
00157                        Int_t log,              
00158                        bool recursive = false,  
00159                        int izone = 0            
00160                       );
00161     
00163 
00183     virtual int DrawFunc (TPad *pad,                    
00184                        TVirtualPS *ps = 0,              
00185                        Option_t *option = 0,            
00186                        const char* fname = "",          
00187                        bool across = true,              
00188                        Int_t nx = 1,                    
00189                        Int_t ny = 1,                    
00190                        Float_t xmargin = 0.01,          
00191                        Float_t ymargin = 0.01,          
00192                        Int_t color = 0,                 
00193                        Int_t log = 0,                   
00194                        bool recursive = false,          
00195                        int izone = 0                    
00196                       );
00199     virtual int DrawFunc (TPad *pad,                    
00200                        TVirtualPS *ps,                  
00201                        Option_t *option,                
00202                        const char* fname,               
00203                        bool across,                     
00204                        Int_t nx,                        
00205                        Int_t ny,                        
00206                        Int_t log,                       
00207                        bool recursive = false,          
00208                        int izone = 0                    
00209                       );
00210     
00212 
00225     virtual void DrawCutFlow (TPad *pad,              
00226                               TVirtualPS *ps = 0,     
00227                               Option_t *option = 0,   
00228                               Option_t *sameoption = 0, 
00229                               bool across = true,     
00230                               Int_t nx = 1,           
00231                               Int_t ny = 1,           
00232                               Float_t xmargin = 0.01, 
00233                               Float_t ymargin = 0.01, 
00234                               Int_t color = 0,        
00235                               Int_t log = 0,          
00236                               bool recursive = false, 
00237                               bool backward = false   
00238                              );
00240     virtual void DrawCutFlow (TPad *pad,              
00241                               TVirtualPS *ps,         
00242                               Option_t *option,       
00243                               Option_t *sameoption,   
00244                               bool across,            
00245                               Int_t nx,               
00246                               Int_t ny,               
00247                               Int_t log,              
00248                               bool recursive = false, 
00249                               bool backward = false   
00250                              );
00252     inline IndexType getEntries() const;                  
00254     inline IndexType getHighestEntry() const;       
00256     inline IndexType getFirstEntry() const;       
00258     inline RegO *getEntry(IndexType i       
00259                              ) const;                  
00261     inline RegO *getNextEntry(IndexType& i  
00262                              ) const;     
00263 
00265     inline RegO *getEntry(const_iterator iter       
00266                          ) const;                  
00268     inline RegO *getNextEntry(const_iterator& i  
00269                              ) const;     
00270                              
00271     inline iterator begin();
00272     inline const_iterator begin() const;
00273     inline iterator end();
00274     inline const_iterator end() const;
00275     
00276     inline reverse_iterator rbegin();
00277     inline const_reverse_iterator rbegin() const;
00278     inline reverse_iterator rend();
00279     inline const_reverse_iterator rend() const;
00280                              
00281     inline iterator lower_bound (IndexType i
00282                                 );
00283     inline const_iterator lower_bound(IndexType i
00284                                 ) const;
00285     inline iterator upper_bound(IndexType i
00286                                 );
00287     inline const_iterator upper_bound(IndexType i
00288                                 ) const;
00289     
00291     inline IndexType getIndex (iterator iter       
00292                                ) const;
00293     inline IndexType getIndex (const_iterator iter       
00294                                ) const;
00295                                         
00296   private:  
00297     MapType theMap;      
00298 };
00299 
00300 // Implementation of inline member functions
00301 ROList::IndexType ROList::getEntries() const { 
00302   return theMap.size(); 
00303 } 
00304                
00305 ROList::IndexType ROList::getHighestEntry() const { 
00306   // theMap.rbegin() is the iterator pointing to the last element in the map
00307   return (theMap.empty()) ? 0 : rbegin()->first+1;
00308 }                
00309                
00310 ROList::IndexType ROList::getFirstEntry() const { 
00311   return (theMap.empty()) ? 0 : begin()->first;
00312 }                
00313 
00314 RegO *ROList::getEntry(IndexType i) const {
00315   const_iterator iter = theMap.find(i);
00316   return (iter != end()) ? iter->second : 0;
00317 }                 
00318 
00319 
00320 RegO *ROList::getNextEntry(IndexType& i) const {
00321   const_iterator iter = theMap.upper_bound(i);
00322   if (iter != theMap.end()) {
00323     i = iter->first;
00324     return iter->second;
00325   }
00326   return 0;
00327 }
00328 
00329 RegO *ROList::getEntry(ROList::const_iterator iter) const {
00330   return (iter != end()) ? iter->second : 0;
00331 }                 
00332 
00333 RegO *ROList::getNextEntry(ROList::const_iterator& iter) const {
00334   if (iter == theMap.end()) return 0;
00335   if (++iter == theMap.end()) return 0;
00336   return iter->second;
00337 }
00338   
00339 ROList::iterator ROList::begin() {
00340   return theMap.begin();
00341 }
00342 ROList::const_iterator ROList::begin() const {
00343   return theMap.begin();
00344 }
00345   
00346 ROList::iterator ROList::end() {
00347   return theMap.end();
00348 }
00349 ROList::const_iterator ROList::end() const {
00350   return theMap.end();
00351 }
00352   
00353 ROList::reverse_iterator ROList::rbegin() {
00354   return theMap.rbegin();
00355 }
00356 ROList::const_reverse_iterator ROList::rbegin() const {
00357   return theMap.rbegin();
00358 }
00359   
00360 ROList::reverse_iterator ROList::rend() {
00361   return theMap.rend();
00362 }
00363 ROList::const_reverse_iterator ROList::rend() const {
00364   return theMap.rend();
00365 }
00366 
00367 ROList::iterator ROList::lower_bound (IndexType i) {
00368   return theMap.lower_bound(i);
00369 }
00370 ROList::const_iterator ROList::lower_bound(IndexType i) const {
00371   return theMap.lower_bound(i);
00372 }
00373 ROList::iterator ROList::upper_bound(IndexType i) {
00374   return theMap.upper_bound(i);
00375 }
00376 ROList::const_iterator ROList::upper_bound(IndexType i) const {
00377   return theMap.upper_bound(i);
00378 }
00379 
00380 ROList::IndexType ROList::getIndex (ROList::iterator iter) const {
00381   if (iter == theMap.end()) return getHighestEntry();
00382   return iter->first;
00383 }
00384 ROList::IndexType ROList::getIndex (ROList::const_iterator iter) const {
00385   if (iter == theMap.end()) return getHighestEntry();
00386   return iter->first;
00387 }
00388               
00389 #endif  /* #ifndef __ROLIST_H */

Generated on Thu Oct 26 12:52:58 2006 for SFH by doxygen 1.3.2