BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
Mcgpj Class Reference

#include <Mcgpj.h>

+ Inheritance diagram for Mcgpj:

Public Member Functions

 Mcgpj (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Definition at line 20 of file Mcgpj.h.

Constructor & Destructor Documentation

◆ Mcgpj()

Mcgpj::Mcgpj ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 55 of file Mcgpj.cxx.

55 :Algorithm(name, pSvcLocator){
56 declareProperty("Data", m_datapath = "${MCGPJROOT}/data"); // Path to data files
57 declareProperty("VpolFname", m_vpolfname = "vpol.dat"); // Vacuum polarization data file name
58 declareProperty("CMEnergy", cmE = 3.097); // 2*Ebeam [GeV]
59 declareProperty("Process", proc = 0); // process
60 declareProperty("NRad", NRad = 20000);
61 declareProperty("HardPhoton", IsHardPhoton = 1);
62 declareProperty("NoVacPol", IsNoVacPol = 0);
63 declareProperty("FSR", IsFSR = 1);
64 declareProperty("AcolAngle", pc = 0.);
65 declareProperty("DeltaE", de = -1.); // [GeV]
66 declareProperty("NTheta0", nt0 = -1.); // [1/sqrt(gamma)]
67 declareProperty("DeltaTheta", dt = 0.5); //[rad]
68 declareProperty("DeltaPhi", dp = 0.3); // [rad]
69 declareProperty("AverageTheta", at = 1.1); //[rad]
70 declareProperty("ThetaDetector", td = 1.1 - 0.5/2); //[rad]
71 declareProperty("AverageMomentum", am = 0.090); //[GeV/c]
72 declareProperty("CrossMomentum", cm = 0.090); //[GeV/c]
73 declareProperty("MinimumEnergy", em = 0.050);//[GeV]
74 declareProperty("ThetaIntermediate", ti = 0.473);// [rad]
75 declareProperty("AlphaScale", al = 1.);
76 declareProperty("ThetaMinus", thm = -1.); //[rad]
77 declareProperty("ThetaPlus", thp = -1.); //[rad]
78 declareProperty("AbsoluteError", te = 0.05); // absolute error in [nb]
79 declareProperty("RelativeError", re = 0.05); // realative error
80// declareProperty("InitialSeed", Seed = 0);
81 declareProperty("BeamSpread", spread = -1);// [MeV]
82// declareProperty("PhaseShift", phase = -90);// [deg]
83 declareProperty("Mode5pi", m_fmode5pi = 0);// 0 - via b1+/- pi-/+, 1 via b10 pi0
84}

Member Function Documentation

◆ execute()

StatusCode Mcgpj::execute ( )

Definition at line 319 of file Mcgpj.cxx.

319 {
320 MsgStream log(messageService(), name());
321 log << MSG::INFO << "Mcgpj executing" << endreq;
322 log<<MSG::WARNING<<"execute start"<<endreq;
323
324 // Fill event information
325 GenEvent* evt = new GenEvent(1,1);
326
327 GenVertex* prod_vtx = new GenVertex();
328
329 evt->add_vertex( prod_vtx );
330
331 // incoming beam e+
332 GenParticle* p =
333 new GenParticle(HepLorentzVector(0,0,0.5*cmE*1e-3,0.5*cmE*1e-3),-11, 3);
334 p->suggest_barcode(1);
335 prod_vtx->add_particle_in(p);
336
337 // incoming beam e-
338 p =
339 new GenParticle(HepLorentzVector(0,0,0.5*cmE*1e-3, 0.5*cmE*1e-3), 11, 3);
340 p->suggest_barcode(2);
341 prod_vtx->add_particle_in(p);
342
343 int npart = 2;
344 if(proc<100){
345 double mom[4*6];
346 int np;
347 gRad->MakeEvent(mom,np);
348
349 // final particle 1
350 for(int i=0; i<np;i++){
351 double ptot = mom[i*4+3];
352 double px = ptot*mom[i*4+0];
353 double py = ptot*mom[i*4+1];
354 double pz = ptot*mom[i*4+2];
355 double mass = 0;
356 int pid = 22;
357 if(i<2){
358 pid = fpid[i];
359 mass = fM;
360 }
361 double etot = sqrt(ptot*ptot + mass*mass*1e-6);
362 p = new GenParticle( HepLorentzVector(px,py,pz,etot), pid, 1);
363 p->suggest_barcode(i+3);
364 prod_vtx->add_particle_out(p);
365 npart++;
366 }
367 } else {
368 int ipart = CS->GenUnWeightedEvent();
369 size_t nmax = CS->GetNfinal() + ((ipart==0)?1:2);
370 for(size_t i=0;i<nmax;i++){
371 TLorentzVector &q = *(CS->GetParticles()[i]);
372 int pid = CS->GetPid(i);
373 p =
374 new GenParticle( HepLorentzVector(q.X()*1e-3,q.Y()*1e-3,q.Z()*1e-3,q.T()*1e-3), pid, 1);
375 p->suggest_barcode(i+3);
376 prod_vtx->add_particle_out(p);
377 npart++;
378 }
379 }
380
381 if( log.level() < MSG::INFO ){
382 evt->print();
383 }
384
385 // Check if the McCollection already exists
386 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(), "/Event/Gen");
387 if (anMcCol!=0){
388 // Add event to existing collection
389 log<<MSG::WARNING<<"add event"<<endreq;
390 MsgStream log(messageService(), name());
391 log << MSG::INFO << "Add McGenEvent to existing collection" << endreq;
392 McGenEvent* mcEvent = new McGenEvent(evt);
393 anMcCol->push_back(mcEvent);
394 } else {
395 // Create Collection and add to the transient store
396 log<<MSG::WARNING<<"create collection"<<endreq;
397 McGenEventCol *mcColl = new McGenEventCol;
398 McGenEvent* mcEvent = new McGenEvent(evt);
399 mcColl->push_back(mcEvent);
400 StatusCode sc = eventSvc()->registerObject("/Event/Gen",mcColl);
401 if (sc != StatusCode::SUCCESS) {
402 log << MSG::ERROR << "Could not register McGenEvent" << endreq;
403 delete mcColl;
404 delete evt;
405 delete mcEvent;
406 return StatusCode::FAILURE;
407 } else {
408 log << MSG::INFO << "McGenEventCol created and " << npart
409 <<" particles stored in McGenEvent" << endreq;
410 }
411 }
412
413 log<<MSG::WARNING<<"execute end"<<endreq;
414 return StatusCode::SUCCESS;
415}
double mass
Double_t etot
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
Definition KKsem.h:33
ObjectVector< McGenEvent > McGenEventCol
Definition McGenEvent.h:39
TRadCor * gRad
Definition Mcgpj.cxx:46
TCrossPart * CS
Definition Mcgpj.cxx:51
int GetPid(size_t i)
Definition TCrossPart.h:71
size_t GetNfinal()
Definition TCrossPart.h:70
size_t GenUnWeightedEvent()
TLorentzVector ** GetParticles()
Definition TCrossPart.h:67
unsigned int MakeEvent()

