short question:
If you should have many (even more than 200) member variables (each of them will be the plot of some physical interest in our analysis). What is the best place to declare these variables?
long explanation:
The structure that I use for my analysis creates a class for iterating over events, it can be narrowed down to
constructor()
initialize()
execute()
finalize()
In the header you should indicate pointers like this (this is apparently a requirement of the package ROOTwe should use):
std::vector<double> *m_jet_pt;
and a pointer to the histogram class:
TH1F *h_jet_pt;
then constructoryou need to initialize pointers to some specific memory address (as far as I understand, this is for subsequent reading data from a file)
constructor()
{
m_jet_pt = 0;
h_jet_pt = new TH1F("name", "title", nbins, min_bin, max_bin);
}
initialize , , , , ( , , ):
TFile *file = new TFile("filename.root");
TTree *tree = (TTree*)file->Get("MyTree");
tree->SetBranchAddress("m_jet_pt", &jet_pt);
execute , , ,
execute()
{
if(m_jet_pt->at(i) > 30)
h_jet_pt->Fill();
}
, , finalize , , ,
finalize()
{
h_jet_pt->Write();
}
immagine 20 jets, 30 electrons, 30 muons .., , - ! , , , ? , !