本文整理汇总了C++中TParticle::Energy方法的典型用法代码示例。如果您正苦于以下问题:C++ TParticle::Energy方法的具体用法?C++ TParticle::Energy怎么用?C++ TParticle::Energy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TParticle
的用法示例。
在下文中一共展示了TParticle::Energy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FinishEvent
//________________________________________________________________________________
void StarMCHits::FinishEvent() {
static const Double_t pEMax = 1 - 1.e-10;
TDataSet *m_DataSet = StarMCHits::instance()->GetHitHolder();
if (! m_DataSet) return;
St_g2t_event *g2t_event = new St_g2t_event("g2t_event",1);
m_DataSet->Add(g2t_event);
g2t_event_st event;
memset (&event, 0, sizeof(g2t_event_st));
fEventNumber++;
event.n_event = fEventNumber;//IHEAD(2)
event.ge_rndm[0] = fSeed;//IHEAD(3)
event.ge_rndm[1] = 0;//IHEAD(4)
event.n_run = 1;
event.n_track_eg_fs = StarVMCApplication::Instance()->GetStack()->GetNtrack();
event.n_track_prim = StarVMCApplication::Instance()->GetStack()->GetNprimary();
event.prim_vertex_p = 1;
event.b_impact = 99;
event.phi_impact = 0.5;
g2t_event->AddAt(&event);
Int_t NoVertex = 1;
St_g2t_vertex *g2t_vertex = new St_g2t_vertex("g2t_vertex",NoVertex);
m_DataSet->Add(g2t_vertex);
g2t_vertex_st vertex;
Int_t NTracks = StarVMCApplication::Instance()->GetStack()->GetNtrack();
St_g2t_track *g2t_track = new St_g2t_track ("g2t_track",NTracks);
m_DataSet->Add(g2t_track);
g2t_track_st track;
StarMCParticle *particle = 0;
Int_t iv = 0;
TLorentzVector oldV(0,0,0,0);
TLorentzVector newV(0,0,0,0);
TLorentzVector devV(0,0,0,0);
for (Int_t it = 0; it <NTracks; it++) {
memset(&track, 0, sizeof(g2t_track_st));
particle = (StarMCParticle*) StarVMCApplication::Instance()->GetStack()->GetParticle(it);
TParticle *part = (TParticle *) particle->GetParticle();
part->ProductionVertex(newV);
devV = newV - oldV;
if (iv == 0 || devV.Mag() > 1.e-7) {
if (iv > 0) g2t_vertex->AddAt(&vertex);
memset (&vertex, 0, sizeof(g2t_vertex_st));
iv++;
vertex.id = iv ;// primary key
vertex.event_p = 0 ;// pointer to event
vertex.eg_label = 0 ;// generator label (0 if GEANT)
vertex.eg_tof = 0 ;// vertex production time
vertex.eg_proc = 0 ;// event generator mechanism
memcpy(vertex.ge_volume," ",4); ;// GEANT volume name
vertex.ge_medium = 0 ;// GEANT Medium
vertex.ge_tof = 0 ;// GEANT vertex production time
vertex.ge_proc = 0 ;// GEANT mechanism (0 if eg)
vertex.ge_x[0] = newV.X() ;// GEANT vertex coordinate
vertex.ge_x[1] = newV.Y() ;
vertex.ge_x[2] = newV.Z() ;
vertex.ge_tof = newV.T() ;
vertex.n_parent = 0 ;// number of parent tracks
vertex.parent_p = 0 ;// first parent track
vertex.is_itrmd = 0 ;// flags intermediate vertex
vertex.next_itrmd_p = 0 ;// next intermedate vertex
vertex.next_prim_v_p= 0 ;// next primary vertex
oldV = newV;
}
vertex.n_daughter++;
track.id = it+1;
track.eg_label = particle->GetIdGen();
track.eg_pid = part->GetPdgCode();
track.ge_pid = gMC->IdFromPDG(track.eg_pid);
track.start_vertex_p = iv;
track.p[0] = part->Px();
track.p[1] = part->Py();
track.p[2] = part->Pz();
track.ptot = part->P();
track.e = part->Energy();
track.charge = part->GetPDG()->Charge()/3;
Double_t ratio = part->Pz()/part->Energy();
ratio = TMath::Min(1.-1e-10,TMath::Max(-1.+1e-10, ratio));
track.rapidity = TMath::ATanH(ratio);
track.pt = part->Pt();
ratio = part->Pz()/part->P();
ratio = TMath::Min(pEMax,TMath::Max(-pEMax, ratio));
track.eta = TMath::ATanH(ratio);
g2t_track->AddAt(&track);
}
g2t_vertex->AddAt(&vertex);
}