◆ finalize()

StatusCode Mcgpj::finalize ( )

Definition at line 417 of file Mcgpj.cxx.

417 {
418 MsgStream log(messageService(), name());
419
420 delete gRad;
421 delete MatrixElements;
422 delete gRandom;
423 delete gConst;
424 delete gGlobal;
425 delete gCut;
426
427 log << MSG::INFO << "Mcgpj finalized" << endreq;
428
429 return StatusCode::SUCCESS;
430}
TVCrossPart * MatrixElements
Definition Mcgpj.cxx:50
TConstants * gConst
Definition Mcgpj.cxx:49
TKinemCut * gCut
Definition Mcgpj.cxx:48
TRadGlobal * gGlobal
Definition Mcgpj.cxx:47

◆ initialize()

StatusCode Mcgpj::initialize ( )

Definition at line 86 of file Mcgpj.cxx.

86 {
87 MsgStream log(messageService(), name());
88
89 log << MSG::INFO << "Mcgpj initialize" << endreq;
90
91 static const bool CREATEIFNOTTHERE(true);
92 StatusCode RndmStatus = service("BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
93 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
94 {
95 log << MSG::ERROR << " Could not initialize Random Number Service" << endreq;
96 return RndmStatus;
97 }
98 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->GetEngine("Mcgpj");
99 engine->showStatus();
100
101 // GeV -> MeV
102 cmE *= 1e3;
103 de *= 1e3;
104 am *= 1e3;
105 cm *= 1e3;
106 em *= 1e3;
107
108 if(gRandom) delete gRandom;
109 gRandom = new TRandom3();
110 gRandom->SetSeed(engine->getSeed());
111 //gRandom->Dump();
112
113 if (proc<100){
114
115 gConst = new TConstants();
116 gGlobal = new TRadGlobal();
117 gCut = new TKinemCut();
118
119 if((proc%10)==3){
120 td = 0.025;
121 dt = 10;
122 dp = 10;
123 cm = 0;
124 am = 0;
125 }
126
127 const int MaxList = 20;
128 bool InList[MaxList];
129 for(int j = 0; j<MaxList; j++) InList[j] = true;
130
131 double EBeam = 0.5*cmE;
132
133 if( ( EBeam < 100 || EBeam > 2500 ) && !IsNoVacPol ){
134 log<<MSG::ERROR<<"Invalid value of beam energy:"<<EBeam<<endreq;
135 return StatusCode::FAILURE;
136 }
137
139
141
142 gGlobal->Set_Type((proc%10));
143
145
147
148 if(0>td)
149 gGlobal->Set_ThetaMin(at-dt/2);
150 else
152
153 if(0>de){
154 if((proc%10)==0)
155 gGlobal->Set_dE_Abs(0.015*EBeam);
156 else
157 gGlobal->Set_dE_Abs(0.0003*EBeam);
158 }
159 else
160 gGlobal->Set_dE_Abs(de);
161
162 if(0>nt0){
163 if(proc>10)
165 else
167 }else
169
170 if(0<thm){
171 gCut->ThetaMinM(thm);
172 gGlobal->Set_ThetaMin(thm);
173 }
174
175 if(0<thp)
176 gCut->ThetaMinP(thp);
177
178 gCut->CosPsi(cos(pc));
179
180 gCut->DeltaTheta(dt);
181
182 gCut->AverageTheta(at);
183
184 gCut->DeltaPhi(dp);
185
186 gCut->PAverage(am);
187
188 gCut->PCross(cm);
189
190 gCut->EMin(em);
191
193
194 gConst->Print();
195
196 try{
197 gGlobal->Init();
198 }catch(std::logic_error lge){
199 log<<MSG::ERROR<<lge.what()<<endreq;
200 return StatusCode::FAILURE;
201 }
202
203 gGlobal->SetDatadir(m_datapath);
204 gGlobal->SetVpolFname(m_vpolfname);
205// gGlobal->SetIntFname("");
206
207 gGlobal->Print();
208
209 gCut->Init();
210 gCut->Print();
211
212 log<<MSG::INFO<<"Cross-section statistical precision will be better than "
213 <<gGlobal->Get_TotalError()<<" nb and "
214 <<gGlobal->Get_RelativeError()*100<<"%"<<endreq;
215
216 if(!IsHardPhoton)
217 log<<MSG::INFO<<"Hard photon on big angle is not included!"<<endreq;
218
219 if(IsNoVacPol)
220 log<<MSG::INFO<<"Vacuum polarization is not included!"<<endreq;
221
222 if(!IsFSR)
223 log<<MSG::INFO<<"Final state radiation is not included!"<<endreq;
224
225 if(proc>10)
226 log<<MSG::INFO<<"Alpha order generation only!"<<endreq;
227
228 log<<std::flush;
229
230 if(proc==0){
232 InList[18] = false;
233 }
234 else if(proc==1 || proc==5)
236 else if(proc==2)
238 else if(proc==3)
240 else if(proc==4)
242 else if(proc==6)
244 else if(proc==10){
246 for(int j = 0; j<MaxList; j++) InList[j] = false;
247 InList[16] = true;
248 InList[17] = true;
249 InList[18] = true;
250 }
251 else
252 return StatusCode::FAILURE;
253
254 if(IsNoVacPol)
256
257 if(!IsFSR)
259
261 gRad->SetNEvents(NRad);
262 gRad->SetPartList(InList);
263 gRad->Init();
264
265 MatrixElements->SetHardPhoton(IsHardPhoton);
267 if((proc%10)==2)((TPiCrossPart*)MatrixElements)->GetFormFactor()->Print();
268
269 if((proc%10)==0){
270 fpid[0] = 11; fpid[1] = -11; fM = 0.51099891;
271 }
272 if((proc%10)==1){
273 fpid[0] = 13; fpid[1] = -13; fM = 105.658367;
274 }
275 if((proc%10)==2){
276 fpid[0] = 211; fpid[1] = -211; fM = 139.57018;
277 }
278 if((proc%10)==3){
279 fpid[0] = 130; fpid[1] = 310; fM = 497.614;
280 }
281 if((proc%10)==4){
282 fpid[0] = 321; fpid[1] = -321; fM = 493.677;
283 }
284 if((proc%10)==5){
285 fpid[0] = 15; fpid[1] = -15; fM = 1776.84;
286 }
287 if((proc%10)==6){
288 fpid[0] = 22; fpid[1] = 22; fM = 0;
289 }
290 }else{
291 double EBeam = 0.5*cmE;
292 if(0>de) de = 0.005*EBeam;
293
294 if(0>nt0) nt0 = 1;
295
296 if(proc==100)
297 {
298 CS = new T3piCrossPart(EBeam,de,nt0);
299 if(spread>0) CS->SetBeamSpread(spread);
300 }
301 else if( proc==101)
302 {
303 CS = new T4piCrossPart(EBeam,de,nt0);
304 if(spread>0) CS->SetBeamSpread(spread);
305 }
306 else if( proc==102)
307 {
308 CS = new T5piCrossPart(EBeam,de,nt0,m_fmode5pi);
309 if(spread>0) CS->SetBeamSpread(spread);
310 }
311 CS->MakeParts(te);
312 }
313
314 log << MSG::INFO << "Mcgpj initialize finished" << endreq;
315
316 return StatusCode::SUCCESS;
317}
double cos(const BesAngle a)
Definition BesAngle.h:213
const double EBeam
virtual CLHEP::HepRandomEngine * GetEngine(const std::string &StreamName)=0
Interface to the CLHEP engine.
void Print()
Definition TConstants.h:58
void SetAlphaScale(const double &x)
Definition TConstants.h:34
void MakeParts(double err)
void SetBeamSpread(double x=1)
Definition TCrossPart.h:73
double DeltaPhi()
Definition TKinemCut.h:31
void Print()
double DeltaTheta()
Definition TKinemCut.h:30
void AverageTheta(const double &x)
Definition TKinemCut.h:51
double PAverage()
Definition TKinemCut.h:32
double ThetaMinP()
Definition TKinemCut.h:42
double CosPsi()
Definition TKinemCut.h:35
double ThetaMinM()
Definition TKinemCut.h:40
double EMin()
Definition TKinemCut.h:34
double PCross()
Definition TKinemCut.h:33
void Init()
void SetNEvents(const unsigned int &n)
Definition TRadCor.h:48
void MakeCrossSection()
void SetPartList(const bool *InList)
Definition TRadCor.h:81
void Init()
void SetDatadir(std::string dir)
Definition TRadGlobal.h:113
void Set_ThetaMin(const double &x)
Definition TRadGlobal.h:86
void Set_Type(const int x)
Definition TRadGlobal.h:92
void Set_ThetaInt(const double &x)
Definition TRadGlobal.h:91
void Set_dE_Abs(const double &x)
Definition TRadGlobal.h:87
double Get_TotalError()
Definition TRadGlobal.h:82
double Get_RelativeError()
Definition TRadGlobal.h:83
void Set_RelativeError(const double &x)
Definition TRadGlobal.h:95
void SetVpolFname(std::string fname)
Definition TRadGlobal.h:114
void Set_Theta0_Rel(const double &x)
Definition TRadGlobal.h:90
void Print(void)
void Set_E(const double &x)
Definition TRadGlobal.h:85
void Init()
void Set_TotalError(const double &x)
Definition TRadGlobal.h:94
void SetNoFSR()
Definition TVCrossPart.h:34
virtual void SetHardPhoton(const bool &x)
Definition TVCrossPart.h:31
void SetZeroVP()
Definition TVCrossPart.h:32

The documentation for this class was generated from the following files: