StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RunJetFinder2009sim.C
1 //
2 // Pibero Djawotho <pibero@tamu.edu>
3 // Texas A&M University
4 // 24 Jan 2011
5 //
6 
7 void RunJetFinder2009sim(int nevents = 1e6,
8  const char* mudstfile = "/star/data47/reco/pp200/pythia6_410/15_25gev/cdf_a/y2006c/gheisha_on/p07ic/rcf1307_01_2000evts.MuDst.root",
9  const char* geantfile = "/star/data47/reco/pp200/pythia6_410/15_25gev/cdf_a/y2006c/gheisha_on/p07ic/rcf1307_01_2000evts.geant.root",
10  const char* jetfile = "rcf1307_01_2000evts.jets.root",
11  const char* skimfile = "rcf1307_01_2000evts.skim.root",
12  bool useL2 = true)
13 {
14  cout << "Read MuDst file:\t" << mudstfile << endl;
15  cout << "Read geant file:\t" << geantfile << endl;
16  cout << "Write jet file:\t" << jetfile << endl;
17  cout << "Write skim file:\t" << skimfile << endl;
18 
19  gROOT->Macro("loadMuDst.C");
20  gROOT->Macro("LoadLogger.C");
21 
22  gSystem->Load("StDetectorDbMaker");
23  gSystem->Load("StTpcDb");
24  gSystem->Load("StDbUtilities");
25  gSystem->Load("StMcEvent");
26  gSystem->Load("StMcEventMaker");
27  gSystem->Load("StDaqLib");
28  gSystem->Load("StEmcRawMaker");
29  gSystem->Load("StEmcADCtoEMaker");
30  gSystem->Load("StPreEclMaker");
31  gSystem->Load("StEmcSimulatorMaker");
32  gSystem->Load("StDbBroker");
33  gSystem->Load("St_db_Maker");
34  gSystem->Load("StEEmcUtil");
35  gSystem->Load("StEEmcDbMaker");
36  gSystem->Load("StSpinDbMaker");
37  gSystem->Load("StEmcTriggerMaker");
38  gSystem->Load("StTriggerUtilities");
39  gSystem->Load("StMCAsymMaker");
40  gSystem->Load("StRandomSelector");
41  gSystem->Load("libfastjet.so");
42  gSystem->Load("libCDFConesPlugin.so");
43  gSystem->Load("libEECambridgePlugin.so");
44  gSystem->Load("libJadePlugin.so");
45  gSystem->Load("libNestedDefsPlugin.so");
46  gSystem->Load("libSISConePlugin.so");
47  gSystem->Load("StJetFinder");
48  gSystem->Load("StJetSkimEvent");
49  gSystem->Load("StJets");
50  gSystem->Load("StJetEvent");
51  gSystem->Load("StJetMaker");
52  gSystem->Load("StEEmcSimulatorMaker");
53 
54  // Create chain
55  StChain* chain = new StChain;
56 
57  // I/O maker
58  StIOMaker* ioMaker = new StIOMaker;
59  ioMaker->SetFile(geantfile);
60  ioMaker->SetIOMode("r");
61  ioMaker->SetBranch("*",0,"0"); // Deactivate all branches
62  ioMaker->SetBranch("geantBranch",0,"r"); // Activate geant Branch
63 
64  // StMcEvent maker
65  StMcEventMaker* mcEventMaker = new StMcEventMaker;
66  mcEventMaker->doPrintEventInfo = false;
67  mcEventMaker->doPrintMemoryInfo = false;
68 
69  // MuDst reader
70  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,"",mudstfile,"",100000,"MuDst");
71 
72  // MuDst DB
73  StMuDbReader* muDstDb = StMuDbReader::instance();
74 
75  // star database
76  St_db_Maker* starDb = new St_db_Maker("StarDb","MySQL:StarDb");
77  starDb->SetDateTime(20090628,53220); // Run 10179006
78  //starDb->SetDateTime(20060516,110349); // Run 7136022
79 
80  // Endcap database
81  StEEmcDbMaker* eemcDb = new StEEmcDbMaker;
82 
83  // EEMC slow simulator
84  StEEmcSlowMaker* eess = new StEEmcSlowMaker;
85  eess->setSamplingFraction(0.0384);
86  eess->setAddPed(true);
87  eess->setSmearPed(true);
88 
89  // BEMC simulator
91  emcSim->setCalibSpread(kBarrelEmcTowerId,0.15);
92  emcSim->setCheckStatus(kBarrelEmcTowerId,false);
93  emcSim->setMakeFullDetector(kBarrelEmcTowerId,true);
94  emcSim->setDoZeroSuppression(kBarrelEmcTowerId,false);
95 
96  StPreEclMaker* preEcl = new StPreEclMaker; // need this to fill new StEvent information
97 
98  // Barrel ADC to energy maker
100  adc->saveAllStEvent(true);
101 
102  // Trigger simulator
103  // -- StL2_2009EmulatorMaker must run before StTriggerSimuMaker?
104  StL2_2009EmulatorMaker* simL2Mk = 0;
105  if (useL2) {
106  simL2Mk = new StL2_2009EmulatorMaker;
107  //simL2Mk->setSetupPath("/star/u/pibero/public/StarTrigSimuSetup/");
108  simL2Mk->setSetupPath("/star/institutions/mit/corliss/L2setup/");
109  simL2Mk->setOutPath("./");
110  }
111  StTriggerSimuMaker* simuTrig = new StTriggerSimuMaker;
112  simuTrig->useOnlineDB(); // for trigger definitions and thresholds
113  simuTrig->setMC(true); // Must be before individual detectors, to be passed
114  //simuTrig->useBbc(); // No BBC in Run 9
115  simuTrig->useBemc();
116  simuTrig->useEemc(); // No EEMC in Run 6
117  simuTrig->bemc->setConfig(StBemcTriggerSimu::kOffline);
118  if (useL2) simuTrig->useL2(simL2Mk);
119 
120  // Get Pythia record
121  StMCAsymMaker* asym = new StMCAsymMaker;
122 
123  // Skim event maker
124  StJetSkimEventMaker* skimEventMaker = new StJetSkimEventMaker("StJetSkimEventMaker",muDstMaker,skimfile);
125  skimEventMaker->addSimuTrigger(240530); // BHT3
126  skimEventMaker->addSimuTrigger(240652); // L2JetHigh
127  skimEventMaker->addSimuTrigger(240411); // JP1
128 
129 #if 0
130  // Run 6 triggers
131  skimEventMaker->addSimuTrigger(127611); //HTTP
132  skimEventMaker->addSimuTrigger(137611);
133  skimEventMaker->addSimuTrigger(5);
134  skimEventMaker->addSimuTrigger(127821); //HTTP-fast
135  skimEventMaker->addSimuTrigger(137821);
136  skimEventMaker->addSimuTrigger(137822);
137  skimEventMaker->addSimuTrigger(127212); //HT2
138  skimEventMaker->addSimuTrigger(137213);
139  skimEventMaker->addSimuTrigger(127501); //JP0
140  skimEventMaker->addSimuTrigger(137501);
141  skimEventMaker->addSimuTrigger(127622); //JP0-etot
142  skimEventMaker->addSimuTrigger(137622);
143  skimEventMaker->addSimuTrigger(127221); //JP1
144  skimEventMaker->addSimuTrigger(137221);
145  skimEventMaker->addSimuTrigger(137222);
146 #endif
147 
148  // Jet maker
149  StJetMaker2009* jetmaker = new StJetMaker2009;
150  jetmaker->setJetFile(jetfile);
151 
152  //------------------------------------------------------------------------------------
153 
154  // Set analysis cuts for 12-point branch with 100% probability of accepting TPC tracks before jet finding
155  StAnaPars* anapars12_100 = new StAnaPars;
156  anapars12_100->useTpc = true;
157  anapars12_100->useBemc = true;
158  anapars12_100->useEemc = true;
159  anapars12_100->randomSelectorProb = 1.00;
160 
161  // The classes available for correcting tower energy for tracks are:
162  // 1. StjTowerEnergyCorrectionForTracksMip
163  // 2. StjTowerEnergyCorrectionForTracksFraction
164  // 3. StjTowerEnergyCorrectionForTracksNull (default: no correction)
165  anapars12_100->setTowerEnergyCorrection(new StjTowerEnergyCorrectionForTracksFraction(1.00));
166 
167  // TPC cuts
168  anapars12_100->addTpcCut(new StjTrackCutFlag(0));
169  anapars12_100->addTpcCut(new StjTrackCutNHits(12));
170  anapars12_100->addTpcCut(new StjTrackCutPossibleHitRatio(0.51));
171  anapars12_100->addTpcCut(new StjTrackCutDca(3));
172  //anapars12_100->addTpcCut(new StjTrackCutDcaPtDependent);
173  anapars12_100->addTpcCut(new StjTrackCutTdcaPtDependent);
174  //anapars12_100->addTpcCut(new StjTrackCutChi2(0,4));
175  anapars12_100->addTpcCut(new StjTrackCutPt(0.2,200));
176  anapars12_100->addTpcCut(new StjTrackCutEta(-2.5,2.5));
177  anapars12_100->addTpcCut(new StjTrackCutLastPoint(125));
178 
179  // BEMC cuts
180  anapars12_100->addBemcCut(new StjTowerEnergyCutBemcStatus(1));
181  anapars12_100->addBemcCut(new StjTowerEnergyCutAdc(4,3)); // ADC-ped>4 AND ADC-ped>3*RMS
182  anapars12_100->addBemcCut(new StjTowerEnergyCutEt(0.2));
183 
184  // EEMC cuts
185  anapars12_100->addEemcCut(new StjTowerEnergyCutBemcStatus(1));
186  anapars12_100->addEemcCut(new StjTowerEnergyCutAdc(4,3)); // ADC-ped>4 AND ADC-ped>3*RMS
187  anapars12_100->addEemcCut(new StjTowerEnergyCutEt(0.2));
188 
189  // Jet cuts
190  anapars12_100->addJetCut(new StProtoJetCutPt(5,200));
191  anapars12_100->addJetCut(new StProtoJetCutEta(-100,100));
192 
193  //------------------------------------------------------------------------------------
194 
195  // Set analysis cuts for 12-point branch with 93% probability of accepting TPC tracks before jet finding
196  StAnaPars* anapars12_093 = new StAnaPars;
197  anapars12_093->useTpc = true;
198  anapars12_093->useBemc = true;
199  anapars12_093->useEemc = true;
200  anapars12_093->randomSelectorProb = 0.93;
201 
202  // The classes available for correcting tower energy for tracks are:
203  // 1. StjTowerEnergyCorrectionForTracksMip
204  // 2. StjTowerEnergyCorrectionForTracksFraction
205  // 3. StjTowerEnergyCorrectionForTracksNull (default: no correction)
206  anapars12_093->setTowerEnergyCorrection(new StjTowerEnergyCorrectionForTracksFraction(1.00));
207 
208  // TPC cuts
209  anapars12_093->addTpcCut(new StjTrackCutFlag(0));
210  anapars12_093->addTpcCut(new StjTrackCutNHits(12));
211  anapars12_093->addTpcCut(new StjTrackCutPossibleHitRatio(0.51));
212  anapars12_093->addTpcCut(new StjTrackCutDca(3));
213  //anapars12_093->addTpcCut(new StjTrackCutDcaPtDependent);
214  anapars12_093->addTpcCut(new StjTrackCutTdcaPtDependent);
215  //anapars12_093->addTpcCut(new StjTrackCutChi2(0,4));
216  anapars12_093->addTpcCut(new StjTrackCutPt(0.2,200));
217  anapars12_093->addTpcCut(new StjTrackCutEta(-2.5,2.5));
218  anapars12_093->addTpcCut(new StjTrackCutLastPoint(125));
219 
220  // BEMC cuts
221  anapars12_093->addBemcCut(new StjTowerEnergyCutBemcStatus(1));
222  anapars12_093->addBemcCut(new StjTowerEnergyCutAdc(4,3)); // ADC-ped>4 AND ADC-ped>3*RMS
223  anapars12_093->addBemcCut(new StjTowerEnergyCutEt(0.2));
224 
225  // EEMC cuts
226  anapars12_093->addEemcCut(new StjTowerEnergyCutBemcStatus(1));
227  anapars12_093->addEemcCut(new StjTowerEnergyCutAdc(4,3)); // ADC-ped>4 AND ADC-ped>3*RMS
228  anapars12_093->addEemcCut(new StjTowerEnergyCutEt(0.2));
229 
230  // Jet cuts
231  anapars12_093->addJetCut(new StProtoJetCutPt(5,200));
232  anapars12_093->addJetCut(new StProtoJetCutEta(-100,100));
233 
234  //------------------------------------------------------------------------------------
235 
236  // Set analysis cuts for 5-point branch
237  StAnaPars* anapars5 = new StAnaPars;
238  anapars5->useTpc = true;
239  anapars5->useBemc = true;
240  anapars5->useEemc = true;
241  anapars5->randomSelectorProb = 0.93;
242 
243  // The classes available for correcting tower energy for tracks are:
244  // 1. StjTowerEnergyCorrectionForTracksMip
245  // 2. StjTowerEnergyCorrectionForTracksFraction
246  // 3. StjTowerEnergyCorrectionForTracksNull (default: no correction)
247  anapars5->setTowerEnergyCorrection(new StjTowerEnergyCorrectionForTracksFraction(1.00));
248 
249  // TPC cuts
250  anapars5->addTpcCut(new StjTrackCutFlag(0));
251  anapars5->addTpcCut(new StjTrackCutNHits(5));
252  anapars5->addTpcCut(new StjTrackCutPossibleHitRatio(0.51));
253  anapars5->addTpcCut(new StjTrackCutDca(3));
254  //anapars5->addTpcCut(new StjTrackCutDcaPtDependent);
255  anapars5->addTpcCut(new StjTrackCutTdcaPtDependent);
256  //anapars5->addTpcCut(new StjTrackCutChi2(0,4));
257  anapars5->addTpcCut(new StjTrackCutPt(0.2,200));
258  anapars5->addTpcCut(new StjTrackCutEta(-2.5,2.5));
259 
260  // BEMC cuts
261  anapars5->addBemcCut(new StjTowerEnergyCutBemcStatus(1));
262  anapars5->addBemcCut(new StjTowerEnergyCutAdc(4,3)); // ADC-ped>4 AND ADC-ped>3*RMS
263  anapars5->addBemcCut(new StjTowerEnergyCutEt(0.2));
264 
265  // EEMC cuts
266  anapars5->addEemcCut(new StjTowerEnergyCutBemcStatus(1));
267  anapars5->addEemcCut(new StjTowerEnergyCutAdc(4,3)); // ADC-ped>4 AND ADC-ped>3*RMS
268  anapars5->addEemcCut(new StjTowerEnergyCutEt(0.2));
269 
270  // Jet cuts
271  anapars5->addJetCut(new StProtoJetCutPt(5,200));
272  anapars5->addJetCut(new StProtoJetCutEta(0.8,2.5));
273 
274  //------------------------------------------------------------------------------------
275 
276  // Set analysis cuts for EMC branch
277  StAnaPars* anaparsEMC = new StAnaPars;
278  anaparsEMC->useTpc = true;
279  anaparsEMC->useBemc = true;
280  anaparsEMC->useEemc = true;
281 
282  // TPC cuts
283  anaparsEMC->addTpcCut(new StjTrackCutFlag(0));
284  anaparsEMC->addTpcCut(new StjTrackCutNHits(1000000));
285 
286  // BEMC cuts
287  anaparsEMC->addBemcCut(new StjTowerEnergyCutBemcStatus(1));
288  anaparsEMC->addBemcCut(new StjTowerEnergyCutAdc(4,3)); // ADC-ped>4 AND ADC-ped>3*RMS
289  anaparsEMC->addBemcCut(new StjTowerEnergyCutEt(0.2));
290 
291  // EEMC cuts
292  anaparsEMC->addEemcCut(new StjTowerEnergyCutBemcStatus(1));
293  anaparsEMC->addEemcCut(new StjTowerEnergyCutAdc(4,3)); // ADC-ped>4 AND ADC-ped>3*RMS
294  anaparsEMC->addEemcCut(new StjTowerEnergyCutEt(0.2));
295 
296  // Jet cuts
297  anaparsEMC->addJetCut(new StProtoJetCutPt(5,200));
298  anaparsEMC->addJetCut(new StProtoJetCutEta(-100,100));
299 
300  //------------------------------------------------------------------------------------
301 
302  // Set analysis cuts for particle jets branch
303  StAnaPars* anaparsParticle = new StAnaPars;
304  anaparsParticle->useMonteCarlo = true;
305 
306  // MC cuts
307  anaparsParticle->addMcCut(new StjMCParticleCutStatus(1)); // final state particles
308 
309  // Jet cuts
310  anaparsParticle->addJetCut(new StProtoJetCutPt(3,200));
311  anaparsParticle->addJetCut(new StProtoJetCutEta(-100,100));
312 
313  //------------------------------------------------------------------------------------
314 
315  // Set analysis cuts for parton jets branch
316  StAnaPars* anaparsParton = new StAnaPars;
317  anaparsParton->useMonteCarlo = true;
318 
319  // MC cuts
320  anaparsParton->addMcCut(new StjMCParticleCutParton);
321 
322  // Jet cuts
323  anaparsParton->addJetCut(new StProtoJetCutPt(3,200));
324  anaparsParton->addJetCut(new StProtoJetCutEta(-100,100));
325 
326  // Set cone jet finder parameters
327  StConePars* conepars = new StConePars;
328  conepars->setGridSpacing(105,-3.0,3.0,120,-TMath::Pi(),TMath::Pi());
329  conepars->setConeRadius(0.7);
330  conepars->setSeedEtMin(0.5);
331  conepars->setAssocEtMin(0.1);
332  conepars->setSplitFraction(0.5);
333  conepars->setPerformMinimization(true);
334  conepars->setAddMidpoints(true);
335  conepars->setRequireStableMidpoints(true);
336  conepars->setDoSplitMerge(true);
337  conepars->setDebug(false);
338 
339  //------------------------------------------------------------------------------------
340 
341  jetmaker->addBranch("ConeJets12_100",anapars12_100,conepars);
342  jetmaker->addBranch("ConeJets12_093",anapars12_093,conepars);
343  jetmaker->addBranch("ConeJets5",anapars5,conepars);
344  jetmaker->addBranch("ConeJetsEMC",anaparsEMC,conepars);
345  jetmaker->addBranch("ParticleConeJets",anaparsParticle,conepars);
346  jetmaker->addBranch("PartonConeJets",anaparsParton,conepars);
347 
348  //------------------------------------------------------------------------------------
349 
350  chain->Init();
351  chain->EventLoop(nevents);
352 }
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
void setDoZeroSuppression(StDetectorId det, bool flag)
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
void setAddPed(Bool_t a=true)
Add pedestal offsets from DB.
void setCheckStatus(StDetectorId det, bool flag)
void setSplitFraction(double v)
split jets if E_shared/E_neighbor&gt;splitFraction
Definition: StConePars.h:50
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 useOnlineDB()
Choose DB to access trigger definitions and thresholds.
void setSmearPed(Bool_t s=true)
Smear the pedestal with sigma from DB.
void setRequireStableMidpoints(bool v)
Require stable midpoints?
Definition: StConePars.h:62
Slow simulator for EEMC.
void setMakeFullDetector(StDetectorId det, bool flag)
simulate pedestal noise where no MC hits are found. Default is true for BTOW, false otherwise...
void saveAllStEvent(Bool_t a)
Set to kTRUE if all hits are to be saved on StEvent.
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