Cat
Event.cpp
Go to the documentation of this file.
1 // $Id: Event.cpp,v 1.6 2006/07/21 09:23:00 fmachefe Exp $
2 
3 // CATEvent include files
4 #include "Data.h"
5 
6 // local
7 #include "Event.h"
8 
9 //-----------------------------------------------------------------------------
10 // Implementation file for class : Event
11 //
12 // 2004-10-06 : Frédéric Machefert
13 //-----------------------------------------------------------------------------
14 
16 
17 TClonesArray *Event::fgData = 0;
18 
19 //=============================================================================
20 // Standard constructor, initializes variables
21 //=============================================================================
22 Event::Event( ){
23  // Create an Event object.
24  // When the constructor is invoked for the first time, the class static
25  // variable fgData is 0 and the TClonesArray fgData created.
26  if (!fgData) fgData = new TClonesArray( "Data" , 4096);
27  raw = fgData;
28  nData = 0;
29 
30 }
31 
32 //=============================================================================
33 // Destructor
34 //=============================================================================
36  Clear();
37 }
38 
39 //______________________________________________________________________________
40 void Event::addData( int evt , int chl , int value ) {
41  TClonesArray &rawdata = *raw;
42  Data *val = new(rawdata[nData++]) Data( evt , chl , value );
43  //Save reference to last Data in the collection of Datas
44  fLastData = val;
45 }
46 
47 //______________________________________________________________________________
48 void Event::Clear(Option_t * /*option*/)
49 {
50  raw->Clear("C"); //will also call Data::Clear
51 }
52 
53 //______________________________________________________________________________
55 {
56  EvtHdr.newEvt();
57  /*
58  data->Clear("C"); //will also call Data::Clear
59  nData = 0 ;
60  */
61 }
62 
63 //=============================================================================
virtual ~Event()
Destructor.
Definition: Event.cpp:35
static TClonesArray * fgData
Definition: Event.h:42
void addData(int, int, int)
Definition: Event.cpp:40
void newEvt()
Definition: Event.cpp:54
TClonesArray * raw
Definition: Event.h:41
ClassDef(Event, 1) protected unsigned long nData
Definition: Event.h:35
ClassImp(Data) Data
Definition: Data.cpp:12
Event()
Standard constructor.
TRef fLastData
Definition: Event.h:43
Definition: Event.h:23
Definition: Data.h:16
void Clear(Option_t *option="")
Definition: Event.cpp:48