本文整理汇总了C++中TChain::Print方法的典型用法代码示例。如果您正苦于以下问题:C++ TChain::Print方法的具体用法?C++ TChain::Print怎么用?C++ TChain::Print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TChain
的用法示例。
在下文中一共展示了TChain::Print方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
TChain* load (std::string methodName)
{
TString trainingFileName ("training");
TString fname0 = pathToData + trainingFileName + TString (".root");
TString fname1 = trainingFileName + TString ("_prediction__") + methodName + TString (".root");
TChain* ch = new TChain ("data");
ch->Add (fname0);
TChain* fr = new TChain ("data");
fr->Add (fname1);
ch->AddFriend (fr,"s");
ch->Print ("");
return ch;
}
示例2: run
//.........这里部分代码省略.........
AliAnalysisMultPbCentralitySelector * centrSelector = new AliAnalysisMultPbCentralitySelector();
centrSelector->SetIsMC(isMC);
centrSelector->SetCentrTaskFiles(file1,file2); // for bookkeping only
centrSelector->SetCentralityBin(centrBin);
if (!useSingleBin) centrSelector->SetCentralityBin(0); // FIXME: ok?
centrSelector->SetCentralityEstimator(centrEstimator);
if(useOtherCentralityCut == 1){
cout << "Setting centrality by MULT" << endl;
centrSelector->SetUseMultRange();
centrSelector->SetMultRange(trackMin,trackMax);
}
if(useOtherCentralityCut == 2){
cout << "Setting centrality by V0" << endl;
centrSelector->SetUseV0Range();
centrSelector->SetMultRange(trackMin,trackMax);
}
if(useOtherCentralityCut == 3){
cout << "Setting centrality by SPD outer" << endl;
centrSelector->SetUseSPDOuterRange();
centrSelector->SetMultRange(trackMin,trackMax);
}
// load my task
if (useSingleBin) {
gROOT->ProcessLine(".L $ALICE_ROOT/PWG0/multPbPb/AddTaskMultPbPbTracks.C");
AliAnalysisTaskMultPbTracks * task = AddTaskMultPbPbTracks("multPbPbtracks.root", cuts, centrSelector);
task->SetIsMC(useMCKinematics);
task->SetOfflineTrigger(AliVEvent::kMB);
if(optionStr.Contains("TPC")) task->SetTPCOnly();
if(optionStr.Contains("NoElectrons")) task->RejectElectrons(kTRUE);
if(useMCKinematics) task->GetHistoManager()->SetSuffix("MC");
if(customSuffix!=""){
cout << "Setting custom suffix: " << customSuffix << endl;
task->GetHistoManager()->SetSuffix(customSuffix);
}
} else {
gROOT->ProcessLine(".L $ALICE_ROOT/PWG0/multPbPb/AddTaskMultPbPbTracksAllCentrality.C");
centrSelector->SetUseV0Range(kTRUE);
Int_t ncentr = 11;
const Float_t minCentr[] = {0 ,79 ,239,559 ,1165,2135,3555,5525,8213 ,12191,15079};
const Float_t maxCentr[] = {79,239,559,1165,2135,3555,5525,8213,12191,15079,21000};
AliAnalysisTaskMultPbTracks ** tasks = AddTaskMultPbPbTracksAllCentrality("multPbPbtracks.root", cuts, centrSelector, ncentr,minCentr,maxCentr);
for(Int_t icentr = 0; icentr < ncentr; icentr++){
tasks[icentr]->Print();
cout << "MC KINEMATICS:" << useMCKinematics << endl;
tasks[icentr]->SetIsMC(useMCKinematics);
tasks[icentr]->SetOfflineTrigger(AliVEvent::kMB);
if(optionStr.Contains("TPC")) tasks[icentr]->SetTPCOnly();
if(optionStr.Contains("NoElectrons")) task[icentr]->RejectElectrons(kTRUE);
if(useMCKinematics) tasks[icentr]->GetHistoManager()->SetSuffix("MC");
if(customSuffix!=""){
cout << "Setting custom suffix: " << customSuffix+long(icentr) << endl;
tasks[icentr]->GetHistoManager()->SetSuffix(customSuffix+long(icentr));
}
}
}
// Init and run the analy
if (!mgr->InitAnalysis()) return;
mgr->PrintStatus();
if (runMode == kMyRunModeLocal ) {
// If running in local mode, create chain of ESD files
cout << "RUNNING LOCAL, CHAIN" << endl;
TChain * chain = GetAnalysisChain(data);
chain->Print();
mgr->StartAnalysis("local",chain,nev);
} else if (runMode == kMyRunModeProofLite) {
TChain * chain = GetAnalysisChain(data);
mgr->StartAnalysis("proof",chain,nev);
}
else if (runMode == kMyRunModeCAF) {
mgr->StartAnalysis("proof",TString(data)+"#esdTree",nev);
} else if (runMode == kMyRunModeGRID) {
mgr->StartAnalysis("grid");
} else {
cout << "ERROR: unknown run mode" << endl;
}
if (!useOtherCentralityCut) {
pathsuffix = pathsuffix + "_" + centrEstimator + "_bin_"+long(centrBin);
} else if(useOtherCentralityCut==1){
pathsuffix = pathsuffix + "_TrackRange_" + long(trackMin) + "_" + long(trackMax);
} else if(useOtherCentralityCut==2){
pathsuffix = pathsuffix + "_V0Range_" + long(trackMin) + "_" + long(trackMax);
} else if(useOtherCentralityCut==3){
pathsuffix = pathsuffix + "_SPDOutRange_" + long(trackMin) + "_" + long(trackMax);
}
pathsuffix += customSuffix;
if (doSave) MoveOutput(data, pathsuffix.Data());
}
示例3: Play
void Play()
{
//gSystem->Load("libRooFit");
//using namespace RooFit;
TChain* S = new TChain("mjdTree");
//Look at COPPI calibration data from Nov 2013
S->Add("/project/projectdirs/majorana/data/mjd/surfprot/data/gatified/P3AKF/mjd_run40001923.root");
S->Add("/project/projectdirs/majorana/data/mjd/surfprot/data/gatified/P3AKF/mjd_run40001924.root");
S->Add("/project/projectdirs/majorana/data/mjd/surfprot/data/gatified/P3AKF/mjd_run40001925.root");
S->Add("/project/projectdirs/majorana/data/mjd/surfprot/data/gatified/P3AKF/mjd_run40001926.root");
S->Add("/project/projectdirs/majorana/data/mjd/surfprot/data/gatified/P3AKF/mjd_run40001927.root");
S->Add("/project/projectdirs/majorana/data/mjd/surfprot/data/gatified/P3AKF/mjd_run40001928.root");
S->Print();
//S->Add("COPPIsA__run1131.root");
TH1D *hc146 = new TH1D("hc146","Channel 146", 2000, 0, 800E3 );
TH1D *hc147 = new TH1D("hc147","Channel 147", 2000, 0, 800E3 );
TCanvas* c1 = new TCanvas("c1","",1500,800);
TCanvas* c2 = new TCanvas("c2","",1500,800);
TCanvas* c3 = new TCanvas("c3","",1500,800);
c1->Divide(1,2);
c2->Divide(1,2);
c3->Divide(1,2);
// --- Find Peaks in Spectrum ---
c1->cd(1);
S->Draw("energy>>hc146","channel==146");
c1->cd(2);
S->Draw("energy>>hc147","channel==147");
// we calibrate with 133Ba and 60Co so let's build TSpectrum and look for those peaks
// let's focus on the highest intensity lines:
// 30.973 0.628
// 356.0129 0.6205
// 30.625 0.34
// 80.9979 0.329
//
// 1332.492 0.999826
// 1173.228 0.9985
// 8.26-8.33 0.0000136
// 7.46-7.48 0.000098
//Use a gaussian to fit each of the peaks.
TF1* tgaus = new TF1("tgaus","gaus",0,900E3);
c1->cd(1);
TSpectrum *s = new TSpectrum(12);
Int_t nfound = s->Search(hc146,3,"",0.05);
vector<calData> x146; //TSpectrum guess
printf("Found %d candidate peaks to fit in channel 146 spectrum:\n",nfound);
TH1 *hb = s->Background(hc146,20,"same");
TH1D* hc146bf = (TH1D*)hc146->Clone("hc146bf");
hc146bf->Add(hb,-1);
if (hb) c1->Update();
c2->cd(1);
hc146bf->Draw();;
Float_t *xpeaks = s->GetPositionX();
calData d;
for (int i = 0; i < nfound; i++) {
//printf("%f : %f \n",s->GetPositionX()[i],s->GetPositionY()[i]);
d.adc=s->GetPositionX()[i];
x146.push_back(d);
}
sort(x146.begin(),x146.end(),CompareByadc);
for(std::vector<calData>::iterator it=x146.begin(); it!=x146.end(); ++it)
{
tgaus->SetParameter(1,(*it).adc);
TFitResultPtr r = hc146bf->Fit(tgaus,"SQ+","",(*it).adc-0.02*((*it).adc),(*it).adc+0.02*((*it).adc));
(*it).fadc=r->Parameter(1);
(*it).efadc=r->ParError(1);
}
cout << " Ts X \t\t Fit X \t\t\t err(x) " << endl;
for(int i = 0; i < nfound; i++)
{
printf("%f \t %f \t +/- \t %f \n",x146[i].adc,x146[i].fadc,x146[i].efadc);
}
c1->cd(2);
nfound = s->Search(hc147,3,"",0.05);
vector<calData> x147; //TSpectrum guess
printf("Found %d candidate peaks to fit in channel 147 spectrum:\n",nfound);
TH1 *hb147 = s->Background(hc147,20,"same");
TH1D* hc147bf = (TH1D*)hc147->Clone("hc147bf");
hc147bf->Add(hb147,-1);
if (hb147) c1->Update();
c2->cd(2);
hc147bf->Draw();;
xpeaks = s->GetPositionX();
for (int i = 0; i < nfound; i++) {
//printf("%f : %f \n",s->GetPositionX()[i],s->GetPositionY()[i]);
d.adc=s->GetPositionX()[i];
x147.push_back(d);
}
sort(x147.begin(),x147.end(),CompareByadc);
for(std::vector<calData>::iterator it=x147.begin(); it!=x147.end(); ++it)
{
tgaus->SetParameter(1,(*it).adc);
//.........这里部分代码省略.........
示例4: filter
//.........这里部分代码省略.........
fname = string("fil_b2dh_gen.root");
break;
default:
return;
}
Double_t p_d0,p_h0,p_ks,p_pi0_h0,p_pip_h0,p_pim_h0,pi0_chi2,egamma,cos_thr,cos_hel,thr_sig,thr_oth;
Int_t ndf_tag_vtx,phsp,bin,exp,run,evtn;
Int_t b0f,d0f;
Double_t k0mm2,k0et,k0hso00,k0hso02,k0hso04,k0hso10,k0hso12,k0hso14,k0hso20,k0hso22,k0hso24,k0hoo0,k0hoo1,k0hoo2,k0hoo3,k0hoo4;
Double_t k1mm2,k1et,k1hso00,k1hso01,k1hso02,k1hso03,k1hso04,k1hso10,k1hso12,k1hso14,k1hso20,k1hso22,k1hso24,k1hoo0,k1hoo1,k1hoo2,k1hoo3,k1hoo4;
Double_t mbc,de,mp,mm,dz,atckpi_max,mpi0,mh0,mk;
Double_t ks_dr,ks_dz,ks_dphi,ks_fl,tag_LH,tag_LH_err;
Double_t mp_mc,mm_mc,d0_t_mc,dt_mc,dz_mc,bin_mc,flv_mc,d0_flv_mc;
// Double_t z_sig_d0;
// Double_t sz_sig_d0;
// Double_t dz_mc_sig_d0;
Double_t chi2_vtx_d0, chi2_mass_d0;
Int_t good_icpv;//,good_icpv_d0;
Int_t mode,h0mode,h0f,pi0f;
Double_t z_sig,z_asc;
Double_t sz_sig,sz_asc;
Int_t ntrk_sig,ntrk_asc,ndf_z_sig,ndf_z_asc;
Double_t chisq_z_sig,chisq_z_asc,h0_chi2;
Double_t cl_z_sig,cl_z_asc;
Double_t costhB,costhBcms,Ecms;
Double_t t_sig_mc,z_sig_mc,t_asc_mc,z_asc_mc;
Double_t dz_mc_sig, dz_mc_asc;
Double_t z_upsilon;
// Double_t dz_pull_sig,dz_pull_sig_d0,dz_pull_asc;
Int_t nptag;
tree->Print();
TFile *ofile = new TFile(fname.c_str(),"RECREATE");
TTree* TEvent = new TTree("TEvent","TEvent");
tree->SetBranchAddress("exp",&exp);
tree->SetBranchAddress("run",&run);
tree->SetBranchAddress("evtn",&evtn);
tree->SetBranchAddress("p_d0",&p_d0);
tree->SetBranchAddress("p_h0",&p_h0);
tree->SetBranchAddress("p_ks",&p_ks);
tree->SetBranchAddress("p_pi0_h0",&p_pi0_h0);
tree->SetBranchAddress("p_pip_h0",&p_pip_h0);
tree->SetBranchAddress("p_pim_h0",&p_pim_h0);
tree->SetBranchAddress("egamma",&egamma);
tree->SetBranchAddress("cos_thr",&cos_thr);
tree->SetBranchAddress("cos_hel",&cos_hel);
tree->SetBranchAddress("thr_sig",&thr_sig);
tree->SetBranchAddress("thr_oth",&thr_oth);
tree->SetBranchAddress("ndf_tag_vtx",&ndf_tag_vtx);
tree->SetBranchAddress("thr_oth",&thr_oth);
tree->SetBranchAddress("phsp",&phsp);
tree->SetBranchAddress("bin",&bin);
Double_t px_pim,py_pim,pz_pim;
Double_t px_pip,py_pip,pz_pip;
Double_t px_ks,py_ks,pz_ks;
tree->SetBranchAddress("px_pim",&px_pim);
tree->SetBranchAddress("py_pim",&py_pim);
tree->SetBranchAddress("pz_pim",&pz_pim);
tree->SetBranchAddress("px_pip",&px_pip);