00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifdef DEBUG
00034 #undef DEBUG
00035 #endif
00036 #define DEBUG 0
00037
00038 Int_t iret;
00039 TBrowser *b = 0;
00040 class StChain;
00041 StChain *chain=0;
00042 void Load(){
00043 printf (" Begin loading shared libraries \n");
00044 gSystem->Load("St_base");
00045 gSystem->Load("StChain");
00046 gSystem->Load("xdf2root");
00047 gSystem->Load("St_Tables");
00048 gSystem->Load("St_xdfin_Maker");
00049 gSystem->Load("St_TLA_Maker");
00050 gSystem->Load("libmsg");
00051 gSystem->Load("libtls");
00052 gSystem->Load("St_params_Maker");
00053
00054
00055 gSystem->Load("global");
00056 gSystem->Load("St_global");
00057 gSystem->Load("St_run_summary_Maker");
00058
00059 gSystem->Load("ebye");
00060 gSystem->Load("St_ebye");
00061 gSystem->Load("St_ebye_Maker");
00062 printf (" Done loading shared libraries \n");
00063 }
00064
00065 ebye(const Int_t SetmakePrior = 0,
00066 const Int_t SetmakeEnsembleAve = 0,
00067 const Int_t SetdoAnalysis = 1,
00068 const Int_t Nevents = 10,
00069 const Int_t Nskip = 94,
00070 const Char_t *fileinp =
00071 "/star/scr2b/dhammika/psc362_02_160evts_h_dst.xdf",
00072
00073 const Char_t *fileprior = 0,
00074
00075 const Char_t *fileensembleave = 0,
00076 const Char_t *fileout = "sca_out.xdf",
00077
00078 const Char_t *FileOut = 0)
00079 {
00080
00081 if (gClassTable->GetID("StChain") < 0) Load();
00082 St_XDFFile *xdf_in = 0;
00083 if (fileinp) xdf_in = new St_XDFFile(fileinp,"r");
00084 St_XDFFile *xdf_out = 0;
00085 if (fileout) xdf_out = new St_XDFFile(fileout,"w");
00086 St_XDFFile *xdf_prior = 0;
00087 if (fileprior) xdf_prior = new St_XDFFile(fileprior, "w");
00088 St_XDFFile *xdf_ensembleave = 0;
00089 if (fileensembleave) xdf_ensembleave = new St_XDFFile(fileensembleave, "w");
00090 TFile *root_out = 0;
00091 if (FileOut) root_out = new TFile(FileOut,"RECREATE");
00092
00093 if (chain) delete chain;
00094 chain = new StChain("ebye");
00095
00096 St_params_Maker *params = new St_params_Maker("params","params");
00097
00098
00099 if (xdf_in) {
00100 St_xdfin_Maker *my_xdfin = new St_xdfin_Maker("xdfin");
00101 chain->SetInputXDFile(xdf_in);
00102 }
00103
00104 St_TLA_Maker *dst = new St_TLA_Maker("dst","event/data/global/dst");
00105 St_run_summary_Maker *summary = new St_run_summary_Maker("run_summary","run/dst");
00106 St_ebye_Maker *my_ebye = new St_ebye_Maker("ebye","event/data/ebye/sca");
00107
00108
00109 if (DEBUG) printf("====>ebye.C::Begin chain.PrintInfo\n");
00110 chain->PrintInfo();
00111 if (DEBUG) printf("====>ebye.C::End chain.PrintInfo\n");
00112
00113 if (DEBUG) printf("====>ebye.C::Begin chain.Init\n");
00114 int iInit = chain->Init();
00115 if (iInit) chain->Fatal(iInit,"on init");
00116 if (DEBUG) printf("====>ebye.C::End chain.Init\n");
00117
00118 if (SetmakePrior){
00119 iret = my_ebye->SetmakePrior(kTRUE);
00120 if (iret){
00121 printf("===>ebye.C::<<< ERROR >>> Problem with my_ebye->SetmakePrior *****\n");
00122 return;
00123 }
00124 else
00125 printf("====>ebye.C::***** my_ebye->SetmakePrior successful *****\n");
00126 }
00127 if (SetmakeEnsembleAve){
00128 iret = my_ebye->SetmakeEnsembleAve(kTRUE);
00129 if (iret){
00130 printf("====>ebye.C::<<< ERROR >>> Problem with my_ebye->SetmakeEnsembleAve *****\n");
00131 return;
00132 }
00133 else
00134 printf("====>ebye.C::***** my_ebye->SetmakeEnsembleAve successful *****\n");
00135 }
00136 if (SetdoAnalysis){
00137 iret = my_ebye->SetdoAnalysis(kTRUE);
00138 if (iret){
00139 printf("====>ebye.C::<<< ERROR >>> Problem with my_ebye->SetdoAnalysis *****\n");
00140 return;
00141 }
00142 else
00143 printf("====>ebye.C::***** my_ebye->SetdoAnalysis successful *****\n");
00144 }
00145
00146
00147 for ( Int_t i=0; i<Nskip;i++){
00148 St_DataSet *set = chain->XDFFile()->NextEventGet();
00149 delete set;
00150 }
00151
00152 gBenchmark->Start("ebye");
00153 printf("====>ebye.C::Beging Benchmark(ebye) \n");
00154 Int_t ngood=0;
00155 Int_t i=1;
00156 for (Int_t i =1; i <= Nevents; i++){
00157 iret = chain->Make(i);
00158 if (iret == 2) {
00159 printf ("====>ebye.C:: <<< ERROR >>> <Chain::Make()>: failed in Event no. %d \n \t chain->Make(i) = %d \n",i, iret);
00160 break;
00161 }
00162 if (!iret) ngood++;
00163
00164
00165 if (!iret && SetdoAnalysis ){
00166 if (xdf_out){
00167 gBenchmark->Start("xdf_out");
00168 St_DataSet *ebye_out = chain->DataSet("ebye");
00169 xdf_out->NextEventPut(ebye_out);
00170 gBenchmark->Stop("xdf_out");
00171 }
00172 printf ("====>ebye.C:: ========================================= Done with Event no. %d\n\n",i);
00173 }
00174 if (i != Nevents) chain->Clear();
00175 }
00176
00177 my_ebye->SetnEvents(ngood);
00178 printf ("====>ebye.C:: ================================================== Total good events processed. %d\n\n",ngood);
00179
00180 if (SetmakePrior && xdf_prior){
00181 my_ebye->PutPrior();
00182 St_DataSet *prior = chain->DataSet("calib/ebye/sca_prior_dir");
00183 xdf_out->NextEventPut(prior);
00184 delete xdf_prior;
00185 }
00186
00187 if (SetmakeEnsembleAve && xdf_ensembleave){
00188 my_ebye->PutEnsembleAve();
00189 St_DataSet *ensembleave = chain->DataSet("calib/ebye/sca_ensemble_dir");
00190 xdf_out->NextEventPut(ensembleave);
00191 delete xdf_ensembleave;
00192 }
00193 if (Nevents > 1) {
00194 chain->Finish();
00195 delete xdf_in;
00196 if (xdf_out){
00197 delete xdf_out;
00198 gBenchmark->Print("xdf_out");
00199 }
00200 gBenchmark->Print("ebye");
00201 }
00202 else {if (!b) b = new TBrowser;}
00203 }
00204