StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RunJetSkim2009sim.C
1 //
2 // Pibero Djawotho <pibero@tamu.edu>
3 // Texas A&M University
4 // 31 March 2011
5 //
6 
7 void RunJetSkim2009sim(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* skimfile = "rcf1307_01_2000evts.skim.root",
11  bool useL2 = true)
12 {
13  cout << "Read MuDst file:\t" << mudstfile << endl;
14  cout << "Read geant file:\t" << geantfile << endl;
15  cout << "Write skim file:\t" << skimfile << endl;
16 
17  gROOT->Macro("loadMuDst.C");
18  gROOT->Macro("LoadLogger.C");
19 
20  gSystem->Load("StDetectorDbMaker");
21  gSystem->Load("StTpcDb");
22  gSystem->Load("StDbUtilities");
23  gSystem->Load("StMcEvent");
24  gSystem->Load("StMcEventMaker");
25  gSystem->Load("StDaqLib");
26  gSystem->Load("StEmcRawMaker");
27  gSystem->Load("StEmcADCtoEMaker");
28  gSystem->Load("StPreEclMaker");
29  gSystem->Load("StEmcSimulatorMaker");
30  gSystem->Load("StDbBroker");
31  gSystem->Load("St_db_Maker");
32  gSystem->Load("StEEmcUtil");
33  gSystem->Load("StEEmcDbMaker");
34  gSystem->Load("StSpinDbMaker");
35  gSystem->Load("StEmcTriggerMaker");
36  gSystem->Load("StTriggerUtilities");
37  gSystem->Load("StMCAsymMaker");
38  gSystem->Load("StRandomSelector");
39  gSystem->Load("libfastjet.so");
40  gSystem->Load("StJetFinder");
41  gSystem->Load("StJetSkimEvent");
42  gSystem->Load("StJets");
43  gSystem->Load("StJetEvent");
44  gSystem->Load("StJetMaker");
45  gSystem->Load("StEEmcSimulatorMaker");
46 
47  // Create chain
48  StChain* chain = new StChain;
49 
50  // I/O maker
51  StIOMaker* ioMaker = new StIOMaker;
52  ioMaker->SetFile(geantfile);
53  ioMaker->SetIOMode("r");
54  ioMaker->SetBranch("*",0,"0"); // Deactivate all branches
55  ioMaker->SetBranch("geantBranch",0,"r"); // Activate geant Branch
56 
57  // StMcEvent maker
58  StMcEventMaker* mcEventMaker = new StMcEventMaker;
59  mcEventMaker->doPrintEventInfo = false;
60  mcEventMaker->doPrintMemoryInfo = false;
61 
62  // MuDst reader
63  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,"",mudstfile,"",100000,"MuDst");
64 
65  // MuDst DB
66  StMuDbReader* muDstDb = StMuDbReader::instance();
67 
68  // star database
69  St_db_Maker* starDb = new St_db_Maker("StarDb","MySQL:StarDb");
70  starDb->SetDateTime(20090628,53220); // Run 10179006
71  //starDb->SetDateTime(20060516,110349); // Run 7136022
72 
73  // Endcap database
74  StEEmcDbMaker* eemcDb = new StEEmcDbMaker;
75 
76  // EEMC slow simulator
77  StEEmcSlowMaker* eess = new StEEmcSlowMaker;
78  eess->setSamplingFraction(0.0384);
79  eess->setAddPed(true);
80  eess->setSmearPed(true);
81 
82  // BEMC simulator
84  emcSim->setCalibSpread(kBarrelEmcTowerId,0.15);
85  StPreEclMaker* preEcl = new StPreEclMaker; // need this to fill new StEvent information
86 
87  // Barrel ADC to energy maker
89 
90  // Trigger simulator
91  // -- StL2_2009EmulatorMaker must run before StTriggerSimuMaker?
92  StL2_2009EmulatorMaker* simL2Mk = 0;
93  if (useL2) {
94  simL2Mk = new StL2_2009EmulatorMaker;
95  //simL2Mk->setSetupPath("/star/u/pibero/public/StarTrigSimuSetup/");
96  simL2Mk->setSetupPath("/star/institutions/mit/corliss/L2setup/");
97  simL2Mk->setOutPath("./");
98  }
99  StTriggerSimuMaker* simuTrig = new StTriggerSimuMaker;
100  simuTrig->useOnlineDB(); // for trigger definitions and thresholds
101  simuTrig->setMC(true); // Must be before individual detectors, to be passed
102  //simuTrig->useBbc(); // No BBC in Run 9
103  simuTrig->useBemc();
104  simuTrig->useEemc(); // No EEMC in Run 6
105  simuTrig->bemc->setConfig(StBemcTriggerSimu::kOffline);
106  if (useL2) simuTrig->useL2(simL2Mk);
107 
108  // Get Pythia record
109  StMCAsymMaker* asym = new StMCAsymMaker;
110 
111  // Skim event maker
112  StJetSkimEventMaker* skimEventMaker = new StJetSkimEventMaker("StJetSkimEventMaker",muDstMaker,skimfile);
113  skimEventMaker->addSimuTrigger(240530); // BHT3
114  skimEventMaker->addSimuTrigger(240652); // L2JetHigh
115  skimEventMaker->addSimuTrigger(240411); // JP1
116 
117  chain->Init();
118  chain->EventLoop(nevents);
119 }
void setSamplingFraction(Float_t f)
Changes the sampling fraction from the default in the fast simulator.
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.
Filling of all StMcEvent classes from g2t tables Transform all the data in the g2t tables into the co...
Bool_t doPrintMemoryInfo
lots of screen output
void useOnlineDB()
Choose DB to access trigger definitions and thresholds.
void setSmearPed(Bool_t s=true)
Smear the pedestal with sigma from DB.
Slow simulator for EEMC.
void setCalibSpread(StDetectorId det, float spread)
smear simulator calibration coefficients using Gaussian with this RMS.