StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EvalRunJetSimu.C
1 
2 // NOTE - This macro is ONLY for running MC simulation data!!
3 //=========================================================================================
4 class StChain;
5 StChain *chain;
6 int total=0;
7 void RunJetSimu(int nevents = 10,
8  const char *dir = "/star/data19/reco/pp200/pythia6_203/default/pt15/y2004x/gheisha_on/trs_ii/",
9  const char* file = "pds1214_02_5000evts.MuDst.root",
10  const char *fname="/star/data19/reco/pp200/pythia6_203/default/pt15/y2004x/gheisha_on/trs_ii/pds1214_02_5000evts.geant.root",
11  const char *filter = "",
12  const char *outfile="test",
13  const char *Eout = "EMC_test.root")
14 {
15 
16  if (gClassTable->GetID("TTable") < 0) {
17  gSystem->Load("libStar");
18  gSystem->Load("libPhysics");
19  }
20  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
21  loadSharedLibraries();
22  gSystem->Load("StMagF");
23  gSystem->Load("StTpcDb");
24  gSystem->Load("StDbUtilities");
25  gSystem->Load("StMcEvent");
26  gSystem->Load("StMcEventMaker");
27  gSystem->Load("StAssociationMaker");
28  gSystem->Load("StMcAnalysisMaker");
29  gSystem->Load("StDaqLib");
30  gSystem->Load("StEmcADCtoEMaker");
31  gSystem->Load("StEpcMaker");
32  gSystem->Load("StDaqLib");
33  gSystem->Load("StEmcUtil");
34  gSystem->Load("StDbLib");
35  gSystem->Load("StDbBroker");
36  gSystem->Load("St_db_Maker");
37  gSystem->Load("StEEmcUtil");// needed by EEMC-Db
38  gSystem->Load("StEEmcDbMaker");
39  gSystem->Load("StJetFinder");
40  gSystem->Load("StJetMaker");
41  assert(gSystem->Load("StRFEvalMaker")==0);
42 
43  double pi = atan(1.0)*4.0;
44  cout << " loading done " << endl;
45 
46  chain= new StChain("StChain");
47  chain->SetDebug(1);
48  gMessMgr->SwitchOff("D");
49  gMessMgr->SwitchOff("I");
50 
51  // StIOMaker - to read files ...
52  StIOMaker* ioMaker = new StIOMaker();
53  ioMaker->SetFile(fname);
54  ioMaker->SetIOMode("r");
55  ioMaker->SetBranch("*",0,"0"); //deactivate all branches
56  ioMaker->SetBranch("geantBranch",0,"r"); //activate geant Branch
57  ioMaker->SetBranch("eventBranch",0,"r"); //activate event Branch
58  //ioMaker->SetDebug();
59 
60  // StMcEventMaker -> get pid from pythia subprocess out
61  class StMcEventMaker *mcEventMaker = new StMcEventMaker();
62  mcEventReader->doPrintEventInfo = false;
63  mcEventReader->doPrintMemoryInfo = false;
64 
65  //Instantiate the MuDstReader
67  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,dir,file,filter,10,"MuDst");
68 
69  //make trigger from ADC in MuDst
70  StJetSimuTrigMaker *trig=new StJetSimuTrigMaker("SimuTrig");
71  trig->setPrintOption(0);
72 
73  //In simulations must set the timestamp and database flavor in order to get ideal gains for BEMC/EEMC
74  St_db_Maker *dbMk =new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb","StarDb");
75  dbMk->SetDateTime(20031120,0);
76  dbMk->SetFlavor("sim","bemcPed");
77  dbMk->SetFlavor("sim","bemcStatus");
78  dbMk->SetFlavor("sim","bemcCalib");
79  dbMk->SetFlavor("sim","bemcGain");
80  dbMk->SetFlavor("sim","eemcPMTcal");
81  dbMk->SetFlavor("sim","eemcPIXcal");
82 
83  //EmcDb
84  StEEmcDbMaker* eemcb = new StEEmcDbMaker("eemcDb");
85 
86  //StMuDst2StEventMaker - make StEvent from MuDst
87  StMuDst2StEventMaker* eventMaker = new StMuDst2StEventMaker("MuDst2StEvent");
88 
89  //get BEMC calibration
90  StEmcADCtoEMaker *adc = new StEmcADCtoEMaker("Eread");
91 
92  //make four vectors for jet
93  StEmcTpcFourPMaker* emcFourPMaker = new StEmcTpcFourPMaker("EmcTpcFourPMaker", muDstMaker, 30, 30, .3, .3, .003, adc);
94  emcFourPMaker->setUseType(StEmcTpcFourPMaker::Hits);//if don't have this line then default is 0 (which is hits)
95 
96  //make weight for asymmetries
97  StJetSimuWeightMaker *weight= new StJetSimuWeightMaker("SimuWeight");
98  weight->setPrintOption(0);
99 
100  //run jet finder
101  char* emcOutfile = new char[256];
102  strcpy(emcOutfile, outfile); strcat(emcOutfile, "emc");
103  StJetMaker* emcJetMaker = new StJetMaker("emcJetMaker", emcFourPMaker, muDstMaker, emcOutfile);
104 
105  //make simulation tree
106  StRFEvalMaker *eval = new StRFEvalMaker("RFEval",Eout);
107  eval->setPrintOption(1);
108 
109  //set1 == coneR=0.7,setConeSeedEtMin=0.5,setCutPtMin=0.2,setSplitFraction=0.0
110  //set2 == coneR=0.7,setConeSeedEtMin=1.0,setCutPtMin=0.35,setSplitFraction=0.0
111  //set3 == coneR=0.7,setConeSeedEtMin=0.5,setCutPtMin=0.2,setSplitFraction=0.5
112  //set4 == coneR=0.7,setConeSeedEtMin=1.0,setCutPtMin=0.2,setSplitFraction=0.0
113  //set5 == setClusterR(1.0),setCutPtMin(0.2),setHitRatio(hitRatio);setJetPtMin(5.0)
114 
115  //set the analysis cuts: (see StppJetAnalyzer -> class StppAnaPars )
116  StppAnaPars* anapars = new StppAnaPars();
117  anapars->setFlagMin(0); //track->flag() > 0
118  anapars->setNhits(15);
119  anapars->setCutPtMin(0.2);
120  anapars->setAbsEtaMax(1.6);
121  anapars->setJetPtMin(5.0);
122  anapars->setJetEtaMax(100.0);
123  anapars->setJetEtaMin(0);
124  anapars->setJetNmin(0);
125 
126  //now setup jetfinders
127  StConePars* cpars = new StConePars();
128  //set the grid characteristics
129  cpars->setGridSpacing(56, -1.6, 1.6, 120, -pi, pi);
130  //behavior characteristics
131  cpars->setConeRadius(0.7);
132  cpars->setSeedEtMin(0.5);
133  cpars->setAssocEtMin(0.1);
134  cpars->setSplitFraction(0.0);
135  cpars->setPerformMinimization(true);
136  cpars->setAddMidpoints(true);
137  cpars->setRequireStableMidpoints(true);
138  cpars->setDoSplitMerge(true);
139  cpars->setDebug(false);
140  emcJetMaker->addAnalyzer(anapars, cpars, "MkConeJetsPt02R07");
141 
142 
143  StKtCluPars* ktpars = new StKtCluPars();
144  ktpars->setR(1.0);
145  ktpars->setDebug(false);
146  emcJetMaker->addAnalyzer(anapars, ktpars, "MkKtJet");
147 
148 
149  chain->Init();
150  chain->PrintInfo();
151  chain->ls(3);
152 
153  //int nevents =1000000;
154  for (Int_t iev=0;iev<nevents; iev++) {
155  cout << "****************************************** " << endl;
156  cout << "Working on eventNumber " << iev << endl;
157  cout << "*************************1***************** " << endl;
158  chain->Clear();
159  int iret = chain->Make(iev);
160  total++;
161  if (iret) {
162  cout << "Bad return code!" << endl;
163  break;
164  }
165  }
166  chain->Finish();
167  cout << "****************************************** " << endl;
168  cout << "total number of events " << total << endl;
169  cout << "****************************************** " << endl;
170 }
171 
172 
173 
174 
175 
176 
177 
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
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
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
void setRequireStableMidpoints(bool v)
Require stable midpoints?
Definition: StConePars.h:62
void setPerformMinimization(bool v)
Let jet wander to minimum?
Definition: StConePars.h:53