GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TYYYRawEvent.cxx
Go to the documentation of this file.
1 // $Id: TYYYRawEvent.cxx 930 2013-01-24 16:10:10Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TYYYRawEvent.h"
15 
16 #include "Riostream.h"
17 
18 #include "TGo4Log.h"
19 
22  fiColumns(0),
23  fdData(0),
24  fiAllocated(0)
25 {
26  // default ctor is for streamer only, avoid heap objects here!
27 }
28 
29 TYYYRawEvent::TYYYRawEvent(const char* name) :
30  TGo4EventElement(name),
31  fiColumns(0),
32  fdData(0),
33  fiAllocated(0)
34 {
35 }
36 
38 {
39  if (fdData) {
40  delete [] fdData;
41  fdData = 0;
42  }
43 }
44 
45 void TYYYRawEvent::Clear(Option_t *t)
46 {
47  for(Int_t t=0; t<fiColumns;++t)
48  fdData[t] = 0.;
49 }
50 
51 void TYYYRawEvent::ReAllocate(Int_t newsize)
52 {
53  if (newsize > fiAllocated) {
54  fiAllocated = newsize < 16 ? 16 : (newsize + 8);
55  TGo4Log::Info("YYYRawEvent reallocating from %d to %d", fiColumns, fiAllocated);
56  Double_t* narray=new Double_t[fiAllocated];
57  for(Int_t i=0;i<fiColumns;++i)
58  narray[i] = fdData[i];
59  delete [] fdData;
60  fdData = narray;
61  fiColumns = newsize;
62  } else {
63  if (newsize == 0) {
64  delete [] fdData;
65  fdData = 0;
66  fiAllocated = 0;
67  }
68  fiColumns = newsize;
69  }
70 }
71 
73 {
75  std::cout<<" YYY Event printout: "<<std::endl;
76  for(Int_t t=0; t<fiColumns;++t)
77  std::cout <<"\t dat("<<t<<")="<<fdData[t]<<std::endl;
78 }
void ReAllocate(Int_t newsize)
virtual void Clear(Option_t *t="")
void PrintEvent()
virtual ~TYYYRawEvent()
virtual void PrintEvent()
Double_t * fdData
Definition: TYYYRawEvent.h:49
Int_t fiAllocated
Definition: TYYYRawEvent.h:51
Int_t fiColumns
Definition: TYYYRawEvent.h:47
static void Info(const char *text,...)
Definition: TGo4Log.cxx:283