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