#include "TYYYRawEvent.h" #include "Riostream.h" #include "TGo4Log.h" #include "TYYYEventSource.h" #include "TGo4TreeSource.h" #include "TGo4FileSource.h" TYYYRawEvent::TYYYRawEvent() : TGo4EventElement("YYYRawEvent"), fxUserSource(0), fxTreeSource(0), fxFileSource(0) { fiColumns=0; fdData=0; // default ctor is for streamer only, avoid heap objects here! } TYYYRawEvent::TYYYRawEvent(const char* name) : TGo4EventElement(name), fxUserSource(0), fxTreeSource(0), fxFileSource(0) { fiColumns = 10; fdData = new Double_t[fiColumns]; } TYYYRawEvent::~TYYYRawEvent() { delete [] fdData; } Int_t TYYYRawEvent::Fill() { Int_t rev=0; if(fxUserSource) { Clear(); // fill from our source rev=fxUserSource->NextEvent(); if(rev!=0) { cout<<"YYY Raw Event -- !!! NextEvent() error:"; cout<GetErrMess()<BuildYYYEvent(this); return rev; } } else if(fxTreeSource) { Clear(); if(fxTreeSource->BuildEvent(this)) { return 0; } else { // error, may be end of tree.. return 1; } } else if(fxFileSource) { Clear(); if(fxFileSource->BuildEvent(this)) { return 0; } else { // error, may be end of tree.. return 1; } } else { TGo4Log::Debug(" !!! YYYEvent: Fill ERROR: unknown event source !!! "); return 1; } return 0; } Int_t TYYYRawEvent::Init() { // Check event sources here and downcast the correct one: // will be called once before event processing is done if(CheckEventSource("TYYYEventSource")) { fxUserSource = dynamic_cast (GetEventSource()); fxTreeSource=0; fxFileSource=0; } else if(CheckEventSource("TGo4TreeSource")) { fxTreeSource = dynamic_cast (GetEventSource()); fxUserSource=0; fxFileSource=0; } else if(CheckEventSource("TGo4FileSource")) { fxFileSource = dynamic_cast (GetEventSource()); fxTreeSource=0; fxUserSource=0; } else { cout<<" !!! YYYEvent: Init ERROR: unknown event source !!!"< fiColumns) { cout <<"*** YYYRawEvent reallocating from "<