Browse Source

Adds ability to comment out lines in data file listing

Caleb Fangmeier 7 years ago
parent
commit
d7237e5c01
3 changed files with 5 additions and 31 deletions
  1. 1 0
      datafile.hpp
  2. 3 3
      root/container.hpp
  3. 1 28
      root/dataset.hpp

+ 1 - 0
datafile.hpp

@@ -70,6 +70,7 @@ std::vector<DataFileDescriptor> read_input_list(const std::string &filename){
     std::vector<DataFileDescriptor> dfds;
     std::string prefix = filename.substr(0, filename.find_last_of("/")+1);
     while(std::getline(istrm, line)){
+        if(line[0] != '#')
         dfds.push_back(DataFileDescriptor(prefix+line));
     }
     return dfds;

+ 3 - 3
root/container.hpp

@@ -181,7 +181,7 @@ class _ContainerTH2 : public Container<TH2,std::pair<V,V>>{
         double high_x;
         double high_y;
 
-        virtual void _do_fill(std::pair<V,V>& val) = 0;
+        virtual void _do_fill(const std::pair<V,V>& val) = 0;
 
     public:
         explicit _ContainerTH2(const std::string& name, const std::string& title,
@@ -204,7 +204,7 @@ class _ContainerTH2 : public Container<TH2,std::pair<V,V>>{
 template <typename V>
 class ContainerTH2 : public _ContainerTH2<V>{
     using _ContainerTH2<V>::_ContainerTH2;
-    void _do_fill(std::pair<V,V>& val){
+    void _do_fill(const std::pair<V,V>& val){
         this->container->Fill(val.first,val.second);
     }
     public:
@@ -217,7 +217,7 @@ class ContainerTH2 : public _ContainerTH2<V>{
 template <typename V>
 class ContainerTH2Many : public _ContainerTH2<std::vector<V>>{
     using _ContainerTH2<std::vector<V>>::_ContainerTH2;
-    void _do_fill(std::pair<std::vector<V>,std::vector<V>>& val){
+    void _do_fill(const std::pair<std::vector<V>,std::vector<V>>& val){
         int min_size = std::min(val.first.size(), val.second.size());
         for(int i=0; i<min_size; i++)
             this->container->Fill(val.first[i],val.second[i]);

+ 1 - 28
root/dataset.hpp

@@ -46,10 +46,9 @@ using namespace fv::root;
 template<typename TREE_CLASS>
 class TreeDataSet : public DataSet{
     private:
-        // Maps filenames to data category. Either "signal" or "background"
-        /* std::map<std::string,std::string> input_categories; */
         // Maps filenames to data label, eg. "TTTT", or "TTZ"
         std::map<std::string,std::string> input_labels;
+        // Maps filenames to data category. Either "signal" or "background"
         std::map<std::string,std::string> input_categories;
         std::string output_filename;
         std::vector<fv::util::DataFileDescriptor> dfds;
@@ -99,32 +98,6 @@ class TreeDataSet : public DataSet{
 
     public:
 
-        /* TreeDataSet(const std::string& output_filename, */
-        /*             const std::vector<std::string>& input_filenames, */
-        /*             const std::string& data_label, */
-        /*             const std::string& tree_name="tree") */
-        /*   :DataSet(), */
-        /*    input_labels({ {input_filename, data_label} }), */
-        /*    output_filename(output_filename), */
-        /*    next_entry(0) { */
-        /*     TChain* chain = new TChain(tree_name.c_str()); */
-        /*     chain->Add(input_filename.c_str()); */
-        /*     tree_obj = new TREE_CLASS(chain); */
-        /*     nentries = tree_obj->fChain->GetEntries(); */
-        /*     output_file = TFile::Open(output_filename.c_str(), "RECREATE"); */
-        /*     tree_obj->fChain->SetBranchStatus("*", false); */
-        /*   } */
-
-        /* 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; */
-        /*     } */
-
-        /* } */
-
         TreeDataSet(const std::string& output_filename, const std::vector<fv::util::DataFileDescriptor>& dfds,
                     const std::string& tree_name)
           :DataSet(),