StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
runBfcCosmic.C
1 TString opt = "in MakeEvent Mudst evout trgd fcsDat fcsWFF fcsCluster fcsPoint Tpcdb";
2 
3 void runBfc(Int_t nevents=1000000, const Char_t *file="st_fcs_22179052_raw_0000001.daq", Int_t pedLedPhy=3, Int_t eventDisplay=1000, Int_t debug=0){
4 
5  TString f(file);
6  int l1 = f.Length();
7  int l2 = f.Last('/');
8  TString dir(f); dir.Remove(l2+1,l1-l2);
9  TString fne(f); fne.Remove(0,l2+1);
10  TString crun(fne);
11  int l3= crun.First('_'); crun.Remove(0,l3+1);
12  int l4= crun.First('_'); crun.Remove(0,l4+1);
13  int l5 =crun.Length(); int l6= crun.First('_'); crun.Remove(l6,l5-l6);
14  int run=crun.Atoi();
15  int day=run/1000;
16  //printf("l1=%d l2=%d l3=%d l4=%d l5=%d l6=%d\n",l1,l2,l3,l4,l5,l6);
17  //printf("f =%s\n",f.Data());
18  //printf("dir=%s\n",dir.Data());
19  //printf("fne=%s\n",fne.Data());
20  //printf("run=%s\n",run.Data());
21  printf("Run=%d yearday=%d\n",run,day);
22  char edout[200];
23 
24  gROOT->LoadMacro("bfc.C"); // Load big "full" chain
25  bfc(-1,opt,file); // Setup but do not init
26 
27  St_db_Maker *dbMk= (St_db_Maker*) chain->GetMaker("db");
28  if(dbMk){
29  dbMk->SetAttr("blacklist", "tpc");
30  dbMk->SetAttr("blacklist", "svt");
31  dbMk->SetAttr("blacklist", "ssd");
32  dbMk->SetAttr("blacklist", "ist");
33  dbMk->SetAttr("blacklist", "pxl");
34  dbMk->SetAttr("blacklist", "pp2pp");
35  dbMk->SetAttr("blacklist", "ftpc");
36  dbMk->SetAttr("blacklist", "emc");
37  dbMk->SetAttr("blacklist", "eemc");
38  dbMk->SetAttr("blacklist", "mtd");
39  dbMk->SetAttr("blacklist", "pmd");
40  dbMk->SetAttr("blacklist", "tof");
41  dbMk->SetAttr("blacklist", "etof");
42  dbMk->SetAttr("blacklist", "rhicf");
43  }
44 
45  StFcsDbMaker* fcsDbMkr = (StFcsDbMaker*) chain->GetMaker("fcsDbMkr");
46  //cout << "fcsDbMkr="<<fcsDbMkr<<endl;
47 
48  StFcsDb* fcsDb = (StFcsDb*) chain->GetDataSet("fcsDb");
49  //cout << "fcsDb="<<fcsDb<<endl;
50  fcsDb->setDbAccess(0);
51  fcsDb->setDebug(debug);
52  // fcsDb->forceUniformGain(0.0053);
53  fcsDb->forceUniformGain(0.0053*2.0); //tail has 1/2 integral
54  fcsDb->forceUniformGainCorrection(1.0);
55  //fcsDb->setRun(run);
56  //fcsDb->setRun19(0);
57  //fcsDb->readGainFromText();
58  //fcsDb->readGainCorrFromText();
59 
60  Int_t filter=0;
61  if(filter){
62  gSystem->Load("StTriggerFilterMaker");
63  StTriggerFilterMaker* filterMaker = new StTriggerFilterMaker;
64  filterMaker->printTriggerId();
65  filterMaker->addTrigger(860000); //mb-hlt-200
66  //filterMaker->addTrigger(860009); //mb-hlt-30
67  filterMaker->addTofUpperLimit(20);
68  }
69 
70  StFcsRawHitMaker *hitmk=(StFcsRawHitMaker *)chain->GetMaker("fcsHit");
71  hitmk->setDebug(debug);
72 
73  StFcsWaveformFitMaker *wff=(StFcsWaveformFitMaker *)chain->GetMaker("StFcsWaveformFitMaker");
74  wff->setDebug(debug);
75  wff->setEnergySelect(10);
76  wff->setTail(2);
77  char wffout[100];
78  char wffout2[100];
79  if(pedLedPhy==3){ //cosmic
80  wff->setEnergySelect(2);
81  wff->setCenterTimeBins(50,30,100);
82  }else if(pedLedPhy==1){ //LED
83  if(run<1106734){
84  wff->setCenterTimeBins(207,190,240);
85  }else{
86  wff->setCenterTimeBins(207+8,190+8,240+8);
87  }
88  wff->setPedTimeBins(0,150);
89  skip=5;
90  }else{ //Physics
91  wff->setCenterTimeBins(50,30,100);
92  }
93  sprintf(wffout,"%d/%d.wff",day,run);
94  wff->setFileName(wffout,10,0);
95  sprintf(wffout2,"%d/%d.wfftime.png",day,run);
96  wff->setMeasureTime(wffout2);
97 
98  StFcsClusterMaker *clu=(StFcsClusterMaker *)chain->GetMaker("StFcsClusterMaker");
99  clu->setDebug(debug);
100  if(pedLedPhy==3){ //cosmic
101  clu->sortById();
102  clu->setNeighborDistance(2.4,2.4);
103  clu->setTowerEThreshold(0.001,0.001);
104  clu->setTowerEThreMoment(0.001,0.001);
105  clu->setTowerERatio2Split(100,100);
106  }
107 
108  if(pedLedPhy==2){ //physics
109  StFcsPointMaker *poi=(StFcsPointMaker *)chain->GetMaker("StFcsPointMaker");
110  poi->setDebug(debug);
111  poi->setShowerShape(3);
112  }
113 
114  if(pedLedPhy==3){ //cosmic
115  gSystem->Load("StFcsCosmicMaker");
116  StFcsCosmicMaker* cosmic = new StFcsCosmicMaker();
117  cosmic->setRun(run);
118  }
119 
120  gSystem->Load("StFcsEventDisplay");
121  StFcsEventDisplay* fcsed;
122  if(pedLedPhy>0 && eventDisplay>0){
123  gSystem->Load("StEpdUtil");
124  fcsed = new StFcsEventDisplay();
125  fcsed->setMaxEvents(eventDisplay);
126  sprintf(edout,"%d/%d.eventDisplay.png",day,run);
127  fcsed->setFileName(edout);
128  fcsed->setFilter(1);
129  if(pedLedPhy==3) fcsed->setMinMax(-3,1);
130  }
131 
132  gSystem->Load("StFcsQaMaker");
133  StFcsQaMaker *qaMkr=new StFcsQaMaker("FcsQa");
134  qaMkr->setRun(run);
135 
136  if(pedLedPhy==0){
137  hitmk->setReadMode(0);
138  qaMkr->setMaxTimeBins(1024);
139  qaMkr->setMaxAdc(512);
140  }else if(pedLedPhy==1){
141  hitmk->setReadMode(0);
142  qaMkr->setMaxTimeBins(256);
143  qaMkr->setSumTimeBins(210,225);
144  qaMkr->setMaxAdc(2048);
145  qaMkr->setMaxAdcSum(20000);
146  }else if(pedLedPhy==2){
147  hitmk->setReadMode(1);
148  qaMkr->setMaxTimeBins(160);
149  qaMkr->setSumTimeBins(35,60);
150  qaMkr->setMaxAdc(1024);
151  qaMkr->setMaxAdcSum(2000);
152  }
153 
154  // Intializet the chain
155  chain->Init();
156 
157  // Process events
158  chain->EventLoop(nevents);
159 }
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