本文整理汇总了C++中Particles::analyze方法的典型用法代码示例。如果您正苦于以下问题:C++ Particles::analyze方法的具体用法?C++ Particles::analyze怎么用?C++ Particles::analyze使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Particles
的用法示例。
在下文中一共展示了Particles::analyze方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mainanalyze
void mainanalyze(TTree *particletree, const float beam_momentum, const TString output_filename="Extracted_distributions.root")
{
cout << "Beta calculated for nucleon mass: " << nucleon_mass << " GeV/c^2 and beam momentum: " << beam_momentum << endl;
float angle,
p1, p2,
pt1, pt2,
pz_cms1, pz_cms2,
E1, E2,
E_prot,
inv_mass,
gbE1, gbE2,
theta1, theta2,
y1, y2,
y_prot_cms,
eta1, eta2,
angle_j,
angle_diff,
y_diff,
eta_diff;
bool positive,
positive_j;
int n[3];
unsigned int all_particles=0;
UInt_t i,j;
TLorentzVector v1, v2, v;
unsigned correlations = 0, pos_correlations = 0, neg_correlations = 0, all_correlations = 0, unlike_correlations = 0;
Event *event = new Event();
Particle *particleA, *particleB;
particletree->SetBranchAddress("event",&event);
Long64_t treeNentries = particletree->GetEntries();
cout << "Number of events: " << treeNentries << endl;
Long64_t ev;
Particles particles;
Histos histos;
TFile *root_output_file;
histos.init();
particles.init(&histos, beam_momentum);
particles.newEvent(true);
root_output_file = new TFile(output_filename,"recreate");
cout << "Writing events" << endl;
for(ev=0; ev<treeNentries; ++ev)
{
particletree->GetEntry(ev);
n[Neg] = n[All] = n[Pos] = 0;
for(i=0; i<event->GetNpa(); ++i)
{
particleA = event->GetParticle(i);
pt1 = TMath::Sqrt(TMath::Power(particleA->GetPx(),2)+TMath::Power(particleA->GetPy(),2));
p1 = TMath::Sqrt(TMath::Power(particleA->GetPx(),2)+TMath::Power(particleA->GetPy(),2)+TMath::Power(particleA->GetPz(),2));
E1 = TMath::Sqrt(pion_mass*pion_mass+p1*p1);
E_prot = TMath::Sqrt(proton_mass*proton_mass+p1*p1);
y_prot_cms = 0.5*TMath::Log((E_prot+particleA->GetPz())/(E_prot-particleA->GetPz())) - particles.y_cms;
v1.SetPxPyPzE(particleA->GetPx(),particleA->GetPy(),particleA->GetPz(),E1);
//Minimal pT cut
// if(pt1 < 0.2)
// continue;
y1 = 0.5*TMath::Log((E1+particleA->GetPz())/(E1-particleA->GetPz())) - particles.y_cms;
angle = TMath::ATan2(particleA->GetPy(), particleA->GetPx());
particles.analyze(particleA,beam_momentum);
positive = particleA->isPositive();
if(event->GetNpa() > 1)
{
for(j=i+1; j<event->GetNpa(); ++j)
{
particleB = event->GetParticle(j);
pt2 = TMath::Sqrt(TMath::Power(particleB->GetPx(),2)+TMath::Power(particleB->GetPy(),2));
p2 = TMath::Sqrt(TMath::Power(particleB->GetPx(),2)+TMath::Power(particleB->GetPy(),2)+TMath::Power(particleB->GetPz(),2));
//cout << "p1 = " << p1 << " | p2 = " << p2 << endl;
E2 = TMath::Sqrt(pion_mass*pion_mass+p2*p2);
E_prot = TMath::Sqrt(proton_mass*proton_mass+p2*p2);
y_prot_cms = 0.5*TMath::Log((E_prot+particleB->GetPz())/(E_prot-particleB->GetPz())) - particles.y_cms;
v2.SetPxPyPzE(particleB->GetPx(),particleB->GetPy(),particleB->GetPz(),E2);
v = v1 + v2;
inv_mass = v.M();
// if(inv_mass < 0.285) //GeV dipion (280 MeV) + Coulomb interactions (5 MeV)
// continue;
//.........这里部分代码省略.........