StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
runMudst4.C
1 /* Execute MuDST-->OFile maker: StFmsOFileMaker */
2 
3 /* arguments of runMudst4:
4  * - file -- muDST root file
5  * - jobid -- unique id for this job
6  * - ifile -- just leave as -1
7  * - nevt -- number of events to read (set to -2 to read all of them)
8  */
9 
10 //void runMudst4(char* file="st_fms_16069001_raw_2500015.MuDst.root",Int_t runnum=16069001,
11 void runMudst4(char* file="st_fms_16088020_raw_5500016.MuDst.root",Int_t runnum=16088020,
12  char * jobid="single",
13  int ifile=-1,
14  Int_t nevt=10000
15  ) {
16 
17  // load libraries
18  loadLibs();
19 
20  // instantiate muDstMaker ==========================================================
21 
22  // chain and mudst maker
23  StChain* chain = new StChain("StChain"); chain->SetDEBUG(0);
24  printf("--------------------------- error below here\n");
25  StMuDstMaker* muDstMaker = new StMuDstMaker(0, 0, "", file,".", 3000, "MuDst");
26  // StMuDstMaker constructor arguments
27  // -- int mode -- 0=read; 1=write
28  // -- int nameMode -- 0=read from inFile; 1=ioMaker
29  // -- char * dirName --
30  // -- char * fileName -- name of .root or filelist (pass to macro)
31  // -- char * filter --
32  // -- int maxFiles -- max # of root files to chain
33  // -- char * name --
34  printf("--------------------------- error above here\n");
35 
36  // figure out how many events to read
37  int n=muDstMaker->tree()->GetEntries();
38  printf("Found %d entries in Mudst\n",n);
39  int start=0, stop=n;
40  if(ifile>=0){
41  int start=ifile*nevt;
42  int stop=(ifile+1)*nevt-1;
43  if(n<start) {printf(" No event left. Exiting\n"); return;}
44  if(n<stop) {printf(" Overwriting end event# stop=%d\n",n); stop=n;}
45  }else if(nevt>=0 && nevt<n){
46  stop=nevt;
47  }else if(nevt==-2){
48  stop=2000000000;
49  }
50  printf("Doing Event=%d to %d\n",start,stop);
51 
52 
53 
54 
55  // DB makers ===========================================================================
56 
57  // StarDB
58  St_db_Maker* dbMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb");
59  dbMk->SetAttr("blacklist", "eemc");
60  dbMk->SetAttr("blacklist", "ftpc");
61  dbMk->SetAttr("blacklist", "ist");
62  dbMk->SetAttr("blacklist", "mtd");
63  dbMk->SetAttr("blacklist", "pmd");
64  //dbMk->SetAttr("blacklist", "pp2pp");
65  dbMk->SetAttr("blacklist", "pxl");
66  dbMk->SetAttr("blacklist", "ssd");
67  dbMk->SetAttr("blacklist", "svt");
68  dbMk->SetAttr("blacklist", "tof");
69  dbMk->SetAttr("blacklist", "tpc");
70  dbMk->SetDebug();
71  //dbMk->SetDateTime(20150301,0);
72 
73  // FMS DB
74  StFmsDbMaker* fmsDB = new StFmsDbMaker("fmsDb");
75  fmsDB->setDebug(0);
76  //fmsDB->readGainFromText();
77  //fmsDB->readRecParamFromFile();
78 
79  // spin DB
80  StSpinDbMaker * spinDB = new StSpinDbMaker("spinDb");
81  //spinDB->InitRun(runnum);
82 
83 
84  // TPC DB (needed by StDAQMaker?)
85  //StTpcDbMaker * tpcDB = new StTpcDbMaker("tpcDb");
86 
87  // for accessing StDAQReader
88  //StDAQMaker * daqMk = new StDAQMaker("daqMk",file);
89 
90 
91 
92 
93  // event makers =========================================================================
94 
95  // event
96  StEventMaker * eventMk = new StEventMaker();
97  //eventMk->doPrintEventInfo = true; // verbose event output
98 
99  // trigger data
100  StTriggerDataMaker * triggerMk = new StTriggerDataMaker();
101  triggerMk->setDebug(1);
102 
103 
104  // FMS
105  //StFmsTriggerMaker * fmsTrigMk = new StFmsTriggerMaker(); // doesn't work; needs old sql DB access
106  StFmsHitMaker * fmsHitMk = new StFmsHitMaker();
107  StFmsPointMaker * fmsPointMk = new StFmsPointMaker();
108 
109 
110  // FPS
111  StFmsFpsMaker * fpsMk = new StFmsFpsMaker();
112 
113 
114  // Instantiate old OFile maker, which used StMuEvent for FMS (insteaed of StEvent); DEPRECATED
115  //gSystem->Load("StMuFmsAnalysisMaker");
116  //StMuFmsAnalysisMaker* ofileMk = new StMuFmsAnalysisMaker(muDstMaker);
117 
118 
119  // OFile Maker
120  StFmsOFileMaker * ofileMk = new StFmsOFileMaker(muDstMaker);
121 
122 
123 
126  // BEGIN SET MAKER OPTIONS
127  //
128  // NOTE: listing 'default' values for batch OFile production in "( )"
129 
130  // mudst reading
131  // if 0, get info from StTriggerData from StTriggerDataMaker/StEvent/MuDst
132  // and apply new DB; cluster finding/fitting is redone
133  // if 1, cluster finding/fitting is NOT redone (i.e., mudst result is read
134  // out); however, some recalculations (like point positions) from updated DB values
135  // are done
136  fmsPointMk->SetReadMuDst(0); // (0)
137  fmsHitMk->SetReadMuDst(0); // (0)
138  fpsMk->setReadMuDST(1); // (1) // (reverse 0<->1 convention as FmsHitMaker and FmsPointMaker)
139 
140  // shower shape
141  // 0='use lednev params', 1='use zhanwen params', 2='use yuxi params'
142  fmsPointMk->setShowerShapeWithAngle(1); // (1)
143 
144  // cluster merging over large/small boundary
145  // if 1, merges large and small cell clusters (experimental!; default 1 in StFmsPointMaker)
146  fmsPointMk->setMergeSmallToLarge(1); // (1)
147 
148  // vertex correction
149  // if 0, no vertex correction; if 1, use MuDst BBC vertex based on run11 calibration (needs update?)
150  fmsPointMk->setVertexZ(1); // (1)
151 
152  // output verbosity of analysis maker
153  ofileMk->verbose = false; // (false) // if true, prints extra output from analysis maker
154  ofileMk->verbose_rp = false; // (false) // if true, prints extra output specific to RP events
155  ofileMk->dump_spinbits = true; // (true) // if true, dumps spin patterns during first event output
156 
157  // do spin QA (if set to true)
158  ofileMk->check_spinbyte = false; // (false)
159 
160  // build extra trees into MFiles
161  ofileMk->build_evtr = false; // (false) // if true, builds easier-to-read-but-bigger-than-p_out event tree
162 
163 
164  // END SET MAKER OPTIONS
167 
168 
169 
170 
171  // define OFile maker outputs
172  TString filenameOFileMaker(file);
173  TRegexp re("\/.*\/");
174  filenameOFileMaker(re) = "";
175  filenameOFileMaker.ReplaceAll("sched",Form("%d.",runnum));
176  filenameOFileMaker.ReplaceAll("list","fmsan.root");
177  filenameOFileMaker.ReplaceAll("MuDst","fmsan");
178 
179  cout << "StFmsOFileMaker outfile name = " << filenameOFileMaker.Data()<<endl;
180  ofileMk->setFileName(filenameOFileMaker.Data());
181  ofileMk->setPrint(1);
182 
183 
184 
185  // execute chain
186  chain->Init();
187  chain->EventLoop(start,stop);
188  chain->Finish();
189  delete chain;
190 }
191 
192 
193 // load libraries
194 void loadLibs() {
195  // STAR libraries for chain, MuDST, logger etc
196  gROOT->Macro("loadMuDst.C");
197  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
198  loadSharedLibraries();
199  gROOT->Macro("LoadLogger.C");
200 
201  gSystem->Load("StTpcDb");
202  gSystem->Load("StDetectorDbMaker");
203  gSystem->Load("StDbUtilities");
204  gSystem->Load("StDaqLib");
205  gSystem->Load("StEmcRawMaker");
206  gSystem->Load("StEmcADCtoEMaker");
207  gSystem->Load("StPreEclMaker");
208  gSystem->Load("StEpcMaker");
209  gSystem->Load("StDbLib");
210  gSystem->Load("StDbBroker");
211  gSystem->Load("St_db_Maker");
212  gSystem->Load("StEEmcUtil");
213  gSystem->Load("StEEmcDbMaker");
214  gSystem->Load("StSpinDbMaker");
215  gSystem->Load("StEmcTriggerMaker");
216  gSystem->Load("StTriggerUtilities");
217  gSystem->Load("StMCAsymMaker");
218  gSystem->Load("StRandomSelector");
219  gSystem->Load("StTriggerFilterMaker");
220  gSystem->Load("StEventMaker");
221  gSystem->Load("StTriggerDataMaker");
222  //gSystem->Load("StDAQMaker");
223  gSystem->Load("libMinuit.so");
224  gSystem->Load("StFmsUtil");
225  gSystem->Load("StFmsDbMaker");
226  gSystem->Load("StFmsHitMaker");
227  gSystem->Load("StFmsPointMaker");
228  gSystem->Load("StFmsTriggerMaker");
229  gSystem->Load("StFmsFpsMaker");
230  gSystem->Load("StMuRpsUtil.so");
231 
232  gSystem->Load("StFmsOFileMaker");
233 }; // end loadLibs()
TTree * tree()
Returns pointer to the current TTree, the top level io structure that holds the event, track, v0, etc. information in branches of that tree.
Definition: StMuDstMaker.h:427
void setDebug(Int_t debug)
debug mode, 0 for minimal message, &gt;0 for more debug messages
virtual Int_t Finish()
Definition: StChain.cxx:85
void SetReadMuDst(int v=1)
void SetReadMuDst(int v=1)
Definition: StFmsHitMaker.h:47
StFmsHitMaker.
Definition: StFmsHitMaker.h:27