GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TYYYRawEvent.cxx
Go to the documentation of this file.
1 // $Id$
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 fuer 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 <iostream>
17 
18 #include "TGo4Log.h"
19 
22 {
23  // default ctor is for streamer only, avoid heap objects here!
24 }
25 
26 TYYYRawEvent::TYYYRawEvent(const char *name) :
27  TGo4EventElement(name)
28 {
29 }
30 
32 {
33  if (fdData) {
34  delete [] fdData;
35  fdData = nullptr;
36  }
37 }
38 
39 void TYYYRawEvent::Clear(Option_t *)
40 {
41  for (Int_t t = 0; t < fiColumns; ++t)
42  fdData[t] = 0.;
43 }
44 
45 void TYYYRawEvent::ReAllocate(Int_t newsize)
46 {
47  if (newsize > fiAllocated) {
48  fiAllocated = newsize < 16 ? 16 : (newsize + 8);
49  TGo4Log::Info("YYYRawEvent reallocating from %d to %d", fiColumns, fiAllocated);
50  auto narray = new Double_t[fiAllocated];
51  for (Int_t i = 0; i < fiColumns; ++i)
52  narray[i] = fdData[i];
53  delete [] fdData;
54  fdData = narray;
55  fiColumns = newsize;
56  } else {
57  if (newsize == 0) {
58  delete [] fdData;
59  fdData = nullptr;
60  fiAllocated = 0;
61  }
62  fiColumns = newsize;
63  }
64 }
65 
67 {
69  std::cout << " YYY Event printout: " << std::endl;
70  for (Int_t t = 0; t < fiColumns; ++t)
71  std::cout << "\t dat(" << t << ")=" << fdData[t] << std::endl;
72 }
void ReAllocate(Int_t newsize)
void PrintEvent() override
static void Info(const char *text,...) GO4_PRINTF_ARGS
Definition: TGo4Log.cxx:294
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
void Clear(Option_t *opt="") override