StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fast.C
1 //usr/bin/env root4star -l -b -q $0'("'${1:-sim.fzd}'",'${2:-5}')'; exit $?
2 // that is a valid shebang to run script as executable, but with only one arg
3 
4 
5 // Run very fast fwd tracking
6 // generate some input data using genfzd
7 
8 TFile *output = 0;
9 
10 void fast( char *inFile = "sim.fzd",
11  int n = 1000, // nEvents to run
12  bool useFstForSeedFinding = true, // use FTT (default) or FST for track finding
13  bool enableTrackRefit = true, // Enable track refit (default off)
14  bool realisticSim = true, // enables data-like mode, real track finding and fitting without MC seed
15  bool useZeroB = false
16  ) {
17  // report all of the parameters passed in
18  cout << "inFile = " << inFile << endl;
19  cout << "n = " << n << endl;
20  cout << "useFstForSeedFinding = " << useFstForSeedFinding << endl;
21  cout << "enableTrackRefit = " << enableTrackRefit << endl;
22  cout << "realisticSim = " << realisticSim << endl;
23  cout << "useZeroB = " << useZeroB << endl;
24  const char *geom = "";
25  TString _geom = geom;
26 
27  // Switches for common options
28  bool SiIneff = false;
29  bool useConstBz = false;
30  bool useFCS = true;
31 
32  // to use the geom cache (skip agml build which is faster)
33  // set the _geom string to "" and make sure the cache file ("fGeom.root") is present
34  // _geom = "";
35 
36  // Setup the chain for reading an FZD
37  TString _chain;
38 
39  _chain = Form("fzin %s sdt20211016 fwdTrack MakeEvent bigbig evout cmudst tree", _geom.Data() );
40 
41 
42  gSystem->Load( "libStarRoot.so" );
43  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");
44  gROOT->LoadMacro("bfc.C");
45  bfc(-1, _chain, inFile);
46 
47  gSystem->Load( "libStFttSimMaker" );
48  gSystem->Load( "libStFcsTrackMatchMaker" );
49 
50  gSystem->Load( "libMathMore.so" );
51  gSystem->Load( "libStarGeneratorUtil" );
52 
53 
54  gSystem->Load("StFwdUtils.so");
55 
56 
57 
58  // Configure the Forward Tracker
59  StFwdTrackMaker * fwdTrack = (StFwdTrackMaker*) chain->GetMaker( "fwdTrack" );
60 
61  if ( fwdTrack ){
62  fwdTrack->SetDebug(1);
63  // config file set here for ideal simulation
64  if ( _geom == "" ){
65  cout << "Using the Geometry cache: fGeom.root" << endl;
66  fwdTrack->setGeoCache( "fGeom.root" );
67  }
68 
69  // choose
70  if (useFstForSeedFinding)
71  fwdTrack->setSeedFindingWithFst();
72  else { // default for this true/false option
73  fwdTrack->setSeedFindingWithFtt();
74  }
75  // other options
76  // fwdTrack->setSeedFindingWithFtt();
77  // fwdTrack->setSeedFindingWithFstFttSequential();
78  // fwdTrack->setSeedFindingWithFstFttSimultaneous();
79 
80 
81  fwdTrack->setOutputFilename( TString::Format( "%s.output.root", inFile ).Data() );
82  fwdTrack->SetVisualize( false );
83  fwdTrack->SetDebug();
84  fwdTrack->setTrackRefit( enableTrackRefit );
85  fwdTrack->setConstB( useConstBz );
86 
87  if ( useZeroB ){
88  cout << "Setting B = 0" << endl;
89  fwdTrack->setZeroB( true );
90  }
91 
92  bool doFitQA = true;
93  if ( doFitQA ){
94  StFwdFitQAMaker *fwdFitQA = new StFwdFitQAMaker();
95  fwdFitQA->SetDebug();
96  TString fitqaoutname(gSystem->BaseName(inFile));
97  fitqaoutname.ReplaceAll(".fzd", ".FwdFitQA.root");
98  fwdFitQA->setOutputFilename( fitqaoutname );
99  chain->AddAfter("fwdTrack", fwdFitQA);
100  }
101  cout << "fwd tracker setup" << endl;
102  }
103 
104  StMuDstMaker * muDstMaker = (StMuDstMaker*)chain->GetMaker( "MuDst" );
105 
106  if (muDstMaker){
107  StFwdQAMaker *fwdQA = new StFwdQAMaker();
108  fwdQA->SetDebug(2);
109  TString fwdqaname(gSystem->BaseName(inFile));
110  fwdqaname.ReplaceAll(".fzd", ".FwdTree.root");
111  fwdQA->setTreeFilename(fwdqaname);
112  chain->AddAfter("MuDst", fwdQA);
113  }
114 
115  // The PicoDst
116  gSystem->Load("libStPicoEvent");
117  gSystem->Load("libStPicoDstMaker");
118  StPicoDstMaker *picoMk = new StPicoDstMaker(StPicoDstMaker::IoWrite);
119  cout << "picoMk = " << picoMk << endl;
120  picoMk->setVtxMode(StPicoDstMaker::Default);
121 
122 chain_loop:
123  chain->Init();
124 
125  //_____________________________________________________________________________
126  //
127  // MAIN EVENT LOOP
128  //_____________________________________________________________________________
129  for (int i = 0; i < n; i++) {
130  cout << "--------->START EVENT: " << i << endl;
131  chain->Clear();
132  if (kStOK != chain->Make())
133  break;
134  cout << "<---------- END EVENT" << endl;
135  } // event loop
136 }
Class that converts MuDst into PicoDst.
void setZeroB(bool zeroB=true)
Set B-field to zero (for zero field running)
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
void setConstB(bool constB=true)
Set B-field to constant (even outside of TPC)
void setSeedFindingWithFtt()
Use Ftt hits in the Seed Finding.
void setVtxMode(const PicoVtxMode vtxMode)
Set vertex selection mode.
void setOutputFilename(std::string fn)
Set the filename for output ROOT file.
virtual Int_t Make()
Definition: StChain.cxx:110
Definition: Stypes.h:40
void setTrackRefit(bool refit=true)
Sets the tracking to refit This adds compatible hits from whichever detector was NOT used in seed fin...
void setGeoCache(TString gc)
Sets geometry cache filename.
void setSeedFindingWithFst()
Use Fst hits in the Seed Finding.