/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ #include #include #include #include #include #include #include #include "AliLog.h" #include "AliHFEcollection.h" using namespace std; ClassImp(AliHFEcollection) //___________________________________________________________________ AliHFEcollection::AliHFEcollection(): TNamed() , fListE(0x0) { // // default constructor // fListE = new TList(); if(!fListE){ AliError("Initialization of the list failed"); } else{ // list is owner of the objects. Once list is deleted, the objects // it contains will be deleted too fListE->SetOwner(kTRUE); } //Printf("%s:%d,%p",(char*)__FILE__,__LINE__,fInstance); } //___________________________________________________________________ AliHFEcollection::AliHFEcollection(char* name, char* title): TNamed(name, title) , fListE(0x0) { // // constructor // fListE = new TList(); if(!fListE){ AliError("Initialization of the list failed"); } else{ // list is owner of the objects. Once list is deleted, the objects // it contains will be deleted too fListE->SetOwner(kTRUE); } } //___________________________________________________________________ AliHFEcollection::AliHFEcollection(const AliHFEcollection &c) : TNamed(c) , fListE(0x0) { // // copy operator // c.Copy(*this); } //___________________________________________________________________ AliHFEcollection &AliHFEcollection::operator=(const AliHFEcollection &ref) { // // Assignment operator // if(this != &ref){ ref.Copy(*this); } return *this; } //___________________________________________________________________ void AliHFEcollection::Copy(TObject &ref) const { // // Performs the copying of the object // AliHFEcollection &target = dynamic_cast(ref); target.fListE = fListE; } //___________________________________________________________________ AliHFEcollection::~AliHFEcollection(){ AliInfo("DESTRUCTOR"); } //___________________________________________________________________ Bool_t AliHFEcollection::CreateTH1F(const char* name, const char* title, Int_t nBin, Float_t nMin, Float_t nMax){ if(!fListE){ AliError("No TList pointer ! "); return kFALSE; } else{ fListE->Add(new TH1F(name, title, nBin, nMin, nMax)); return CheckObject(name); } } //___________________________________________________________________ Bool_t AliHFEcollection::CreateTH2F(const char* name, const char* title, Int_t nBinX, Float_t nMinX, Float_t nMaxX, Int_t nBinY, Float_t nMinY, Float_t nMaxY){ if(!fListE){ AliError("No TList pointer ! "); return kFALSE; } fListE->Add(new TH2F(name, title, nBinX, nMinX, nMaxX, nBinY, nMinY, nMaxY)); return CheckObject(name); } //___________________________________________________________________ Bool_t AliHFEcollection::CreateTH1Fvector1(Int_t X, const char* name, const char* title, Int_t nBin, Float_t nMin, Float_t nMax){ // create a 1 dimensional array of size [X] if(!fListE){ AliError("No TList pointer ! "); return kFALSE; } if(X <=0){ AliError("can not create array with negative or zero size "); return kFALSE; } TString hname; for(Int_t i=0; iFindObject(name)){ AliError("Creating or Finding the object failed"); return kFALSE; } return kTRUE; } //___________________________________________________________________ TObject* AliHFEcollection::Get(const char* name){ return fListE->FindObject(name); } //___________________________________________________________________ Long64_t AliHFEcollection::Merge(TCollection *list){ if(!fListE){ AliError("AliHFEcollection::Merge : No TList pointer ! "); return 0; } return fListE->Merge(list); } //____________________________________________________________________ void AliHFEcollection::Browse(TBrowser *b) { // Browse the content of the directory. if (b) { TObject *obj = 0; TIter nextin(fListE); //Add objects that are only in memory while ((obj = nextin())) { b->Add(obj, obj->GetName()); } } }