//--------------------- // Class Generator // purpose : define certain functional schemes that are used to generate corresponding histograms // author : Francesco Span\`o // started on : 7 December 201 // continued on : 30thJanuary 2012 //--------------------- #ifndef Generator_h #define Generator_h #include #include #include #include #include #include #include"TTree.h" #include"TDirectory.h" #include #include #include //using namespace std; class Generator{ private: TF1* theFunc; TF2* theFunc2; TF3* theFunc3; TString theOutput; TString theHistName; vector theBins; Int_t theNev; // ntuple, branch, variable name // CARE::pointer to an object that does not go out of scope // I have control over memory need to use TTree* theNtup; struct MyNtup_t{ Double_t var; } ; TTree* theEmpty; MyNtup_t myntup; // CARE::pointer to an object that does not go out of scope // I have control over memory need to use TH1D* theHist ; TList theList; public: Generator(); // at preset foresee only two outputs: ntuple with events distributed according to the function one gets // : 1D histogram binned with a given binning appropriate for the function // pass by copy, the binning can be passed by copy too, no need to pass by reference, they will not be modified anyways // do not run the risk, not a lot of info // make // FIXME: in generatl one needs a function object, for the momemgt we do 1D functions, we can extend to 2d and 3d functions // or general functions Generator(TF1* function,TString output,TString histname, vector binning, Int_t events); // Generator(TFunction function,TString output, vector binning, Int_t events); // make histogram only //Generator(TFunction function,vector binning, Int_t events); Generator(TF1* function, TString histname, vector binning, Int_t events); // make ntuple only Generator(TF1* function, Int_t events); // check out the virtual // pass output by copy; if I make a pointer and I pass the pointer te pointer will be out of scope virtual ~Generator(); // void setFunction(TFunction function); void setFunction(TF1* function); void setOutput(TString output); void setBinning(vector& binning); void setHistName(TString histname); void setNEvents(Int_t events); void makeOutput(); void makeNtup(); void makeHist(); void makeList(); TList getOutput(); TTree getNtup(); TH1D getHist(); }; #endif