FairRoot/PandaRoot
HypStatDecay.cxx
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- HypStatDecay source file -----
3 // ----- Created 10/06/08 by A. Sanchez -----
4 // -------------------------------------------------------------------------
5 
6 
7 #include <iostream>
8 #include "TClonesArray.h"
9 #include "TFile.h"
10 #include "TLorentzVector.h"
11 #include "TTree.h"
12 //#include "TRandom.h"
13 #include "TVector3.h"
14 //#include "THParticle.h"
15 #include "HypStatDecay.h"
16 
17 using namespace std;
18 #include "cfortran.h"
19 extern "C" {
20 extern struct {
21  int n, AG[1000], ZG[1000], HG[1000];
22  float PXs[1000], PYs[1000], PZs[1000],
23  EP[1000],GM[1000] ;
24 } frag_;
25 }
26 
27 extern "C" void initia_(double* she, int* an, int* zn, int* hn);//install DPM
28 extern "C" void razhyp_gen__(double* shell ); //to generate events
29 
30 
31 // ----- Default constructor ------------------------------------------
33  iEvent = fev = 0;
34  //fMass = 0.;
35  fNtr =0;
36  fMom.SetXYZ(0.,0.,0.);
37  //fInputFile = NULL;
38  //fInputTree = NULL;
39  //fFrag = NULL;
40 }
41 // ------------------------------------------------------------------------
42 
43 
44 
45 // ----- Standard constructor -----------------------------------------
46 HypStatDecay::HypStatDecay(const Char_t* fileName) {
47  iEvent = fev =0;
48  //fMass = 0.;
49  fNtr =0;
50  fMom.SetXYZ(0.,0.,0.);
51  fFileName = fileName;
52  // fInputFile = new TFile(fFileName);
53  // fInputTree = (TTree*) fInputFile->Get("data");
54  // fParticles = new TClonesArray("THParticle",100);
55  // fInputTree->SetBranchAddress("Particles", &fParticles);
56  she= 3.;
57  if(strcmp(fFileName,"12C")==0){
58  std::cout<<" 12C + Xi- --> 13BLL "<<std::endl;
59  an = 13;
60  zn = 5;
61  hn =2;
62  } else if(strcmp(fFileName,"13C")==0){
63  std::cout<<" 13C + Xi- --> 14BLL "<<std::endl;
64  an = 14;
65  zn = 5;
66  hn =2;
67  } else if(strcmp(fFileName,"10B")==0){
68  std::cout<<" 10B + Xi- --> 11BeLL "<<std::endl;
69  an = 11;
70  zn = 4;
71  hn =2;
72  } else if(strcmp(fFileName,"11B")==0){
73  std::cout<<" 11B + Xi- --> 12BeLL "<<std::endl;
74  an = 12;
75  zn = 4;
76  hn =2;
77  } else if(strcmp(fFileName,"9Be")==0){
78  std::cout<<" 9Be + Xi- --> 10LiLL "<<std::endl;
79  an = 10;
80  zn = 3;
81  hn =2;
82  }
83 
84 
85  initia_(&she, &an, &zn, &hn);
86 
87 //
88 }
89 // ------------------------------------------------------------------------
90 
91 
92 
93 // ----- Destructor ---------------------------------------------------
95  CloseInput();
96 }
97 // ------------------------------------------------------------------------
98 
99 
100 
101 // ----- Public method ReadEvent --------------------------------------
102 void HypStatDecay::GetFragment(Int_t ) // primGen //[R.K.03/2017] unused variable(s)
103 {
104  fPx.clear();fPy.clear();fPz.clear();
105  A.clear();Z.clear();H.clear();
106  fMass.clear();fEx.clear();
107  fPid.clear();
108 
109  razhyp_gen__(&she);
110  int npart;
111  npart = frag_.n;
112  cout<<" npart razhyp "<<npart<<endl;
113 
114 
115 
116 
117 
118  //SetFrag(fFrag);
119  //return kTRUE;
120 
121  for (int i= 0; i< frag_.n; ++i) {
122 
123  if(frag_.EP[i]>0.){ //gamma emission
124 
125  //----photon emitted from excited hypfragment
126 
127  tvL.SetXYZ(frag_.PXs[i],frag_.PYs[i],frag_.PZs[i]);
128 
129  v = GetPgCMSLab((frag_.GM[i])*1000,frag_.EP[i],tvL,r);
130 
131  fPx.push_back(v.Px()/1000);
132  fPy.push_back(v.Py()/1000);
133  fPz.push_back(v.Pz()/1000);
134  fMass.push_back(0.);
135  fPid.push_back(22);
136 
137  //cout<<" pid 22 "<<v.Px()/1000<<" "<<v.Py()/1000<<" "<<v.Pz()/1000<<endl;
138 
139 
140  //----deexcited Hypfragment
141 
142  tNvL.SetXYZ(frag_.PXs[i],frag_.PYs[i],frag_.PZs[i]);
143  vN = GetPNuCMSLab((frag_.GM[i])*1000,frag_.EP[i],tNvL,r);
144 
145  fPx.push_back(vN.Px()/1000);
146  fPy.push_back(vN.Py()/1000);
147  fPz.push_back(vN.Pz()/1000);
148  fMass.push_back(frag_.GM[i]);
149 
150  //hypernucleus or ion
151  //if((frag_.HG[i]>0&&frag_.ZG[i]>0&&frag_.AG[i]>0)||
152  // (frag_.HG[i]==0 &&(frag_.ZG[i]>1)&&frag_.AG[i]>1))
153  fPid.push_back(1000000000+10000000*frag_.HG[i]+10000* frag_.ZG[i] +10 * frag_.AG[i]);
154 
155  //cout<<" pid frag22 "<<vN.Px()/1000<<" "<<vN.Py()/1000<<" "<<vN.Pz()/1000<<endl;
156  }
157 
158  if(frag_.EP[i]==0.){
159 
160  fPx.push_back(frag_.PXs[i]/1000);
161  fPy.push_back(frag_.PYs[i]/1000);
162  fPz.push_back(frag_.PZs[i]/1000);
163  fMass.push_back(frag_.GM[i]);
164 
165 
166  //hypernucleus or ion
167  if(frag_.HG[i]>0 &&frag_.ZG[i]>0&&frag_.AG[i]>0)
168  {
169  fPid.push_back(1000000000+10000000*frag_.HG[i]+10000* frag_.ZG[i] +10 * frag_.AG[i]);
170  }
171 
172  if(frag_.HG[i]==0 &&frag_.ZG[i]>0&&frag_.AG[i]>0){
173 
174  if(frag_.ZG[i]==1&&frag_.AG[i]==1)fPid.push_back(2212);//proton
175 
176  else fPid.push_back(1000000000+10000000*frag_.HG[i]+10000* frag_.ZG[i] +10 * frag_.AG[i]);
177  }
178 
179  if(frag_.HG[i]==0&&frag_.ZG[i]==0&&frag_.AG[i]==1)
180  {
181 
182  fPid.push_back(2112);//neutron
183  }
184 
185  // if(frag_.HG[i]==0&&frag_.ZG[i]==1&&frag_.AG[i]==1){
186 
187  // fPid.push_back(2212);//proton
188  // }
189 
190 
191  if(frag_.HG[i]==1&&frag_.ZG[i]==0&&frag_.AG[i]==1)
192  {
193 
194  fPid.push_back(3122);//lambda
195  }
196 
197  //cout<<"pid fra "<<frag_.PXs[i]/1000<<" "<<frag_.PYs[i]/1000<<" "<<frag_.PZs[i]/1000<<endl;
198  }
199 
200 
201  }
202 
203  cout<<" after gamma emision npart razhyp "<<fPx.size()<<endl;
204  SetNtr( fPx.size()); //after electromagnetic decay(frag +photon)
205 
206 }
207 void HypStatDecay::GetData(Int_t tr, TVector3 &p,Int_t &pid,Double_t &mass)
208 {
209 
210 
211  pid = fPid[tr];
212 
213  Double_t px = fPx[tr];
214  Double_t py = fPy[tr];
215  Double_t pz = fPz[tr];
216 
217  p.SetXYZ(px,py,pz);
218  mass = fMass[tr];
219 
220  // Loop over particle in event
221  }
222 // ------------------------------------------------------------------------
223 
224 void HypStatDecay::GetAZH(Int_t ion,Int_t &AI,Int_t &ZI,Int_t &L)
225 {
226  //Int_t A,Z,L;
227 
228  if(ion>1000000000&&(ion<1010000000))
229  { ion -= 1000000000;
230  ZI = ion/10000;
231  ion -= 10000*ZI;
232  AI = ion/10;
233  L = 0;
234  cout<<" ion charge "<<ZI<<" "<<AI<<" "<<L<<endl;
235  //return Z;
236 
237  }
238 if((ion>1010000000||ion>1020000000))
239  {
240  ion -= 1000000000;
241  L = ion/10000000;
242  ion -= 10000000*L;
243  ZI = ion/10000;
244  ion -= 10000*ZI;
245  AI = ion/10;
246  cout<<L<<" hypernuclei charge "<<ZI<<" "<<AI<<" "<<L<<endl;
247 
248  //return Z;
249 
250  }
251 if(ion==2212){AI=1;ZI=1;L=0;}
252 if(ion==2112){AI=1;ZI=0;L=0;}
253 if(ion==3122){AI=1;ZI=0;L=1;}
254 if(ion==22){AI=0;ZI=0;L=0;}
255 
256 }
257 
258 
259 
260 TLorentzVector HypStatDecay::GetPgCMSLab(float mass,float &Delta,TVector3 &PL,TRandom& rd)
261 {
262  Double_t Mex,Pgam,Xgam,Ygam,Zgam,EL,PLmag;//, MC; //[R.K.03/2017] unused variable
263  //Double_t theta,phi; //[R.K. 01/2017] unused variable
264 
265  TLorentzVector res,PNlab,resLab;
266  //mASS OF EXCITED HYPERNUCLEUS
267  //cout<<mass<<" "<<Delta<<endl;
268  Mex = mass + Delta;
269  //cout<<Mex<<" "<<Mex*Mex<<" "<<mass*mass<<endl;
270 
271  //MC = (Mex*Mex) - (mass*mass); //[R.K.03/2017] unused variable
272  //cout<<Mex*Mex-mass*mass<<" "<<MC<<" "<<MC/(2*Mex)<<endl;
273  // --pgam in CM after decay
274  Pgam = ((Mex*Mex) - (mass*mass))/(2*Mex);
275 
276  //cout<<"pgamCM "<<Pgam<<" "<<endl;
277  Xgam= Ygam = Zgam = 0.;
278 
279  //isotropically distributed
280  rd.Sphere(Xgam,Ygam,Zgam,Pgam);
281  //theta = acos(r->Uniform(cos(0.* TMath::DegToRad()),cos(180.* TMath::DegToRad())));
282  //phi = r->Uniform(0,360) * TMath::DegToRad();
283 
284  /* Xgam = Pgam*TMath::Sin(theta)*TMath::Cos(phi);
285  Ygam = Pgam*TMath::Sin(theta)*TMath::Sin(phi);
286  Zgam = Pgam*TMath::Cos(theta);
287  */
288  //cout<<"pgamCM "<<Xgam<<" "<<Ygam<<" "<<Zgam<<" "<<endl;
289 
290  res.SetPxPyPzE(Xgam,Ygam,Zgam,Pgam);
291  //-- hypernucleus impuls in LabS
292  PLmag =PL.Mag2();
293 
294  EL = TMath::Sqrt(Mex*Mex + PLmag);
295  PNlab.SetPxPyPzE(PL.X(),PL.Y(),PL.Z(),EL);
296  //-- general boost in the Pl direction
297  //--Pgam in the LabS.
298  res.Boost(PL.X()/EL,PL.Y()/EL,PL.Z()/EL);
299  //cout<<"particle 1"<<endl;
300 
301  //printf("%e %e %e \n",PL.X()/EL,PL.Y()/EL,PL.Z()/EL);
302 
303 
304  return res;
305 
306 
307 }
308 
309 TLorentzVector HypStatDecay::GetPNuCMSLab(float mass,float &Delta,TVector3 &PL,TRandom& rd)
310 {
311  Double_t Mex,Pgam,Xgam,Ygam,Zgam,EL,PLmag;//, MC; //[R.K.03/2017] unused variable
312  TLorentzVector result,PNlab,resLab;
313  //Double_t theta, phi; //[R.K.03/2017] unused variable
314  //mASS OF EXCITED HYPERNUCLEUS
315  //cout<<mass<<" "<<Delta<<endl;
316  Mex = mass + Delta;
317  //cout<<Mex<<" "<<Mex*Mex<<" "<<mass*mass<<endl;
318 
319  //MC = (Mex*Mex) - (mass*mass); //[R.K.03/2017] unused variable
320  //cout<<Mex*Mex-mass*mass<<" "<<MC<<" "<<MC/(2*Mex)<<endl;
321  // --pgam in CM after decay
322  Pgam = ((Mex*Mex) - (mass*mass))/(2*Mex);
323 
324  //cout<<"pgamCM "<<Pgam<<" "<<endl;
325  Xgam= Ygam = Zgam = 0.;
326  //isotropically distributed
327  rd.Sphere(Xgam,Ygam,Zgam,-Pgam);
328 
329  //theta = acos(rd.Uniform(cos(0.* TMath::DegToRad()),cos(180.* TMath::DegToRad()))); //[R.K.03/2017] unused variable
330  //phi = rd.Uniform(0,360) * TMath::DegToRad(); //[R.K.03/2017] unused variable
331  /*Xgam = -Pgam*TMath::Sin(theta)*TMath::Cos(phi);
332  Ygam = -Pgam*TMath::Sin(theta)*TMath::Sin(phi);
333  Zgam = -Pgam*TMath::Cos(theta);*/
334  //cout<<"pgamCM "<<Xgam<<" "<<Ygam<<" "<<Zgam<<" "<<endl;
335 
336  result.SetPxPyPzE(Xgam,Ygam,Zgam, TMath::Sqrt((Pgam*Pgam) + (mass*mass)));
337  //-- hypernucleus impuls in LabS
338  PLmag =PL.Mag2();
339 
340  EL = TMath::Sqrt(Mex*Mex + PLmag);
341  PNlab.SetPxPyPzE(PL.X(),PL.Y(),PL.Z(),EL);
342  //-- general boost in the Pl direction
343  //--Pgam in the LabS.
344  result.Boost(PL.X()/EL,PL.Y()/EL,PL.Z()/EL);
345  //cout<<"particle 1"<<endl;
346 
347  return result;
348 
349 
350 }
351 
352 Double_t HypStatDecay::GetEtot(Float_t mass,TVector3 P)
353 {
354  Double_t E;
355  E= TMath::Sqrt(TMath::Power(mass,2)+TMath::Power(P.Mag()/1000.,2));
356 
357 
358  return E;
359 
360 
361 }
362 
363 
364 
365 
366 // ----- Private method CloseInput ------------------------------------
368  // if ( fInputFile ) {
369 // cout << "-I HypStatDecay: Closing input file " << fFileName
370 // << endl;
371 // fInputFile->Close();
372 // delete fInputFile;
373 // }
374 // fInputFile = NULL;
375 }
376 // ------------------------------------------------------------------------
377 
378 
379 
Double_t p
Definition: anasim.C:58
void initia_(double *she, int *an, int *zn, int *hn)
double r
Definition: RiemannTest.C:14
Int_t res
Definition: anadigi.C:166
Int_t i
Definition: run_full.C:25
void GetFragment(Int_t primGen)
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
int n
int pid()
TLorentzVector GetPgCMSLab(float mass, float &Delta, TVector3 &PL, TRandom &rd)
struct @2 frag_
__m128 v
Definition: P4_F32vec4.h:4
int AG[1000]
virtual ~HypStatDecay()
Double_t
int HG[1000]
int ZG[1000]
float PZs[1000]
void razhyp_gen__(double *shell)
float EP[1000]
GeV c P
void GetAZH(Int_t ion, Int_t &AI, Int_t &ZI, Int_t &L)
void GetData(Int_t tr, TVector3 &p, Int_t &pid, Double_t &mass)
search fragment in event
TLorentzVector GetPNuCMSLab(float mass, float &Delta, TVector3 &PL, TRandom &rd)
float PYs[1000]
float GM[1000]
ClassImp(PndAnaContFact)
double Z
Definition: anaLmdDigi.C:68
float PXs[1000]
double pz[39]
Definition: pipisigmas.h:14
Double_t GetEtot(Float_t mass, TVector3 P)