title: Best practice for class with many member variables
body: <p><strong>short question:</strong>
  If you must have many (even more than 200) member variables (each of them will be a plot of some physical quantity of interest in our analysis). What is the best place where to declare these variables?</p>
  
  <p><strong>long explanation:</strong>
  The framework I use for my analysis creates a class to loop over events, it can be narrowed down to </p>
  
  <pre><code>constructor()
  initialize()
  execute()
  finalize()
  </code></pre>
  
  <p>In the header you would declare pointers like (this is apparently a requirement of the <code>ROOT</code> package we must use):</p>
  
  <pre><code>std::vector&lt;double&gt; *m_jet_pt;
  </code></pre>
  
  <p>and pointer to a histogram class:</p>
  
  <pre><code>TH1F *h_jet_pt;
  </code></pre>
  
  <p>then in the <code>constructor</code> one must initialize the pointers to some definite memory address (as far as I understand this is for later read data from a file)</p>
  
  <pre><code>constructor()
  {
    // this is data, will be associated to a TTree later
    m_jet_pt = 0;
  
    // this is a histogram
    h_jet_pt = new TH1F("name", "title", nbins, min_bin, max_bin); 
  }
  </code></pre>
  
  <p>then in the <code>initialize</code> function you open a file containing data previously stored and set the address of the members of the class to point to objects contained in the file (I don't know how this works or if my statement is precise):</p>
  
  <pre><code>TFile *file = new TFile("filename.root");
  
  // The tree is where the data is (for some reason ROOT uses C style casts)
  TTree *tree = (TTree*)file-&gt;Get("MyTree");
  
  // this is how to set the address of the member class pointer
  // to point to the data in the tree:
  tree-&gt;SetBranchAddress("m_jet_pt", &amp;jet_pt);
  </code></pre>
  
  <p>Then in the <code>execute</code> function is called in a loop, once for each event and you would do the physics selection you want</p>
  
  <pre><code>execute()
  {
    // I omit here where the `i` index comes from as not relevant
    if(m_jet_pt-&gt;at(i) &gt; 30)
  
      h_jet_pt-&gt;Fill();
  }
  </code></pre>
  
  <p>and finally in the <code>finalize</code> function you would do all you need to do once each event after the selection is made, for example storing the histograms in another file</p>
  
  <pre><code>finalize()
  {
    h_jet_pt-&gt;Write();
  }
  </code></pre>
  
  <p>Now immagine I have 20 quantites for <code>jets</code>, 30 for <code>electrons</code>, 30 for <code>muons</code> and so on, you can see how the number of member variables gets huge! Soon the code becames a mess so how would you expert programmers deal with such a situation? Hope this is clear enough!</p>