StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
runSimBfc.C
1 TString input_dir = "./fcs2022";
2 TString output_dir = ".";
3 TString input_chain = "sdt20211016.120000,dev2021,fzin,geant,FieldOn,logger,MakeEvent,ReverseField,agml,usexgeom,bigbig,fstFastSim,fttFastSim,fcsSim,fcsWFF,fcsCluster,fwdTrack";
4 
5 void runSimBfc( Int_t nEvents=1000, Int_t run=1, const char* pid="JPsi", float vz=0.0,
6  TString myDir=input_dir, TString myOutDir=output_dir,
7  int TrgVersion=202207,
8  int debug=0, int e=0, float pt=1.5,
9  char* epdmask="0.0100",
10  int leakyHcal=0,
11  int eventDisplay=0,
12  TString myChain=input_chain,
13  Int_t mnEvents=0,
14  std::string configFile = "sim/fast_track.xml",
15  bool SiIneff = false){
16 
17  gSystem->Load( "libStarRoot.so" );
18  gROOT->SetMacroPath(".:/star-sw/StRoot/macros/:./StRoot/macros:./StRoot/macros/graphics:./StRoot/macros/analysis:./StRoot/macros/test:./StRoot/macros/examples:./StRoot/macros/html:./StRoot/macros/qa:./StRoot/macros/calib:./StRoot/macros/mudst:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros/graphics:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros/analysis:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros/test:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros/examples:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros/html:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros/qa:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros/calib:/afs/rhic.bnl.gov/star/packages/DEV/StRoot/macros/mudst:/afs/rhic.bnl.gov/star/ROOT/36/5.34.38/.sl73_x8664_gcc485/rootdeb/macros:/afs/rhic.bnl.gov/star/ROOT/36/5.34.38/.sl73_x8664_gcc485/rootdeb/tutorials");
19  gROOT->LoadMacro("bfc.C");
20 
21  TString myDat, subDir, infile, outfile;
22  TString proc(pid);
23  if(proc.Contains("dy") || proc.Contains("JPsi") || proc.Contains("mb") || proc.Contains("jet") || proc.Contains("dybg")){
24  subDir=Form("pythia_%s_vz%d",pid,(int)vz);
25  myDat=Form("pythia_%s_vz%d_run%i.fzd",pid,(int)vz,run);
26  }else if(e>0.0){
27  myDat=Form("%s.e%d.vz%d.run%i.fzd",pid,e,(int)vz,run);
28  }else{
29  myDat=Form("%s.pt%3.1f.vz%d.run%i.fzd",pid,pt,(int)vz,run);
30  }
31  if(myDir.EqualTo(".")) {infile = myDir + "/" + myDat;}
32  else {infile = myDir + "/" + subDir + "/" + myDat;}
33  outfile = myOutDir + "/" + myDat.ReplaceAll(".fzd",".root");
34  cout << "Input file=" << infile << endl;
35  cout << "Output file=" << outfile << endl;
36 
37  bfc( -1, myChain, infile);
38  chain->SetOutputFile(outfile);
39 
40  St_db_Maker *dbMk= (St_db_Maker*) chain->GetMaker("db");
41  dbMk->SetAttr("blacklist", "tpc");
42  dbMk->SetAttr("blacklist", "svt");
43  dbMk->SetAttr("blacklist", "ssd");
44  dbMk->SetAttr("blacklist", "ist");
45  dbMk->SetAttr("blacklist", "pxl");
46  dbMk->SetAttr("blacklist", "pp2pp");
47  dbMk->SetAttr("blacklist", "ftpc");
48  dbMk->SetAttr("blacklist", "emc");
49  dbMk->SetAttr("blacklist", "eemc");
50  dbMk->SetAttr("blacklist", "mtd");
51  dbMk->SetAttr("blacklist", "pmd");
52  dbMk->SetAttr("blacklist", "tof");
53  dbMk->SetAttr("blacklist", "etof");
54  dbMk->SetAttr("blacklist", "rhicf");
55  dbMk->SetAttr("blacklist", "Calibrations_rich");
56 
57  StFcsDbMaker* fcsdbmkr = (StFcsDbMaker*) chain->GetMaker("fcsDbMkr");
58  cout << "fcsdbmkr="<<fcsdbmkr<<endl;
59  fcsdbmkr->setDbAccess(1);
60 
61  StFcsDb* fcsdb = (StFcsDb*) chain->GetDataSet("fcsDb");
62  cout << "fcsdb="<<fcsdb<<endl;
63  //fcsdb->readGainFromText();
64  //fcsdb->readGainCorrFromText();
65  fcsdb->forceUniformGain(0.0053);
66  fcsdb->forceUniformGainCorrection(1.0);
67 
68  StFcsFastSimulatorMaker *fcssim = (StFcsFastSimulatorMaker*) chain->GetMaker("fcsSim");
69  fcssim->setDebug(debug);
70  fcssim->setLeakyHcal(leakyHcal);
71 
72  StFcsWaveformFitMaker *wff=(StFcsWaveformFitMaker *)chain->GetMaker("StFcsWaveformFitMaker");
73  wff->setDebug(debug);
74  wff->setEnergySelect(0);
75 
76  StFcsClusterMaker *clu=(StFcsClusterMaker *)chain->GetMaker("StFcsClusterMaker");
77  clu->setDebug(debug);
78 
79  /*
80  StFcsPointMaker *poi=(StFcsPointMaker *)chain->GetMaker("StFcsPointMaker");
81  poi->setDebug(1);
82  poi->setShowerShape(3);
83  */
84 
85  /*
86  gSystem->Load("RTS");
87  gSystem->Load("StFcsTriggerSimMaker");
88  StFcsTriggerSimMaker* fcsTrgSim = new StFcsTriggerSimMaker();
89  fcsTrgSim->setSimMode(1);
90  fcsTrgSim->setTrigger(TrgVersion);
91  fcsTrgSim->setDebug(debug);
92  fcsTrgSim->setEtGain(1.0); //ET match
93  //fcsTrgSim->setEtGain(0.5); //halfway
94  //fcsTrgSim->setEtGain(0.0); //E match
95  //fcsTrgSim->setReadPresMask(Form("mask/fcs_ecal_epd_mask.ele.pt0.6.vz0.thr%s.txt",epdmask));
96  //TString txfile(outfile); txfile.ReplaceAll(".root",".event.txt"); fcsTrgSim->setWriteEventText(txfile.Data());
97  TString qafile(outfile); qafile.ReplaceAll(".root",".qahist.root"); fcsTrgSim->setWriteQaHist(qafile.Data());
98  fcsTrgSim->setThresholdFile("stage_params.txt");
99 
100  gSystem->Load("StFcsTrgQaMaker");
101  StFcsTrgQaMaker* fcsTrgQa = new StFcsTrgQaMaker();
102  TString tqafile(outfile); tqafile.ReplaceAll(".root",Form(".thr%s.trgqa.root",epdmask));
103  fcsTrgQa->setFilename(tqafile.Data());
104  fcsTrgQa->setEcalPtThr(pt*0.75);
105  */
106 
107  // Configure FTT FastSim
108  StFttFastSimMaker *fttFastSim = (StFttFastSimMaker*) chain->GetMaker( "fttSim" );
109 
110  // Configure FST FastSim
111  StFstFastSimMaker *fstFastSim = (StFstFastSimMaker*) chain->GetMaker( "fstFastSim" );;
112  //TString qaoutname(gSystem->BaseName(inFile));
113  //qaoutname.ReplaceAll(".fzd", ".FastSimu.QA.root");
114  //fstFastSim->SetQAFileName(qaoutname);
115  if (SiIneff) fstFastSim->SetInEfficiency(0.1); // inefficiency of Si
116 
117  // Configure the Forward Tracker
118  StFwdTrackMaker * fwdTrack = (StFwdTrackMaker*) chain->GetMaker( "fwdTrack" );;
119  cout << "Running FwdTracking with config: " << configFile << endl;
120  fwdTrack->SetConfigFile( configFile );
121  //fwdTrack->SetGenerateTree( true );
122  //fwdTrack->SetGenerateHistograms( true );
123 
124  //FwdTrack and FcsCluster assciation
125  gSystem->Load("StFcsTrackMatchMaker");
127  TString matchfile(outfile); matchfile.ReplaceAll(".root",".match.root");
128  match->setFileName(matchfile.Data());
129  match->SetDebug(debug);
130 
131  gSystem->Load("StFcsDiLeptonMaker");
132  StFcsDiLeptonMaker *dilep = new StFcsDiLeptonMaker;
133  TString dilepfile(outfile); dilepfile.ReplaceAll(".root",".dilep.root");
134  dilep->setFileName(dilepfile.Data());
135 
136  if(eventDisplay>0){
137  gSystem->Load("StEpdUtil");
138  gSystem->Load("StFcsEventDisplay");
139  StFcsEventDisplay* fcsed = new StFcsEventDisplay();
140  fcsed->setMaxEvents(eventDisplay);
141  outfile.ReplaceAll(".root",".eventDisplay.png");
142  fcsed->setFileName(outfile.Data());
143  }
144 
145 
146  chain->Init();
147  StMaker::lsMakers(chain);
148  chain->EventLoop(mnEvents,nEvents);
149  chain->Finish();
150 }
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