Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:30

0001 // Author: Gero Flucke <mailto:flucke@mail.desy.de>
0002 //____________________________________
0003 // GFHistArray
0004 //   Author:      Gero Flucke
0005 //   Date:        May 31st, 2002
0006 //   last update: $Date: 2007/04/04 12:33:17 $  
0007 //   by:          $Author: flucke $
0008 //
0009 
0010 #include <TH1.h>
0011 
0012 #include "GFHistArray.h"
0013 
0014 ClassImp(GFHistArray);
0015 
0016 GFHistArray::GFHistArray(Int_t initCapacity, Int_t lowerBound) 
0017   : TObjArray(initCapacity, lowerBound)
0018 {
0019   
0020 }
0021 
0022 GFHistArray::~GFHistArray()
0023 {
0024 
0025 }
0026   
0027   //    TObject        **GetObjectRef(TObject *obj) const;
0028 void GFHistArray::AddFirst(TObject *obj)
0029 {
0030   if(this->CheckObjOK(obj)) this->TObjArray::AddFirst(obj);
0031 }
0032 void GFHistArray::AddLast(TObject *obj)
0033 {
0034   if(this->CheckObjOK(obj)) this->TObjArray::AddLast(obj);
0035 }
0036 
0037 void GFHistArray::AddAll(const TCollection *collection)
0038 {
0039   TIter i(collection);
0040   while(TObject* obj = i.Next()){
0041     if(this->CheckObjOK(obj)) this->Add(obj);
0042   }
0043 }
0044 
0045 void GFHistArray::AddAll(const GFHistArray *hists)
0046 {
0047   this->TObjArray::AddAll(hists);
0048 }
0049 
0050 void GFHistArray::AddAt(TObject *obj, Int_t idx)
0051 {
0052   if(this->CheckObjOK(obj)) this->TObjArray::AddAt(obj, idx);
0053 }
0054 
0055 void GFHistArray::AddAtAndExpand(TObject *obj, Int_t idx)
0056 {
0057   if(this->CheckObjOK(obj)) this->TObjArray::AddAtAndExpand(obj, idx);
0058 }
0059 
0060 Int_t GFHistArray::AddAtFree(TObject *obj)
0061 {
0062   if(this->CheckObjOK(obj)) return this->TObjArray::AddAtFree(obj);
0063   else return -1;
0064 }
0065 
0066 void GFHistArray::AddAfter(const TObject *after, TObject *obj)
0067 {
0068   if(this->CheckObjOK(obj)) this->TObjArray::AddAfter(after, obj);
0069 }
0070 
0071 void GFHistArray::AddBefore(const TObject *after, TObject *obj)
0072 {
0073   if(this->CheckObjOK(obj)) this->TObjArray::AddBefore(after, obj);
0074 }
0075 
0076 TH1 *GFHistArray::RemoveAt(Int_t idx)
0077 {
0078   return static_cast<TH1*>(this->TObjArray::RemoveAt(idx));
0079 }
0080 
0081 TH1 *GFHistArray::Remove(TObject *obj)
0082 {
0083   return static_cast<TH1*>(this->TObjArray::Remove(obj));
0084 }
0085 
0086 
0087 // inline?:
0088 TH1 *GFHistArray::At(Int_t idx) const
0089 {
0090   return static_cast<TH1*>(this->TObjArray::At(idx));
0091 }
0092 
0093 TH1 *GFHistArray::UncheckedAt(Int_t i) const 
0094 { 
0095   return static_cast<TH1*>(TObjArray::UncheckedAt(i)); 
0096 }
0097 
0098 TH1 *GFHistArray::Before(const TObject *obj) const
0099 {
0100   return static_cast<TH1*>(this->TObjArray::Before(obj)); 
0101 }
0102 
0103 TH1 *GFHistArray::After(const TObject *obj) const
0104 {
0105   return static_cast<TH1*>(this->TObjArray::After(obj)); 
0106 }
0107 
0108 TH1 *GFHistArray::First() const
0109 {
0110   return static_cast<TH1*>(this->TObjArray::First()); 
0111 }
0112 
0113 TH1 *GFHistArray::Last() const
0114 {
0115   return static_cast<TH1*>(this->TObjArray::Last()); 
0116 }
0117 
0118 // no inline:
0119 TH1 *GFHistArray::operator[](Int_t i) const
0120 {
0121   return static_cast<TH1*>(this->TObjArray::At(i)); 
0122 }
0123 
0124 // TH1 *&GFHistArray::operator[](Int_t i)
0125 TObject *&GFHistArray::operator[](Int_t i)
0126 {
0127 // should not be used...
0128   return this->TObjArray::operator[](i); 
0129 }
0130 
0131 
0132 Bool_t GFHistArray::CheckObjOK (TObject * histObj)
0133 {
0134   // accept NULL pointer:
0135   return (!histObj || histObj->InheritsFrom(TH1::Class()));
0136 }