StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjMCAsymMaker.C
1 #include "StMaker.h"
2 
3 
4 #include <StMuDSTMaker/COMMON/StMuDstMaker.h>
5 #include <StMuDSTMaker/COMMON/StMuDst.h>
6 #include <StMuDSTMaker/COMMON/StMuEvent.h>
7 
8 #include <StTriggerUtilities/StTriggerSimuMaker.h>
9 #include <StTriggerUtilities/StTriggerSimuResult.h>
10 #include <StTriggerUtilities/Bemc/StBemcTriggerSimu.h>
11 
12 #include <StSpinPool/StMCAsymMaker/StMCAsymMaker.h>
13 
14 #include <TChain.h>
15 #include <TDirectory.h>
16 
17 #include "StjMCMuDst.h"
18 #include "StjMCKinMuDst.h"
19 #include "StjMCParticleList.h"
20 #include "StjMCParticlePrint.h"
21 
22 #include <libgen.h>
23 
24 #include <string>
25 #include <cstring>
26 
27 using namespace std;
28 
29 class StjMCAsymMaker : public StMaker {
30 
31 public:
32 
33  StjMCAsymMaker(const Char_t *name, TDirectory* file, StMuDstMaker* uDstMaker)
34  : StMaker(name), _file(file), _uDstMaker(uDstMaker)
35  { }
36 
37  virtual ~StjMCAsymMaker() { }
38 
39  const char* GetCVS() const
40  {static const char cvs[]="Tag $Name: $ $Id: StjMCAsymMaker.C,v 1.3 2014/08/06 11:43:24 jeromel Exp $ built " __DATE__ " " __TIME__; return cvs;}
41 
42 private:
43 
44  TDirectory* _file;
45  TTree* _tree;
46 
47  StMuDstMaker* _uDstMaker;
48  StjMCMuDst* _mc;
49 
50  Int_t _runNumber;
51  Int_t _eventId;
52  Double_t _vertexZ;
53 
54  Double_t _s;
55  Double_t _t;
56  Double_t _u;
57  Double_t _pt;
58  Double_t _costh;
59  Double_t _x1;
60  Double_t _x2;
61  Int_t _pid;
62 
63  Int_t _pdg1;
64  Int_t _pdg2;
65  Int_t _pdg3;
66  Int_t _pdg4;
67 
68  Double_t _a_ll;
69 
70  Double_t _f1_cteq5m1;
71  Double_t _f2_cteq5m1;
72  Double_t _f1_cteq5l;
73  Double_t _f2_cteq5l;
74 
75  Double_t _df1_gsa_nlo;
76  Double_t _df2_gsa_nlo;
77  Double_t _df1_gsb_nlo;
78  Double_t _df2_gsb_nlo;
79  Double_t _df1_gsc_nlo;
80  Double_t _df2_gsc_nlo;
81 
82  Double_t _df1_grsv_lo;
83  Double_t _df2_grsv_lo;
84  Double_t _df1_grsv_nlo;
85  Double_t _df2_grsv_nlo;
86  Double_t _df1_grsv_g0;
87  Double_t _df2_grsv_g0;
88  Double_t _df1_grsv_gmax;
89  Double_t _df2_grsv_gmax;
90  Double_t _df1_grsv_gmin;
91  Double_t _df2_grsv_gmin;
92 
93  Double_t _df1_grsv_m015;
94  Double_t _df2_grsv_m015;
95  Double_t _df1_grsv_m030;
96  Double_t _df2_grsv_m030;
97  Double_t _df1_grsv_m045;
98  Double_t _df2_grsv_m045;
99  Double_t _df1_grsv_m060;
100  Double_t _df2_grsv_m060;
101  Double_t _df1_grsv_m075;
102  Double_t _df2_grsv_m075;
103  Double_t _df1_grsv_m090;
104  Double_t _df2_grsv_m090;
105  Double_t _df1_grsv_m105;
106  Double_t _df2_grsv_m105;
107  Double_t _df1_grsv_p030;
108  Double_t _df2_grsv_p030;
109  Double_t _df1_grsv_p045;
110  Double_t _df2_grsv_p045;
111  Double_t _df1_grsv_p060;
112  Double_t _df2_grsv_p060;
113  Double_t _df1_grsv_p070;
114  Double_t _df2_grsv_p070;
115 
116  Double_t _df1_dssv_nlo;
117  Double_t _df2_dssv_nlo;
118 
119  StjMCParticle getMcParticleForId(const StjMCParticleList& list, int id)
120  {
121  for(StjMCParticleList::const_iterator it = list.begin(); it != list.end(); ++it)
122  {
123  if((*it).mcparticleId == id) return (*it);
124  }
125  return StjMCParticle();
126  }
127 
128 public:
129 
130  Int_t Init()
131  {
132  _mc = new StjMCMuDst(_uDstMaker);
133 
134  _file->cd();
135  _tree = new TTree("mcasym", "mcasym");
136  _tree->Branch("runNumber" , &_runNumber , "runNumber/I" );
137  _tree->Branch("eventId" , &_eventId , "eventId/I" );
138  _tree->Branch("vertexZ" , &_vertexZ , "vertexZ/D" );
139 
140  _tree->Branch("s" , &_s , "s/D");
141  _tree->Branch("t" , &_t , "t/D");
142  _tree->Branch("u" , &_u , "u/D");
143  _tree->Branch("pt" , &_pt , "pt/D");
144  _tree->Branch("costh" , &_costh , "costh/D");
145  _tree->Branch("x1" , &_x1 , "x1/D");
146  _tree->Branch("x2" , &_x2 , "x2/D");
147  _tree->Branch("pid" , &_pid , "pid/I");
148  _tree->Branch("pdg1" , &_pdg1 , "pdg1/I");
149  _tree->Branch("pdg2" , &_pdg2 , "pdg2/I");
150  _tree->Branch("pdg3" , &_pdg3 , "pdg3/I");
151  _tree->Branch("pdg4" , &_pdg4 , "pdg4/I");
152  _tree->Branch("a_ll" , &_a_ll , "a_ll/D");
153  _tree->Branch("f1_cteq5m1" , &_f1_cteq5m1 , "f1_cteq5m1/D");
154  _tree->Branch("f2_cteq5m1" , &_f2_cteq5m1 , "f2_cteq5m1/D");
155  _tree->Branch("f1_cteq5l" , &_f1_cteq5l , "f1_cteq5l/D");
156  _tree->Branch("f2_cteq5l" , &_f2_cteq5l , "f2_cteq5l/D");
157  _tree->Branch("df1_gsa_nlo" , &_df1_gsa_nlo , "df1_gsa_nlo/D");
158  _tree->Branch("df2_gsa_nlo" , &_df2_gsa_nlo , "df2_gsa_nlo/D");
159  _tree->Branch("df1_gsb_nlo" , &_df1_gsb_nlo , "df1_gsb_nlo/D");
160  _tree->Branch("df2_gsb_nlo" , &_df2_gsb_nlo , "df2_gsb_nlo/D");
161  _tree->Branch("df1_gsc_nlo" , &_df1_gsc_nlo , "df1_gsc_nlo/D");
162  _tree->Branch("df2_gsc_nlo" , &_df2_gsc_nlo , "df2_gsc_nlo/D");
163  _tree->Branch("df1_grsv_lo" , &_df1_grsv_lo , "df1_grsv_lo/D");
164  _tree->Branch("df2_grsv_lo" , &_df2_grsv_lo , "df2_grsv_lo/D");
165  _tree->Branch("df1_grsv_nlo" , &_df1_grsv_nlo , "df1_grsv_nlo/D");
166  _tree->Branch("df2_grsv_nlo" , &_df2_grsv_nlo , "df2_grsv_nlo/D");
167  _tree->Branch("df1_grsv_g0" , &_df1_grsv_g0 , "df1_grsv_g0/D");
168  _tree->Branch("df2_grsv_g0" , &_df2_grsv_g0 , "df2_grsv_g0/D");
169  _tree->Branch("df1_grsv_gmax" , &_df1_grsv_gmax , "df1_grsv_gmax/D");
170  _tree->Branch("df2_grsv_gmax" , &_df2_grsv_gmax , "df2_grsv_gmax/D");
171  _tree->Branch("df1_grsv_gmin" , &_df1_grsv_gmin , "df1_grsv_gmin/D");
172  _tree->Branch("df2_grsv_gmin" , &_df2_grsv_gmin , "df2_grsv_gmin/D");
173  _tree->Branch("df1_grsv_m015" , &_df1_grsv_m015 , "df1_grsv_m015/D");
174  _tree->Branch("df2_grsv_m015" , &_df2_grsv_m015 , "df2_grsv_m015/D");
175  _tree->Branch("df1_grsv_m030" , &_df1_grsv_m030 , "df1_grsv_m030/D");
176  _tree->Branch("df2_grsv_m030" , &_df2_grsv_m030 , "df2_grsv_m030/D");
177  _tree->Branch("df1_grsv_m045" , &_df1_grsv_m045 , "df1_grsv_m045/D");
178  _tree->Branch("df2_grsv_m045" , &_df2_grsv_m045 , "df2_grsv_m045/D");
179  _tree->Branch("df1_grsv_m060" , &_df1_grsv_m060 , "df1_grsv_m060/D");
180  _tree->Branch("df2_grsv_m060" , &_df2_grsv_m060 , "df2_grsv_m060/D");
181  _tree->Branch("df1_grsv_m075" , &_df1_grsv_m075 , "df1_grsv_m075/D");
182  _tree->Branch("df2_grsv_m075" , &_df2_grsv_m075 , "df2_grsv_m075/D");
183  _tree->Branch("df1_grsv_m090" , &_df1_grsv_m090 , "df1_grsv_m090/D");
184  _tree->Branch("df2_grsv_m090" , &_df2_grsv_m090 , "df2_grsv_m090/D");
185  _tree->Branch("df1_grsv_m105" , &_df1_grsv_m105 , "df1_grsv_m105/D");
186  _tree->Branch("df2_grsv_m105" , &_df2_grsv_m105 , "df2_grsv_m105/D");
187  _tree->Branch("df1_grsv_p030" , &_df1_grsv_p030 , "df1_grsv_p030/D");
188  _tree->Branch("df2_grsv_p030" , &_df2_grsv_p030 , "df2_grsv_p030/D");
189  _tree->Branch("df1_grsv_p045" , &_df1_grsv_p045 , "df1_grsv_p045/D");
190  _tree->Branch("df2_grsv_p045" , &_df2_grsv_p045 , "df2_grsv_p045/D");
191  _tree->Branch("df1_grsv_p060" , &_df1_grsv_p060 , "df1_grsv_p060/D");
192  _tree->Branch("df2_grsv_p060" , &_df2_grsv_p060 , "df2_grsv_p060/D");
193  _tree->Branch("df1_grsv_p070" , &_df1_grsv_p070 , "df1_grsv_p070/D");
194  _tree->Branch("df2_grsv_p070" , &_df2_grsv_p070 , "df2_grsv_p070/D");
195  _tree->Branch("df1_dssv_nlo" , &_df1_dssv_nlo , "df1_dssv_nlo/D");
196  _tree->Branch("df2_dssv_nlo" , &_df2_dssv_nlo , "df2_dssv_nlo/D");
197 
198  return kStOk;
199  }
200 
201  Int_t Make()
202  {
203  _runNumber = _uDstMaker->muDst()->event()->runId();
204  _eventId = _uDstMaker->muDst()->event()->eventId();
205  _vertexZ = _uDstMaker->muDst()->event()->primaryVertexPosition().z();
206 
207  StTriggerSimuMaker* trigSimu = dynamic_cast<StTriggerSimuMaker*>(GetMaker("StarTrigSimu"));
208  StTriggerSimuResult trigResult = trigSimu->detailedResult(117001);
209 
210  StMCAsymMaker *asym = dynamic_cast<StMCAsymMaker*>(GetMaker("MCAsym"));
211 
212  StjMCKinMuDst* mckin = new StjMCKinMuDst(_uDstMaker);
213  _s = mckin->s();
214  _t = mckin->t();
215  _u = mckin->u();
216  _pt = mckin->pt();
217  _costh = mckin->costh();
218  _x1 = mckin->x1();
219  _x2 = mckin->x2();
220  _pid = mckin->pid();
221 
222 
223  StjMCParticleList list = _mc->getMCParticleList();
224  StjMCParticle part1 = getMcParticleForId(list, 5);
225  StjMCParticle part2 = getMcParticleForId(list, 6);
226  StjMCParticle part3 = getMcParticleForId(list, 7);
227  StjMCParticle part4 = getMcParticleForId(list, 8);
228 
229  _pdg1 = part1.pdg;
230  _pdg2 = part2.pdg;
231  _pdg3 = part3.pdg;
232  _pdg4 = part4.pdg;
233 
234  _a_ll = asym->getPartonicALL(_s, _t, _u, _pid, _pdg1, _pdg2, _pdg3, _pdg4);
235 
236  Double_t Q2 = _pt*_pt;
237 
238  _f1_cteq5m1 = asym->get_unpolPDF_NLO(_pdg1, _x1, Q2);
239  _f2_cteq5m1 = asym->get_unpolPDF_NLO(_pdg2, _x2, Q2);
240  _f1_cteq5l = asym->get_unpolPDF_LO(_pdg1, _x1, Q2);
241  _f2_cteq5l = asym->get_unpolPDF_LO(_pdg2, _x2, Q2);
242 
243  _df1_gsa_nlo = asym->get_polPDF_NLO_GSA(_pdg1, _x1, Q2);
244  _df2_gsa_nlo = asym->get_polPDF_NLO_GSA(_pdg2, _x2, Q2);
245  _df1_gsb_nlo = asym->get_polPDF_NLO_GSB(_pdg1, _x1, Q2);
246  _df2_gsb_nlo = asym->get_polPDF_NLO_GSB(_pdg2, _x2, Q2);
247  _df1_gsc_nlo = asym->get_polPDF_NLO_GSC(_pdg1, _x1, Q2);
248  _df2_gsc_nlo = asym->get_polPDF_NLO_GSC(_pdg2, _x2, Q2);
249 
250  _df1_grsv_lo = asym->get_polPDF_LO(_pdg1, _x1, Q2);
251  _df2_grsv_lo = asym->get_polPDF_LO(_pdg2, _x2, Q2);
252  _df1_grsv_nlo = asym->get_polPDF_NLO(_pdg1, _x1, Q2);
253  _df2_grsv_nlo = asym->get_polPDF_NLO(_pdg2, _x2, Q2);
254  _df1_grsv_g0 = asym->get_polPDF_NLO_g0(_pdg1, _x1, Q2);
255  _df2_grsv_g0 = asym->get_polPDF_NLO_g0(_pdg2, _x2, Q2);
256  _df1_grsv_gmax = asym->get_polPDF_NLO_gmax(_pdg1, _x1, Q2);
257  _df2_grsv_gmax = asym->get_polPDF_NLO_gmax(_pdg2, _x2, Q2);
258  _df1_grsv_gmin = asym->get_polPDF_NLO_gmin(_pdg1, _x1, Q2);
259  _df2_grsv_gmin = asym->get_polPDF_NLO_gmin(_pdg2, _x2, Q2);
260 
261  _df1_grsv_m015 = asym->get_polPDF_NLO_m015(_pdg1, _x1, Q2);
262  _df2_grsv_m015 = asym->get_polPDF_NLO_m015(_pdg2, _x2, Q2);
263  _df1_grsv_m030 = asym->get_polPDF_NLO_m030(_pdg1, _x1, Q2);
264  _df2_grsv_m030 = asym->get_polPDF_NLO_m030(_pdg2, _x2, Q2);
265  _df1_grsv_m045 = asym->get_polPDF_NLO_m045(_pdg1, _x1, Q2);
266  _df2_grsv_m045 = asym->get_polPDF_NLO_m045(_pdg2, _x2, Q2);
267  _df1_grsv_m060 = asym->get_polPDF_NLO_m060(_pdg1, _x1, Q2);
268  _df2_grsv_m060 = asym->get_polPDF_NLO_m060(_pdg2, _x2, Q2);
269  _df1_grsv_m075 = asym->get_polPDF_NLO_m075(_pdg1, _x1, Q2);
270  _df2_grsv_m075 = asym->get_polPDF_NLO_m075(_pdg2, _x2, Q2);
271  _df1_grsv_m090 = asym->get_polPDF_NLO_m090(_pdg1, _x1, Q2);
272  _df2_grsv_m090 = asym->get_polPDF_NLO_m090(_pdg2, _x2, Q2);
273  _df1_grsv_m105 = asym->get_polPDF_NLO_m105(_pdg1, _x1, Q2);
274  _df2_grsv_m105 = asym->get_polPDF_NLO_m105(_pdg2, _x2, Q2);
275  _df1_grsv_p030 = asym->get_polPDF_NLO_p030(_pdg1, _x1, Q2);
276  _df2_grsv_p030 = asym->get_polPDF_NLO_p030(_pdg2, _x2, Q2);
277  _df1_grsv_p045 = asym->get_polPDF_NLO_p045(_pdg1, _x1, Q2);
278  _df2_grsv_p045 = asym->get_polPDF_NLO_p045(_pdg2, _x2, Q2);
279  _df1_grsv_p060 = asym->get_polPDF_NLO_p060(_pdg1, _x1, Q2);
280  _df2_grsv_p060 = asym->get_polPDF_NLO_p060(_pdg2, _x2, Q2);
281  _df1_grsv_p070 = asym->get_polPDF_NLO_p070(_pdg1, _x1, Q2);
282  _df2_grsv_p070 = asym->get_polPDF_NLO_p070(_pdg2, _x2, Q2);
283 
284  _df1_dssv_nlo = asym->get_polPDF_NLO_DSSV(_pdg1, _x1, Q2);
285  _df2_dssv_nlo = asym->get_polPDF_NLO_DSSV(_pdg2, _x2, Q2);
286 
287  _tree->Fill();
288  return kStOk;
289  }
290 
291  Int_t Finish()
292  {
293  _tree->BuildIndex("runNumber", "eventId");
294  return kStOk;
295  }
296  ClassDef(StjMCAsymMaker, 0)
297 };
const StTriggerSimuResult & detailedResult(int trigId)
returns object containing detailed information about simulation of given trigger
Definition: Stypes.h:41