BOSS 7.0.5
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 ()
 
 Mcgpj (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Definition at line 20 of file Generator/Mcgpj/Mcgpj-00-01-04/Mcgpj/Mcgpj.h.

Constructor & Destructor Documentation

◆ Mcgpj() [1/2]

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

Definition at line 54 of file Mcgpj.cxx.

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

◆ Mcgpj() [2/2]

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

Member Function Documentation

◆ execute() [1/2]

StatusCode Mcgpj::execute ( )

Definition at line 318 of file Mcgpj.cxx.

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

◆ execute() [2/2]

StatusCode Mcgpj::execute ( )

◆ finalize() [1/2]

StatusCode Mcgpj::finalize ( )

Definition at line 416 of file Mcgpj.cxx.

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

◆ finalize() [2/2]

StatusCode Mcgpj::finalize ( )

◆ initialize() [1/2]

StatusCode Mcgpj::initialize ( )

Definition at line 85 of file Mcgpj.cxx.

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

◆ initialize() [2/2]

StatusCode Mcgpj::initialize ( )

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