StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RunJetSimuSkimFinder.C
1 // NOTE - This macro is ONLY for running MC simulation data!!
2 //=========================================================================================
3 
4 void RunJetSimuSkimFinder(const int nevents = 2000,
5  const char* mudstfile = "/star/data47/reco/pp200/pythia6_410/15_25gev/cdf_a/y2006c/gheisha_on/p07ic/rcf1307_01_2000evts.MuDst.root",
6  const char* geantfile = "/star/data47/reco/pp200/pythia6_410/15_25gev/cdf_a/y2006c/gheisha_on/p07ic/rcf1307_01_2000evts.geant.root",
7  const char* jetfile = "Jets_pt15_25_01.root",
8  const char* skimfile = "Skim_pt15_25_01.root")
9 {
10  // Load shared libraries
11  gROOT->Macro("loadMuDst.C");
12  gROOT->Macro("LoadLogger.C");
13 
14  gSystem->Load("StTpcDb");
15  gSystem->Load("StDetectorDbMaker");
16  gSystem->Load("StDbUtilities");
17  gSystem->Load("StMcEvent");
18  gSystem->Load("StMcEventMaker");
19  gSystem->Load("StDaqLib");
20  gSystem->Load("StEmcRawMaker");
21  gSystem->Load("StEmcADCtoEMaker");
22  gSystem->Load("StPreEclMaker");
23  gSystem->Load("StEpcMaker");
24  gSystem->Load("StEmcSimulatorMaker");
25  gSystem->Load("StEmcUtil");
26  gSystem->Load("StDbBroker");
27  gSystem->Load("St_db_Maker");
28  gSystem->Load("StEEmcUtil");
29  gSystem->Load("StEEmcDbMaker");
30  gSystem->Load("StSpinDbMaker");
31  gSystem->Load("StEmcTriggerMaker");
32  gSystem->Load("StTriggerUtilities");
33  gSystem->Load("StMCAsymMaker");
34  gSystem->Load("StRandomSelector");
35  gSystem->Load("StJetFinder");
36  gSystem->Load("StJetSkimEvent");
37  gSystem->Load("StJets");
38  gSystem->Load("StJetEvent");
39  gSystem->Load("StJetMaker");
40  gSystem->Load("StEEmcSimulatorMaker");
41 
42  cout << "Loading shared libraries done" << endl;
43 
44  // Create StChain
45  StChain* chain = new StChain;
46 
47  // I/O maker
48  StIOMaker* ioMaker = new StIOMaker;
49  ioMaker->SetFile(geantfile);
50  ioMaker->SetIOMode("r");
51  ioMaker->SetBranch("*",0,"0"); // Deactivate all branches
52  ioMaker->SetBranch("geantBranch",0,"r"); // Activate geant Branch
53 
54  StMcEventMaker* mcEventMaker = new StMcEventMaker;
55  mcEventMaker->doPrintEventInfo = false;
56  mcEventMaker->doPrintMemoryInfo = false;
57 
58  // Instantiate the MuDstReader
60  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,"",mudstfile,"",1e6,"MuDst");
61 
62  // Database -- get a real calibration (this is ok, MLM)
63  St_db_Maker* dbMk = new St_db_Maker("StarDb","MySQL:StarDb","MySQL:StarDb","$STAR/StarDb");
64  dbMk->SetDateTime(20060516,110349); // Run 7136022
65  dbMk->SetFlavor("sim","eemcPMTcal");
66  dbMk->SetFlavor("sim","eemcPIXcal");
67  dbMk->SetFlavor("sim","eemcPMTped");
68  dbMk->SetFlavor("sim","eemcPMTstat");
69  dbMk->SetFlavor("sim","eemcPMTname");
70  dbMk->SetFlavor("sim","eemcADCconf");
71 
72  // Database interface
73  StDetectorDbMaker* detDbMk = new StDetectorDbMaker;
74 
75  // Endcap DB
76  StEEmcDbMaker* eemcb = new StEEmcDbMaker("eemcDb");
77 
78  // Endcap slow simulator
79  // Note: Slow simulator has a bug for Endcap SMD, sector 11: v-plane (as of 2008.04.09 not yet fixed)
80  // This SMD bug should not affect JetFinder results, since it is uses only Tower energies.
81  StEEmcSlowMaker* slowSim = new StEEmcSlowMaker("slowSim");
82  slowSim->setSamplingFraction(0.0384); // effectively scales all Tower energies with a factor of 1.3 (added by: Ilya Selyuzhenkov; April 11, 2008)
83 
84  // Get BEMC calibration
85  StEmcSimulatorMaker* emcSim = new StEmcSimulatorMaker; //use this instead to "redo" converstion from geant->adc
86  emcSim->setCalibSpread(kBarrelEmcTowerId,0.15);
87  StPreEclMaker* preEcl = new StPreEclMaker; //need this to fill new StEvent information
88 
89  // Barrel ADC to energy maker
91 
92  // Trigger simulator
93  StTriggerSimuMaker* simuTrig = new StTriggerSimuMaker;
94  simuTrig->setMC(true); // Must be before individual detectors, to be passed
95  simuTrig->useBbc();
96  simuTrig->useBemc();
97  simuTrig->bemc->setConfig(StBemcTriggerSimu::kOffline);
98 
99 #if 0
101  assert(simL2Mk);
102  simL2Mk->setSetupPath("/afs/rhic.bnl.gov/star/users/kocolosk/public/StarTrigSimuSetup/");
103  simL2Mk->setOutPath("./");
104  simuTrig->useL2(simL2Mk);
105 #endif
106 
107  // Get pythia record
108  StMCAsymMaker* asym = new StMCAsymMaker("MCAsym");
109 
110  // Get skimMaker
111  StJetSkimEventMaker* skimEventMaker = new StJetSkimEventMaker("StJetSkimEventMaker",muDstMaker,skimfile);
112  //skimEventMaker->addSimuTrigger(127501);
113  //skimEventMaker->addSimuTrigger(137501);
114  //skimEventMaker->addSimuTrigger(137213);
115  //skimEventMaker->addSimuTrigger(127221);
116  skimEventMaker->addSimuTrigger(137222); // bemc-jp1-mb, th1=60 (8.3 GeV)
117 
118  // Mike's 4p maker:
119  // The classes available for correcting tower energy for tracks are:
120  // 1. StjTowerEnergyCorrectionForTracksMip
121  // 2. StjTowerEnergyCorrectionForTracksFraction
122  bool doTowerSwapFix = true;
123  StBET4pMaker* bet4pMaker = new StBET4pMaker("BET4pMaker",muDstMaker,doTowerSwapFix,new StjTowerEnergyCorrectionForTracksMip);
124  StBET4pMaker* bet4pMakerFrac000 = new StBET4pMaker("BET4pMakerFrac000",muDstMaker,doTowerSwapFix,new StjTowerEnergyCorrectionForTracksFraction(0.0));
125  StBET4pMaker* bet4pMakerFrac020 = new StBET4pMaker("BET4pMakerFrac020",muDstMaker,doTowerSwapFix,new StjTowerEnergyCorrectionForTracksFraction(0.2));
126  StBET4pMaker* bet4pMakerFrac050 = new StBET4pMaker("BET4pMakerFrac050",muDstMaker,doTowerSwapFix,new StjTowerEnergyCorrectionForTracksFraction(0.5));
127  StBET4pMaker* bet4pMakerFrac070 = new StBET4pMaker("BET4pMakerFrac070",muDstMaker,doTowerSwapFix,new StjTowerEnergyCorrectionForTracksFraction(0.7));
128  StBET4pMaker* bet4pMakerFrac100 = new StBET4pMaker("BET4pMakerFrac100",muDstMaker,doTowerSwapFix,new StjTowerEnergyCorrectionForTracksFraction(1.0));
129  StBET4pMaker* bet4pMakerFrac130 = new StBET4pMaker("BET4pMakerFrac130",muDstMaker,doTowerSwapFix,new StjTowerEnergyCorrectionForTracksFraction(1.3));
130 
131  // Pythia4pMaker
132  StPythiaFourPMaker* pythiaFourPMaker = new StPythiaFourPMaker;
133 
134  // Instantiate the JetMaker
135  StJetMaker* emcJetMaker = new StJetMaker("emcJetMaker",muDstMaker,jetfile);
136  emcJetMaker->SetTreeWriter(new StjeJetEventTreeWriter(jetfile));
137 
138  // Setup 3 jet analyses that use the same track/jet cuts
139  // Set the analysis cuts: (See StJetMaker/StppJetAnalyzer.h -> class StppAnaPars)
140  StppAnaPars* anapars = new StppAnaPars;
141  anapars->setFlagMin(0); // track->flag()>0
142  anapars->setNhits(12);
143  anapars->setCutPtMin(0.2); // track->pt()>0.2
144  anapars->setAbsEtaMax(2); // abs(track->eta())<1.6
145  anapars->setJetPtMin(3.5);
146  anapars->setJetEtaMax(100);
147  anapars->setJetEtaMin(0);
148  anapars->setJetNmin(0);
149 
150  // Setup the cone finder with R=0.7
151  StConePars* cpars4 = new StConePars;
152  cpars4->setGridSpacing(105,-3,3,120,-TMath::Pi(),TMath::Pi()); // including EEMC
153  cpars4->setConeRadius(0.7);
154  cpars4->setSeedEtMin(0.5);
155  cpars4->setAssocEtMin(0.1);
156  cpars4->setSplitFraction(0.5);
157  cpars4->setPerformMinimization(true);
158  cpars4->setAddMidpoints(true);
159  cpars4->setRequireStableMidpoints(true);
160  cpars4->setDoSplitMerge(true);
161  cpars4->setDebug(false);
162  emcJetMaker->addAnalyzer(anapars,cpars4,bet4pMaker,"ConeJets12");
163  emcJetMaker->addAnalyzer(anapars,cpars4,bet4pMakerFrac000,"ConeJets12_000");
164  emcJetMaker->addAnalyzer(anapars,cpars4,bet4pMakerFrac020,"ConeJets12_020");
165  emcJetMaker->addAnalyzer(anapars,cpars4,bet4pMakerFrac050,"ConeJets12_050");
166  emcJetMaker->addAnalyzer(anapars,cpars4,bet4pMakerFrac070,"ConeJets12_070");
167  emcJetMaker->addAnalyzer(anapars,cpars4,bet4pMakerFrac100,"ConeJets12_100");
168  emcJetMaker->addAnalyzer(anapars,cpars4,bet4pMakerFrac130,"ConeJets12_130");
169 
170  anapars->setNhits(5);
171  emcJetMaker->addAnalyzer(anapars,cpars4,bet4pMaker,"ConeJets5");
172 
173  anapars->setNhits(1000000);
174  emcJetMaker->addAnalyzer(anapars,cpars4,bet4pMaker,"ConeJetsEMC");
175 
176  // Set the analysis cuts for pythia clustering: (See StJetMaker/StppJetAnalyzer.h -> class StppAnaPars)
177  StppAnaPars* pythiapars = new StppAnaPars;
178  pythiapars->setFlagMin(0);
179  pythiapars->setNhits(0);
180  pythiapars->setCutPtMin(0.0001);
181  pythiapars->setAbsEtaMax(5.0);
182  pythiapars->setJetPtMin(3.0);
183  pythiapars->setJetEtaMax(5.0);
184  pythiapars->setJetEtaMin(0);
185  pythiapars->setJetNmin(0);
186 
187  StConePars* pythia_cpars4 = new StConePars;
188  pythia_cpars4->setGridSpacing(105,-3,3,120,-TMath::Pi(),TMath::Pi()); // including EEMC
189  pythia_cpars4->setConeRadius(0.7);
190  pythia_cpars4->setSeedEtMin(0.5);
191  pythia_cpars4->setAssocEtMin(0.1);
192  pythia_cpars4->setSplitFraction(0.5);
193  pythia_cpars4->setPerformMinimization(true);
194  pythia_cpars4->setAddMidpoints(true);
195  pythia_cpars4->setRequireStableMidpoints(true);
196  pythia_cpars4->setDoSplitMerge(true);
197  pythia_cpars4->setDebug(false);
198  emcJetMaker->addAnalyzer(pythiapars,pythia_cpars4,pythiaFourPMaker,"PythiaConeJets");
199 
200  chain->Init();
201  chain->EventLoop(nevents);
202 }
void setConeRadius(double v)
Set cone radius:
Definition: StConePars.h:65
void setSamplingFraction(Float_t f)
Changes the sampling fraction from the default in the fast simulator.
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
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
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 setSeedEtMin(double v)
minimum et threshold to be considered a seed
Definition: StConePars.h:44
Bool_t doPrintMemoryInfo
lots of screen output
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
Slow simulator for EEMC.
void setCalibSpread(StDetectorId det, float spread)
smear simulator calibration coefficients using Gaussian with this RMS.
void setPerformMinimization(bool v)
Let jet wander to minimum?
Definition: StConePars.h:53