00001 // $Id: TMeshRawEvent.cxx 999 2013-07-25 11:58:59Z 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 "TMeshRawEvent.h" 00015 00016 #include "TMeshUnpackProc.h" 00017 #include "TGo4FileSource.h" 00018 #include "TGo4Log.h" 00019 00020 //*********************************************************** 00021 TMeshRawEvent::TMeshRawEvent() 00022 :TGo4EventElement("RawEvent"),fxUnpacker(0),fxFile(0) 00023 { 00024 } 00025 //*********************************************************** 00026 TMeshRawEvent::TMeshRawEvent(const char* name) 00027 :TGo4EventElement(name),fxUnpacker(0),fxFile(0) 00028 { 00029 } 00030 //*********************************************************** 00031 TMeshRawEvent::~TMeshRawEvent() 00032 { 00033 } 00034 //*********************************************************** 00035 00036 //----------------------------------------------------------- 00037 Int_t TMeshRawEvent::Init() 00038 { 00039 Int_t rev=0; 00040 //std::cout << "+++ Init event" << std::endl; 00041 Clear(); 00042 if(CheckEventSource("TMeshUnpackProc")) 00043 { 00044 fxUnpacker = dynamic_cast<TMeshUnpackProc*>(GetEventSource()); 00045 // for the subcomponents, we have to set unpacker as source ?: 00046 // only if we would use the subcomponents' Fill() methodsin our Fill() 00047 // fxSub1.SetEventSource(fxUnpacker); 00048 // fxSub1.Init(); 00049 // fxSub2.SetEventSource(fxUnpacker); 00050 // fxSub1.Init(); 00051 // fxSub3.SetEventSource(fxUnpacker); 00052 // fxSub1.Init(); 00053 TGo4Log::Info("TMeshRawEvent init for Unpack step"); 00054 } 00055 else if(CheckEventSource("TGo4FileSource")) 00056 { 00057 fxFile = dynamic_cast<TGo4FileSource*> (GetEventSource()); 00058 TGo4Log::Info("TMeshRawEvent init for file input"); 00059 } 00060 else 00061 rev=1; 00062 return rev; 00063 } 00064 //----------------------------------------------------------- 00065 Int_t TMeshRawEvent::Fill() 00066 { 00067 Int_t rev=0; 00068 Clear(); 00069 if(fxUnpacker) 00070 { 00071 fxUnpacker->Unpack(this); // user event processing method 00072 // alternatively, we could work with the Fill() of the subcomponents: 00073 // fxSub1.Fill(); 00074 // fxSub2.Fill(); 00075 // fxSub3.Fill(); 00076 } 00077 else if(fxFile) 00078 fxFile->BuildEvent(this); // method from framework to restore event from file 00079 else 00080 rev=1; 00081 return rev; 00082 } 00083 00084 //----------------------------------------------------------- 00085 void TMeshRawEvent::Clear(Option_t *t) 00086 { 00087 fxSub1.Clear(t); 00088 fxSub2.Clear(t); 00089 fxSub3.Clear(t); 00090 }