15 #include "StEStructEventMaker.h"
17 #include "StMessMgr.h"
34 StEStructEventMaker::~StEStructEventMaker() { }
44 if(!readEvent())
return kStEOF;
49 bool StEStructEventMaker::readEvent(){
51 if(!openRead())
return false;
52 if(meventCount >= mChain->GetEntries() || mChain->GetEntry(meventCount++)==0)
return false;
53 mEStructEvent->FillChargeCollections();
59 bool StEStructEventMaker::openRead(){
62 if(!mfileList)
return false;
63 if(mChain)
return true;
67 mChain=
new TChain(
"EStructDst");
68 mChain->SetDirectory(0);
70 ifstream from(mfileList);
74 mfileCount=meventCount=0;
79 from.getline(line,512);
80 if(line[0]==
'#')
continue;
81 if(!strstr(line,
".estruct.root"))
continue;
86 mChain->SetBranchAddress(
"EStructEvent",&mEStructEvent);
92 bool StEStructEventMaker::openWrite() {
95 if(mEStructEventFile)
return true;
96 if(!moutFile)
return false;
99 mEStructEventFile=
new TFile(moutFile,
"RECREATE",
"StEStructDst");
100 mEStructTree =
new TTree(
"EStructDst",
"StEStructDst",99);
101 mEStructTree->SetAutoSave(1000000);
102 branch = mEStructTree->Branch(
"EStructEvent",
"StEStructEvent",&mEStructEvent,65526, 99);
104 cout<<
" EStructBranch not created !!! "<<endl;
113 if(!openWrite() || !e)
return false;
114 mEStructEventFile->cd();
115 if(mEStructEvent)
delete mEStructEvent;
117 mEStructTree->Fill();
122 void StEStructEventMaker::setInputFileList(
const char* f){
return setName(f,0);};
125 void StEStructEventMaker::setOutputFile(
const char* f){
return setName(f,1); };
129 void StEStructEventMaker::setName(
const char* name,
int opt){
133 char* tmp=
new char[strlen(name)+1];
156 Int_t StEStructEventMaker::Init() {
167 if(!mEStructEventFile)
return kStOk;
168 mEStructEventFile->cd();
169 mEStructTree->Write();
170 mEStructEventFile->Close();
virtual void Clear(Option_t *option="")
User defined functions.
void Clear(Option_t *option="")
User defined functions.