00001 // $Id: TYYYRawEvent.cxx 930 2013-01-24 16:10:10Z linev $ 00002 //----------------------------------------------------------------------- 00003 // The GSI Online Offline Object Oriented (Go4) Project 00004 // Experiment Data Processing at EE department, GSI 00005 //----------------------------------------------------------------------- 00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH 00007 // Planckstr. 1, 64291 Darmstadt, Germany 00008 // Contact: http://go4.gsi.de 00009 //----------------------------------------------------------------------- 00010 // This software can be used under the license agreements as stated 00011 // in Go4License.txt file which is part of the distribution. 00012 //----------------------------------------------------------------------- 00013 00014 #include "TYYYRawEvent.h" 00015 00016 #include "Riostream.h" 00017 00018 #include "TGo4Log.h" 00019 00020 TYYYRawEvent::TYYYRawEvent() : 00021 TGo4EventElement(), 00022 fiColumns(0), 00023 fdData(0), 00024 fiAllocated(0) 00025 { 00026 // default ctor is for streamer only, avoid heap objects here! 00027 } 00028 00029 TYYYRawEvent::TYYYRawEvent(const char* name) : 00030 TGo4EventElement(name), 00031 fiColumns(0), 00032 fdData(0), 00033 fiAllocated(0) 00034 { 00035 } 00036 00037 TYYYRawEvent::~TYYYRawEvent() 00038 { 00039 if (fdData) { 00040 delete [] fdData; 00041 fdData = 0; 00042 } 00043 } 00044 00045 void TYYYRawEvent::Clear(Option_t *t) 00046 { 00047 for(Int_t t=0; t<fiColumns;++t) 00048 fdData[t] = 0.; 00049 } 00050 00051 void TYYYRawEvent::ReAllocate(Int_t newsize) 00052 { 00053 if (newsize > fiAllocated) { 00054 fiAllocated = newsize < 16 ? 16 : (newsize + 8); 00055 TGo4Log::Info("YYYRawEvent reallocating from %d to %d", fiColumns, fiAllocated); 00056 Double_t* narray=new Double_t[fiAllocated]; 00057 for(Int_t i=0;i<fiColumns;++i) 00058 narray[i] = fdData[i]; 00059 delete [] fdData; 00060 fdData = narray; 00061 fiColumns = newsize; 00062 } else { 00063 if (newsize == 0) { 00064 delete [] fdData; 00065 fdData = 0; 00066 fiAllocated = 0; 00067 } 00068 fiColumns = newsize; 00069 } 00070 } 00071 00072 void TYYYRawEvent::PrintEvent() 00073 { 00074 TGo4EventElement::PrintEvent(); 00075 std::cout<<" YYY Event printout: "<<std::endl; 00076 for(Int_t t=0; t<fiColumns;++t) 00077 std::cout <<"\t dat("<<t<<")="<<fdData[t]<<std::endl; 00078 }