StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
runMudst.C
1 
3 void runMudst(char* file="/star/u/akio/pwg/fms2015/mudst/st_fms_16077027_raw_4000001.MuDst.root",
4  int ifile=-1, Int_t nevt=-1, char* outdir="hist", int opt=4, int readMuDst=1, int print=0){
5  gROOT->Macro("load.C"); // Load all required libraries
6  gSystem->Load("StEventMaker");
7 
8  StChain* chain = new StChain("StChain"); chain->SetDEBUG(0);
9  StMuDstMaker* muDstMaker = new StMuDstMaker(0, 0, "", file,".", 1000, "MuDst");
10  int n=muDstMaker->tree()->GetEntries();
11  printf("Found %d entries in Mudst\n",n);
12  int start=0, stop=n;
13  if(ifile>=0){
14  int start=ifile*nevt;
15  int stop=(ifile+1)*nevt-1;
16  if(n<start) {printf(" No event left. Exiting\n"); return;}
17  if(n<stop) {printf(" Overwriting end event# stop=%d\n",n); stop=n;}
18  }else if(nevt>=0 && nevt<n){
19  stop=nevt;
20  }else if(nevt==-2){
21  stop=2000000000;
22  }
23  printf("Doing Event=%d to %d\n",start,stop);
24 
25  int filter=1;
26  if(filter){
27  StTriggerFilterMaker* filterMaker = new StTriggerFilterMaker;
28  filterMaker->printTriggerId();
29  const int TIDBASE=480800;
30  const int NBEAM=4;
31  const int MAXVERSION=3;
32  const int NTRG=11; //123=FMS-sm-bs123,456=FMS-lg-bs123,7=FMS-DiBS,8910=FMS-JP012,11=FMS-DiJP,13=LED
33  filterMaker->addTrigger(42);
34  filterMaker->addTrigger(50);
35  for(int k=0; k<NBEAM; k++){
36  for(int j=0; j<MAXVERSION; j++){
37  for(int i=1; i<=NTRG; i++){
38  int id=TIDBASE + 10000*k + 20*j + i;
39  printf("Adding TriggerId=%d to the filter\n",id);
40  filterMaker->addTrigger(id);
41  }
42  int id=TIDBASE + 10000*k + 20*j + 13; //Veto LED events
43  printf("Adding TriggerId=%d to VETO\n",id);
44  filterMaker->addVetoTrigger(id);
45  }
46  }
47  printf("Adding TriggerId=%d to VETO\n",54);
48  filterMaker->addVetoTrigger(54);//LED before production id
49  }
50 
51  St_db_Maker* dbMk = new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb");
52  //dbMk->SetDEBUG(2); //dbMk->SetDateTime(20150301,0);
53 
54  StFmsDbMaker* fmsdb = new StFmsDbMaker("fmsDb");
55  fmsdb->setDebug(1);
56  //fmsdb->readGainFromText();
57  //fmsdb->readRecParamFromFile();
58 
59  StEventMaker* eventMk = new StEventMaker();
60  StFmsHitMaker* fmshitMk = new StFmsHitMaker();
61  StFmsPointMaker* pointMaker = new StFmsPointMaker("StFmsPointMaker");;
62  if(opt==0) {pointMaker->setMergeSmallToLarge(0);}
63  else {pointMaker->setMergeSmallToLarge(1);}
64  if(opt>=2) {pointMaker->setCategorizationAlgo(1);}
65  else {pointMaker->setCategorizationAlgo(0);}
66  if(opt>=3) {pointMaker->setTry1PhotonFit(1);}
67  else {pointMaker->setTry1PhotonFit(0);}
68  if(opt>=4) {pointMaker->setScaleShowerShape(1);}
69  else {pointMaker->setScaleShowerShape(0);}
70  if(readMuDst){
71  fmshitMk->SetReadMuDst();
72  pointMaker->SetReadMuDst();
73  }
74 
75  StFmsFpsMaker* fmsfps = new StFmsFpsMaker();
76  fmsfps->setReadMuDST();
77 
79  fmsqa->setPrint(print);
80  TString filename(file);
81  filename.ReplaceAll("mudst",outdir);
82  filename.ReplaceAll(".list",".MuDst.root");
83  if(ifile<0){
84  filename.ReplaceAll(".MuDst.root",".fmsqa.root");
85  }else{
86  filename.ReplaceAll(".MuDst.root",Form(".%d.fmsqa.root",ifile));
87  }
88  cout << "StFmsQaMaker Output File Name = " << filename.Data()<<endl;
89  fmsqa->setFileName(filename.Data());
90 
91  if(print>=10){
92  gSystem->Load("StFmsEventDisplay");
93  StFmsEventDisplay* fmsed = new StFmsEventDisplay();
94  fmsed->setMaxEvents(100);
95  TString filenameED(file);
96  filenameED.ReplaceAll("mudst",outdir);
97  filenameED.ReplaceAll(".MuDst.root",".eventDisplay.png");
98  filenameED.ReplaceAll(".list",".eventDisplay.root");
99  fmsed->setFileName(filenameED.Data());
100  if(print==11) fmsed->setFilter(1);
101  if(print==12) fmsed->setFilter(2);
102  }
103 
104  gSystem->Load("StFmsDiPi0");
105  StFmsDiPi0* dipi0 = new StFmsDiPi0();
106  TString filenameDiPi0(file);
107  filenameDiPi0.ReplaceAll("mudst",outdir);
108  filenameDiPi0.ReplaceAll(".list",".MuDst.root");
109  if(ifile<0){
110  filenameDiPi0.ReplaceAll(".MuDst.root",".dipi0.root");
111  }else{
112  filenameDiPi0.ReplaceAll(".MuDst.root",Form(".%d.dipi0.root",ifile));
113  }
114  cout << "DiPi0 outfile name = " << filenameDiPi0.Data()<<endl;
115  dipi0->setFileName(filenameDiPi0.Data());
116  TString filenameTree(filenameDiPi0);
117  filenameTree.ReplaceAll(".dipi0.root",".tree.root");
118  dipi0->setTreeFileName(filenameTree.Data());
119  dipi0->setWriteTree();
120 
121  chain->Init();
122  chain->EventLoop(start,stop);
123  chain->Finish();
124  delete chain;
125 }
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