本文整理汇总了C++中TNtuple::GetBranch方法的典型用法代码示例。如果您正苦于以下问题:C++ TNtuple::GetBranch方法的具体用法?C++ TNtuple::GetBranch怎么用?C++ TNtuple::GetBranch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TNtuple
的用法示例。
在下文中一共展示了TNtuple::GetBranch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: n3HeSim
float n3HeSim(int nev_=0, float rfsf_phi_=300, int sev=0)
{
// commandline option '-var=val' to change any global
for (int i=1; i<gApplication->Argc(); ++i)
{
TString opt(gApplication->Argv(i));
if ((opt[0]=='-' || opt[0]=='+') && opt.Contains("="))
gROOT->ProcessLine(opt=opt.Append(";").Strip(TString::kLeading,'-'));
}
if (nev_)
nev = nev_;
if (rfsf_phi_!=0)
rfsf_phi=rfsf_phi_/360.;
TFile* f = new TFile("/home/siplu/GIT/n3He_Soft/Github/Simulation/data/mcstas.root");
TNtuple* ntp = (TNtuple*)f->Get("mcstas");
// set up ntuple
BRANCH(l);
BRANCH(pol);
BRANCH(p5);
BRANCH(p6);
BRANCH(t6);
BRANCH(x6);
BRANCH(y6);
BRANCH(vx6);
BRANCH(vy6);
BRANCH(vz6);
float chop[4];
TBranch* b_chop[4];
for (int j=0;j<nch;++j)
{
b_chop[j]=ntp->GetBranch(vch[j]);
ntp->SetBranchAddress(vch[j],&chop[j]);
}
// precalculate track projections
float dwc = lwc/nz; // WC parameters
float da = 2./na, a0=-1+da/2; // polar [cos(theta)] integration
float db = 2*PI/nb, b0=-PI+db/2; // azimuthal [phi] integration
float cxyz[3], &cx=cxyz[0],&cy=cxyz[1],&cz=cxyz[2]; // projection cosines
float ccz[NDIV], ccx[NDIV][NDIV], ccy[NDIV][NDIV], as; // cached values
float aa=a0;
for (int ia=0; ia<na; ++ia, aa+=da)
{
ccz[ia]=aa;
if (ccz[ia]==0)
ccz[ia]=1e-11;
as=sqrt(1-aa*aa);
float bb=b0;
for (int ib=0; ib<nb; ++ib, bb+=db)
{
ccx[ia][ib]=as*cos(bb);
if (ccx[ia][ib]==0)
ccx[ia][ib]=1e-11;
ccy[ia][ib]=as*sin(bb);
if (ccy[ia][ib]==0)
ccy[ia][ib]=1e-11;
}
}
// cumulative beta distribution
for (int i=0;i<nbet;++i)
beta_int[i+1]=beta_int[i]+beta_pt[i];
// initialize WC response matrices
double n5 = 0; // pre-polarizer neutrons
double N[NTOF]={0}; // chopped neutrons at end of SMpol
double P2N[NTOF]={0}; // " * P^2
double WN[NTOF]={0}; // captures in 3He target
double BN[NTOF][nwc]={{0}}; // N_i = N beta_i = \sum{n_i} ions
double GBN[NTOF][nwc]={{0}}; // M_i = N_i gamma_i = \sum{n_i gamma}
double D2N[NTOF][nwc][nwc]={{{0}}}; // delta^2 N_ij = covariance
double GW[NTOF][nwc]={{0}}; // weight of each element
// loop over events, fill "n","p2n" histograms, wc response matrices
if (ntp->GetEntries()<nev)
nev=ntp->GetEntries();
for (int iev=sev;iev<sev+nev;++iev)
{
if (verbose && cnt)
{ // :........:....
if (iev%(50*cnt)==0)
cout<<endl<<" :"<<flush;
else if (iev%(10*cnt)==0)
cout<<":"<<flush;
else if (iev%cnt==0) cout<<"."<<flush;
}
// read variables
ntp->GetEntry(iev);
hl5.Fill(l,p5*1.4/2*60);
n5 += p5;
hl6.Fill(l,p6*1.4/2*60);
// polarizer
float tx = 1; //Transmission
b_pol->GetEntry(iev);
if (pol!=pol)
//.........这里部分代码省略.........