StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
runBfc.C
1 TString opt = "in MakeEvent evout tpcDb trgd fcsDat fcsWFF fcsCluster fcsPoint";
2 
3 void runBfc(const Char_t *file="/gpfs01/star/subsysg/FPS/fcs2021/st_physics_22066021_raw_0000002.daq",
4  Int_t nevents=10, Int_t pedLedPhy=2, Int_t eventDisplay=10, Int_t debug=1){
5 
6  TString f(file);
7  int l1 = f.Length();
8  int l2 = f.Last('/');
9  TString dir(f); dir.Remove(l2+1,l1-l2);
10  TString fne(f); fne.Remove(0,l2+1);
11  TString crun(fne);
12  int l3= crun.First('_'); crun.Remove(0,l3+1);
13  int l4= crun.First('_'); crun.Remove(0,l4+1);
14  int l5 =crun.Length(); int l6= crun.First('_'); crun.Remove(l6,l5-l6);
15  int run=crun.Atoi();
16  int day=run/1000;
17  //printf("l1=%d l2=%d l3=%d l4=%d l5=%d l6=%d\n",l1,l2,l3,l4,l5,l6);
18  //printf("f =%s\n",f.Data());
19  //printf("dir=%s\n",dir.Data());
20  //printf("fne=%s\n",fne.Data());
21  //printf("run=%s\n",run.Data());
22  printf("Run=%d yearday=%d\n",run,day);
23  char edout[200];
24 
25  gROOT->LoadMacro("bfc.C"); // Load big "full" chain
26  bfc(-1,opt,file); // Setup but do not init
27 
28  St_db_Maker *dbMk= (St_db_Maker*) chain->GetMaker("db");
29  if(dbMk){
30  dbMk->SetAttr("blacklist", "tpc");
31  dbMk->SetAttr("blacklist", "svt");
32  dbMk->SetAttr("blacklist", "ssd");
33  dbMk->SetAttr("blacklist", "ist");
34  dbMk->SetAttr("blacklist", "pxl");
35  dbMk->SetAttr("blacklist", "pp2pp");
36  dbMk->SetAttr("blacklist", "ftpc");
37  dbMk->SetAttr("blacklist", "emc");
38  dbMk->SetAttr("blacklist", "eemc");
39  dbMk->SetAttr("blacklist", "mtd");
40  dbMk->SetAttr("blacklist", "pmd");
41  dbMk->SetAttr("blacklist", "tof");
42  dbMk->SetAttr("blacklist", "etof");
43  dbMk->SetAttr("blacklist", "rhicf");
44  }
45 
46  StFcsDbMaker* fcsDbMkr = (StFcsDbMaker*) chain->GetMaker("fcsDbMkr");
47  //cout << "fcsDbMkr="<<fcsDbMkr<<endl;
48 
49  StFcsDb* fcsDb = (StFcsDb*) chain->GetDataSet("fcsDb");
50  //cout << "fcsDb="<<fcsDb<<endl;
51  fcsDb->setDbAccess(0);
52  fcsDb->setDebug(debug);
53  // fcsDb->forceUniformGain(0.0053);
54  fcsDb->forceUniformGain(0.0053*2.0); //tail has 1/2 integral
55  fcsDb->forceUniformGainCorrection(1.0);
56  //fcsDb->setRun(run);
57  //fcsDb->setRun19(0);
58  //fcsDb->readGainFromText();
59  //fcsDb->readGainCorrFromText();
60 
61  StFcsRawHitMaker *hitmk=(StFcsRawHitMaker *)chain->GetMaker("fcsHit");
62  hitmk->setDebug(debug);
63 
64  StFcsWaveformFitMaker *wff=(StFcsWaveformFitMaker *)chain->GetMaker("StFcsWaveformFitMaker");
65  wff->setDebug(1);
66  wff->setEnergySelect(10);
67  wff->setTail(2);
68  char wffout[100];
69  char wffout2[100];
70  if(pedLedPhy==1){
71  if(run<1106734){
72  wff->setCenterTimeBins(207,190,240);
73  }else{
74  wff->setCenterTimeBins(207+8,190+8,240+8);
75  }
76  wff->setPedTimeBins(0,150);
77  skip=5;
78  }else{
79  wff->setCenterTimeBins(50,30,100);
80  }
81  sprintf(wffout,"%d/%d.wff",day,run);
82  wff->setFileName(wffout,10,0);
83  sprintf(wffout2,"%d/%d.wfftime.png",day,run);
84  wff->setMeasureTime(wffout2);
85 
86  StFcsClusterMaker *clu=(StFcsClusterMaker *)chain->GetMaker("StFcsClusterMaker");
87  clu->setDebug(1);
88 
89  StFcsPointMaker *poi=(StFcsPointMaker *)chain->GetMaker("StFcsPointMaker");
90  poi->setDebug(1);
91  poi->setShowerShape(3);
92 
93 
94  gSystem->Load("StFcsEventDisplay");
95  StFcsEventDisplay* fcsed;
96  if(pedLedPhy>0 && eventDisplay>0){
97  gSystem->Load("StEpdUtil");
98  fcsed = new StFcsEventDisplay();
99  fcsed->setMaxEvents(eventDisplay);
100  sprintf(edout,"%d/%d.eventDisplay.png",day,run);
101  fcsed->setFileName(edout);
102  fcsed->setFilter(1);
103  //fcsed->setRun19(0);
104  }
105 
106  gSystem->Load("StFcsQaMaker");
107  StFcsQaMaker *qaMkr=new StFcsQaMaker("FcsQa");
108  qaMkr->setRun(run);
109 
110  if(pedLedPhy==0){
111  hitmk->setReadMode(0);
112  qaMkr->setMaxTimeBins(1024);
113  qaMkr->setMaxAdc(512);
114  }else if(pedLedPhy==1){
115  hitmk->setReadMode(0);
116  qaMkr->setMaxTimeBins(256);
117  qaMkr->setSumTimeBins(210,225);
118  qaMkr->setMaxAdc(2048);
119  qaMkr->setMaxAdcSum(20000);
120  }else if(pedLedPhy==2){
121  hitmk->setReadMode(1);
122  qaMkr->setMaxTimeBins(160);
123  qaMkr->setSumTimeBins(35,60);
124  qaMkr->setMaxAdc(1024);
125  qaMkr->setMaxAdcSum(2000);
126  }
127 
128  // Intializet the chain
129  chain->Init();
130 
131  // Process events
132  chain->EventLoop(nevents);
133 }
void setPedTimeBins(int min, int max)
Set the timebin region where the pedestal occurs, for non-pedestal subtracted data.
void setTail(int v)
Set tail parameters to use for #mDbPulse, see StFcsDbPulse::setTail()
void setFileName(char *file, int maxpage=25, int skip=5)
Set event drawing options.
void forceUniformGain(float ecal, float hcal=0.0053, float pres=0.01)
fixed default gaincorr
Definition: StFcsDb.h:234
void setDbAccess(int v=1)
debug level
Definition: StFcsDb.cxx:250
void setDebug(int v)
void forceUniformGainCorrection(float ecal, float hcal=1.0, float pres=0.5)
Definition: StFcsDb.h:240