|
@@ -28,8 +28,8 @@
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
* SOFTWARE.
|
|
* SOFTWARE.
|
|
*/
|
|
*/
|
|
-#ifndef minitreedataset_h
|
|
|
|
-#define minitreedataset_h
|
|
|
|
|
|
+#ifndef root_dataset_h
|
|
|
|
+#define root_dataset_h
|
|
|
|
|
|
#include <string>
|
|
#include <string>
|
|
#include <tuple>
|
|
#include <tuple>
|
|
@@ -58,6 +58,7 @@ class TreeDataSet : public DataSet{
|
|
|
|
|
|
bool load_next(){
|
|
bool load_next(){
|
|
if (next_entry >= nentries) return false;
|
|
if (next_entry >= nentries) return false;
|
|
|
|
+ tree_obj->LoadTree(next_entry);
|
|
tree_obj->GetEntry(next_entry);
|
|
tree_obj->GetEntry(next_entry);
|
|
++next_entry;
|
|
++next_entry;
|
|
return true;
|
|
return true;
|
|
@@ -110,8 +111,19 @@ class TreeDataSet : public DataSet{
|
|
nentries = tree_obj->fChain->GetEntries();
|
|
nentries = tree_obj->fChain->GetEntries();
|
|
output_file = TFile::Open(output_filename.c_str(), "RECREATE");
|
|
output_file = TFile::Open(output_filename.c_str(), "RECREATE");
|
|
tree_obj->fChain->SetBranchStatus("*", false);
|
|
tree_obj->fChain->SetBranchStatus("*", false);
|
|
|
|
+ /* print_branch_statuses(); */
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ void print_branch_statuses(){
|
|
|
|
+ TObjArray* obj_arr = tree_obj->fChain->GetListOfBranches();
|
|
|
|
+ for(TIter iter=obj_arr->begin(); iter!= obj_arr->end(); ++iter){
|
|
|
|
+ TBranch* br = (TBranch*)*iter;
|
|
|
|
+ std::cout << br->GetName() << ": "
|
|
|
|
+ << tree_obj->fChain->GetBranchStatus(br->GetName()) << std::endl;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
// TODO: Rewrite this constructor
|
|
// TODO: Rewrite this constructor
|
|
/* MiniTreeDataSet(const std::string& output_filename, const std::map<std::string,std::string>& filenames_with_labels) */
|
|
/* MiniTreeDataSet(const std::string& output_filename, const std::map<std::string,std::string>& filenames_with_labels) */
|
|
/* :DataSet(), */
|
|
/* :DataSet(), */
|
|
@@ -169,6 +181,20 @@ class TreeDataSet : public DataSet{
|
|
return new PointerValue<T>(bname, bref);
|
|
return new PointerValue<T>(bname, bref);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ template <typename T>
|
|
|
|
+ Value<T>* track_branch_obj(const std::string& bname){
|
|
|
|
+ TBranch* branch = tree_obj->fChain->GetBranch(bname.c_str());
|
|
|
|
+ if (branch == nullptr){
|
|
|
|
+ CRITICAL("Branch: " << bname << " does not exist in input tree.", -1);
|
|
|
|
+ }
|
|
|
|
+ T** bref = (T**) branch->GetAddress();
|
|
|
|
+ tree_obj->fChain->SetBranchStatus(bname.c_str(), true);
|
|
|
|
+ INFO("Registering object branch \"" << bname
|
|
|
|
+ << "\" with address " << bref
|
|
|
|
+ << " and type " << typeid(bref).name());
|
|
|
|
+ return new ObjectValue<T>(bname, bref);
|
|
|
|
+ }
|
|
|
|
+
|
|
template <typename T>
|
|
template <typename T>
|
|
decltype(auto) track_branch_vec(const std::string& size_bname, const std::string& value_bname){
|
|
decltype(auto) track_branch_vec(const std::string& size_bname, const std::string& value_bname){
|
|
track_branch_ptr<T>(value_bname);
|
|
track_branch_ptr<T>(value_bname);
|
|
@@ -191,4 +217,4 @@ class TreeDataSet : public DataSet{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
-#endif // minitreedataset_h
|
|
|
|
|
|
+#endif // root_dataset_h
|