StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RunPythia.C
1 //RunPythia.C
2 
3 // NOTE - This macro is ONLY for running MC simulation data!!
4 //=========================================================================================
5 class StChain;
6 StChain *chain;
7 int total=0;
8 
9 void RunPythia(
10  int nevents = 100,
11  const char *dir ="",
12  const char* infile ="/star/data18/reco/pp200/pythia6_203/default/pt15/y2004x/gheisha_on/trs_ij/pds1214_69_5000evts.MuDst.root",
13  const char* outdir = "./processed/")
14 {
15  /*
16  TString ofile = TString(outdir) + TString(infile) + TString("_simu.jet.root");
17  TString sofile = TString(outdir) + TString(infile) + TString("_simu.out.root");
18  */
19 
20  TString ofile = "blah_simu.jet.root";
21  TString sofile = "blah_simu.out.root";
22  const char* outfile = ofile.Data();
23  const char *soutfile = sofile;
24 
25  cout <<"write files:\t"<<outfile<<"\tand:\t"<<soutfile<<endl;
26 
27  if (gClassTable->GetID("TTable") < 0) {
28  gSystem->Load("libStar");
29  gSystem->Load("libPhysics");
30  }
31  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
32  loadSharedLibraries();
33  gSystem->Load("StMagF");
34  gSystem->Load("StTpcDb");
35  gSystem->Load("StDbUtilities");
36  gSystem->Load("StMcEvent");
37  gSystem->Load("StMcEventMaker");
38  gSystem->Load("StDaqLib");
39  gSystem->Load("StEmcRawMaker");
40  gSystem->Load("StEmcADCtoEMaker");
41  gSystem->Load("StEpcMaker");
42  gSystem->Load("StDbLib");
43  gSystem->Load("StDbBroker");
44  gSystem->Load("St_db_Maker");
45  gSystem->Load("StJetFinder");
46  gSystem->Load("StJetMaker");
47 
48  double pi = atan(1.0)*4.0;
49  cout << " loading done " << endl;
50 
51  chain= new StChain("StChain");
52  chain->SetDebug(1);
53 
54  // StIOMaker - to read geant files
55  StIOMaker* ioMaker = new StIOMaker();
56  ioMaker->SetFile(infile);
57  //ioMaker->SetFile(fname);
58  ioMaker->SetIOMode("r");
59  ioMaker->SetBranch("*",0,"0"); //deactivate all branches
60  ioMaker->SetBranch("geantBranch",0,"r"); //activate geant Branch
61 
62  // Instantiate StMcEventMaker
63  class StMcEventMaker *mcEventMaker = new StMcEventMaker();
64  mcEventMaker->doPrintEventInfo = false;
65  mcEventMaker->doPrintMemoryInfo = false;
66 
67  //Instantiate the MuDstReader
69  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,dir,infile,"",10,"MuDst");
70 
71  //Database
72  St_db_Maker *dbMk =new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb","StarDb");
73  dbMk->SetDateTime(20031120,0);
74 
75  //EmcAdc2EMaker
77 
78  //Instantiate the StEmcTpcFourPMaker
79  StEmcTpcFourPMaker* emcFourPMaker = new StEmcTpcFourPMaker("EmcTpcFourPMaker", muDstMaker, 30, 30, .3, .3, .003, adc);
80  emcFourPMaker->setUseType(StEmcTpcFourPMaker::Hits);//if don't have this line then default is 0 (which is hits)
81  emcFourPMaker->setMaxPoints(150);
82  emcFourPMaker->setMinPointThreshold(.3);
83 
84  //Instantiate Trigger maker for simulation
85  StJetSimuTrigMaker *trig=new StJetSimuTrigMaker("SimuTrig");
86  trig->setPrintOption(0);
87 
88  //Instantiate Maker with Pythia event record etc for simulation
89  StJetSimuWeightMaker *weight= new StJetSimuWeightMaker("SimuWeight");
90  weight->setPrintOption(0);
91 
92  //Instantiate Tree Maker for simulation
93  StJetSimuTreeMaker *stree= new StJetSimuTreeMaker("SimuTree",soutfile);
94  stree->setPrintOption(0);
95 
96  //Pythia4pMaker
97  //StPythiaFourPMaker* pythiaFourPMaker = new StPythiaFourPMaker("StPythiaFourPMaker",weight, mcEventMaker);
98 
99  //Instantiate the JetMaker
100  StJetMaker* emcJetMaker = new StJetMaker("emcJetMaker", muDstMaker, outfile);
101 
102  //set the analysis cuts: (see StJetMaker/StppJetAnalyzer.h -> class StppAnaPars )
103  StppAnaPars* anapars = new StppAnaPars();
104  anapars->setFlagMin(0); //track->flag() > 0
105  anapars->setNhits(0); //track->nHitsFit()>15
106  anapars->setCutPtMin(0.0001); //track->pt() > 0.2
107  anapars->setAbsEtaMax(5.0); //abs(track->eta())<5.0
108  anapars->setJetPtMin(5.0); //MLM, remember to change this back to 5!
109  anapars->setJetEtaMax(5.0);
110  anapars->setJetEtaMin(0);
111  anapars->setJetNmin(0);
112 
113 
114  //Setup the cone finder (See StJetFinder/StConeJetFinder.h -> class StConePars)
115  StConePars* cpars = new StConePars();
116  cpars->setGridSpacing(200, -5.0, 5.0, 120, -pi, pi);
117  cpars->setConeRadius(0.7);
118  cpars->setSeedEtMin(0.5);
119  cpars->setAssocEtMin(0.01);
120  cpars->setSplitFraction(0.5);
121  cpars->setPerformMinimization(true);
122  cpars->setAddMidpoints(true);
123  cpars->setRequireStableMidpoints(true);
124  cpars->setDoSplitMerge(true);
125  cpars->setDebug(false);
126 
127  //Setup the kt=finder (See StJetFinder/StKtCluFinder.h -> class StKtCluPars)
128  StKtCluPars* ktpars = new StKtCluPars();
129  ktpars->setR(1.0);
130  ktpars->setDebug(false);
131 
132  //Creat jet finders
133  //emcJetMaker->addAnalyzer(anapars, cpars, pythiaFourPMaker, "PythiaConeJetsPt02R07"); //cone + pythia
134  //emcJetMaker->addAnalyzer(anapars, ktpars, pythiaFourPMaker, "PythiaKtJet"); //kt + pythia
135  //emcJetMaker->addAnalyzer(anapars, cpars, emcFourPMaker, "RecoConeJetsPt02R07"); //cone + reco
136  emcJetMaker->addAnalyzer(anapars, ktpars, emcFourPMaker, "RecoKtJet"); //kt + Reco
137 
138  chain->Init();
139  chain->PrintInfo();
140 
141  TChain* muchain = muDstMaker->chain();
142 
143  for (Int_t iev=0;iev<nevents; iev++) {
144  cout << "****************************************** " << endl;
145  //cout << "Working on eventNumber:\t" << iev << "\t of:\t"<<ntotal<<endl;
146  cout << "Working on eventNumber:\t" << iev <<endl;
147  cout << "*************************1***************** " << endl;
148  chain->Clear();
149  int iret = chain->Make(iev);
150  total++;
151  if (iret) {
152  cout << "Bad return code!" << endl;
153  break;
154  }
155  }
156  chain->Finish();
157  cout << "****************************************** " << endl;
158  cout << "total number of events " << total << endl;
159  cout << "****************************************** " << endl;
160 }
void setConeRadius(double v)
Set cone radius:
Definition: StConePars.h:65
void setAddMidpoints(bool v)
Add seeds at midpoints?
Definition: StConePars.h:56
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
void setSplitFraction(double v)
split jets if E_shared/E_neighbor&gt;splitFraction
Definition: StConePars.h:50
static void setLevel(unsigned int level)
sets the debug level
Definition: StMuDebug.h:74
void setGridSpacing(int nEta, double etaMin, double etaMax, int nPhi, double phiMin, double phiMax)
Set the grid spacing:
Definition: StConePars.h:36
virtual Int_t Finish()
Definition: StChain.cxx:85
void setDoSplitMerge(bool v)
Do Split/Merge step?
Definition: StConePars.h:59
void setDebug(bool v)
Toggle debug streams on/off.
Definition: StConePars.h:68
Filling of all StMcEvent classes from g2t tables Transform all the data in the g2t tables into the co...
void setR(double r)
Set the distance measure, called d by Ellis/Soper.
Definition: StKtCluPars.h:15
void setSeedEtMin(double v)
minimum et threshold to be considered a seed
Definition: StConePars.h:44
Bool_t doPrintMemoryInfo
lots of screen output
void setDebug(bool v)
Toggle the debug stream on/off.
Definition: StKtCluPars.h:19
virtual Int_t Make()
Definition: StChain.cxx:110
void setAssocEtMin(double v)
minimum et threshold to be considered for addition to the seed
Definition: StConePars.h:47
TChain * chain()
In read mode, returns pointer to the chain of .MuDst.root files that where selected.
Definition: StMuDstMaker.h:426
void setRequireStableMidpoints(bool v)
Require stable midpoints?
Definition: StConePars.h:62
void setPerformMinimization(bool v)
Let jet wander to minimum?
Definition: StConePars.h:53