本文整理汇总了C++中TChain::GetLeaf方法的典型用法代码示例。如果您正苦于以下问题:C++ TChain::GetLeaf方法的具体用法?C++ TChain::GetLeaf怎么用?C++ TChain::GetLeaf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TChain
的用法示例。
在下文中一共展示了TChain::GetLeaf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Parity_pi
//.........这里部分代码省略.........
TProfile *pParity_int_ww_oppo_run = new TProfile("Parity_int_ww_oppo_run","Parity_int_ww_oppo_run",10000,8000,18000,-100,100,"");
TProfile *pParity_int_ss_ran_obs1 = new TProfile("Parity_int_ss_ran_obs1","Parity_int_ss_ran_obs1",4,0.5,4.5,-100,100,"");
TProfile *pParity_int_ss_ran_obs2 = new TProfile("Parity_int_ss_ran_obs2","Parity_int_ss_ran_obs2",4,0.5,4.5,-100,100,"");
TProfile *pParity_int_ss_ran_obs3 = new TProfile("Parity_int_ss_ran_obs3","Parity_int_ss_ran_obs3",4,0.5,4.5,-100,100,"");
TProfile2D *pParity_eta_ss_obs1 = new TProfile2D("Parity_eta_ss_obs1","Parity_eta_ss_obs1",12,0.5,12.5,20,-1,1,-100,100,"");
TProfile2D *pParity_eta_ss_obs2 = new TProfile2D("Parity_eta_ss_obs2","Parity_eta_ss_obs2",12,0.5,12.5,20,-1,1,-100,100,"");
TProfile2D *pParity_eta_ss_obs3 = new TProfile2D("Parity_eta_ss_obs3","Parity_eta_ss_obs3",12,0.5,12.5,20,-1,1,-100,100,"");
TProfile2D *pParity_Deta_ss_obs1 = new TProfile2D("Parity_Deta_ss_obs1","Parity_Deta_ss_obs1",12,0.5,12.5,20,0,2,-100,100,"");
TProfile2D *pParity_Deta_ss_obs2 = new TProfile2D("Parity_Deta_ss_obs2","Parity_Deta_ss_obs2",12,0.5,12.5,20,0,2,-100,100,"");
TProfile2D *pParity_Deta_ss_obs3 = new TProfile2D("Parity_Deta_ss_obs3","Parity_Deta_ss_obs3",12,0.5,12.5,20,0,2,-100,100,"");
TProfile2D *pParity_pt_ss_obs1 = new TProfile2D("Parity_pt_ss_obs1","Parity_pt_ss_obs1",12,0.5,12.5,20,0,2.0,-100,100,"");
TProfile2D *pParity_pt_ss_obs2 = new TProfile2D("Parity_pt_ss_obs2","Parity_pt_ss_obs2",12,0.5,12.5,20,0,2.0,-100,100,"");
TProfile2D *pParity_pt_ss_obs3 = new TProfile2D("Parity_pt_ss_obs3","Parity_pt_ss_obs3",12,0.5,12.5,20,0,2.0,-100,100,"");
TProfile2D *pParity_Dpt_ss_obs1 = new TProfile2D("Parity_Dpt_ss_obs1","Parity_Dpt_ss_obs1",12,0.5,12.5,200,0,2.0,-100,100,"");
TProfile2D *pParity_Dpt_ss_obs2 = new TProfile2D("Parity_Dpt_ss_obs2","Parity_Dpt_ss_obs2",12,0.5,12.5,200,0,2.0,-100,100,"");
TProfile2D *pParity_Dpt_ss_obs3 = new TProfile2D("Parity_Dpt_ss_obs3","Parity_Dpt_ss_obs3",12,0.5,12.5,200,0,2.0,-100,100,"");
TProfile2D *pParity_Q_ss_obs1 = new TProfile2D("Parity_Q_ss_obs1","Parity_Q_ss_obs1",4,0.5,4.5,500,0,5.0,-100,100,"");
TProfile2D *pParity_Q_ss_obs2 = new TProfile2D("Parity_Q_ss_obs2","Parity_Q_ss_obs2",4,0.5,4.5,500,0,5.0,-100,100,"");
TProfile2D *pParity_Q_ss_obs3 = new TProfile2D("Parity_Q_ss_obs3","Parity_Q_ss_obs3",4,0.5,4.5,500,0,5.0,-100,100,"");
TProfile *pParity_noHBT_ss_obs2 = new TProfile("Parity_noHBT_ss_obs2","Parity_noHBT_ss_obs2",4,0.5,4.5,-100,100,"");
TProfile *pParity_noHBT_ss_obs3 = new TProfile("Parity_noHBT_ss_obs3","Parity_noHBT_ss_obs3",4,0.5,4.5,-100,100,"");
Int_t nentries = chain->GetEntries();
// nentries = 50000;
//loop through events
for(int i = 0; i < nentries; i++) {
if((i+1)%1000==0) cout<<"Processing entry == "<< i+1 <<" == out of "<<nentries<<".\n";
chain->GetEntry(i);
TLeaf* leaf_RunId = chain->GetLeaf("mRunId");
TLeaf* leaf_EventId = chain->GetLeaf("mEventId");
TLeaf* leaf_Trigger = chain->GetLeaf("mTrigger");
TLeaf* leaf_Bz = chain->GetLeaf("mBfield");
TLeaf* leaf_PrimaryVertexZ = chain->GetLeaf("mPrimaryVertexPositionZ");
TLeaf* leaf_VPDVz = chain->GetLeaf("mVPDEWdiff");
TLeaf* leaf_RefMult = chain->GetLeaf("mRefMult");
TLeaf* leaf_TOFMult = chain->GetLeaf("mTOFmult");
TLeaf* leaf_Centrality = chain->GetLeaf("mCentrality");
TLeaf* leaf_ZDC_EP = chain->GetLeaf("mZDC_EP");
TLeaf* leaf_ZDC = chain->GetLeaf("mZDC");
TLeaf* leaf_ZDCcoin = chain->GetLeaf("mZDCCoin");
TLeaf* leaf_BBCco = chain->GetLeaf("mBBCCoin");
TLeaf* leaf_NoTracks = chain->GetLeaf("mNumberOfV0s");
Run = (int)leaf_RunId->GetValue(0);
Event = (int)leaf_EventId->GetValue(0);
Trigger = (int)leaf_Trigger->GetValue(0);
Bz = leaf_Bz->GetValue(0);
PVtxz = leaf_PrimaryVertexZ->GetValue(0);
VPDvz = leaf_VPDVz->GetValue(0);
RefMult = (int)leaf_RefMult->GetValue(0);
TOFMult = (int)leaf_TOFMult->GetValue(0);
NPTracks= (int)leaf_NoTracks->GetValue(0);
ZDCw = leaf_ZDC->GetValue(1) + leaf_ZDC->GetValue(2) + leaf_ZDC->GetValue(3);
ZDCe = leaf_ZDC->GetValue(5) + leaf_ZDC->GetValue(6) + leaf_ZDC->GetValue(7);
ZDCcoin = leaf_ZDCcoin->GetValue(0);
BBCco = leaf_BBCco->GetValue(0);
psi_E = leaf_ZDC_EP->GetValue(0);
psi_W = leaf_ZDC_EP->GetValue(2);
mod_E = leaf_ZDC_EP->GetValue(1);
mod_W = leaf_ZDC_EP->GetValue(3);
Centrality = leaf_Centrality->GetValue(0);
示例2: Calc_Eff_200
void Calc_Eff_200(int cen) {
const float PI = TMath::Pi();
const float mean = 0.01166;
const float rms = 0.05312;
TFile *f1 = new TFile("cen6.ntuple_result_v2_11_subEP_dca1_pt015_eta1_noP_pionDca1_higherEP.root");
TH1* h_pt = (TH1*)f1->Get("Hist_Pt");
float real[9][7] = {{1.68441e+07,1.94857e+07,1.91433e+07,1.76339e+07,1.57031e+07,1.3709e+07,1.18246e+07},
{3.87595e+07,4.43888e+07,4.34577e+07,4.00144e+07,3.57267e+07,3.13252e+07,2.71556e+07},
{8.04378e+07,9.2009e+07,9.01896e+07,8.33911e+07,7.47927e+07,6.59201e+07,5.74707e+07},
{1.28651e+08,1.47865e+08,1.45606e+08,1.3528e+08,1.2199e+08,1.08084e+08,9.47436e+07},
{1.9998e+08,2.31542e+08,2.29316e+08,2.14124e+08,1.94076e+08,1.72786e+08,1.52079e+08},
{2.91541e+08,3.40818e+08,3.39637e+08,3.1877e+08,2.90097e+08,2.59203e+08,2.29072e+08},
{3.94517e+08,4.66796e+08,4.68155e+08,4.41467e+08,4.03254e+08,3.61425e+08,3.20203e+08},
{2.3895e+08,2.85928e+08,2.88314e+08,2.72767e+08,2.49768e+08,2.24261e+08,1.98897e+08},
{2.70925e+08,3.27361e+08,3.31383e+08,3.14285e+08,2.88208e+08,2.5899e+08,2.29898e+08}};
float emrc[9][7] = {{127.287,180.108,180.46,203.105,201.325,185.72,183.217},
{111.057,137.61,163.772,151.6,161.841,157.728,178.696},
{157.959,196.018,206.222,184.609,183.632,238.975,225.804},
{294.14,355.613,355.514,396.844,397.958,385.601,425},
{499,551,666,616,706,750,677},
{715,916,988,992,1031,1047,1070},
{1045,1247,1393,1414,1523,1589,1527},
{653,853,898,928,1016,1073,996},
{863,975,1199,1263,1262,1258,1314}};
const int cenDef[9] = {10, 22, 43, 76, 125, 193, 281, 396, 466};
float Eweight = 1;
TChain* chain = new TChain("McV0PicoDst");
int nfile = 0;
nfile += chain->Add("output_p/*.root");
nfile += chain->Add("output_pbar/*.root");
// nfile += chain->Add("output_test/*.root");
// nfile += chain->Add("output_km/*.root");
// nfile += chain->Add("output_kp/*.root");
cout <<"Added "<<nfile<<" files"<<endl;
cout<<"# entries in chain: "<<chain->GetEntries()<<endl;
char fname_out[200];
sprintf(fname_out,"cen%d.eff_200_p.root",cen);
TFile fout(fname_out,"RECREATE");
TH1D* Hist_RefMult = new TH1D("Hist_RefMult","Hist_RefMult",500,-0.5,499.5);
TH2D* Hist_mc_pt = new TH2D("Hist_mc_pt","Hist_mc_pt",28,0,560,200,0,10);
TH1D* Hist_mc_pt_cen = new TH1D("Hist_mc_pt_cen","Hist_mc_pt_cen",200,0,10);
TH1D* Hist_mc_pt_L = new TH1D("Hist_mc_pt_L","Hist_mc_pt_Lokesh",200,0,10);
TH1D* Hist_mc_eta = new TH1D("Hist_mc_eta","Hist_mc_eta",200,-1,1);
TH1D* Hist_rc_flag = new TH1D("Hist_rc_flag","Hist_rc_flag",3000,-1000+0.5,2000.5);
TH2D* Hist_rc_pt = new TH2D("Hist_rc_pt","Hist_rc_pt",28,0,560,200,0,10);
TH1D* Hist_rc_pt_cen = new TH1D("Hist_rc_pt_cen","Hist_rc_pt_cen",200,0,10);
TH1D* Hist_rc_pt_scale = new TH1D("Hist_rc_pt_scale","Hist_rc_pt_scale",200,0,10);
TH1D* Hist_rc_pt_L = new TH1D("Hist_rc_pt_L","Hist_rc_pt_Lokesh",200,0,10);
TH1D* Hist_rc_eta = new TH1D("Hist_rc_eta","Hist_rc_eta",200,-1,1);
TH1D* Hist_rc_dca = new TH1D("Hist_rc_dca","Hist_rc_dca",200,0,20);
TH1D* Hist_rc_dca_scale = new TH1D("Hist_rc_dca_scale","Hist_rc_dca_scale",200,0,20);
TH1D* Hist_rc_nfit = new TH1D("Hist_rc_nfit","Hist_rc_nfit",100,0,100);
TH1D* Hist_rc_rat = new TH1D("Hist_rc_rat","Hist_rc_rat",100,0,2);
TH1D* Hist_dphi = new TH1D("Hist_dphi","Hist_dphi",128,-3.2,3.2);
TH1D* Hist_dphi1 = new TH1D("Hist_dphi1","Hist_dphi1",128,-3.2,3.2);
TH1D* Hist_dphi2 = new TH1D("Hist_dphi2","Hist_dphi2",128,-3.2,3.2);
TH1D* Hist_dphi3 = new TH1D("Hist_dphi3","Hist_dphi3",128,-3.2,3.2);
TH1D* Hist_dphi4 = new TH1D("Hist_dphi4","Hist_dphi4",128,-3.2,3.2);
TH1D* Hist_dphi_pion = new TH1D("Hist_dphi_pion","Hist_dphi_pion",128,-3.2,3.2);
TH1D* Hist_ddphi = new TH1D("Hist_ddphi","Hist_ddphi",128,-3.2,3.2);
TProfile* p_dphi = new TProfile("p_dphi","p_dphi",4,0.5,4.5,-100,100);
TProfile* p_dphi_pt = new TProfile("p_dphi_pt","p_dphi_pt",200,0,10,-100,100);
TProfile* p_dphi_L = new TProfile("p_dphi_L","p_dphi_L",4,0.5,4.5,-100,100);
TProfile* p_dphi_LM= new TProfile("p_dphi_LM","p_dphi_LM",4,0.5,4.5,-100,100);
TProfile* p_dphi_M = new TProfile("p_dphi_M","p_dphi_M",4,0.5,4.5,-100,100);
TProfile* p_dphi_RM= new TProfile("p_dphi_RM","p_dphi_RM",4,0.5,4.5,-100,100);
TProfile* p_dphi_R = new TProfile("p_dphi_R","p_dphi_R",4,0.5,4.5,-100,100);
TProfile* p_ddphi = new TProfile("p_ddphi","p_ddphi",4,0.5,4.5,-100,100);
TProfile* p_ddphi_L = new TProfile("p_ddphi_L","p_ddphi_L",4,0.5,4.5,-100,100);
TProfile* p_ddphi_LM= new TProfile("p_ddphi_LM","p_ddphi_LM",4,0.5,4.5,-100,100);
TProfile* p_ddphi_M = new TProfile("p_ddphi_M","p_ddphi_M",4,0.5,4.5,-100,100);
TProfile* p_ddphi_RM= new TProfile("p_ddphi_RM","p_ddphi_RM",4,0.5,4.5,-100,100);
TProfile* p_ddphi_R = new TProfile("p_ddphi_R","p_ddphi_R",4,0.5,4.5,-100,100);
TH1D* Hist_asym = new TH1D("Hist_asym","Hist_asym",600,-1.5+0.0025,1.5+0.0025);
TH1D* Hist_asym_L = new TH1D("Hist_asym_L","Hist_asym_L",600,-1.5+0.0025,1.5+0.0025);
TH1D* Hist_asym_LM= new TH1D("Hist_asym_LM","Hist_asym_LM",600,-1.5+0.0025,1.5+0.0025);
TH1D* Hist_asym_M = new TH1D("Hist_asym_M","Hist_asym_M",600,-1.5+0.0025,1.5+0.0025);
TH1D* Hist_asym_RM= new TH1D("Hist_asym_RM","Hist_asym_RM",600,-1.5+0.0025,1.5+0.0025);
TH1D* Hist_asym_R = new TH1D("Hist_asym_R","Hist_asym_R",600,-1.5+0.0025,1.5+0.0025);
Int_t nentries = chain->GetEntries();
for(int i = 0; i < nentries; i++){
if((i+1)%1000==0) cout<<"Processing entry == "<< i+1 <<" == out of "<<nentries<<".\n";
chain->GetEntry(i);
TLeaf* leaf_RunId = chain->GetLeaf("runnumber");
TLeaf* leaf_RefMult = chain->GetLeaf("nrefmult");
TLeaf* leaf_Px = chain->GetLeaf("primvertexX");
TLeaf* leaf_Py = chain->GetLeaf("primvertexY");
TLeaf* leaf_Pz = chain->GetLeaf("primvertexZ");
TLeaf* leaf_ZDCrate = chain->GetLeaf("zdcrate");
TLeaf* leaf_nmcv0 = chain->GetLeaf("nmcv0");
TLeaf* leaf_nv0 = chain->GetLeaf("nv0");
TLeaf* leaf_Np = chain->GetLeaf("numberP");
//.........这里部分代码省略.........
示例3: main
int main(int argc, char* argv[])
{
vector<vector<double> >* voltages = new vector<vector<double> >;
vector<vector<double> >* currents = new vector<vector<double> >;
voltages->resize(52);
currents->resize(52);
TChain* chain = loadChain(argc, argv);
int entries = chain->GetEntries();
cout << entries/2 << " files\n";
for(int i=0; i<entries; i++)
{
chain->GetEvent(i);
for(int slot=0; slot<16; slot++)
{
TLeaf* vleaf = chain->GetLeaf(("VHS_"+target_card[slot]+".VM."+target_channel[slot]).c_str());
voltages->at(slot).push_back(vleaf->GetValue(0));
TLeaf* ileaf = chain->GetLeaf(("VHS_"+target_card[slot]+".IM."+target_channel[slot]).c_str());
currents->at(slot).push_back(ileaf->GetValue(0));
}
for(int slot=0; slot<36; slot++)
{
if(veto_card[slot]=="4_3")
{
voltages->at(slot+16).push_back(-1);
currents->at(slot+16).push_back(-1);
}
else
{
TLeaf* vleaf = chain->GetLeaf(("VHS_"+veto_card[slot]+".VM."+veto_channel[slot]).c_str());
voltages->at(slot+16).push_back(vleaf->GetValue(0));
TLeaf* ileaf = chain->GetLeaf(("VHS_"+veto_card[slot]+".IM."+veto_channel[slot]).c_str());
currents->at(slot+16).push_back(ileaf->GetValue(0));
}
}
}
const double allowed_dv = 100;
const double allowed_di = 50e-06;
vector<bool> pmt_flags_v;
vector<bool> pmt_flags_i;
pmt_flags_v.resize(52,0);
pmt_flags_i.resize(52,0);
for( auto pmt = voltages->begin();
pmt!=voltages->end(); ++pmt )
{
double meanvalue = mean(*pmt);
double deviation = std_dev(*pmt);
//cout << "Mean: " << meanvalue << " Dev: " << deviation << endl;
for(auto it2 = (*pmt).begin();
it2!=(*pmt).end(); ++it2)
{
//cout << distance((*it).begin(), it2) << " ";
if( abs(*it2-meanvalue) > allowed_dv )
pmt_flags_v.at( distance(voltages->begin(), pmt) ) = true;
}
}
for( auto pmt = currents->begin();
pmt!=currents->end(); ++pmt )
{
double meanvalue = mean(*pmt);
double deviation = std_dev(*pmt);
for(auto it2 = (*pmt).begin();
it2!=(*pmt).end(); ++it2)
if( abs(*it2-meanvalue) > allowed_di )
pmt_flags_i.at( distance(currents->begin(), pmt) ) = true;
}
bool error = false;
// Now if we managed to pick up some flags lets say so
for(auto it = pmt_flags_v.begin();
it!=pmt_flags_v.end(); ++it)
if(*it==true)
{
cout << "PMT: " << distance(pmt_flags_v.begin(), it) << " varied VOLTAGE more than "
<< allowed_dv << " from its mean value" << endl;
error = true;
}
for(auto it = pmt_flags_i.begin();
it!=pmt_flags_i.end(); ++it)
if(*it==true)
{
cout << "PMT: " << distance(pmt_flags_i.begin(), it) << " varied CURRENT more than "
<< allowed_di << " from its mean value" << endl;
error = true;
}
if(error == true)
{
cout << ">>> See error.txt for full report <<<" << endl;
writeReport(voltages, pmt_flags_v, currents, pmt_flags_i);
}
delete currents;
//.........这里部分代码省略.........