本文整理汇总了C++中TTree::Show方法的典型用法代码示例。如果您正苦于以下问题:C++ TTree::Show方法的具体用法?C++ TTree::Show怎么用?C++ TTree::Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTree
的用法示例。
在下文中一共展示了TTree::Show方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Show
void ElectronMuonPreTagTree::Show(Long64_t entry)
{
// Print contents of entry.
// If entry is not specified, print current entry
if (!fChain) return;
fChain->Show(entry);
}
示例2: clonesA_Event_w
void clonesA_Event_w()
{
// protect against old ROOT versions
if ( gROOT->GetVersionInt() < 30503 ) {
cout << "Works only with ROOT version >= 3.05/03" << endl;
return;
}
if ( gROOT->GetVersionDate() < 20030406 ) {
cout << "Works only with ROOT CVS version after 5. 4. 2003" << endl;
return;
}
//write a Tree
TFile *hfile = new TFile("clonesA_Event.root","RECREATE","Test TClonesArray");
TTree *tree = new TTree("clonesA_Event","An example of a ROOT tree");
TUsrSevtData1 *event1 = new TUsrSevtData1();
TUsrSevtData2 *event2 = new TUsrSevtData2();
tree->Branch("top1","TUsrSevtData1",&event1,8000,99);
tree->Branch("top2","TUsrSevtData2",&event2,8000,99);
for (Int_t ev = 0; ev < 10; ev++) {
cout << "event " << ev << endl;
event1->SetEvent(ev);
event2->SetEvent(ev);
tree->Fill();
if (ev <3) tree->Show(ev);
}
tree->Write();
tree->Print();
delete hfile;
}
示例3: read_SyntBranch
void read_SyntBranch() {
gSystem->Load("libCintex");
Cintex::Enable();
gSystem->Load("libPoolTestsPoolTreeTests");
TFile f("T1.root");
TTree * t = (TTree*)f.Get("Syn");
t->Show(7);
t->Scan("m_2:m_3","id<10");
t->Scan("","id<5");
}
示例4:
void TGo4EventInfo::linkedObjectUpdated(const char* linkname, TObject* obj)
{
TTree* tr = dynamic_cast<TTree*>(obj);
if (tr!=0) {
tr->Show(0);
return;
}
if (obj!=0) {
obj->Print();
return;
}
}
示例5: runstring
void runstring() {
TString *sone = new TString("topsone");
string *stwo = new string("topstwo");
vector<TString> *sthree = new vector<TString>;
vector<string> *sfour = new vector<string>;
vector<bool> sfive;
vector<int> ssix;
sthree->push_back("sthree_1");
sthree->push_back("sthree_2");
sfour->push_back("sfour_1");
sfour->push_back("sfour_2");
sfive.push_back(false);
sfive.push_back(true);
sfive.push_back(false);
ssix.push_back(33);
myclass *m = new myclass(1);
TFile *f = new TFile("string.root","RECREATE");
TTree *t = new TTree("T","T");
t->Branch("sone",&sone,32000,0);
t->Branch("stwo",&stwo,32000,0);
t->Branch("sthree",&sthree,32000,0);
t->Branch("sfour",&sfour,32000,0);
t->Branch("obj.",&m);
t->Branch("sfive",&sfive);
t->Branch("ssix",&ssix);
t->Fill();
f->Write();
t->Show(0);
t->Scan("*");
t->Scan("sone");
t->Scan("stwo");
t->Scan("sthree.Data()");
t->Scan("sfour.c_str()");
}
示例6: clonesA_Event_r
void clonesA_Event_r()
{
//read the Tree
TFile * hfile = new TFile("clonesA_Event.root");
TTree *tree = (TTree*)hfile->Get("clonesA_Event");
TUsrSevtData1 * event1 = 0;
TUsrSevtData2 * event2 = 0;
tree->SetBranchAddress("top1",&event1);
tree->SetBranchAddress("top2",&event2);
for (Int_t ev = 0; ev < 8; ev++) {
tree->Show(ev);
cout << "Pileup event1: " << event1->GetPileup() << endl;
cout << "Pileup event2: " << event2->GetPileup() << endl;
event1->Clear();
event2->Clear();
// gObjectTable->Print(); // detect possible memory leaks
}
delete hfile;
}
示例7: main
//.........这里部分代码省略.........
std::vector<Int_t> trackids;
std::vector<HGCSSGenParticle> final_state;
std::vector<HGCSSGenParticle> init_state;
//Fill up the good partons :)
for (Int_t j = 0; j < gen_partons->size(); j++) {
HGCSSGenParticle& parton = (*gen_partons)[j];
Int_t track_ID = parton.trackID();
Int_t id_ = std::find(trackids.begin(), trackids.end(), track_ID)
- trackids.begin();
if ((id_ == trackids.size()) || (track_ID == 1)) {
trackids.push_back(track_ID);
final_state.push_back(parton);
init_state.push_back(parton);
} else {
Double_t current_z = final_state.at(id_).z();
if (current_z < parton.z())
//Overwrite that parton
final_state[id_] = parton;
if (current_z > parton.z())
//Overwrite that parton
init_state[id_] = parton;
}
}
N_e = 0;
N_p = 0;
N_nf = 0;
N_ni = 0, N_pscalar_final = 0;
N_pscalar_init = 0;
TVector3 N_final = TVector3(0, 0, 0);
//Calculate Parton Quantities
for (Int_t j = 0; j < final_state.size(); j++) {
if ((j == 0) && final_state.at(j).pz() < 4000)
break;
else if (j == 0)
continue;
HGCSSGenParticle parton = final_state.at(j);
if (parton.pdgid() == 11) {
E_theta[N_e] = parton.theta();
E_pt[N_e] = parton.pt();
E_pz[N_e] = parton.pz();
N_e += 1;
}
if (parton.pdgid() == 22) {
P_theta[N_p] = parton.theta();
P_pt[N_p] = parton.pt();
P_pz[N_p] = parton.pz();
N_p += 1;
}
if (parton.pdgid() == 2112) {
N_theta_final[N_nf] = parton.theta();
N_pt_final[N_nf] = parton.pt();
N_pz_final[N_nf] = parton.pz();
TVector3 temp_neut = TVector3(parton.px(), parton.py(),
parton.pz());
N_final += temp_neut;
N_pscalar_final += temp_neut.Mag();
N_nf += 1;
}
}
N_pvec_final = N_final.Mag();
TVector3 N_init = TVector3(0, 0, 0);
for (Int_t j = 0; j < init_state.size(); j++) {
if (init_state.at(j).pdgid() != 2112)
continue;
HGCSSGenParticle parton = init_state.at(j);
N_theta_initial[N_ni] = parton.theta();
N_pt_initial[N_ni] = parton.pt();
N_pz_initial[N_ni] = parton.pz();
TVector3 temp_neut = TVector3(parton.px(), parton.py(),
parton.pz());
N_init += temp_neut;
N_pscalar_init += temp_neut.Mag();
N_ni += 1;
}
if (N_ni > 75)
tree->Show(ievt, 1000000);
N_pvec_init = N_init.Mag();
//Calculate the energy deposited
for (Int_t j = 0; j < len_hits; j++) {
HGCSSRecoHit& hit = (*rechits)[j];
eng += weights[hit.layer()] * hit.energy();
}
N_hits = len_hits;
Eng_dep = eng;
Evt = ievt;
t1.Fill();
}
t1.Write();
return 1;
}
示例8: Show
void CalibTree::Show(Long64_t entry) {
// Print contents of entry.
// If entry is not specified, print current entry
if (!fChain) return;
fChain->Show(entry);
}
示例9: merging
int merging()
{
Long_t NUMBER_OF_ENTRIES = 100;
TTree* newResult = new TTree("xxx", "Argument");
static Double_t x, y;
newResult->Branch("x", &x, "x/D");
newResult->Branch("y", &y, "y/D");
for(Long_t i=0; i<NUMBER_OF_ENTRIES; ++i)
{
x = i;
y = i*i;
//fprintf(stderr,"res %lf %lf %d\n",x,y,i<NUMBER_OF_ENTRIES);
newResult->Fill();
}// end of for
// newResult->Scan("x:y");
// ======================================
TMessage message(kMESS_OBJECT);
message.Reset();
message.SetWriteMode();
message.WriteObject(newResult);
message.Reset();
message.SetReadMode();
TTree* readResult = 0;
readResult = ((TTree*)message.ReadObject(message.GetClass()));
readResult->SetName("yyy");
// ======================================
TTree* result = 0;
result = readResult->CloneTree(0);
result->SetName("zzz");
result->Print();
result->Show(19);
readResult->Print();
readResult->Show(29);
cout<< "Result has " << result->GetEntries()<< " entries." << endl;
TList newResultCollection;
newResultCollection.SetOwner(kFALSE);
newResultCollection.Add(readResult);
cerr<<"Hello 1\n";
result->Merge(&newResultCollection);
cerr<<"Hello 2\n";
cout<<result->GetEntries()<<endl;
printf("result entries = %lld\n",result->GetEntries());
// ======================================
newResultCollection.Clear();
delete newResult;
delete readResult;
return 0;
} // end of main