Commit 0872d66c authored by Keerthi Nakkalil's avatar Keerthi Nakkalil
Browse files

The TP.root shows that 4 trees are merged. However, while scanning only the...

The TP.root shows that 4 trees are merged. However, while scanning only the last tree entries are shown 
parent 73bf2f1c
//TList* TPlist = new TList;
//TFile* TPfile = new TFile("TP.root","update");
TList* TPlist = new TList;
void TreeEnergyWrite(){
......@@ -42,8 +43,8 @@ void TreeTPWrite(int c, int r){
TFile* TPfile = new TFile("TP.root","update");
std::string TPtreeName = "TPtree" + std::to_string(c) + "_" + std::to_string(r);
TTree* TPtree = new TTree(TPtreeName.c_str()," TP tree");
TTree* Mergedtree = new TTree("MergedTree", "Merged trees");
Mergedtree->SetDirectory(TPfile);
// TTree* Mergedtree = new TTree("MergedTree", "Merged trees");
// Mergedtree->SetDirectory(TPfile);
TPtree->Branch("TPcol1",&TPcol1,"TPcol1/I");
TPtree->Branch("TPcol2",&TPcol2,"TPcol2/I");
......@@ -92,15 +93,21 @@ void TreeTPWrite(int c, int r){
// TPtree->Write("",TObject::kOverwrite);
// TPtree->Write("",TObject::kWriteDelete);
TPtree->Write();
// TPtree->Scan();
// TPtree->Write();
// TPtree->Scan();
//Add new trees (incl voltage col) to list and merge the trees
/* std::cout << " The tree for the pixel " << c << " and " << r << " is added to the list " << std::endl;
TList* TPlist = new TList;
//TList* TPlist = new TList;
std::cout << " The tree for the pixel " << c << " and " << r << " is added to the list " << std::endl;
TPlist->Add(TPtree);
Mergedtree = TTree::MergeTrees(TPlist);
Mergedtree->Write("",TObject::kWriteDelete);*/
TTree* newtree = TTree::MergeTrees(TPlist);
newtree->SetName("MergedTree");
// TTree* Mergedtree = new TTree("MergedTree", "Merged trees");
newtree->SetDirectory(TPfile);
// Mergedtree = TTree::MergeTrees(TPlist);
// Mergedtree->Write("",TObject::kWriteDelete);
newtree->Write("",TObject::kWriteDelete);
TPfile->Close();
//Efile->Close();
......@@ -118,7 +125,7 @@ void TreeTest(){
}
}
// std::cout <<" The size of the tree list is " << TPlist->GetSize() << std::endl;
std::cout <<" The size of the tree list is " << TPlist->GetSize() << std::endl;
//TPfile->Close();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment