StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
runSimBfc.C
1 TString input_dir = "./";
2 TString output_dir = "./";
3 TString input_chain = "sdt20211025.120000,fzin,geant,FieldOn,logger,MakeEvent,CMuDst,fcsSim,fcsWFF,fcsCluster,fcsPoint";
4 
6 
7 void runSimBfc( Int_t nEvents=1000, Int_t run=1, const char* pid="mu+", int TrgVersion=202207,
8  int debug=0, int e=0, float pt=4.0, float vz=0.0,
9  char* epdmask="0.0300",
10  int leakyHcal=0,
11  int eventDisplay=10,
12  TString myDir=input_dir, TString myOutDir=output_dir,
13  TString myChain=input_chain, Int_t mnEvents=0){
14 
15  gROOT->LoadMacro("bfc.C");
16  // gROOT->Macro("loadMuDst.C");
17  TString myDat;
18  TString proc(pid);
19  if(proc.Contains("dy") || proc.Contains("mb") || proc.Contains("jet") || proc.Contains("dybg")){
20  myDat=Form("pythia.%s.vz%d.run%i.fzd",pid,(int)vz,run);
21  }else if(e>0.0){
22  myDat=Form("%s.e%d.vz%d.run%i.fzd",pid,e,(int)vz,run);
23  }else{
24  myDat=Form("%s.pt%3.1f.vz%d.run%i.fzd",pid,pt,(int)vz,run);
25  }
26  printf("Opening %s\n",(myDir+myDat).Data());
27  bfc( -1, myChain, myDir+myDat );
28 
29  TString outfile = myOutDir + myDat.ReplaceAll(".fzd",".root");
30  cout << "output file=" <<outfile<<endl;
31  chain->SetOutputFile(outfile);
32 
33  St_db_Maker *dbMk= (St_db_Maker*) chain->GetMaker("db");
34  dbMk->SetAttr("blacklist", "tpc");
35  dbMk->SetAttr("blacklist", "svt");
36  dbMk->SetAttr("blacklist", "ssd");
37  dbMk->SetAttr("blacklist", "ist");
38  dbMk->SetAttr("blacklist", "pxl");
39  dbMk->SetAttr("blacklist", "pp2pp");
40  dbMk->SetAttr("blacklist", "ftpc");
41  dbMk->SetAttr("blacklist", "emc");
42  dbMk->SetAttr("blacklist", "eemc");
43  dbMk->SetAttr("blacklist", "mtd");
44  dbMk->SetAttr("blacklist", "pmd");
45  dbMk->SetAttr("blacklist", "tof");
46  dbMk->SetAttr("blacklist", "etof");
47  dbMk->SetAttr("blacklist", "rhicf");
48  dbMk->SetAttr("blacklist", "Calibrations_rich");
49 
50  StFcsDbMaker* fcsdbmkr = (StFcsDbMaker*) chain->GetMaker("fcsDbMkr");
51  cout << "fcsdbmkr="<<fcsdbmkr<<endl;
52 
53  StFcsDb* fcsdb = (StFcsDb*) chain->GetDataSet("fcsDb");
54  cout << "fcsdb="<<fcsdb<<endl;
55  fcsdb->forceUniformGain(0.0053);
56  fcsdb->forceUniformGainCorrection(1.0);
57 
58  StFcsFastSimulatorMaker *fcssim = (StFcsFastSimulatorMaker*) chain->GetMaker("fcsSim");
59 
60  StFcsWaveformFitMaker *wff=(StFcsWaveformFitMaker *)chain->GetMaker("StFcsWaveformFitMaker");
61  wff->setEnergySelect(0);
62  wff->setDebug(debug);
63 
64  StFcsClusterMaker *clu=(StFcsClusterMaker *)chain->GetMaker("StFcsClusterMaker");
65  clu->setDebug(debug);
66 
67  StFcsPointMaker *poi=(StFcsPointMaker *)chain->GetMaker("StFcsPointMaker");
68  poi->setDebug(debug);
69  poi->setShowerShape(3);
70 
71  gSystem->Load("StFcsEcalHcalMipMaker");
73  mip->setRun(run);
74 
75  /*
76  gSystem->Load("RTS");
77  gSystem->Load("StFcsTriggerSimMaker");
78  StFcsTriggerSimMaker* fcsTrgSim = new StFcsTriggerSimMaker();
79  fcsTrgSim->setSimMode(1);
80  fcsTrgSim->setTrigger(TrgVersion);
81  fcsTrgSim->setDebug(debug);
82  fcsTrgSim->setEtGain(1.0); //ET match
83  //fcsTrgSim->setEtGain(0.5); //halfway
84  //fcsTrgSim->setEtGain(0.0); //E match
85  //fcsTrgSim->setReadPresMask(Form("mask/fcs_ecal_epd_mask.ele.pt0.6.vz0.thr%s.txt",epdmask));
86  //TString txfile(outfile); txfile.ReplaceAll(".root",".event.txt"); fcsTrgSim->setWriteEventText(txfile.Data());
87  TString qafile(outfile); qafile.ReplaceAll(".root",".qahist.root"); fcsTrgSim->setWriteQaHist(qafile.Data());
88  fcsTrgSim->setThresholdFile("stage_params.txt");
89 
90  gSystem->Load("StFcsTrgQaMaker");
91  StFcsTrgQaMaker* fcsTrgQa = new StFcsTrgQaMaker();
92  TString tqafile(outfile); tqafile.ReplaceAll(".root",Form(".thr%s.trgqa.root",epdmask));
93  fcsTrgQa->setFilename(tqafile.Data());
94  fcsTrgQa->setEcalPtThr(pt*0.75);
95  */
96 
97  if(eventDisplay>0){
98  gSystem->Load("StEpdUtil");
99  gSystem->Load("StFcsEventDisplay");
100  StFcsEventDisplay* fcsed = new StFcsEventDisplay();
101  fcsed->setMaxEvents(eventDisplay);
102  outfile.ReplaceAll(".root",".eventDisplay.png");
103  fcsed->setFileName(outfile.Data());
104  }
105 
106  chain->Init();
107  StMaker::lsMakers(chain);
108  chain->EventLoop(mnEvents,nEvents);
109  chain->Finish();
110 }
virtual Int_t Finish()
Definition: StChain.cxx:85
void forceUniformGain(float ecal, float hcal=0.0053, float pres=0.01)
fixed default gaincorr
Definition: StFcsDb.h:234
void setDebug(int v)
void forceUniformGainCorrection(float ecal, float hcal=1.0, float pres=0.5)
Definition: StFcsDb.h:240