StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DoEqualDaq.C
1 //
3 // $Id: DoEqualDaq.C,v 1.2 2007/04/10 11:36:24 ogrebeny Exp $
4 // Author: Thomas Ullrich, Oct 2000
5 //
7 //
8 // Description:
9 //
11 //
12 // $Log: DoEqualDaq.C,v $
13 // Revision 1.2 2007/04/10 11:36:24 ogrebeny
14 // Bug fixes
15 //
16 // Revision 3.1 2000/10/13 19:23:46 ullrich
17 // Initial Revision
18 //
20 #include <string>
21 #include <typeinfo>
22 class StChain;
23 StChain *chain=0;
24 
25 void DoEqualDaq(char* file="daq/*.daq",int nevents = 500000,char* name = "equal1.root")
26 {
27 
28  //
29  // First load some shared libraries we need
30  //
31  gSystem->Load("St_base");
32  gSystem->Load("StChain");
33  gSystem->Load("libgen_Tables");
34  gSystem->Load("libsim_Tables");
35  gSystem->Load("libglobal_Tables");
36  gSystem->Load("StUtilities");
37  gSystem->Load("StIOMaker");
38  gSystem->Load("StTreeMaker");
39  gSystem->Load("StarClassLibrary");
40  gSystem->Load("StEvent");
41  gSystem->Load("StMagF");
42  gSystem->Load("libgeometry_Tables");
43  gSystem->Load("St_Tables");
44  gSystem->Load("StEmcUtil");
45 
46  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
47  loadSharedLibraries();
48  gSystem->Load("StDbUtilities");
49  gSystem->Load("StDbLib");
50  gSystem->Load("StDbBroker");
51  gSystem->Load("St_db_Maker");
52  gSystem->Load("libgeometry_Tables");
53  gSystem->Load("StDaqLib");
54  gSystem->Load("StEmcRawMaker");
55  gSystem->Load("StEmcADCtoEMaker");
56  gSystem->Load("StPreEclMaker");
57  gSystem->Load("StEpcMaker");
58 
59  gSystem->Load("StEmcCalibrationMaker");
60 
61 
62  chain=new StChain("StChain");
63  chain->SetDebug();
64 
65  //
66  // Setup IO maker
67  //
68  StIOMaker *IOMk = new StIOMaker();
69  IOMk->SetFile(file);
70  IOMk->SetIOMode("r");
71  IOMk->SetBranch("*",0,"0"); //deactivate all branches
72  IOMk->SetBranch("daqBranch",0,"r");
73  IOMk->SetDebug();
74 
75  St_db_Maker *db = new St_db_Maker("StarDb","MySQL:StarDb");
76 
77  m = new StEmcADCtoEMaker();
78  m->saveAllStEvent(kTRUE);
79  m->setPrint(kFALSE);
80 
81  // This process the EMC event and fill the tables
82  // necessary for calibration
84  char outfile[300];
85 
86  // does equalization
87  sprintf(outfile,"/home/emc/online/emc/pedestal/equal/%s",name);
88  StEmcEqualMaker *equal = new StEmcEqualMaker();
89  equal->setFile(outfile);
90 
91  //
92  // Initialize chain
93  //
94 
95  Int_t iInit = chain->Init();
96  if (iInit) chain->Fatal(iInit,"on init");
97  chain->PrintInfo();
98 
99  int istat=0,i=1;
100 
101 
102  EventLoop: if (i <= nevents && istat!=2)
103  {
104 
105  cout << endl << "============================ Event " << i<< " start ============================" << endl;
106 
107  chain->Clear();
108  istat = chain->Make();
109 
110  if (istat==2) {cout << "Last event processed. Status = " << istat << endl;}
111  if (istat==3) {cout << "Error event processed. Status = " << istat << endl;}
112  i++;
113  goto EventLoop;
114  }
115 
116  i--;
117  cout << endl << "============================ Event " << i << " finish ============================" << endl;
118 
119 }
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Make()
Definition: StChain.cxx:110