StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
runSimuGammaTreeMaker.C
1 void runSimuGammaTreeMaker
2 (
3  char *inputFile = "/star/institutions/uky/betan/mit0026_10.MuDst.root",
4  char *outputFile = "test.root"
5 )
6 {
7 
8  // Set up simulation file paths
9  TString muDstFile(inputFile);
10  TString geantFile = muDstFile;
11  geantFile.ReplaceAll("MuDst","geant");
12 
13  cout << "****************************************" << endl;
14  cout << "Reading MuDst File : " << muDstFile << endl;
15  cout << "Reading Geant File : " << geantFile << endl;
16  cout << "Writing Output File : " << outputFile << endl;
17 
18  // Load libraries
19  cout << "Loading common libraries..." << endl;
20  gROOT->Macro("loadMuDst.C");
21  gROOT->Macro("LoadLogger.C");
22 
23  gSystem->Load("libMinuit");
24  gSystem->Load("StDetectorDbMaker");
25  gSystem->Load("StDbUtilities");
26  gSystem->Load("StDbBroker");
27  gSystem->Load("St_db_Maker");
28  gSystem->Load("StSpinDbMaker");
29 
30  gSystem->Load("StMcEvent");
31  gSystem->Load("StMcEventMaker");
32 
33  gSystem->Load("libgeometry_Tables"); // BEMC Only
34  gSystem->Load("StDaqLib"); // BEMC Only
35  gSystem->Load("StPreEclMaker"); // BEMC Only
36  gSystem->Load("StEmcSimulatorMaker"); // BEMC Only
37 
38  gSystem->Load("StEEmcDbMaker"); // EEMC Only
39  gSystem->Load("StEEmcUtil"); // EEMC Only
40  gSystem->Load("StEEmcSimulatorMaker"); // EEMC Only
41  gSystem->Load("StEEmcA2EMaker"); // EEMC Only
42  gSystem->Load("StEEmcClusterMaker"); // EEMC Only
43 
44  gSystem->Load("StMCAsymMaker");
45  gSystem->Load("StJetSkimEvent");
46  gSystem->Load("StGammaMaker");
47 
49  // Start up the chain //
51 
52  StChain *chain = new StChain("chain");
53 
54  // Instantiate IO Maker
55  StIOMaker* ioMaker = new StIOMaker();
56  ioMaker->SetFile(geantFile.Data());
57  ioMaker->SetIOMode("r");
58  ioMaker->SetBranch("*", 0, "0");
59  ioMaker->SetBranch("geantBranch", 0, "r");
60 
61  StMcEventMaker *mcEventMaker = new StMcEventMaker();
62  mcEventMaker->doPrintEventInfo = false;
63  mcEventMaker->doPrintMemoryInfo = false;
64 
65  StMuDstMaker *muDstMaker = new StMuDstMaker(0, 0, "", muDstFile.Data(), "", 1e6, "MuDst");
66  muDstMaker->SetStatus("*", 0);
67  muDstMaker->SetStatus("MuEvent", 1);
68  muDstMaker->SetStatus("Event", 1);
69  muDstMaker->SetStatus("McEvent", 1);
70  muDstMaker->SetStatus("PrimaryVertices", 1);
71  muDstMaker->SetStatus("PrimaryTracks", 1);
72  muDstMaker->SetStatus("GlobalTracks", 1);
73  muDstMaker->SetStatus("EmcTow", 1); // BEMC Only
74  muDstMaker->SetStatus("EmcPrs", 1); // BEMC only
75  muDstMaker->SetStatus("EmcSmde", 1); // BEMC Only
76  muDstMaker->SetStatus("EmcSmdp", 1); // BEMC Only
77  muDstMaker->SetStatus("EEmcPrs", 1); // EEMC Only
78  muDstMaker->SetStatus("EEmcSmdu", 1); // EEMC Only
79  muDstMaker->SetStatus("EEmcSmdv", 1); // EEMC Only
80 
81  St_db_Maker *StarDatabase = new St_db_Maker("StarDb", "MySQL:StarDb", "$STAR/StarDb");
82  StarDatabase->SetDateTime(20060522, 112810); // 2006 pp
83 
85  // Barrel //
87 
89  emcSim->setCalibSpread(kBarrelEmcTowerId, 0.15);
90  emcSim->setCalibOffset(kBarrelEmcTowerId, 0.0);
91 
92  emcSim->setCalibSpread(kBarrelSmdEtaStripId, 0.25);
93  emcSim->setCalibOffset(kBarrelSmdEtaStripId, 0.0);
94  emcSim->setMaximumAdc(kBarrelSmdEtaStripId, 700);
95  emcSim->setMaximumAdcSpread(kBarrelSmdEtaStripId, 70);
96  emcSim->setMaxCrossTalkPercentage(kBarrelSmdEtaStripId, 0.5);
97 
98  emcSim->setCalibSpread(kBarrelSmdPhiStripId, 0.25);
99  emcSim->setCalibOffset(kBarrelSmdPhiStripId, 0.0);
100  emcSim->setMaximumAdc(kBarrelSmdPhiStripId, 700);
101  emcSim->setMaximumAdcSpread(kBarrelSmdPhiStripId, 70);
102 
103  StPreEclMaker* preEcl = new StPreEclMaker();
104 
106  // Endcap //
108 
109  // Initialize EEMC database
110  StEEmcDbMaker *EEmcDatabase = new StEEmcDbMaker("eemcDb");
111 
112  StEEmcSlowMaker *slowSim = new StEEmcSlowMaker("slowSim");
113 
114  StEEmcA2EMaker *EEanalysis = new StEEmcA2EMaker("mEEanalysis");
115  EEanalysis->database("eemcDb"); // sets db connection
116  EEanalysis->source("MuDst", 1); // sets mudst as input
117  EEanalysis->threshold(3.0, 0); // tower threshold (ped+N sigma)
118  EEanalysis->threshold(3.0, 1); // pre1 threshold
119  EEanalysis->threshold(3.0, 2); // pre2 threshold
120  EEanalysis->threshold(3.0, 3); // post threshold
121  EEanalysis->threshold(3.0, 4); // smdu threshold
122  EEanalysis->threshold(3.0, 5); // smdv threshold
123 
124 
126  // GammaMaker //
128 
129  // Possible values for the second argument,
130  // kBemc (Use only the BEMC)
131  // kEemc (Use only the EEMC)
132  // kBoth (Use both detectors)
133 
134  StGammaMaker *gammaMaker = new StGammaMaker("gammaMaker", StGammaMaker::kBoth, StGammaMaker::kSimu);
135  gammaMaker->setOutputFile(outputFile);
136  gammaMaker->storeEmptyEvents();
137 
138  gammaMaker->setClusterEtThreshold(5.1);
139  gammaMaker->setConeRadius(0.4);
140  gammaMaker->setBsmdRange(0.05237);
141  gammaMaker->setEsmdRange(20.0);
142 
143  gammaMaker->setSeedEnergyThreshold(3.6);
144  gammaMaker->setClusterEnergyThreshold(5.1);
145 
146  gammaMaker->setTrackEtRawThreshold(0.0);
147  gammaMaker->setTowerEtRawThreshold(0.0);
148 
149  gammaMaker->setEemcTowerClusterThreshold(0.1);
150 
152  // Start up the chain //
154 
155  cout << "Starting up the chain..." << endl;
156 
157  chain->ls(3);
158  chain->Init();
159 
160  int ntotal = 1e6;
161 
162  cout << "Looping over events..." << endl;
163 
164  Int_t stat = 0;
165  Int_t total = 0;
166  for(int iev = 0; iev < ntotal; ++iev)
167  {
168 
169  cout << "******************************************" << endl;
170  cout << "Processing Event: " << iev << endl;
171  cout << "*************************1****************" << endl;
172 
173  chain->Clear();
174  stat = chain->Make();
175 
176  if(stat)
177  {
178  cout << "Bad return code!" << endl;
179  break;
180  }
181 
182  ++total;
183 
184  }
185 
186  chain->Finish();
187 
188  cout << "****************************************** " << endl;
189  cout << total << " Total Events" << endl;
190  cout << "****************************************** " << endl;
191 
192  return;
193 
194 }
EEmc ADC –&gt; energy maker.
void setMaximumAdc(StDetectorId det, float adc)
maximum possible ADC for a channel. Defaults are 4095 (TOW), 1023 (PRS), 1023 (SMDs) ...
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
void setCalibOffset(StDetectorId det, float offset)
scale simulator calibration coefficients by 1.0 + offset. Default is zero
void source(const Char_t *, Int_t=0)
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Finish()
Definition: StChain.cxx:85
void threshold(Float_t cut, Int_t layer)
Filling of all StMcEvent classes from g2t tables Transform all the data in the g2t tables into the co...
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
void setMaximumAdcSpread(StDetectorId det, float spread)
maximum possible ADC will be calculated by sampling Gaussian with this spread. Default is 0 for all d...
Bool_t doPrintMemoryInfo
lots of screen output
virtual Int_t Make()
Definition: StChain.cxx:110
void setMaxCrossTalkPercentage(StDetectorId det, float percentage)
this setting has no effect if det!=kBarrelSmdEtaStripId. Simulate cross-talk from cross-capacitance...
void SetStatus(const char *arrType, int status)
Slow simulator for EEMC.
void database(const Char_t *)
Set the name of the EEMC database, init obtains pointer.
void setCalibSpread(StDetectorId det, float spread)
smear simulator calibration coefficients using Gaussian with this RMS.